/** * Chargement du fichier de configuration suivant la langue en cours de session. * @access private * return string */ private function pathConfigLoad($configfile) { try { return $configfile . backend_model_language::current_Language() . '.conf'; } catch (Exception $e) { magixglobal_model_system::magixlog('An error has occured :', $e); } }
/** * Construction du menu select * @param $create * @return string */ private function lang_select($create) { $create->configLoad('local_' . backend_model_language::current_Language() . '.conf'); $idlang = ''; $iso = ''; foreach (backend_db_block_lang::s_data_lang() as $key) { $idlang[] = $key['idlang']; $iso[] = $key['iso']; } $lang_conb = array_combine($idlang, $iso); $select = backend_model_forms::select_static_row($lang_conb, array('attr_name' => 'idlang', 'attr_id' => 'idlang', 'default_value' => '', 'empty_value' => $create->getConfigVars('select_language'), 'class' => 'form-control', 'upper_case' => true)); return $select; }
/** * selection du type * @param $create * @param null $update */ private function select_metas($create, $update = null) { $create->configLoad('local_' . backend_model_language::current_Language() . '.conf'); if ($update != null) { if ($update == 1) { $default = array($update => 'title'); } elseif ($update == 2) { $default = array($update => 'description'); } } $select = backend_model_forms::select_static_row(array('1' => 'Title', '2' => 'Description'), array('attr_name' => 'idmetas', 'attr_id' => 'idmetas', 'default_value' => $default, 'empty_value' => $create->getConfigVars('select_type'), 'class' => 'form-control', 'upper_case' => false)); $create->assign('select_metas', $select); }
/** * @access private * Charge les données de l'image de la news * @param $create * @param $news_img */ private function ajax_image($create, $news_img) { if (file_exists($create->basePathConfig('section') . 'local_' . backend_model_language::current_Language() . '.conf')) { $create->configLoad($create->basePathConfig('section') . 'local_' . backend_model_language::current_Language() . '.conf', ''); } if ($news_img != null) { $img = '<p><img src="/upload/news/s_' . $news_img . '" class="img-thumbnail" alt="" /></p>'; $img .= '<p><a class="btn btn-danger delete-image"><span class="icon-trash"></span> ' . $create->getConfigVars("remove") . '</a></p>'; } else { $img = '<p><img data-src="holder.js/140x140/text:Thumbnails" class="ajax-image img-thumbnail" /></p>'; } print $img; }
public function getLanguage() { return backend_model_language::current_Language(); }
/** * Chargement du fichier de configuration suivant la langue en cours de session. * @access private * return string */ private function pathConfigLoad($configfile, $filextension = false, $plugin = '') { try { $filextends = $filextension ? $filextension : '.conf'; $lang = backend_model_language::current_Language(); if (file_exists($this->path_dir_i18n())) { $translate = !empty($lang) ? $lang : 'fr'; return $this->path_dir_i18n() . $configfile . $translate . $filextends; } else { return null; } } catch (Exception $e) { magixglobal_model_system::magixlog("Error path config", $e); } }
/** * @access private * Retourne l'image du produit * @param $create * @param $imgcatalog */ private function ajax_product_image($create, $imgcatalog) { if (file_exists($create->basePathConfig('section') . 'local_' . backend_model_language::current_Language() . '.conf')) { $create->configLoad($create->basePathConfig('section') . 'local_' . backend_model_language::current_Language() . '.conf', ''); } $img = ''; if ($imgcatalog != null) { if (file_exists(self::dirImgProduct() . 'medium' . DIRECTORY_SEPARATOR . $imgcatalog)) { $small = getimagesize(self::dirImgProduct() . 'mini' . DIRECTORY_SEPARATOR . $imgcatalog); $medium = getimagesize(self::dirImgProduct() . 'medium' . DIRECTORY_SEPARATOR . $imgcatalog); $product = getimagesize(self::dirImgProduct() . 'product' . DIRECTORY_SEPARATOR . $imgcatalog); $img .= '<p>'; $img .= '<a href="#" data-delete="' . $imgcatalog . '" class="btn btn-danger btn-block delete-image">'; $img .= '<span class="icon-trash"></span> ' . $create->getConfigVars("remove") . '</a>'; $img .= '</p>'; $img .= '<div class="col-lg-2 col-sm-3">'; $img .= '<div class="thumbnail">'; $img .= '<img src="/upload/catalogimg/mini/' . $imgcatalog . '" alt="" />'; $img .= '<div class="caption">'; $img .= '<ul class="list-unstyled">'; $img .= '<li>width:' . $small[0] . '</li>'; $img .= '<li>height:' . $small[1] . '</li>'; $img .= '</ul>'; $img .= '</div>'; $img .= '</div>'; $img .= '</div>'; $img .= '<div class="col-lg-3 col-sm-4">'; $img .= '<div class="thumbnail">'; $img .= '<img src="/upload/catalogimg/medium/' . $imgcatalog . '" alt="" />'; $img .= '<div class="caption">'; $img .= '<ul class="list-unstyled">'; $img .= '<li>width:' . $medium[0] . '</li>'; $img .= '<li>height:' . $medium[1] . '</li>'; $img .= '</ul>'; $img .= '</div>'; $img .= '</div>'; $img .= '</div>'; $img .= '<div class="col-lg-5 col-sm-5">'; $img .= '<div class="thumbnail">'; $img .= '<img src="/upload/catalogimg/product/' . $imgcatalog . '" alt="" />'; $img .= '<div class="caption">'; $img .= '<ul class="list-unstyled">'; $img .= '<li>width:' . $product[0] . '</li>'; $img .= '<li>height:' . $product[1] . '</li>'; $img .= '</ul>'; $img .= '</div>'; $img .= '</div>'; $img .= '</div>'; } else { $img = '<p><img data-src="holder.js/140x140/text:Thumbnails" class="ajax-image img-thumbnail" /></p>'; } } else { $img .= '<p><img data-src="holder.js/140x140/text:Thumbnails" class="ajax-image img-thumbnail" /></p>'; } print $img; }
/** * Smarty {autoload_i18n} function plugin * * Type: function * Name: * Date: * Update * Purpose: * Examples: * Output: * @link * @author Gerits Aurelien * @version 1.0 * @param array * @param Smarty * @return string */ function smarty_function_autoload_i18n($params, $template) { backend_controller_template::configLoad('local_' . backend_model_language::current_Language() . '.conf'); }
/** * Smarty {iso} function plugin * * Type: function * Name: * Date: * Update * Purpose: * Examples: * Output: * @link * @author Gerits Aurelien * @version 1.0 * @param array * @param Smarty * @return string */ function smarty_function_iso($params, $template) { return backend_model_language::current_Language(); }
/** * Construction du menu select pour les rôles * @param $create * @param null $idadmin * @return null|string */ private function role_select($create, $idadmin = null) { $create->configLoad('local_' . backend_model_language::current_Language() . '.conf'); if ($idadmin != null) { $user_role = parent::s_role_data($idadmin); foreach ($user_role as $key) { $id_user_role[] = $key['id_role']; $role_user_name[] = $key['role_name']; } $user_role_conb = array_combine($id_user_role, $role_user_name); } else { $user_role_conb = null; } if (parent::s_all_role() != null) { $id_role = ''; $role_name = ''; foreach (parent::s_all_role() as $key) { $id_role[] = $key['id_role']; $role_name[] = $key['role_name']; } $role_conb = array_combine($id_role, $role_name); $select = backend_model_forms::select_static_row($role_conb, array('attr_name' => 'id_role', 'attr_id' => 'id_role', 'default_value' => $user_role_conb, 'empty_value' => $create->getConfigVars('select_role'), 'class' => 'form-control', 'upper_case' => false)); } else { $select = null; } return $select; }
/** * @access private * Scanne le dossier skin (public) et retourne les images ou capture des thèmes */ private function scanTemplateDir($create) { $create->configLoad('local_' . backend_model_language::current_Language() . '.conf'); $skin = $this->directory_skin(); if (!is_readable($skin)) { throw new exception('skin is not minimal permission'); } $makefiles = new magixcjquery_files_makefiles(); $dir = $makefiles->scanRecursiveDir($skin, '.svn'); $count = count($dir); if ($count == 0) { throw new exception('skin is not found'); } if (!is_array($dir)) { throw new exception('skin is not array'); } $template = null; foreach ($dir as $d) { if ($d == $this->load_theme()) { $btn_class = ' btn-primary'; $btn_title = $create->getConfigVars('select'); } else { $ctpl = ''; $btn_class = ' btn-default'; $btn_title = $create->getConfigVars('choose'); } $themePath = self::directory_skin() . $d; if ($makefiles->scanDir($themePath) != null) { if (file_exists($themePath . '/screenshot.png')) { $img = 'src="' . magixcjquery_html_helpersHtml::getUrl() . '/skin/' . $d . '/screenshot.png"'; $srcData = ''; } else { $img = 'src="' . magixcjquery_html_helpersHtml::getUrl() . '/skin/default/screenshot.png"'; $srcData = ' data-src="holder.js/260x180"'; } $template .= '<li class="col-sm-4">'; $template .= '<div class="thumbnail">'; $template .= '<img ' . $img . $srcData . ' alt="' . $btn_title . '">'; $template .= '<div class="caption">'; $template .= '<h3>' . $d . '</h3>'; $template .= '<p><a data-skin="' . $d . '" class="skin-tpl btn btn-large btn-block' . $btn_class . '" href="#">' . $btn_title . '</a></p>'; $template .= '</div>'; $template .= '</div>'; $template .= '</li>'; } } return $template; }
/** * Chargement des données du cache * @param $create * @return string */ private function load_cache_data($create) { $create->configLoad('local_' . backend_model_language::current_Language() . '.conf'); $config = parent::s_setting_id('cache'); $select = backend_model_forms::select_static_row(array('none' => $create->getConfigVars('inactive'), 'files' => $create->getConfigVars('files'), 'apc' => 'APC'), array('attr_name' => 'cache', 'attr_id' => 'cache', 'default_value' => $config['setting_value'], 'empty_value' => $create->getConfigVars('select_cache'), 'class' => 'form-control', 'upper_case' => false)); return $select; }