Exemplo n.º 1
0
 public static function get_editable_form($id, $elem, $type_id)
 {
     global $msg, $charset;
     $type = cms_editorial_types::get_type($type_id);
     //les champs perso...
     $obj = new cms_editorial_parametres_perso($type_id);
     $fields = $obj->show_editable_fields($id, $elem);
     $form = "";
     for ($i = 0; $i < count($fields["FIELDS"]); $i++) {
         $p = $fields["FIELDS"][$i];
         $form .= "\r\n\t\t\t<div class='row'>\r\n\t\t\t<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "</label></div>\r\n\t\t\t<div class='row'>" . $p["AFF"] . "</div>\r\n\t\t\t</div><div class='row'>&nbsp;</div>";
     }
     if ($form && count($type['exentions'])) {
         $extension_form = "<hr />";
     } else {
         $extension_form = "";
     }
     $form .= $fields['CHECK_SCRIPTS'];
     //les extensions de formulaires
     for ($i = 0; $i < count($type['extensions']); $i++) {
         $infos = explode(" ", $type['extensions'][$i]);
         $module = new $infos[0]();
         $extension_form .= $module->get_extension_form($infos[1], $elem, $id);
     }
     return $form . $extension_form;
 }
 function show_editable_fields($id, $type = "")
 {
     global $aff_list_empr, $charset;
     $perso = array();
     //on va chercher les champs génériques
     $generic_type = $this->get_generic_type($type);
     $generic_check_script = "";
     if ($generic_type) {
         $generic = new cms_editorial_parametres_perso($generic_type, $this->base_url);
         $p = $generic->show_editable_fields($id);
         $perso['FIELDS'] = $p['FIELDS'];
         $generic_check_script = $p['GENERIC_CHECK_SCRIPTS'];
     }
     if (!$this->no_special_fields) {
         $this->get_values($id);
         $check_scripts = "";
         reset($this->t_fields);
         while (list($key, $val) = each($this->t_fields)) {
             $t = array();
             $t["NAME"] = $val["NAME"];
             $t["TITRE"] = $val["TITRE"];
             $field = array();
             $field["ID"] = $key;
             $field["NAME"] = $this->t_fields[$key]["NAME"];
             $field["MANDATORY"] = $this->t_fields[$key]["MANDATORY"];
             $field["SEARCH"] = $this->t_fields[$key]["SEARCH"];
             $field["EXPORT"] = $this->t_fields[$key]["EXPORT"];
             $field["EXCLUSION"] = $this->t_fields[$key]["EXCLUSION"];
             $field["OPAC_SORT"] = $this->t_fields[$key]["OPAC_SORT"];
             $field["ALIAS"] = $this->t_fields[$key]["TITRE"];
             $field["DATATYPE"] = $this->t_fields[$key]["DATATYPE"];
             $field["OPTIONS"][0] = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $this->t_fields[$key]["OPTIONS"], "OPTIONS");
             $field["VALUES"] = $this->values[$key];
             $field["PREFIX"] = $this->prefix;
             eval("\$aff=" . $aff_list_empr[$this->t_fields[$key][TYPE]] . "(\$field,\$check_scripts);");
             $t["AFF"] = $aff;
             $t["NAME"] = $field["NAME"];
             $perso["FIELDS"][] = $t;
             $perso["GENERIC_CHECK_SCRIPTS"] = $check_scripts;
         }
         //Compilation des javascripts de validité renvoyés par les fonctions d'affichage
         $check_scripts = "<script>function cancel_submit(message) { alert(message); return false;}\nfunction check_form() {\n" . $generic_check_script . $check_scripts . "\nreturn true;\n}\n</script>";
         $perso["CHECK_SCRIPTS"] = $check_scripts;
     } else {
         $perso["CHECK_SCRIPTS"] = "<script>function check_form() {\n" . $generic_check_script . "\nreturn true; }</script>";
     }
     return $perso;
 }