id = intval($id); $this->fetch_datas_cache(); } protected function fetch_datas_cache(){ if($tmp=cms_cache::get_at_cms_cache($this)){ $this->restore($tmp); }else{ $this->fetch_datas(); cms_cache::set_at_cms_cache($this); } } protected function restore($cms_object){ foreach(get_object_vars($cms_object) as $propertieName=>$propertieValue){ $this->{$propertieName}=$propertieValue; } } protected function fetch_datas(){ if($this->id){ $query = "select document_title,document_description,document_filename,document_mimetype,document_filesize,document_vignette,document_url,document_path,document_create_date,document_num_storage,document_type_object,document_num_object from cms_documents where id_document = '".$this->id."'"; $result = pmb_mysql_query($query); if(pmb_mysql_num_rows($result)){ $row = pmb_mysql_fetch_object($result); $this->title = $row->document_title; $this->description = $row->document_description; $this->filename = $row->document_filename; $this->mimetype = $row->document_mimetype; $this->filesize = $row->document_filesize; $this->vignette = $row->document_vignette; $this->url = $row->document_url; $this->path = $row->document_path; $this->create_date = $row->document_create_date; $this->num_storage = $row->document_num_storage; $this->type_object = $row->document_type_object; $this->num_object = $row->document_num_object; } if($this->num_storage){ $this->storage = storages::get_storage_class($this->num_storage); } } } public function get_item_render($edit_js_function="openEditDialog"){ global $msg,$charset; $item = "
".htmlentities(($this->title ? $this->title : $this->filename),ENT_QUOTES,$charset)."
".htmlentities($this->mimetype,ENT_QUOTES,$charset).($this->filesize ? " - (".$this->get_human_size().")" : "")."
".htmlentities(($this->title ? $this->title : $this->filename),ENT_QUOTES,$charset)."
".htmlentities($this->mimetype,ENT_QUOTES,$charset).($this->filesize ? " - (".$this->get_human_size().")" : "")."