/** * @access private * Charge le formulaire pour l'élément */ private function load_img_forms($attr_name) { $setting = new backend_model_setting(); $input = ''; $thead = 0; $tbody = 0; foreach ($setting->fetch_img_size($attr_name) as $row) { $input .= '<form class="forms-config" method="post" action="" id="si_' . $row['attr_name'] . '_' . $row['config_size_attr'] . '_' . $row['type'] . '">'; $input .= '<table class="tb-size-config">'; if ($thead == 0) { $input .= '<thead>' . "\n"; $input .= '<tr class="ui-widget ui-widget-header"><th>Cible</th><th>Format</th><th>Largeur</th><th>Hauteur</th><th>Echelle</th><th></th></tr>' . "\n"; $input .= '</thead>' . "\n"; $input .= '<tbody>' . "\n"; $thead++; } $input .= '<tr><td class="size_img_attribute">' . magixcjquery_string_convert::ucFirst($row['config_size_attr']) . '</td>' . "\n"; $input .= '<td class="size_img_type">' . $this->img_size_type($row['type']) . '</td>' . "\n"; $input .= '<td> <input type="hidden" name="id_size_img" value="' . $row['id_size_img'] . '" /> <label>Largeur :</label><input type="text" name="width" class="spincount" value="' . $row['width'] . '" size="5" /></td>' . "\n"; $input .= '<td><label>Hauteur :</label><input type="text" name="height" class="spincount" value="' . $row['height'] . '" size="5" /></td>' . "\n"; if ($row['img_resizing'] == 'basic') { $input .= '<td>Basic <input type="radio" checked="checked" name="img_resizing" value="basic" /> Adaptive <input type="radio" name="img_resizing" value="adaptive" /></td>' . "\n"; } else { $input .= '<td>Basic <input type="radio" name="img_resizing" value="basic" /> Adaptive <input type="radio" name="img_resizing" checked="checked" value="adaptive" /></td>' . "\n"; } $input .= '<td><input type="submit" value="Save" /></td></tr>'; if ($tbody == 0) { $input .= '</tbody>' . "\n"; $tbody++; } $input .= '</table>' . "\n"; $input .= '</form>' . "\n"; } return $input; }
/** * @access private * Construction de la liste des plugins suivant des paramètres prédéfinis * @example: * * Icons : * public function setConfig(){ return array( 'url'=> array( 'lang' => 'none', 'action'=>'' ), 'icon'=> array( 'type'=>'font', 'name'=>'fa fa-flag' ) ); } * URL et Langues : * public function setConfig(){ return array( 'url'=> array( 'lang' =>'list', 'action'=>'list' ) ); } * Renommer le plugin : * public function setConfig(){ return array( 'url'=> array( 'lang' =>'none', 'action'=>'', 'name'=>'mon plugin' ) ); } */ public function set_html_item($debug = false) { $firebug = new magixcjquery_debug_magixfire(); /** * Si le dossier est accessible en lecture */ if (!is_readable($this->directory_plugins())) { throw new exception('Plugin dir is not minimal permission'); } $makefiles = new magixcjquery_files_makefiles(); $dir = $makefiles->scanRecursiveDir($this->directory_plugins()); if ($dir != null) { plugins_Autoloader::register(); $list = ''; foreach ($dir as $d) { if (file_exists($this->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) { $pluginPath = $this->directory_plugins() . $d; if ($makefiles->scanDir($pluginPath) != null) { //Nom de la classe pour le test de la méthode $class = 'plugins_' . $d . '_admin'; //Si la méthode run existe on ajoute le plugin dans le menu if (method_exists($class, 'run')) { $access = $this->allow_access_config($d); $role = new backend_model_role(); $data_role = $role->data(); // Si la methode setConfig existe on charge les éléments if (method_exists($class, 'setConfig')) { $class_name = $this->execute_plugins($class); $setConfig = $class_name->setConfig(); } else { if ($this->pathImgIcon($d, 'icon.png')) { $setConfig = array('icon' => array('type' => 'image', 'name' => 'icon.png')); } else { $setConfig = array('icon' => array('type' => 'font', 'name' => 'fa-folder')); } } // setConfig doit être un tableau if (is_array($setConfig)) { if ($setConfig['icon']['type'] == 'image') { $icon = '<img src="' . $this->pathImgIcon($d, $setConfig['icon']['name']) . '" width="16" height="16" alt="icon ' . $d . '" />'; } elseif ($setConfig['icon']['type'] == 'font') { $icon = '<span class="' . $setConfig['icon']['name'] . '"></span>'; } if (isset($this->nameplugin)) { if ($this->nameplugin == $d) { $class_active = ' class="active"'; $class_open = ' open'; $class_on = ' on'; } else { $class_active = ''; $class_open = ''; $class_on = ''; } } else { $class_active = ''; $class_open = ''; $class_on = ''; } $array_lang = self::getTemplateVars('array_lang'); // Vérifie si URL est disponible dans le tableau if (array_key_exists('url', $setConfig)) { if (isset($setConfig['url']['lang'])) { $lang = $setConfig['url']['lang']; } else { $lang = 'none'; } if (isset($setConfig['url']['action'])) { if ($setConfig['url']['action'] != '') { $action = '&action=' . $setConfig['url']['action']; } else { $action = ''; } } else { $action = ''; } if (isset($setConfig['url']['name'])) { if ($setConfig['url']['name'] != '') { $name = magixcjquery_string_convert::ucFirst($setConfig['url']['name']); } else { $name = magixcjquery_string_convert::ucFirst($d); } } else { $name = magixcjquery_string_convert::ucFirst($d); } } else { $lang = 'none'; $action = ''; $name = magixcjquery_string_convert::ucFirst($d); } //Si le fichier d'accès est disponible, on retourne les permissions if ($access != null or $access != '') { if ($access >= $data_role['id']) { //Si mode multi langue if ($lang === 'list') { $list .= '<li>'; $list .= '<a href="#plugin-' . $d . '" class="showit' . $class_open . '">'; $list .= '<span class="fa fa-plus-square-o"></span> ' . $name; $list .= '</a>'; $list .= '<div class="collapse-item' . $class_on . '" id="plugin-' . $d . '">'; $list .= '<div class="lang-group">'; foreach ($array_lang as $key => $value) { //Ajoute la class active à la langue courante if ($this->nameplugin === $d and $this->getlang === $key) { $lang_active = ' active'; } else { $lang_active = ''; } $list .= '<a class="badge' . $lang_active . '" href="/' . PATHADMIN . '/plugins.php?name=' . $d . '&getlang=' . $key . $action . '">'; $list .= magixcjquery_string_convert::upTextCase($value) . '</a>'; } $list .= '</div>'; $list .= '</div>'; $list .= '</li>'; } else { $list .= '<li>'; $list .= '<a' . $class_active . ' href="/' . PATHADMIN . '/plugins.php?name=' . $d . $action . '">' . $icon . ' '; $list .= $name; $list .= '</a>'; $list .= '</li>'; } } elseif ($access == '*') { //Si mode multi langue if ($lang === 'list') { $list .= '<li>'; $list .= '<a href="#plugin-' . $d . '" class="showit' . $class_open . '">'; $list .= '<span class="fa fa-plus-square-o"></span> '; $list .= $name; $list .= '</a>'; $list .= '<div class="collapse-item' . $class_on . '" id="plugin-' . $d . '">'; $list .= '<div class="lang-group">'; foreach ($array_lang as $key => $value) { //Ajoute la class active à la langue courante if ($this->nameplugin === $d and $this->getlang === $key) { $lang_active = ' active'; } else { $lang_active = ''; } $list .= '<a class="badge' . $lang_active . '" href="/' . PATHADMIN . '/plugins.php?name=' . $d . '&getlang=' . $key . $action . '">'; $list .= magixcjquery_string_convert::upTextCase($value) . '</a>'; } $list .= '</div>'; $list .= '</div>'; $list .= '</li>'; } else { $list .= '<li>'; $list .= '<a' . $class_active . ' href="/' . PATHADMIN . '/plugins.php?name=' . $d . $action . '">' . $icon . ' '; $list .= $name; $list .= '</a>'; $list .= '</li>'; } } } else { $list .= '<li>'; $list .= '<a' . $class_active . ' href="/' . PATHADMIN . '/plugins.php?name=' . $d . $action . '">' . $icon . ' '; $list .= $name; $list .= '</a>'; $list .= '</li>'; } } else { throw new Exception('setConfig is not array'); } //Si on demande un debug if ($debug) { $firebug->magixFireLog($d . ' pluginPath: ' . $pluginPath); $firebug->magixFireLog($d . ' access: ' . $access); $firebug->magixFireLog($d . ' icon type: ' . $setConfig['icon']['type']); $firebug->magixFireLog($d . ' icon name: ' . $setConfig['icon']['name']); $firebug->magixFireLog($d . ' URL: ' . $setConfig['url']); } } } } } } return $list; }
/** * @access private * Retourne l'image et la langue suivant l'identifiant * @param integer $idlang * @param $idlang * @return string */ private function parent_language($idlang) { $db = backend_db_block_lang::s_data_iso($idlang); return '<img src="/upload/iso_lang/' . $db['iso'] . '.png" alt="' . $db['iso'] . '" /> ' . magixcjquery_string_convert::ucFirst($db['language']); }