public function get_datas()
 {
     //on commence par récupérer l'identifiant retourné par le sélecteur...
     $selector = $this->get_selected_selector();
     if ($selector) {
         $section_id = $selector->get_value();
         $section_ids = $this->filter_datas("sections", array($section_id));
         if ($section_ids[0]) {
             $group_metadatas = parent::get_group_metadatas();
             $datas = array();
             $section = new cms_section($section_ids[0]);
             $datas = $section->format_datas();
             $datas["details"] = $datas;
             $datas = array_merge($datas, parent::get_datas());
             $datas['link'] = $this->get_constructed_link("section", $section_ids[0]);
             $datas['logo_url'] = $datas["logo"]["big"];
             foreach ($group_metadatas as $i => $metadatas) {
                 if (is_array($metadatas["metadatas"])) {
                     foreach ($metadatas["metadatas"] as $key => $value) {
                         try {
                             $group_metadatas[$i]["metadatas"][$key] = H2o::parseString($value)->render($datas);
                         } catch (Exception $e) {
                         }
                     }
                 }
             }
             return $group_metadatas;
         }
     }
     return false;
 }
 protected function build_tree_sections($id_parent, $depth = 0)
 {
     if ($this->parameters['max_depth'] == 0 || $depth < $this->parameters['max_depth']) {
         $items = $ids = $rows = array();
         $query = "select id_section,section_title from cms_sections where section_num_parent = " . $id_parent . " order by section_order asc";
         $result = pmb_mysql_query($query);
         if (pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 $ids[] = $row->id_section;
                 $rows[] = $row;
             }
             $ids = $this->filter_datas("sections", $ids);
             foreach ($rows as $row) {
                 if (in_array($row->id_section, $ids)) {
                     $section = new cms_section($row->id_section);
                     $item = array('id' => $row->id_section, 'title' => $row->section_title, 'link' => $this->get_constructed_link("section", $row->id_section), 'details' => $section->format_datas(false, false));
                     $sub_query = "select count(id_section) from cms_sections where section_num_parent = " . $row->id_section;
                     $sub_result = pmb_mysql_query($sub_query);
                     if (pmb_mysql_num_rows($result) && pmb_mysql_result($sub_result, 0, 0) > 0) {
                         $item['children'] = $this->build_tree_sections($row->id_section, $depth + 1);
                     }
                     $items[] = $item;
                 }
             }
         }
     }
     return $items;
 }
 /**
  * Génération de la structure de données representant les items de type rubrique
  *
  */
 protected function get_items_datas($selector_values)
 {
     global $dbh;
     $rubriques_retour = array();
     if (count($selector_values)) {
         foreach ($selector_values as $id) {
             $rubrique_instance = new cms_section($id);
             $rubrique_data = $rubrique_instance->format_datas();
             $rubrique = array();
             $rubrique['num_section'] = $rubrique_data['id'];
             $rubrique['title'] = $rubrique_data['title'];
             $rubrique['summary'] = $rubrique_data['resume'];
             $rubrique['content'] = $rubrique_data['resume'];
             $rubrique['logo_url'] = $rubrique_data['logo']['large'];
             $rubrique['url'] = $this->get_constructed_link("section", $rubrique_data['id']);
             if ($rubrique_data['start_date'] == "") {
                 $rubrique['publication_date'] = $rubrique_data['create_date'];
             } else {
                 $rubrique['publication_date'] = $rubrique_data['start_date'];
             }
             $rubriques_retour[] = $rubrique;
         }
     }
     return $rubriques_retour;
 }
 public function render($ids)
 {
     $datas = array();
     for ($i = 0; $i < count($ids); $i++) {
         $section = new cms_section($ids[$i]);
         $infos = $section->format_datas(false, false);
         $infos['link'] = $this->get_constructed_link("section", $infos['id']);
         $datas[] = $infos;
     }
     return parent::render(array('records' => $datas));
 }
 public function get_datas()
 {
     //on commence par récupérer l'identifiant retourné par le sélecteur...
     $selector = $this->get_selected_selector();
     if ($selector) {
         $section_id = $selector->get_value();
         $section_ids = $this->filter_datas("sections", array($section_id));
         if ($section_ids[0]) {
             $section = new cms_section($section_ids[0]);
             $return = $section->format_datas(true, true, true, true);
             return $return;
         }
     }
     return false;
 }
 public function render($datas)
 {
     global $opac_url_base;
     $render_datas = array();
     $render_datas['sections'] = array();
     $render_datas['home'] = array('title' => $this->msg['home'], 'link' => $opac_url_base);
     foreach ($datas as $section) {
         $cms_section = new cms_section($section);
         $infos = $cms_section->format_datas(false, false);
         $infos['link'] = $this->get_constructed_link("section", $section);
         $render_datas['sections'][] = $infos;
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
 public function render($datas)
 {
     //on rajoute nos éléments...
     //le titre
     $render_datas = array();
     $render_datas['title'] = "Liste de rubriques";
     $render_datas['sections'] = array();
     foreach ($datas as $section) {
         $cms_section = new cms_section($section);
         $infos = $cms_section->format_datas();
         $infos['link'] = $this->get_constructed_link("section", $section);
         foreach ($infos['articles'] as $i => $article) {
             $infos['articles'][$i]['link'] = $this->get_constructed_link("article", $article["id"]);
         }
         $render_datas['sections'][] = $infos;
     }
     //on rappelle le tout...
     return parent::render($render_datas);
 }
Пример #8
0
 public function get_children($filter)
 {
     global $dbh;
     $children = array();
     if ($this->id) {
         $query = "select id_section from cms_sections JOIN cms_editorial_publications_states ON section_publication_state=id_publication_state where section_num_parent = " . $this->id;
         if ($filter) {
             $query .= " and ((section_start_date != 0 and to_days(section_start_date)<=to_days(now()) and to_days(section_end_date)>=to_days(now()))||(section_start_date != 0 and section_end_date =0 and to_days(section_start_date)<=to_days(now()))||(section_start_date = 0 and to_days(section_end_date)>=to_days(now()))||(section_start_date = 0 and section_end_date = 0)) and (editorial_publication_state_opac_show=1" . (!$_SESSION['id_empr_session'] ? " and editorial_publication_state_auth_opac_show = 0" : "") . ") ";
         }
         $query .= " order by section_order";
         $result = pmb_mysql_query($query, $dbh);
         if (pmb_mysql_num_rows($result)) {
             while ($row = pmb_mysql_fetch_object($result)) {
                 $child = new cms_section($row->id_section);
                 $children[] = $child->format_datas();
             }
         }
     }
     return $children;
 }
Пример #9
0
 public function get_children($filter)
 {
     global $dbh;
     $children = array();
     if ($this->id) {
         $query = "select id_section from cms_sections where section_num_parent = " . $this->id;
         if ($filter) {
             $query .= " and ((section_start_date != 0 and to_days(section_start_date)<=to_days(now()) and to_days(section_end_date)>=to_days(now()))||(section_start_date != 0 and section_end_date =0 and to_days(section_start_date)<=to_days(now()))||(section_start_date = 0 and to_days(section_end_date)>=to_days(now()))||(section_start_date = 0 and section_end_date = 0))";
         }
         $query .= " order by section_order";
         $result = mysql_query($query, $dbh);
         if (mysql_num_rows($result)) {
             while ($row = mysql_fetch_object($result)) {
                 $child = new cms_section($row->id_section);
                 $children[] = $child->format_datas();
             }
         }
     }
     return $children;
 }
Пример #10
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));
 }
Пример #11
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), 'last_update_date' => format_date($this->last_update_date));
 }