public function get_datas()
 {
     global $dbh;
     $documents = array();
     //on commence par récupérer l'identifiant retourné par le sélecteur...
     $selector = $this->get_selected_selector();
     if ($selector) {
         $docs = $selector->get_value();
         $valid = $this->filter_datas($docs['type_object'], array($docs['num_object']));
         if ($docs['num_object'] == $valid[0] && is_array($docs['ids'])) {
             if ($this->parameters['sort_by']) {
                 $query = "select id_document from cms_documents where id_document in (" . implode(",", $docs['ids']) . ") order by " . $this->parameters['sort_by'] . " " . $this->parameters['sort_order'];
                 $result = pmb_mysql_query($query, $dbh);
                 if (pmb_mysql_num_rows($result)) {
                     $docs['ids'] = array();
                     while ($row = pmb_mysql_fetch_object($result)) {
                         $docs['ids'][] = $row->id_document;
                     }
                 }
             }
             foreach ($docs['ids'] as $document_linked) {
                 $document = new cms_document($document_linked);
                 $documents[] = $document->format_datas();
             }
         }
     }
     return array('documents' => $documents, 'nb_documents' => count($documents), 'type_object' => $docs['type_object'], 'num_object' => $docs['num_object']);
 }
Exemplo n.º 2
0
 public function format_datas($get_children = true, $get_articles = true, $filter = true, $get_parent = false)
 {
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     $result = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents), 'last_update_date' => format_date($this->last_update_date));
     if ($get_children) {
         $result['children'] = $this->get_children($filter);
     }
     if ($get_articles) {
         $result['articles'] = $this->get_articles($filter);
     }
     if ($get_parent && $result['num_parent']) {
         $cms_parent_section = new cms_section($result['num_parent']);
         $result['parent'] = $cms_parent_section->format_datas(false, false);
     }
     return $result;
 }
Exemplo n.º 3
0
 public function format_datas()
 {
     if ($this->formated_datas === null) {
         $this->formated_datas = array();
         $parent = cms_provider::get_instance("section", $this->num_parent);
         $documents = array();
         foreach ($this->documents_linked as $id_doc) {
             $document = new cms_document($id_doc);
             $documents[] = $document->format_datas();
         }
         $this->formated_datas = array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents), 'last_update_date' => format_date($this->last_update_date));
     }
     return $this->formated_datas;
 }
Exemplo n.º 4
0
 public function format_datas($get_children = true, $get_articles = true, $filter = true, $get_parent = false)
 {
     $documents = array();
     if ($this->formated_datas === null) {
         foreach ($this->documents_linked as $id_doc) {
             $document = new cms_document($id_doc);
             $documents[] = $document->format_datas();
         }
         $this->formated_datas = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
     }
     $formated_datas = $this->formated_datas;
     if ($get_children) {
         if ($filter && $this->children['filter'] === null) {
             $this->children['filter'] = $this->get_children($filter);
         } else {
             if ($this->children['full'] === null) {
                 $this->children['full'] = $this->get_children($filter);
             }
         }
         if (filter) {
             $formated_datas['children'] = $this->children['filter'];
         } else {
             $formated_datas['children'] = $this->children['full'];
         }
     }
     if ($get_articles) {
         if ($filter && $this->articles['filter'] === null) {
             $this->articles['filter'] = $this->get_articles($filter);
         } else {
             if ($this->articles['full'] === null) {
                 $this->articles['full'] = $this->get_articles($filter);
             }
         }
         if (filter) {
             $formated_datas['articles'] = $this->articles['filter'];
         } else {
             $formated_datas['articles'] = $this->articles['full'];
         }
     }
     if ($get_parent && $formated_datas['num_parent']) {
         $cms_parent_section = cms_provider::get_instance("section", $formated_datas['num_parent']);
         $formated_datas['parent'] = $cms_parent_section->format_datas(false, false);
     }
     return $formated_datas;
 }
Exemplo n.º 5
0
 public function format_datas($get_children = true, $get_articles = true, $filter = true)
 {
     if ($this->logo->data) {
         $logo_exists = true;
     } else {
         $logo_exists = false;
     }
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     $result = array('id' => $this->id, 'num_parent' => $this->num_parent, 'title' => $this->title, 'resume' => $this->resume, 'logo' => array('small_vign' => $this->logo->get_vign_url("small_vign"), 'vign' => $this->logo->get_vign_url("vign"), 'large' => $this->logo->get_vign_url("large"), 'exists' => $logo_exists), 'publication_state' => $this->publication_state, 'start_date' => $this->start_date, 'end_date' => $this->end_date, 'descriptors' => $this->descriptors, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
     if ($get_children) {
         $result['children'] = $this->get_children($filter);
     }
     if ($get_articles) {
         $result['articles'] = $this->get_articles($filter);
     }
     return $result;
 }
Exemplo n.º 6
0
 public function format_datas()
 {
     if ($this->logo->data) {
         $logo_exists = true;
     } else {
         $logo_exists = false;
     }
     $parent = new cms_section($this->num_parent);
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     return array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => array('small_vign' => $this->logo->get_vign_url("small_vign"), 'vign' => $this->logo->get_vign_url("vign"), 'large' => $this->logo->get_vign_url("large"), 'exists' => $logo_exists), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
 }
Exemplo n.º 7
0
 public function format_datas()
 {
     $parent = new cms_section($this->num_parent);
     $documents = array();
     foreach ($this->documents_linked as $id_doc) {
         $document = new cms_document($id_doc);
         $documents[] = $document->format_datas();
     }
     return array('id' => $this->id, 'parent' => $parent->format_datas(false, false), 'title' => $this->title, 'resume' => $this->resume, 'logo' => $this->logo->format_datas(), 'publication_state' => $this->publication_state, 'start_date' => format_date($this->start_date), 'end_date' => format_date($this->end_date), 'descriptors' => $this->descriptors, 'content' => $this->contenu, 'type' => $this->type_content, 'fields_type' => $this->fields_type, 'create_date' => $this->create_date, 'documents' => $documents, 'nb_documents' => count($documents));
 }