예제 #1
0
 public function add($param = "")
 {
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     if ($this->insideForm == false) {
         $this->fileRequired = true;
         $this->legendeEnabled = true;
     }
     if ($this->insideForm == true) {
         $prefixe_field = $this->field . "__";
         $mySelect = new mySelect(__FILE__);
         $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "medias";
         $mySelect->fields = "*";
         $mySelect->orderby = "id DESC";
         // pour prendre le premier élément
         $mySelect->where = "field_media=:field_media AND id_parent=:id_parent";
         $mySelect->whereValue["field_media"] = array($this->field, PDO::PARAM_STR);
         //$formMaj->tables . "." .
         $id_parent = $formMaj->datasForm[$myAdmin->LANG_DATAS]["id"];
         if ($id_parent == "") {
             $id_parent = $formMaj->datasForm[""]["id"];
         }
         $mySelect->whereValue["id_parent"] = array($id_parent, PDO::PARAM_INT);
         $resultmySelect = $mySelect->query();
         foreach ($resultmySelect as $rowS) {
             $lg = $rowS["lg"];
             $value_fichier_media[$lg] = $rowS["fichier_media"];
             $value_titre_media[$lg] = $rowS["titre_media"];
             if ($lg == $myAdmin->LANG_DEF) {
                 // pour les données monolangue
                 $value_idMedia = $rowS["id"];
                 $value_fichier_media[""] = $rowS["fichier_media"];
                 $value_titre_media[""] = $rowS["titre_media"];
             }
         }
     } else {
         $prefixe_field = "";
     }
     $newfield = new file();
     $newfield->field = $prefixe_field . "fichier_media";
     $newfield->multiLang = $this->multiLangType;
     if ($this->insideForm == true) {
         $newfield->label = $this->label;
     } else {
         $newfield->label = $datas_lang["fichier_media"];
     }
     $newfield->value = $value_fichier_media;
     $newfield->startFolder = $this->startFolder;
     $newfield->tooltip = $this->tooltip;
     $newfield->addClass = $this->addClass;
     $newfield->extensionsAuthorized = "";
     if ($this->extensionsAuthorized != "") {
         $newfield->extensionsAuthorized = $this->extensionsAuthorized;
     }
     $newfield->multi = $this->multi;
     $newfield->upload = $this->upload;
     $newfield->uploadDirect = $this->uploadDirect;
     $newfield->widthLabel = 2;
     $newfield->widthField = 9;
     $newfield->placeholder = $this->placeholder;
     $result = $newfield->add();
     $field_fichier_media = $result;
     if ($this->fileRequired == true) {
         $newfield->rule("required", true);
     }
     // champ Titre: légende de l'image, du fichier ou du lien
     if ($this->legendeEnabled == true) {
         $newfield = new input();
         $newfield->field = $prefixe_field . "titre_media";
         $newfield->multiLang = true;
         $newfield->value = $value_titre_media;
         $newfield->label = $datas_lang["legende"];
         $newfield->tooltip = $datas_lang["tooltipsLegende"];
         $newfield->widthLabel = 2;
         $newfield->widthField = 9;
         $result = $newfield->add();
         $field_titre_media = $result;
     }
     $smarty->assign('field_fichier_media', $field_fichier_media);
     $smarty->assign('field_titre_media', $field_titre_media);
     if ($this->insideForm == true) {
         $newfield = new hidden();
         $newfield->field = "fieldMedia__" . $this->field;
         $newfield->multiLang = false;
         $newfield->value = serialize(array("type" => $this->type, "field_media" => $this->field, "idMedia" => $value_idMedia));
         $result = $newfield->add();
         $smarty->assign('fieldMediaField', $result);
     }
     $smarty->assign('this', $this);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.mediaFile.tpl');
     if ($this->insideForm == true) {
         $this->smartAssign($this->field, $data);
     } else {
         $this->smartAssign("media", $data);
     }
     return $data;
 }
예제 #2
0
$formMaj->multiLang = true;
$formMaj->clause_where();
// si validation du formulaire
if ($__POST["actionForm"] != "") {
    $formMaj->set_datas();
}
$newfield = new hidden();
$newfield->field = "id_parent";
$newfield->multiLang = false;
$newfield->defaultValue = $idParent;
$newfield->add();
$newfield = new input();
$newfield->field = "titre";
$newfield->multiLang = true;
$newfield->label = "Titre (si différent du type)";
$newfield->add();
// on charge tout les types de texte
$obj_article = new article("type_texte_itineraire");
$obj_article->fields = "id,titre";
$result = $obj_article->query();
$tab_type_texte_itineraire = array();
foreach ($result as $row) {
    $tab_type_texte_itineraire[$row["id"]] = $row["titre"];
}
// on charge les types de texte utilisés
$mySelect = new mySelect(__FILE__);
$mySelect->tables = $myTable;
$mySelect->fields = "type_texte";
$mySelect->where = "actif=1 AND lg='fr' and id_parent=" . $idParent;
$result = $mySelect->query();
$tab_type_texte = array();
예제 #3
0
$newfield->field = "lien_destination";
$newfield->multiLang = true;
$newfield->label = $datas_lang["lien"];
$newfield->placeholder = "http://, https:// ...";
$result = $newfield->add();
$newfield->rule("complete_url", true);
$newfield = new radio();
$newfield->field = "cible_destination";
$newfield->multiLang = false;
$newfield->defaultValue = "_blank";
$newfield->label = $datas_lang["cible"];
$newfield->items = $datas_lang["listeCible"];
$result = $newfield->add();
$newfield = new radio();
$newfield->field = "type_affichage";
$newfield->label = $datas_lang["pubTypeAffichage"];
$newfield->items = $datas_lang["pubTypes"];
$newfield->defaultValue = "N";
$newfield->add();
$newfield = new input();
$newfield->field = "couleur_fond";
$newfield->multiLang = false;
$newfield->widthField = 3;
$newfield->label = $datas_lang["pubCouleurFond"];
$newfield->placeholder = $datas_lang["pubCouleurFond_placeholder"];
$newfield->tooltip = $datas_lang["pubCouleurFond_tooltip"];
$result = $newfield->add();
$newfield->rule("alphanumeric", true);
$newfield->rule("minlength", 6);
$newfield->rule("maxlength", 6);
include DOS_INCPAGES_ADMIN . "maj-prepare.php";