コード例 #1
0
function smarty_function_widget_about_data($params, $template)
{
    plugins_Autoloader::register();
    $collection = new plugins_about_public();
    $template->assign('about', $collection->getAbout());
    $template->assign('companyData', $collection->getData());
}
コード例 #2
0
ファイル: access.php プロジェクト: biggtfish/magixcms
 public function listPlugins()
 {
     $pathplugins = new backend_controller_plugins();
     /**
      * Si le dossier est accessible en lecture
      */
     if (!is_readable($pathplugins->directory_plugins())) {
         throw new exception('Plugin dir is not minimal permission');
     }
     $makefiles = new magixcjquery_files_makefiles();
     $dir = $makefiles->scanRecursiveDir($pathplugins->directory_plugins());
     if ($dir != null) {
         plugins_Autoloader::register();
         $list = '';
         foreach ($dir as $d) {
             if (file_exists($pathplugins->directory_plugins() . $d . DIRECTORY_SEPARATOR . 'admin.php')) {
                 $pluginPath = $pathplugins->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')) {
                         $plugin[$class] = $d;
                     }
                 }
             }
         }
         return $plugin;
     }
 }
コード例 #3
0
/**
* Smarty {widget_cart_nbr_items} function plugin
*
* Type:     function
* Name:     widget_cart_nbr_items
* Date:     18 juillet 2011
* Update:   8 Aout 2011
* Purpose:
* Examples: 
* 			### BASIC ###
       {widget_cart_nbr_items}
* Output:   
* @link 	http://www.magix-dev.be
* @author   Gerits Aurelien
* @version  1.5
* @param array
* @param Smarty
* @return string
* RETOURNE LE NOMBRE DE PRODUITS DANS LE PANIER
*/
function smarty_function_widget_cart_nbr_items($params, $template)
{
    plugins_Autoloader::register();
    //chargement des function plugins
    $default_value = '0';
    $default_price = '0,00';
    //if session key_cart
    if (isset($_SESSION['key_cart'])) {
        $session_key = $_SESSION['key_cart'];
    } else {
        $session_key = null;
    }
    if ($session_key != null) {
        $nbr_items = plugins_cartpay_public::load_cart_nbr_items($session_key);
        $nbr_items = $nbr_items != 0 ? $nbr_items : $default_value;
        $price_items = plugins_cartpay_public::load_cart_price_items($session_key);
        $price_items = $price_items != 0 ? $price_items : $default_price;
    } else {
        $nbr_items = $default_value;
        $price_items = $default_price;
    }
    //collection items cart
    $cartItems = array('nbr_items' => $nbr_items, 'price_items' => $price_items);
    $template->assign('collectionCart', $cartItems, true);
}
コード例 #4
0
ファイル: autoload.php プロジェクト: biggtfish/magixcms
 /**
  * Registration
  * @access public
  * @static
  * @name register
  */
 public static function register()
 {
     self::$prefix = substr(__CLASS__, 0, strpos(__CLASS__, '_') + 1);
     self::$path = dirname(dirname(realpath(__FILE__))) . DIRECTORY_SEPARATOR;
     // ici est opéré la registration
     spl_autoload_register(array(__CLASS__, 'autoload'));
 }
