protected function gen_select() { //si on est en création de cadre if (!$this->id) { $this->parameters = array(); } $select = "<select name='" . $this->get_form_value_name($this->cms_module_common_selector_type_editorial_type) . "' \n\t\t\tonchange=\"cms_type_fields(this.value);\" >\n\t\t"; $types = new cms_editorial_types($this->cms_module_common_selector_type_editorial_type); $select .= $types->get_selector_options($this->parameters["type_editorial"]); $select .= "</select>\n\t\t<script type='text/javascript'>\n\t\t\tfunction cms_type_fields(id_type){\n\t\t\t\tdojo.xhrGet({\n\t\t\t\t\turl : '" . $this->get_ajax_link(array($this->class_name . "_hash[]" => $this->hash)) . "&id_type='+id_type,\n\t\t\t\t\thandelAs : 'text/html',\n\t\t\t\t\tload : function(data){\n\t\t\t\t\t\tdojo.byId('type_editorial_fields').innerHTML = data;\n\t\t\t\t\t}\n\t\t\t\t});\t\t\t\t\t\t\n\t\t\t}\n\t\t</script>"; return $select; }
protected function gen_select() { global $charset; //si on est en création de cadre if (!$this->id) { $this->parameters['type_editorial'] = array(); } $select = "\n\t\t<select name='" . $this->get_form_value_name("section") . "[]' multiple='yes'>"; $types = new cms_editorial_types("section"); $types->get_types(); for ($i = 0; $i < count($types->types); $i++) { $select .= "\r\n\t\t\t<option value='" . $types->types[$i]['id'] . "'" . (in_array($types->types[$i]['id'], $this->parameters['type_editorial']) ? " selected='selected'" : "") . ">" . htmlentities($types->types[$i]['label'], ENT_QUOTES, $charset) . "</option>"; } $select .= "\n\t\t</select>"; return $select; }
public function save_type_form($num_type, $elem_id) { //enregistrement des CP $type_fields = new cms_editorial_parametres_perso($num_type); $type_fields->rec_fields_perso($elem_id, $this->element); //on passe aux extensions! $type = cms_editorial_types::get_type($num_type); for ($i = 0; $i < count($type['extensions']); $i++) { $infos = explode(" ", $type['extensions'][$i]); $module = new $infos[0](); $extension_form .= $module->save_extension_form($infos[1], $this->element, $elem_id); } }
case "save": $cms_build = new cms_build(); $cms_build->save_version_form($id); ajax_http_send_response($cms_build->build_versions_list_ajax()); break; case "del_version": $cms_build = new cms_build(); ajax_http_send_response($cms_build->version_delete($id)); break; case "del_cms": $cms_build = new cms_build(); $cms_build->cms_delete($id); ajax_http_send_response($cms_build->build_versions_list_ajax()); break; case "edit": $cms_build = new cms_build(); ajax_http_send_response($cms_build->get_version_form($id, 1)); break; } break; case "get_type_form": ajax_http_send_response(cms_editorial_types::get_editable_form($id, $elem, $type_id)); break; case "documents": case "document": include $base_path . "/cms/ajax/documents/main.inc.php"; break; case 'dashboard': include "./dashboard/ajax_main.inc.php"; break; }
} elseif ($field == "deflt_cms_article_statut") { if ($cms_active && SESSrights & CMS_AUTH) { $publications_states = new cms_editorial_publications_states(); $selector = "\n\t\t\t\t\t\t<select name=\"form_" . $field . "\">\n\t\t\t\t\t\t\t" . $publications_states->get_selector_options($field_values[$i]) . "\n\t\t\t\t\t\t</select>"; $deflt_user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\t\n\t\t\t\t\t\t<div class='colonne_suite'>\t\t\t\n\t\t\t\t\t\t\t{$selector}\n\t\t\t\t\t\t</div></div>\n"; } } elseif ($field == "deflt_cms_article_type") { if ($cms_active && SESSrights & CMS_AUTH) { $types = new cms_editorial_types('article'); $types->get_types(); $selector = "\n\t\t\t\t\t\t<select name=\"form_" . $field . "\">\n\t\t\t\t\t\t\t" . $types->get_selector_options($field_values[$i]) . "\n\t\t\t\t\t\t</select>"; $deflt_user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\t\n\t\t\t\t\t\t<div class='colonne_suite'>\t\t\t\n\t\t\t\t\t\t\t{$selector}\n\t\t\t\t\t\t</div></div>\n"; } } elseif ($field == "deflt_cms_section_type") { if ($cms_active && SESSrights & CMS_AUTH) { $types = new cms_editorial_types('section'); $types->get_types(); $selector = "\n\t\t\t\t\t\t<select name=\"form_" . $field . "\">\n\t\t\t\t\t\t\t" . $types->get_selector_options($field_values[$i]) . "\n\t\t\t\t\t\t</select>"; $deflt_user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\t\n\t\t\t\t\t\t<div class='colonne_suite'>\t\t\t\n\t\t\t\t\t\t\t{$selector}\n\t\t\t\t\t\t</div></div>\n"; } } elseif ($field == "deflt_scan_request_status") { if ($pmb_scan_request_activate) { $request_status_instance = new scan_request_status(); $selector = "\n\t\t\t\t\t\t<select name=\"form_" . $field . "\">\n\t\t\t\t\t\t\t" . $request_status_instance->get_selector_options($field_values[$i]) . "\n\t\t\t\t\t\t</select>"; $deflt_user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . "</div>\n\t\n\t\t\t\t\t\t<div class='colonne_suite'>\t\t\t\n\t\t\t\t\t\t\t{$selector}\n\t\t\t\t\t\t</div></div>\n"; } } else { $deflt_table = substr($field, 6); if ($deflt_table == "integration_notice_statut") { $deflt_table = "notice_statut"; }
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 duplicate($recursive, $num_parent = 0) { global $dbh; if (!$num_parent) { $num_parent = $this->num_parent; } //on place la nouvelle rubrique à la fin par défaut $query = "SELECT id_section FROM cms_sections WHERE section_num_parent=" . addslashes($num_parent); $result = pmb_mysql_query($query, $dbh); if ($result) { $order = ",section_order = '" . (pmb_mysql_num_rows($result) + 1) . "' "; } else { $order = ",section_order = 1"; } $insert = "insert into cms_sections set\r\n\t\tsection_title = '" . addslashes($this->title) . "',\r\n\t\tsection_resume = '" . addslashes($this->resume) . "',\n\t\tsection_logo = '" . addslashes($this->logo->data) . "',\r\n\t\tsection_publication_state ='" . addslashes($this->publication_state) . "',\r\n\t\tsection_start_date = '" . addslashes($this->start_date) . "',\r\n\t\tsection_end_date = '" . addslashes($this->end_date) . "',\r\n\t\tsection_num_parent = '" . addslashes($num_parent) . "' ,\r\n\t\tsection_num_type = '" . $this->num_type . "' ,\r\n\t\tsection_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_sections_descriptors set num_section = '" . $id . "', num_noeud = '" . $this->descriptors[$i] . "',section_descriptor_order='" . $i . "'"; pmb_mysql_query($rqt, $dbh); } //on crée la nouvelle instance $new_section = new cms_section($id); //enfin les éléments du type de contenu $types = new cms_editorial_types("section"); $types->duplicate_type_form($this->num_type, $id, $this->id); $new_section->maj_indexation(); $new_section->documents_linked = $this->documents_linked; $new_section->save_documents(); //audit audit::insert_creation(AUDIT_EDITORIAL_SECTION, $id); if ($recursive) { //on duplique les rubriques enfants $query = "select id_section from cms_sections where section_num_parent = " . $this->id . " order by section_order"; $result = pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $child = new cms_section($row->id_section); $child->duplicate($recursive, $id); } } //on duplique les articles enfants $query = "select id_article from cms_articles where num_section = " . $this->id . " order by article_order"; $result = pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $article = new cms_article($row->id_article); $article->duplicate($id); } } } }
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(); }
/** 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; }
switch ($elem) { case "article_generic": case "section_generic": $query = "select id_editorial_type from cms_editorial_types where editorial_type_element = '" . $elem . "'"; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $type_id = $row->id_editorial_type; } break; } $fields = new cms_editorial_parametres_perso($type_id, "./admin.php?categ=cms_editorial&sub=type&elem=" . $elem . "&quoi=fields&type_id=" . $type_id); $fields->proceed(); break; default: $types = new cms_editorial_types($elem); switch ($action) { case "edit": print $types->get_form($id); break; case "save": $types->save(); print $types->get_table(); break; case "delete": $types->delete($id); print $types->get_table(); break; case "list": default: print $types->get_table();