/** * Chargement d'un plugin dans l'administration * @access private */ private function setplugin($debug = false) { try { plugins_Autoloader::register(); //Si le fichier admin.php existe dans le plugin if (file_exists($this->directory_plugins() . $this->nameplugin() . DIRECTORY_SEPARATOR . 'admin.php')) { //Si la classe exist on recherche la fonction run() if (class_exists('plugins_' . $this->nameplugin() . '_admin')) { $load = $this->execute_plugins('plugins_' . $this->nameplugin() . '_admin'); //Si la méthode existe on ajoute le plugin dans le register et execute la fonction run() if (method_exists($load, 'run')) { $role = new backend_model_role(); $role_data = explode(',', $role->sql_arg()); $access = (string) $this->allow_access_config($this->nameplugin()); if ($debug) { $firebug = new magixcjquery_debug_magixfire(); $firebug->magixFireLog($this->nameplugin() . ': ' . $access); $firebug->magixFireLog($this->path_dir_i18n()); $firebug->magixFireLog($role_data); } $this->configLoad(); if ($access != null or $access != '') { if (array_key_exists($access, $role_data)) { $load->run(); } elseif ($access == '*') { $load->run(); } } else { $load->run(); } } } else { throw new Exception('Class ' . $this->nameplugin() . ' is not found'); } } } catch (Exception $e) { magixglobal_model_system::magixlog('An error has occured :', $e); } }
/** * Retourne au format JSON la liste des produits * @param $limit */ private function json_listing_product($limit) { $pager = new magixglobal_model_pager(); $max = $limit; $offset = $pager->setPaginationOffset($limit, $this->getpage); $role = new backend_model_role(); $sort = 'idcatalog'; if (parent::s_catalog($this->getlang, $role->sql_arg(), $limit, $max, $offset, $sort) != null) { foreach (parent::s_catalog($this->getlang, $role->sql_arg(), $limit, $max, $offset, $sort) as $key) { if ($key['desccatalog'] != null) { $content = 1; } else { $content = 0; } if ($key['imgcatalog'] != null) { $img = 1; } else { $img = 0; } if ($key['price'] != null) { $price = number_format($key['price'], 2, ',', '.'); } else { $price = 0; } $json_data[] = '{"idcatalog":' . json_encode($key['idcatalog']) . ',"urlcatalog":' . json_encode($key['urlcatalog']) . ',"titlecatalog":' . json_encode($key['titlecatalog']) . ',"content":' . json_encode($content) . ',"price":' . json_encode($price) . ',"img":' . json_encode($img) . ',"iso":' . json_encode($key['iso']) . ',"pseudo":' . json_encode($key['pseudo_admin']) . '}'; } print '[' . implode(',', $json_data) . ']'; } else { print '{}'; } }