コード例 #5
0
ファイル: plugins.php プロジェクト: biggtfish/magixcms
 /**
  * Scanne les plugins et vérifie si la fonction d'execution exist afin de l'intégrer dans le module
  * @access private
  * @param string $methodName
  * @return array|null
  */
 public function menu_item_plugin($methodName)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in load plugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             $data = '';
             $arrData = '';
             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) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             if (method_exists('plugins_' . $d . '_admin', $methodName)) {
                                 if (method_exists('plugins_' . $d . '_admin', 'setConfig')) {
                                     $class_name = $this->execute_plugins('plugins_' . $d . '_admin');
                                     $setConfig = $class_name->setConfig();
                                     if (array_key_exists('url', $setConfig)) {
                                         if (isset($setConfig['url']['name'])) {
                                             $data['name'] = $setConfig['url']['name'];
                                         } else {
                                             $data['name'] = $d;
                                         }
                                     }
                                     $data['url'] = $d;
                                 } else {
                                     $data['url'] = $d;
                                     $data['name'] = null;
                                 }
                                 $arrData[] = $data;
                             }
                         }
                     }
                 }
             }
             if (is_array($arrData)) {
                 $arr_item = $arrData;
             } else {
                 $arr_item = null;
             }
             return $arr_item;
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
コード例 #6
0
ファイル: plugins.php プロジェクト: biggtfish/magixcms
 /**
  * Chargement d'un plugin dans la partie public
  * @access private
  */
 private function load_plugin()
 {
     try {
         plugins_Autoloader::register();
         if (file_exists($this->directory_plugins() . $this->getplugin() . DIRECTORY_SEPARATOR . 'public.php')) {
             if (class_exists('plugins_' . $this->getplugin() . '_public')) {
                 $load = $this->get_call_class('plugins_' . $this->getplugin() . '_public');
                 if (method_exists($load, 'run')) {
                     $load->run();
                 }
             } else {
                 throw new Exception('Class ' . $this->getplugin() . ' not define');
             }
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog("Error plugins execute", $e);
     }
 }
コード例 #7
0
ファイル: sitemap.php プロジェクト: biggtfish/magixcms
 /**
  * Scanne les plugins et vérifie si la fonction createSitemap 
  * exist afin de l'intégrer dans le sitemap
  * @access private
  */
 private function writeplugin($idlang)
 {
     try {
         plugins_Autoloader::register();
         // Si le dossier est accessible en lecture
         if (!is_readable($this->directory_plugins())) {
             throw new exception('Error in writeplugin: Plugin is not minimal permission');
         }
         $makefiles = new magixcjquery_files_makefiles();
         $dir = $makefiles->scanRecursiveDir($this->directory_plugins());
         if ($dir != null) {
             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) {
                         if (class_exists('plugins_' . $d . '_admin')) {
                             $this->loadConfigPlugins('plugins_' . $d . '_admin', $idlang);
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         magixglobal_model_system::magixlog('An error has occured :', $e);
     }
 }
コード例 #8
0
/**
*
{widget_catalog_data
   conf =[
       'context' =>  'product',
       'sort' => 'name',
       'plugins' => [
           'override'  => 'dbCatalog',
           'item' => [
               'my_field'  =>  'my_field'
           ]
       ]
   ]
   assign='productData'
   }
   {*<pre>{$productData|print_r}</pre>*}
   <div id="listing-product" class="product-list">
       <div class="row">
           {include file="catalog/loop/product.tpl" data=$productData}
       </div>
   </div>
*/
function smarty_function_widget_catalog_data($params, $template)
{
    plugins_Autoloader::register();
    $ModelSystem = new magixglobal_model_system();
    $ModelCatalog = new frontend_model_catalog();
    // Set and load data
    $current = $ModelSystem->setCurrentId();
    $conf = is_array($params['conf']) ? $params['conf'] : array();
    $override = $params['conf']['plugins']['override'] ? $params['conf']['plugins']['override'] : '';
    $data = $ModelCatalog->getData($conf, $current, $override);
    $newrow = is_array($params['conf']['plugins']['item']) ? $params['conf']['plugins']['item'] : array();
    $items = array();
    if ($data != null) {
        // *** format items loop (foreach item)
        // ** Loop management var
        $deep = 1;
        $deep_minus = $deep - 1;
        $deep_plus = $deep + 1;
        $pass_trough = 0;
        $data_empty = false;
        // ** Loop format & output var
        $row = array();
        $i[$deep] = 0;
        // *** boucle / loop
        do {
            // *** loop management START
            if ($pass_trough == 0) {
                // Si je n'ai plus de données à traiter je vide ma variable
                $row[$deep] = null;
            } else {
                // Sinon j'active le traitement des données
                $pass_trough = 0;
            }
            // Si je suis au premier niveaux et que je n'ai pas de donnée à traiter
            if ($deep == 1 and $row[$deep] == null) {
                // récupération des données dans $data
                $row[$deep] = array_shift($data);
            }
            // Si ma donnée possède des sous-donnée sous-forme de tableau
            if (isset($row[$deep]['subdata'])) {
                if (is_array($row[$deep]['subdata']) and $row[$deep]['subdata'] != null) {
                    // On monte d'une profondeur
                    $deep++;
                    $deep_minus++;
                    $deep_plus++;
                    // on récupére la  première valeur des sous-données en l'éffacant du tableau d'origine
                    $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            } elseif ($deep != 1) {
                if ($row[$deep] == null) {
                    if ($row[$deep_minus]['subdata'] == null) {
                        // Si je n'ai pas de sous-données & pas de données à traiter & pas de frères à récupérer dans mon parent
                        // ====> désactive le tableaux de sous-données du parent et retourne au niveau de mon parent
                        unset($row[$deep_minus]['subdata']);
                        unset($i[$deep]);
                        $deep--;
                        $deep_minus = $deep - 1;
                        $deep_plus = $deep + 1;
                    } else {
                        // Je récupère un frère dans mon parent
                        $row[$deep] = array_shift($row[$deep_minus]['subdata']);
                    }
                    // Désactive le traitement des données
                    $pass_trough = 1;
                }
            }
            // *** loop management END
            // *** list format START
            if ($row[$deep] != null and $pass_trough != 1) {
                $i[$deep]++;
                // Construit les données de l'item en array avec clée nominative unifiée ('name' => 'monname,'descr' => '<p>ma descr</p>,...)
                $itemData = $ModelCatalog->setItemData($row[$deep], $current['catalog'], $newrow);
                // Récupération des sous-données (enfants)
                if (isset($items[$deep_plus]) != null) {
                    $itemData['subdata'] = $items[$deep_plus];
                    $items[$deep_plus] = null;
                } else {
                    $subitems = null;
                }
                $items[$deep][] = $itemData;
            }
            // Si $data est vide => arrête la boucle
            if (empty($data) and $row[1] == null) {
                $data_empty = true;
            }
        } while ($data_empty == false);
        // *** container construct
    }
    $assign = isset($params['assign']) ? $params['assign'] : 'data';
    $template->assign($assign, $items[$deep]);
}
コード例 #9
0
function smarty_function_widget_blocklink_data($params, $template)
{
    plugins_Autoloader::register();
    $collection = new plugins_blocklink_public();
    $template->assign('links', $collection->getLinks());
}
コード例 #10
0
function smarty_function_widget_advantage_data($params, $template)
{
    plugins_Autoloader::register();
    $collection = new plugins_advantage_public();
    $template->assign('advantages', $collection->getAdvs());
}