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 get_format_data_structure() { $datas = cms_section::get_format_data_structure(false, false); $datas[] = array('var' => "link", 'desc' => $this->msg['cms_module_sectionslist_view_carousel_link_desc']); $format_datas = array(array('var' => "id", 'desc' => $this->msg['cms_module_carousel_view_carousel_id_desc']), array('var' => "records", 'desc' => $this->msg['cms_module_carousel_view_carousel_records_desc'], 'children' => $this->prefix_var_tree($datas, "records[i]"))); return $format_datas; }
public function get_format_data_structure() { $datas = cms_section::get_format_data_structure(); $datas[] = array('var' => "link", 'desc' => $this->msg['cms_module_metadatas_datasource_metadatas_section_link_desc']); $format_datas = array(array('var' => "details", 'desc' => $this->msg['cms_module_metadatas_datasource_metadatas_section_section_desc'], 'children' => $this->prefix_var_tree($datas, "details"))); $format_datas = array_merge(parent::get_format_data_structure(), $format_datas); return $format_datas; }
public function get_format_data_structure() { $format = array(); $format[] = array('var' => "title", 'desc' => $this->msg['cms_module_common_view_title']); $sections = array('var' => "sections", 'desc' => $this->msg['cms_module_common_view_section_desc'], 'children' => $this->prefix_var_tree(cms_section::get_format_data_structure(), "sections[i]")); $sections['children'][] = array('var' => "sections[i].link", 'desc' => $this->msg['cms_module_common_view_section_link_desc']); $format[] = $sections; return $format; }
public function get_format_data_structure() { //dans ce cas là, c'est assez simple, c'est la vue qui va chercher les données... $format = array(); $format[] = array('var' => 'home', 'desc' => "", 'children' => array(array('var' => "home.title", 'desc' => $this->msg['cms_module_common_view_home_title_desc']), array('var' => "home.link", 'desc' => $this->msg['cms_module_common_view_home_link_desc']))); $sections = array('var' => "sections", 'desc' => $this->msg['cms_module_common_view_section_desc'], 'children' => $this->prefix_var_tree(cms_section::get_format_data_structure(false, false), "sections[i]")); $sections['children'][] = array('var' => "sections[i].link", 'desc' => $this->msg['cms_module_common_view_section_link_desc']); $format[] = $sections; return $format; }
public static function get_format_data_structure($type, $full = true) { global $msg; $main_fields = array(); $main_fields[] = array('var' => "id", 'desc' => $msg['cms_module_common_datasource_desc_id_' . $type]); if ($type == "section") { $main_fields[] = array('var' => "num_parent", 'desc' => $msg['cms_module_common_datasource_desc_num_parent']); } else { $main_fields[] = array('var' => "parent", 'desc' => $msg['cms_module_common_datasource_desc_parent'], 'children' => self::prefix_var_tree(cms_section::get_format_data_structure(false, false), "parent")); } $main_fields[] = array('var' => "title", 'desc' => $msg['cms_module_common_datasource_desc_title']); $main_fields[] = array('var' => "resume", 'desc' => $msg['cms_module_common_datasource_desc_resume']); if ($type == "article") { $main_fields[] = array('var' => "content", 'desc' => $msg['cms_module_common_datasource_desc_content']); } $main_fields[] = array('var' => "logo", 'children' => self::prefix_var_tree(cms_logo::get_format_data_structure(false, false), "logo"), 'desc' => $msg['cms_module_common_datasource_desc_logo']); $main_fields[] = array('var' => "publication_state", 'desc' => $msg['cms_module_common_datasource_desc_publication_state']); $main_fields[] = array('var' => "start_date", 'desc' => $msg['cms_module_common_datasource_desc_start_date']); $main_fields[] = array('var' => "end_date", 'desc' => $msg['cms_module_common_datasource_desc_end_date']); $main_fields[] = array('var' => "descriptors", 'desc' => $msg['cms_module_common_datasource_desc_descriptors'], 'children' => array(array('var' => "descriptors[i].id", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_id']), array('var' => "descriptors[i].name", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_name']), array('var' => "descriptors[i].comment", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_comment']), array('var' => "descriptors[i].lang", 'desc' => $msg['cms_module_common_datasource_desc_descriptors_lang']))); $main_fields[] = array('var' => "type", 'desc' => $msg['cms_module_common_datasource_desc_type_' . $type]); $main_fields[] = array('var' => "fields_type", 'desc' => $msg['cms_module_common_datasource_desc_fields_type_' . $type]); $main_fields[] = array('var' => "create_date", 'desc' => $msg['cms_module_common_datasource_desc_create_date']); //pour les types de contenu $fields_type = array(); $types = new cms_editorial_types($type); $fields_type = $types->get_format_data_structure($full); return array(array('var' => $msg['cms_module_common_datasource_main_fields'], "children" => $main_fields), array('var' => "nb_documents", 'desc' => $msg['cms_module_common_datasource_desc_nb_documents']), array('var' => "documents", 'desc' => $msg['cms_module_common_datasource_desc_documents'], 'children' => self::prefix_var_tree(cms_document::get_format_data_structure(), "documents[i]")), array('var' => $msg['cms_module_common_datasource_types'], 'desc' => $msg['cms_module_common_datasource_desc_types'], "children" => $fields_type)); }
public function create_section($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; if (docwatch_watch::check_watch_rights($this->num_watch)) { $query = "select watch_section_default_parent, watch_section_default_content_type,watch_section_default_publication_status from docwatch_watches where id_watch =" . $this->num_watch; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $section_type = $row->watch_section_default_content_type; $section_status = $row->watch_section_default_publication_status; $section_parent = $row->watch_section_default_parent; } else { return array(); } $section = new cms_section(); $section->id = 0; $section->title = $this->title; $section->resume = $this->summary; $section->start_date = $this->publication_date; $section->publication_state = $section_status; $section->descriptors = $this->descriptors; $section->num_parent = $section_num_parent; $section->num_type = $section_type; $section->save(); if (!$section->id) { return array(); } $query = "update docwatch_items set\titem_num_section = '" . $section->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); $this->set_num_section($section->id); return array('id' => $section->id, 'title' => $this->title, 'link' => "./cms.php?categ=section&sub=edit&id=" . $section->id); } }
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)); }
public function get_format_data_structure() { return array(array('var' => "items", 'desc' => $this->msg['cms_module_menu_datasource_menu_items_desc'], 'children' => array(array('var' => "items[i].id", 'desc' => $this->msg['cms_module_menu_datasource_menu_item_id_desc']), array('var' => "items[i].title", 'desc' => $this->msg['cms_module_menu_datasource_menu_item_title_desc']), array('var' => "items[i].link", 'desc' => $this->msg['cms_module_menu_datasource_menu_item_link_desc']), array('var' => "items[i].details", 'desc' => $this->msg['cms_module_menu_datasource_menu_item_details_desc'], 'children' => cms_editorial::prefix_var_tree(cms_section::get_format_data_structure(false, false, false), "items[i].details")), array('var' => "items[i].children", 'desc' => $this->msg['cms_module_menu_datasource_menu_item_children_desc'])))); }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_section_edit.inc.php,v 1.2 2013-09-06 08:00:05 apetithomme Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/cms/cms_section.class.php"; if ($id != "new") { $section = new cms_section($id); } else { if ($num_parent) { $section = new cms_section(0, $num_parent); } else { $section = new cms_section(); } } print $section->get_form("cms_section_edit", "cms_section_edit");
public static function get_format_data_structure($get_children = true, $get_articles = true, $full = true, $get_parent = false) { global $msg; $format = cms_editorial::get_format_data_structure("section", $full); if ($get_parent) { $format[] = array('var' => "parent", 'desc' => $msg['cms_editorial_desc_parent_section'], 'children' => self::prefix_var_tree(cms_section::get_format_data_structure(false, false), "parent")); } if ($get_children) { $format[] = array('var' => 'children', 'desc' => $msg['cms_editorial_desc_children'], 'children' => self::prefix_var_tree(cms_section::get_format_data_structure(false, false), "children[i]")); } if ($get_articles) { $format[] = array('var' => 'articles', 'desc' => $msg['cms_editorial_desc_articles'], 'children' => self::prefix_var_tree(cms_article::get_format_data_structure(), "articles[i]")); } return $format; }
/** Fonctions: */ public static function get_watch_form() { global $docwatch_watch_form_tpl, $msg; $marc_select = new marc_select("doctype", 'record_types'); $cms_editorial_article = new cms_editorial_types('article'); $cms_editorial_section = new cms_editorial_types('section'); $cms_section = new cms_section(); $cms_article = new cms_article(); $cms_publication_state = new cms_editorial_publications_states(); $status = $cms_publication_state->get_selector_options(); $record_part = gen_plus("record_options", encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_options_record']), '<div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_record_default_type']) . '</label> </div> <div class="row">' . str_replace('<select', '<select data-dojo-type="dijit/form/Select" style="width:auto"', $marc_select->display) . '</div> <div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_record_default_status']) . '</label> </div> <div class="row"> <select id="record_status" data-dojo-type="dijit/form/Select" style="width:auto" name="record_status">' . self::get_record_status() . '</select> </div>'); $article_part = gen_plus("article_options", encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_options_article']), '<div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_article_default_content_type']) . '</label> </div> <div class="row"> <select id="article_type" data-dojo-type="dijit/form/Select" style="width:auto" name="article_type">' . $cms_editorial_article->get_selector_options() . '</select> </div> <div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_article_default_publication_status']) . '</label> </div> <div class="row"> <select id="article_status" data-dojo-type="dijit/form/Select" style="width:auto" name="article_status">' . $status . '</select> </div> <div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_article_default_parent']) . '</label> </div> <div class="row"> <select id="article_parent" data-dojo-type="dijit/form/Select" style="width:auto" name="article_parent">' . $cms_article->get_parent_selector() . '</select> </div>'); $section_part = gen_plus("section_options", encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_options_section']), '<div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_section_default_content_type']) . '</label> </div> <div class="row"> <select id="section_type" data-dojo-type="dijit/form/Select" style="width:auto" name="section_type">' . $cms_editorial_section->get_selector_options() . '</select> </div> <div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_section_default_publication_status']) . '</label> </div> <div class="row"> <select id="section_status" data-dojo-type="dijit/form/Select" style="width:auto" name="section_status">' . $status . '</select> </div> <div class="row"> <label>' . encoding_normalize::utf8_normalize($msg['dsi_docwatch_watch_form_section_default_parent']) . '</label> </div> <div class="row"> <select id="section_parent" data-dojo-type="dijit/form/Select" style="width:auto" name="section_parent">' . $cms_section->get_parent_selector() . '</select> </div>'); $form = $docwatch_watch_form_tpl; $form = str_replace('!!users_checkboxes!!', self::generate_users(), $form); $form = str_replace('!!options_record!!', $record_part, $form); $form = str_replace('!!options_article!!', $article_part, $form); $form = str_replace('!!options_section!!', $section_part, $form); return $form; }
$result = array('status' => "ok"); } print json_encode($result); break; case "delete_article": $article = new cms_article($id); $res = $article->delete(); if ($res !== true) { $result = array("status" => "ko", "error_message" => $charset != "uft-8" ? utf8_encode($res) : $res); } else { $result = array('status' => "ok"); } print json_encode($result); break; case "duplicate_section": $section = new cms_section($id); $section->duplicate($recursive); break; case "duplicate_article": $article = new cms_article($id); $article->duplicate(); break; case "edit_logo": $logo = new cms_logo($id, $quoi); print $logo->get_field(); break; case 'update_article': header('Content-type: text/html;charset=' . $charset); $articles = explode(",", $articles); $order = 1; foreach ($articles as $id_article) {
$state = floor($count / 2 / ($count / $jauge_size)); } $state .= "px"; // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>"; print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>"; // calcul pourcentage avancement $percent = floor(($start + $start_2) / $count * 100); if ($percent > 100) { $percent = 50; } // affichage du % d'avancement et de l'état print "<div align='center'>{$percent}%</div>"; while ($row = mysql_fetch_assoc($query)) { // permet de charger la bonne langue, mot vide... $section = new cms_section($row['id_section']); $info = $section->maj_indexation(); } mysql_free_result($query); $next = $start + $lot; print "\n\t\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t<input type='hidden' name='start' value=\"{$start}\">\n\t\t<input type='hidden' name='start_2' value=\"{$next}\">\n\t\t<input type='hidden' name='count' value=\"{$count}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!--\n\t\tsetTimeout(\"document.forms['current_state'].submit()\",1000);\n\t\t-->\n\t\t</script>"; } else { $spec = $spec - INDEX_CMS; $not = mysql_query("SELECT 1 FROM cms_editorial_words_global_index group by num_obj,type", $dbh); $compte = mysql_num_rows($not); $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["nettoyage_reindex_cms"], ENT_QUOTES, $charset) . " :"; $v_state .= $compte . " " . htmlentities($msg["nettoyage_res_reindex_cms"], ENT_QUOTES, $charset); print "\n\t\t\t<form class='form-{$current_module}' name='process_state' action='./clean.php' method='post'>\n\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\"><!--\n\t\t\t\tdocument.forms['process_state'].submit();\n\t\t\t\t-->\n\t\t\t</script>"; mysql_query("ALTER TABLE cms_editorial_words_global_index ENABLE KEYS", $dbh); mysql_query("ALTER TABLE cms_editorial_fields_global_index ENABLE KEYS", $dbh); }
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)); }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_section_save.inc.php,v 1.2 2013-07-12 07:48:01 apetithomme Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/cms/cms_section.class.php"; require_once $class_path . "/cms/cms_editorial_tree.class.php"; $section = new cms_section(); $section->get_from_form(); $section->save(); print cms_editorial_tree::get_listing();
public function create_section($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; $section = new cms_section(); $section->id = 0; $section->num_type = 0; // ? $section->num_parent = 0; // ? $section->title = $this->title; $section->resume = $this->summary; $section->start_date = $this->publication_date; $section->publication_state = 0; // ? $section->descriptors = $this->descriptors; //$section->logo->id ? $section->save(); if (!$section->id) { return array(); } $query .= "update docwatch_items set\titem_num_section = '" . $section->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); return array('id' => $section->id, 'title' => $this->title, 'link' => ""); }
public function get_format_data_structure() { return cms_section::get_format_data_structure(true, true, true, true); }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_section_delete.inc.php,v 1.1 2015-03-10 17:12:25 arenou Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/cms/cms_section.class.php"; require_once $class_path . "/cms/cms_editorial_tree.class.php"; if (!$cms_editorial_form_obj_id) { return false; } else { $section = new cms_section($cms_editorial_form_obj_id); $section->delete(); } print cms_editorial_tree::get_listing();
function cleanCMS() { global $msg, $dbh, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_reindex_cms"], ENT_QUOTES, $charset) . "</h3>"; //remise a zero de la table au début pmb_mysql_query("TRUNCATE cms_editorial_words_global_index", $dbh); pmb_mysql_query("ALTER TABLE cms_editorial_words_global_index DISABLE KEYS", $dbh); pmb_mysql_query("TRUNCATE cms_editorial_fields_global_index", $dbh); pmb_mysql_query("ALTER TABLE cms_editorial_fields_global_index DISABLE KEYS", $dbh); $query = "select id_article from cms_articles order by id_article"; $articles = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($articles)) { while ($row = pmb_mysql_fetch_object($articles)) { $article = new cms_article($row->id_article); $article->maj_indexation(); } } $query = "select id_section from cms_sections order by id_section"; $sections = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($sections)) { while ($row = pmb_mysql_fetch_object($sections)) { $section = new cms_section($row->id_section); $section->maj_indexation(); } } pmb_mysql_query("ALTER TABLE cms_editorial_words_global_index ENABLE KEYS", $dbh); pmb_mysql_query("ALTER TABLE cms_editorial_fields_global_index ENABLE KEYS", $dbh); $articles = pmb_mysql_query("SELECT count(1) FROM cms_articles", $dbh); $count = pmb_mysql_result($articles, 0, 0); $sections = pmb_mysql_query("SELECT count(1) FROM cms_sections", $dbh); $count += pmb_mysql_result($sections, 0, 0); $result .= $count . " " . htmlentities($msg['nettoyage_res_reindex_cms'], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }