/** * Génération de la structure de données representant les items de type article * */ protected function get_items_datas($selector_values) { global $dbh; $articles_retour = array(); if (count($selector_values)) { foreach ($selector_values as $id) { $article_instance = new cms_article($id); $article_data = $article_instance->format_datas(); $article = array(); $article['num_article'] = $article_data['id']; $article['title'] = $article_data['title']; $article['summary'] = $article_data['resume']; $article['content'] = $article_data['content']; if ($article_data['start_date'] == "") { $article['publication_date'] = $article_data['create_date']; } else { $article['publication_date'] = $article_data['start_date']; } $article['logo_url'] = $article_data['logo']['large']; $article['url'] = $this->get_constructed_link("article", $article_data['id']); $articles_retour[] = $article; } } return $articles_retour; }
public function get_format_data_structure() { $datas = cms_article::get_format_data_structure(false, false); $datas[] = array('var' => "link", 'desc' => $this->msg['cms_module_articleslist_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_article::get_format_data_structure(); $datas[] = array('var' => "link", 'desc' => $this->msg['cms_module_metadatas_datasource_metadatas_article_link_desc']); $format_datas = array(array('var' => "details", 'desc' => $this->msg['cms_module_metadatas_datasource_metadatas_article_article_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' => "articles", 'desc' => $this->msg['cms_module_common_view_articles_desc'], 'children' => $this->prefix_var_tree(cms_article::get_format_data_structure(), "articles[i]")); $sections['children'][] = array('var' => "articles[i].link", 'desc' => $this->msg['cms_module_common_view_article_link_desc']); $format[] = $sections; return $format; }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_article_edit.inc.php,v 1.3 2015-05-11 08:10:40 dgoron Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/cms/cms_article.class.php"; if ($id != "new") { $article = new cms_article($id); } else { if ($num_parent) { $article = new cms_article(0, $num_parent); } else { $article = new cms_article(); } } print $article->get_form("cms_article_edit", "cms_article_edit", "");
$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) { $article = new cms_article($id_article); $article->update_parent_section($num_section, $order); $order++; } break; case "build": switch ($action) { case "save": $cms_build = new cms_build(); ajax_http_send_response($cms_build->save_opac(unserialize(stripslashes($cms_build_info)), unserialize(stripslashes($cms_data)))); break; } break; case "module": include $base_path . "/cms/ajax/modules/main.inc.php"; break;
public function get_format_data_structure() { return cms_article::get_format_data_structure(); }
public function create_article($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; $article = new cms_article(); $article->id = 0; $article->num_type = 0; // ? $article->num_parent = 0; // ? $article->title = $this->title; $article->resume = $this->summary; $article->contenu = $this->content; $article->start_date = $this->publication_date; $article->publication_state = 0; // ? $article->descriptors = $this->descriptors; //$article->logo->id ? $article->save(); if (!$article->id) { return array(); } $query .= "update docwatch_items set\titem_num_article = '" . $article->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); return array('id' => $article->id, 'title' => $this->title, 'link' => ""); }
$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... $article = new cms_article($row['id_article']); $info = $article->maj_indexation(); } mysql_free_result($query); $next = $start + $lot; print "\n\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t<input type='hidden' name='start' value=\"{$next}\">\n\t<input type='hidden' name='start_2' value=\"{$start_2}\">\n\t<input type='hidden' name='count' value=\"{$count}\">\n\t</form>\n\t<script type=\"text/javascript\"><!-- \n\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t-->\n\t</script>"; } else { $query = mysql_query("select id_section from cms_sections order by id_section LIMIT {$start_2}, {$lot}"); if (mysql_num_rows($query)) { // définition de l'état de la jauge $state = floor(($start + $start_2) / ($count / $jauge_size)); if ($start + $start_2 > $count) { $state = floor($count / 2 / ($count / $jauge_size)); } $state .= "px"; // mise à jour de l'affichage de la jauge
public function create_article($section_num_parent = 0) { global $dbh; global $pmb_keyword_sep; if (docwatch_watch::check_watch_rights($this->num_watch)) { $query = "select watch_article_default_parent, watch_article_default_content_type,watch_article_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); $article_type = $row->watch_article_default_content_type; $article_status = $row->watch_article_default_publication_status; $article_parent = $row->watch_article_default_parent; } else { return array(); } $article = new cms_article(); $article->id = 0; $article->num_type = $article_type; $article->num_parent = $article_parent; $article->title = $this->title; $article->resume = $this->summary; $article->contenu = $this->content; $article->start_date = $this->publication_date; $article->publication_state = $article_status; $article->descriptors = $this->descriptors; //$article->logo->id ? $article->save(); if (!$article->id) { return array(); } $query = "update docwatch_items set\titem_num_article = '" . $article->id . "' where id_item = '" . $this->id . "'"; pmb_mysql_query($query, $dbh); $this->set_num_article($article->id); return array('id' => $article->id, 'title' => $this->title, 'link' => "./cms.php?categ=article&sub=edit&id=" . $article->id); } }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_article_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_article.class.php"; require_once $class_path . "/cms/cms_editorial_tree.class.php"; if (!$cms_editorial_form_obj_id) { return false; } else { $section = new cms_article($cms_editorial_form_obj_id); $section->delete(); } print cms_editorial_tree::get_listing();
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; }
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; }
public function duplicate($num_parent = 0) { global $dbh; if (!$num_parent) { $num_parent = $this->num_parent; } //on place le nouvel article à la fin par défaut $query = "SELECT id_article FROM cms_articles WHERE num_section=" . addslashes($num_parent); $result = pmb_mysql_query($query); if ($result) { $order = ",article_order = '" . (pmb_mysql_num_rows($result) + 1) . "' "; } else { $order = ",article_order = 1"; } $insert = "insert into cms_articles set \n\t\tarticle_title = '" . addslashes($this->title) . "', \n\t\tarticle_resume = '" . addslashes($this->resume) . "', \n\t\tarticle_contenu = '" . addslashes($this->contenu) . "',\n\t\tarticle_logo = '" . addslashes($this->logo->data) . "',\n\t\tarticle_publication_state ='" . addslashes($this->publication_state) . "', \n\t\tarticle_start_date = '" . addslashes($this->start_date) . "', \n\t\tarticle_end_date = '" . addslashes($this->end_date) . "', \n\t\tnum_section = '" . addslashes($num_parent) . "', \n\t\tarticle_num_type = '" . $this->num_type . "',\n\t\tarticle_creation_date=sysdate() " . $order; pmb_mysql_query($insert, $dbh); $id = pmb_mysql_insert_id(); //au tour des descripteurs... for ($i = 0; $i < count($this->descriptors); $i++) { $rqt = "insert into cms_articles_descriptors set num_article = '" . $id . "', num_noeud = '" . $this->descriptors[$i] . "',article_descriptor_order='" . $i . "'"; pmb_mysql_query($rqt, $dbh); } //on crée la nouvelle instance $new_article = new cms_article($id); //enfin les éléments du type de contenu $types = new cms_editorial_types("article"); $types->duplicate_type_form($this->num_type, $id, $this->id); $new_article->maj_indexation(); $new_article->documents_linked = $this->documents_linked; $new_article->save_documents(); }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_article_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_article.class.php"; require_once $class_path . "/cms/cms_editorial_tree.class.php"; $article = new cms_article(); $article->get_from_form(); $article->save(); print cms_editorial_tree::get_listing();
public function get_format_data_structure($type = 'event') { $format_datas = array(); switch ($type) { //event case "event": $format_datas = cms_article::get_format_data_structure("article"); $format_datas[] = array('var' => "event_start", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_start_desc'], 'children' => array(array('var' => "event_start.format_value", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_start_format_value_desc']), array('var' => "event_start.value", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_start_value_desc']), array('var' => "event_start.time", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_start_time_desc']))); $format_datas[] = array('var' => "event_end", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_end_desc'], 'children' => array(array('var' => "event_end.format_value", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_end_format_value_desc']), array('var' => "event_end.value", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_end_value_desc']), array('var' => "event_end.time", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_event_end_time_desc']))); $format_datas[] = array('var' => "id_type", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_id_type_desc']); $format_datas[] = array('var' => "color", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_color_desc']); $format_datas[] = array('var' => "calendar", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_calendar_desc']); break; case "eventslist": $format_event = $this->get_format_data_structure("event"); $format_datas[] = array('var' => "events", 'desc' => $this->msg['cms_module_agenda_datasource_agenda_events_desc'], 'children' => $this->prefix_var_tree($format_event, "events[i]")); break; } return $format_datas; }
<?php // +-------------------------------------------------+ // © 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: cms_article_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_article.class.php"; if ($id != "new") { $article = new cms_article($id); } else { if ($num_parent) { $article = new cms_article(0, $num_parent); } else { $article = new cms_article(); } } print $article->get_form("cms_article_edit", "cms_article_edit", $base_path . "/cms.php?categ=articles&sub=save");
/** 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; }