public function req_myselect($name) { $mySelect = new mySelect(__FILE__); $mySelect->tables = "{$thisSite->PREFIXE_TBL_CLI} .{$name}"; $mySelect->fields = "id,titre"; $mySelect->where = "actif=:actif"; $mySelect->whereValue["actif"] = "1"; $mySelect->orderby = "titre ASC"; $this->result = $mySelect->query(); }
public function query($debug = "") { global $thisSite; $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "articles"; if ($this->fields == "") { $mySelect->fields = "*"; } else { $mySelect->fields = $this->fields; } $mySelect->where = "actif=1 AND art = '" . $this->article . "'"; if ($this->lg != "" && $this->lg != "all") { // si une langue est indiqué on l'utilise $mySelect->where .= " AND lg='" . $this->lg . "'"; } else { if ($this->lg == "") { $mySelect->where .= " AND lg='" . $thisSite->current_lang . "'"; } } if ($this->id != "") { $mySelect->where .= " AND id=" . $this->id; } if ($this->where != "") { $mySelect->where .= " AND " . $this->where; } if ($this->orderby == "") { $mySelect->orderby = "id ASC"; } else { $mySelect->orderby = $this->orderby; } if ($this->limit != "") { $mySelect->limit = $this->limit; } $result = $mySelect->query($debug); // on ajoute les médias si demandé $whatMedias = explode(",", $this->medias); if (count($whatMedias) > 0) { foreach ($result as $x => $row) { foreach ($whatMedias as $media) { $thisMedia = new media($this->article . "_" . $media); $thisMedia->idParent = $row["id"]; $dataMedias = $thisMedia->get(); $result[$x][$media] = $dataMedias; } } } return $result; }
function deleteArbo($idDel) { global $thisSite; $arbo_site = array(); $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "arbo"; $mySelect->fields = "*"; $result = $mySelect->query(); foreach ($result as $row) { $nivRub = unserialize($row['arbo_menu']); //echoa($row['code_menu']); //echoa($nivRub); if (array_key_exists($idDel, $nivRub)) { unset($nivRub[$idDel]); } if (is_array($nivRub)) { foreach ($nivRub as $idRub => $nivsRub) { //echoa($nivsRub); if (is_array($nivsRub)) { if (array_key_exists($idDel, $nivsRub)) { unset($nivRub[$idRub][$idDel]); } } if (is_array($nivsRub)) { foreach ($nivsRub as $idsRub => $nivssRub) { //echoa($nivssRub); if (is_array($nivssRub)) { if (array_key_exists($idDel, $nivssRub)) { unset($nivRub[$idRub][$idsRub][$idDel]); } } } } //$nivsRub } } //$nivRub //echoa($nivRub); $myUpdate = new myUpdate(__FILE__); $myUpdate->table = $thisSite->PREFIXE_TBL_GEN . "arbo"; $myUpdate->field["arbo_menu"] = serialize($nivRub); $myUpdate->where = "code_menu='" . $row['code_menu'] . "'"; $result = $myUpdate->execute(); } // suppression dans l'arbo }
function getEmail($code) { global $thisSite; $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "emails"; $mySelect->fields = "*"; $mySelect->where = "code=:code"; $mySelect->whereValue["code"] = array($code, PDO::PARAM_STR); $result = $mySelect->query(); $row = current($result); $titre = $row["titre"]; $email = $row["email"]; $ltemp = array(); array_push($ltemp, $email); array_push($ltemp, $titre); return $ltemp; }
<?php // Chargement total element à updater en ligne pour controle foreach ($listCols as $col => $datasCol) { if ($datasCol["update"] > 0) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $myTable; $mySelect->fields = $datasCol["field"]; if ($formList->where == "") { $mySelect->where = $datasCol["field"] . "=1"; } else { $mySelect->where = $formList->where . " AND " . $datasCol["field"] . "=1"; } $countTrue = $mySelect->count(); $listCols[$col]["countTrue"] = $countTrue; } } // recherche des colonnes existant dans la table et qui donc peuvent être utilisé pour le tri par colonne foreach ($listCols as $col => $datasCol) { if ($datasCol["field"] != "") { $field = $datasCol["field"]; $oneDatasList = current($formList->datasList); if (isset($oneDatasList[$field]) && !isset($listCols[$col]["orderOk"])) { $listCols[$col]["orderOk"] = 1; } } }
<?php session_start(); accessAuth(); $obj_article = new article("projet"); // Récupérer le nom de l'utilisateur connecté $userTitre = $_SESSION['auth']['titre']; // Récupérer la liste des projets $obj_article = new article("projet"); $obj_article->fields = "id,titre"; $obj_article->orderby = "titre ASC"; $list_projet = $obj_article->query(); // récupérer la liste des catégories $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "categories"; $mySelect->fields = "id,titre"; $mySelect->where = "actif=:actif"; $mySelect->whereValue["actif"] = "1"; $mySelect->orderby = "titre ASC"; $list_categorie = $mySelect->query(); $smarty->assign('user_titre', $userTitre); $smarty->assign('list_projet', $list_projet); $smarty->assign('list_categorie', $list_categorie);
public function count_datas($clg) { global $myAdmin; $mySelect = new mySelect(__FILE__); $mySelect->tables = $this->tables; $mySelect->where = $this->whereFull; $mySelect->whereValue = $this->whereValuebyLg[$clg]; $result = $mySelect->count(); return $result; }
<?php /************************************************** * * Requête concernant la Table Eléments * *************************/ // Récupérer les éléments par rapport aux variables "$var_field_id" et "$id" $tabElement = array(); $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements"; $mySelect->fields = "*"; if (!empty($action)) { $mySelect->where = "actif=:actif AND id=:id_element AND {$var_field_id}=:{$var_field_id}"; $mySelect->whereValue["id_element"] = $id_element; $mySelect->whereValue["id_projet"] = $currentProjet['id']; $mySelect->whereValue["actif"] = "1"; } else { if (!$action) { $mySelect->where = "actif=:actif AND {$var_field_id}=:{$var_field_id}"; $mySelect->whereValue["actif"] = "1"; $mySelect->whereValue["{$var_field_id}"] = $id; } } $mySelect->orderby = "titre ASC"; $tabElement = $mySelect->query(); foreach ($tabElement as $KElement => $Element) { // Récupérer le prefix de id_utilisateur "admin-" $prefix_utilisateur[$KElement] = substr($Element["creation_utilisateur"], 0, 6); if ($prefix_utilisateur[$KElement] == "admin-") { // garder les valeurs apres "admin-"
public function add($param = "") { if (!is_array($this->items) && $this->tags != true) { return 0; } global $myAdmin; global $formMaj; global $datas_lang; global $smarty; global $thisSite; if ($this->tags == true) { $this->multiLang = false; // multilangue géré par la table des tags } $this->LIST_LANG_EXTENSION_FIELD = $myAdmin->LIST_LANG_EXTENSION_FIELD; parent::add(); $smarty->assign('this', $this); $listDisabled = array(); if (!is_array($this->valuesDisabled)) { $valuesDisabled = explode(",", $this->valuesDisabled); $listDisabled = $valuesDisabled; } else { $listDisabled = $this->valuesDisabled; } foreach ($this->list_lang as $clg => $extlg) { $value = $this->getValue($clg); $values = explode(",", $value); if (!is_array($values)) { $values = array(); } if ($this->tags == true) { if ($listItems == "") { $listItems = array(); $mySelect2 = new mySelect(__FILE__); $mySelect2->tables = $thisSite->PREFIXE_TBL_GEN . "tags"; $mySelect2->fields = "*"; $mySelect2->where = "parent=:parent AND lg=:lg"; $mySelect2->whereValue["parent"] = array($this->field, PDO::PARAM_STR); $mySelect2->whereValue["lg"] = array("fr", PDO::PARAM_STR); $mySelect2->orderby = "titre ASC"; $result2 = $mySelect2->query(); foreach ($result2 as $row2) { $listItems[$row2['id']] = $row2['titre']; } } } else { $listItems = $this->items; } if ($this->iconeLangue() == true || $this->tags == true) { $smarty->assign('marginLeft', 50); } else { $smarty->assign('marginLeft', 0); } $indice = 0; $datasItem = array(); $count_items = count($listItems); $myGroup = ""; foreach ($listItems as $val => $text) { $val = delQuotes($val); $value = delQuotes($value); if (in_array($val, $listDisabled)) { $stateDisabled = "state-disabled"; $disabled = "disabled"; } else { $stateDisabled = ""; $disabled = ""; } if (in_array(htmlspecialchars($val, ENT_QUOTES), $values)) { $selected = "selected"; } else { $selected = ""; } if ($count_items == 1) { $str_indice = ""; } else { $str_indice = "_" . $indice; } $idField = $this->field . $extlg . $str_indice; $datasItem[$indice] = array("val" => $val, "text" => $text, "idField" => $idField, "stateDisabled" => $stateDisabled, "disabled" => $disabled, "selected" => $selected); $myGroup = $idField; $indice++; $marginLeft = 0; } //echoa($datasItem); $datasItemByLg[$clg] = $datasItem; } // lg $smarty->assign('datasItemByLg', $datasItemByLg); $allmyGroup = $smarty->getTemplateVars("myGroup"); $allmyGroup .= $this->field . $extlg . ":\"" . $myGroup . "\",\n"; $smarty->assign("myGroup", $allmyGroup); $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.selectM.tpl'); addStructure("addJsStructure", DOS_OUTILS_ADMIN . "multiple-select/jquery.multiple.select.js"); $this->smartAssign($this->field, $data); return $data; }
if ($code_menu == "principal") { $sitemap_priority = "0.9"; } else { $sitemap_priority = "0.7"; } } if ($sitemap_changefreq == "") { $sitemap_changefreq = "monthly"; } if (stristr($tab_rub["lien_rub"], "javascript") === FALSE) { echo "<url>\n<loc>" . $thisSite->racineWithLang . $tab_rub["lien_rub"] . "</loc>\n<priority>{$sitemap_priority}</priority>\n<changefreq>{$sitemap_changefreq}</changefreq>\n</url>\n"; } if (count($tab_rub["SRUBS"]) > 0) { foreach ($tab_rub["SRUBS"] as $id_srub => $tab_srub) { list($titre_srub, $lien_srub) = $tab_srub; $mySelect2 = new mySelect(__FILE__); $mySelect2->tables = $thisSite->PREFIXE_TBL_GEN . "pages"; $mySelect2->fields = "*"; $mySelect2->where = "id=:id AND actif=1 and lg=:lg"; $mySelect2->whereValue["id"] = array($id_srub, PDO::PARAM_INT); $mySelect2->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR); $result2 = $mySelect2->query(); $row2 = current($result2); $sitemap_priority = $row2['page_sitemap_priority']; $sitemap_changefreq = $row2['page_sitemap_changefreq']; if ($sitemap_priority == "") { $sitemap_priority = "0.5"; } if ($sitemap_changefreq == "") { $sitemap_changefreq = "monthly"; }
public function addArbo() { global $thisSite; if ($this->idPage == 0 || $this->idPage == "") { return false; } $myTable = $thisSite->PREFIXE_TBL_GEN . "arbo"; if ($this->idPageParent == "") { $this->idPageParent = 0; } if ($this->code_menu == "noneItem" || $this->code_menu == "") { $this->code_menu = "horsmenu"; } $mySelect = new mySelect(__FILE__); $mySelect->tables = $myTable; $mySelect->fields = "arbo_menu"; $mySelect->where = "code_menu='" . $this->code_menu . "'"; $result = $mySelect->query(); $row = current($result); $arbo_menu = unserialize($row['arbo_menu']); if (is_array($this->idPageParent)) { $arbo_menu[$this->idPageParent[0]][$this->idPageParent[1]][$this->idPage] = ""; } else { if ($this->idPageParent > 0) { $arbo_menu[$this->idPageParent][$this->idPage] = ""; } else { $arbo_menu[$this->idPage] = ""; } } $myUpdate = new myUpdate(__FILE__); $myUpdate->table = $myTable; $myUpdate->field["arbo_menu"] = serialize($arbo_menu); $myUpdate->where = "code_menu='" . $this->code_menu . "'"; $result = $myUpdate->execute(); }
$list_champ[$datas["id"]] = $datas["titre"]; if ($datas["filtre1"] == "1") { $list_champ_crypte[] = $datas["id"]; } } $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "categories"; $mySelect->fields = "list_champ"; $mySelect->where = "actif=:actif AND id=:id"; $mySelect->whereValue["actif"] = "1"; $mySelect->whereValue["id"] = $__GET['idc']; $result = $mySelect->query(); $row = current($result); $list_champ_categorie = explode(",", $row["list_champ"]); foreach ($list_champ_categorie as $idChamp) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements_champs"; $mySelect->fields = "valeur"; $mySelect->where = "id_element=:id_element AND id=:id"; $mySelect->whereValue["id_element"] = $__GET['ide']; $mySelect->whereValue["id"] = $idChamp; $resultValeur = $mySelect->query(); $rowValeur = current($resultValeur); if ($rowValeur["valeur"] != "") { if (in_array($idChamp, $list_champ_crypte)) { $rowValeur["valeur"] = decrypt_string("KEY", $rowValeur["valeur"]); } } ?> <section>
} // On vérifie si le champ mot de passe à bien été saisie, si oui on le crypte en md5 if (empty($_POST['password'])) { $errors['password'] = "******"; $smarty->assign('errors', $errors); } else { $password = md5($_POST['password']); } /************************** * * AUTHENTIFICATION DE L'UTILISATEUR * - Vérifier si l'utilisateur existe en BDD, selon les paramères saisie dans le formulaire de connexion * *********************************************/ // Récupérer l'utilisateur qui correspond au données saisies $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "utilisateurs"; $mySelect->fields = "id,titre,email,id_type"; $mySelect->where = "actif=:actif AND email=:email AND mdp=:mdp"; $mySelect->whereValue["actif"] = "1"; $mySelect->whereValue["email"] = $_POST['email']; $mySelect->whereValue["mdp"] = $password; $user = $mySelect->query(); // Si l'utilisateur existe en base de données grâce aux informations saisies alors if (!empty($user)) { // Récupérer le titre du type d'utilisateur de l'utilisateur en question $obj_article = new article("type_utilisateur"); $obj_article->fields = "id,titre"; $obj_article->where = "id=" . $user[0]['id_type']; // $obj_article->whereValue["idType"]=$user[0]['id_type']; $tabType = $obj_article->query();
} // Récupérer les bonne valeurs des champs par rapport au projet $listChamp = array(); foreach ($list_id_champ as $kidc => $vv) { foreach ($list_id_champ[$kidc] as $idc) { foreach ($list_champ as $KlistChamp => $VlistChamp) { if ($VlistChamp['id'] == $idc) { $listChamp[$kidc][] = array('id' => $VlistChamp['id'], 'titre' => $VlistChamp['titre'], 'filtre' => $VlistChamp['filtre']); } } } } // Récupérer les valeurs qui correspond aux champs $listValeurs = array(); foreach ($list_element['Element'] as $klistE => $vlistE) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements_champs"; $mySelect->fields = "id,valeur"; $mySelect->where = "id_element=:id_element"; $mySelect->whereValue["id_element"] = $vlistE['id']; $listValeur[] = $mySelect->query(); } $listFiltre = array(); foreach ($listChamp as $KLC => $ChampFiltre) { foreach ($listChamp[$KLC] as $KeyLC => $VLC) { $listFiltre[$KLC] = $VLC['filtre']; } } // Injecter dans listChamps le tableaux des valeurs $list_Champ_Valeur = array(); foreach ($listChamp as $Klistchamp => $Vlistchamp) {
<?php /************************************************** * * Requête concernant la Table Catégorie * *************************/ // Récupérer les catégories par rapport aux éléments donnée par la requête $tabElement $list_categorie_full = array(); foreach ($tabElement as $Kelem => $Velem) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "categories"; $mySelect->fields = "*"; $mySelect->where = "actif=:actif AND id=:id_categorie"; $mySelect->whereValue["actif"] = "1"; $mySelect->whereValue["id_categorie"] = $Velem['id_categorie']; $list_categorie_full[] = $mySelect->query(); } $list_categorie = array(); foreach ($list_categorie_full as $keyList => $cat) { $cat = current($cat); $list_categorie['Categorie'][$cat['id']] = array('id' => $cat["id"], 'titre' => $cat["titre"], 'list_champ' => $cat["list_champ"], 'list_type_utilisateur' => $cat["list_type_utilisateur"]); } // Injecter $list_categorie dans $tabElement pour avoir un seul tableau propre foreach ($tabElement as $k => $value) { //$id_categories[$k] = $value[id_categorie]; $list_element['Element'][$k] = array('id' => $value[id], 'titre' => $value[titre], 'creation_date' => $value[creation_date], 'actif' => $value[actif], 'creation_utilisateur' => $value[creation_utilisateur], 'remarques' => $value[remarques], 'id_projet' => $value[id_projet], 'Categorie' => $list_categorie['Categorie'][$value['id_categorie']]); } if (!$list_element) { ?> <div class="row">
if ($script_bandeau != "") { echo $script_bandeau; } if ($lien_destination != "") { echo "</span>"; } echo "</div>"; if ($type_affichage == "F") { echo "</div>"; } $temp = ob_get_contents(); ob_end_clean(); $temp = $temp . "\n\n"; $smarty->assign("PUBLICITE_" . $pub_emplacement . $pub_emplacement_numero, $temp); // MAJ STATS $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_PUB . "stats"; $mySelect->where = "id_bandeau=:id_bandeau AND aa=:aa AND mm=:mm AND jj=:jj AND lg=:lg"; $mySelect->whereValue["id_bandeau"] = array($bandeauChoisi, PDO::PARAM_INT); $mySelect->whereValue["aa"] = array(date(Y), PDO::PARAM_STR); $mySelect->whereValue["mm"] = array(date(m), PDO::PARAM_STR); $mySelect->whereValue["jj"] = array(date(d), PDO::PARAM_STR); $mySelect->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR); if ($mySelect->count() == 0) { $myInsert = new myInsert(__FILE__); $myInsert->table = $thisSite->PREFIXE_TBL_PUB . "stats"; $myInsert->field["id_emplacement"] = $pub_emplacement; $myInsert->field["lg"] = $thisSite->current_lang; $myInsert->field["id_campagne"] = $id_campagne; $myInsert->field["id_bandeau"] = $bandeauChoisi; $myInsert->field["aa"] = date(Y);
<?php include DOS_INC_ADMIN . "controle_login.php"; // ajout selecteur de variables $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "variables"; $mySelect->fields = "*"; $mySelect->where = "lg>=:lg"; $mySelect->whereValue["lg"] = array($myAdmin->LANG_ADMIN, PDO::PARAM_STR); $nb_variables = $mySelect->count(); if ($nb_variables > 0) { $result = $mySelect->query(); $data_variables = ""; $data_variables .= "<div id='show_variables'>"; $data_variables .= "<select id='liste_variables' onChange=\"javascript:select_variables();\" >"; $data_variables .= "<option>Choisissez une variable...</option>"; foreach ($result as $row) { $codevar = $thisSite->SEPVAR . stripslashes($row["code"]) . $thisSite->SEPVAR; $titrevar = stripslashes($row["titre"]); $data_variables .= "<option value='{$codevar}'>{$titrevar}</option>"; } $data_variables .= "</select>"; $data_variables .= "</div>"; $smarty->assign("data_variables", $data_variables); } //nb_variables
public function load_pages($debug = 0) { // if(is_array($this->pages)) { return false; } // si existe déjà, on passe $pages = array(); $mySelect = new mySelect(__FILE__); $mySelect->tables = $this->PREFIXE_TBL_GEN . "pages"; $mySelect->fields = "*"; $mySelect->where = "lg=:lg AND actif=1"; $mySelect->whereValue["lg"] = array($this->current_lang, PDO::PARAM_STR); $mySelect->orderby = "id ASC"; $result = $mySelect->query(); foreach ($result as $row) { $idPage = stripslashes($row["id"]); $datasPages = $row; // si tag_title vide : tag_title = page_titre if ($datasPages["page_tag_title"] == "") { $datasPages["page_tag_title"] = $datasPages["page_titre"]; } // page_url = URL simple sans arbo ni type de page // insert chemin absolue si !!racine!! $datasPages["page_url"] = str_replace($this->SEPVAR . "racine" . $this->SEPVAR, $this->RACINE, $datasPages["page_url"]); $pages[$idPage] = $datasPages; } $this->pages = $pages; $this->loadUrlPages(); if ($debug == 1) { echoa($pages); } return true; }
<?php $pathBatch = "../"; include $pathBatch . "init_pages/" . "batch.php"; // récupération données standard $table = $__GET["table"]; $valOrigin = $__GET["valOrigin"]; end($__GET); $field = key($__GET); $valField = $__GET[$field]; // champ de la base de donnée: on enleve l'extension langue du champ si existe if (in_array(substr($field, strrpos($field, "_")), $myAdmin->LIST_LANG_EXTENSION_FIELD)) { $BdDfield = substr($field, 0, strrpos($field, "_")); } else { $BdDfield = $field; } $mySelect = new mySelect(__FILE__); $mySelect->tables = $table; $mySelect->fields = "id," . $BdDfield; $mySelect->where = $BdDfield . "='" . addslashes($valField) . "' AND " . $BdDfield . "!='" . addslashes($valOrigin) . "'"; $qt = $mySelect->count(); if ($qt > 0) { echo "false"; } else { echo "true"; }
public function sumbit_check_onglet($id_projet, $id_categorie, $id_element) { global $thisSite; $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "elements"; $mySelect->fields = "*"; $mySelect->where = "actif=:actif AND id=:id AND id_projet=:id_projet AND id_categorie=:id_categorie"; $mySelect->whereValue["id"] = $id_element; $mySelect->whereValue["id_projet"] = $id_projet; $mySelect->whereValue["id_categorie"] = $id_categorie; $mySelect->whereValue["actif"] = "1"; $result = $mySelect->query(); if (empty($result)) { $this->clear_panel = true; return $this->clear_panel; } }
function load_intitules_by_lang() { global $thisSite; $intitules_lang = array(); $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "intitules"; $mySelect->fields = "*"; $mySelect->where = "lg=:lg"; $mySelect->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR); $result = $mySelect->query(); foreach ($result as $row) { $intitules_lang[$row["code"]] = add_variables($row["titre"]); } $thisSite->intitulesLang = $intitules_lang; }
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; }
public function get() { global $thisSite; $mySelectM = new mySelect(__FILE__); $mySelectM->tables = $thisSite->PREFIXE_TBL_GEN . "medias"; $mySelectM->fields = "*"; $mySelectM->orderby = "chrono ASC"; $mySelectM->where = "lg=:lg AND actif=1 AND field_media='" . $this->field . "'"; if ($this->idParent > 0) { $mySelectM->where .= " AND id_parent=:idParent"; $mySelectM->whereValue["idParent"] = array($this->idParent, PDO::PARAM_INT); } if ($this->idMedia > 0) { $mySelectM->where .= " AND id=:idMedia"; $mySelectM->whereValue["idMedia"] = array($this->idMedia, PDO::PARAM_INT); } if ($this->onlySelection > 0) { $mySelectM->where .= " AND image_principale=1"; } $mySelectM->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR); $resultM = $mySelectM->query(); $allMedias = array(); $x = 1; foreach ($resultM as $rowM) { $temp = array(); if ($rowM["fichier_media"] == "" && $rowM["lien_destination"] == "") { continue; } $temp["id"] = $rowM["id"]; if ($rowM["type"] == "image") { $temp["image"] = $rowM["fichier_media"]; for ($indiceVignette = 0; $indiceVignette < 5; $indiceVignette++) { $temp["vig" . $indiceVignette] = get_vignette($rowM["fichier_media"], $indiceVignette); } $temp["legende"] = $rowM["titre_media"]; $temp["fichier_destination"] = $rowM["fichier_destination"]; $temp["lien_destination"] = $rowM["lien_destination"]; $temp["cible_destination"] = $rowM["cible_destination"]; $temp["image_principale"] = $rowM["image_principale"]; } if ($rowM["type"] == "file") { $temp["fichier"] = $rowM["fichier_media"]; $temp["legende"] = $rowM["titre_media"]; if ($temp["legende"] == "") { $temp["legende"] = get_nom_fichier($rowM["fichier_media"]); } } if (strpos($rowM["type"], "video") === 0) { $temp["lien_video"] = $rowM["fichier_media"]; $temp["type_video"] = $rowM["type"]; $temp["legende"] = $rowM["titre_media"]; $temp["image_principale"] = $rowM["image_principale"]; $temp["thumb"] = $this->imageVideo($rowM["type"], $rowM["fichier_media"], $this->sizeThumbVideo); $temp["player"] = $this->embedVideo($rowM["type"], $rowM["fichier_media"]); } if ($rowM["type"] == "link") { $temp["lien"] = $rowM["lien_destination"]; $temp["cible"] = $rowM["cible_destination"]; $temp["legende"] = $rowM["titre_media"]; if ($temp["legende"] == "") { $temp["legende"] = get_nom_fichier($rowM["lien_destination"]); } } /*if($rowM["image_principale"]==1) { $allMedias[0]=$temp; } else { $allMedias[$x]=$temp; $x++; }*/ $allMedias[$x] = $temp; $x++; } return $allMedias; }
$mySelect->orderby = "titre ASC"; $result = $mySelect->query(); $listCampagnes = array(); foreach ($result as $row) { $listCampagnes[$row["id"]] = $row["titre"]; } $datas_page["listCampagnes"] = $listCampagnes; $newfield = new select(); $newfield->field = "F__id_campagne"; $newfield->label = $datas_lang["pubCampagne"]; $newfield->widthField = 3; $newfield->items = $listCampagnes; $newfield->allItems = true; $newfield->value = ${$newfield->field}; $newfield->add(); $mySelect = new mySelect(__FILE__); $mySelect->tables = $myTableEmplacements; $mySelect->fields = "id,titre"; $mySelect->orderby = "titre ASC"; $result = $mySelect->query(); $listEmplacements = array(); foreach ($result as $row) { $listEmplacements[$row["id"]] = $row["titre"]; } $datas_page["listEmplacements"] = $listEmplacements; $newfield = new select(); $newfield->field = "F__id_emplacement"; $newfield->label = $datas_lang["pubEmplacement"]; $newfield->widthField = 3; $newfield->items = $listEmplacements; $newfield->allItems = true;
if (is_array($datasArticle["filtre"])) { foreach ($datasArticle["filtre"] as $f => $filtre) { if ($datasArticle["filtre"][$f]["field"] == "") { $datasArticle["filtre"][$f]["field"] = "filtre" . $f; } } } // si période demandée pour l'article, on ajoute un filtre automatiquement if (array_key_exists("periode", $datasArticle["fields_show"])) { $datasArticle["filtre"][0]["field"] = "date"; $datasArticle["filtre"][0]["type"] = "date"; $datasArticle["filtre"][0]["label"] = "Date"; } if (is_array($datasArticle["filtre"])) { ksort($datasArticle["filtre"]); } if ($datasArticle["maxElements"] == 1) { $mySelect = new mySelect(__FILE__); $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "articles"; $mySelect->fields = "id"; $mySelect->where = "art='" . $datasArticle["name"] . "'"; $res = $mySelect->query(); $rowx = current($res); $idCurrent = $rowx["id"]; // $extensionPageCurrent = "-maj"; } $maxElements = $datasArticle["maxElements"]; $forceTemplate = DOS_PAGES_ADMIN . "modeles/article" . $extensionPageCurrent; include $forceTemplate . ".php"; $smarty->assign("datasArticle", $datasArticle);