Example #1
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  */
 public function setItemData($row, $current)
 {
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelDateformat = new magixglobal_model_dateformat();
     $ModelTemplate = new frontend_model_template();
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if (isset($row['idnews'])) {
         $data['tag'] = null;
         $tag['data'] = parent::s_tagByNews($row['idnews']);
         if (is_array($tag['data'])) {
             foreach ($tag['data'] as $t) {
                 $t['uri'] = $ModelRewrite->filter_news_tag_url($row['iso'], $t['name_tag'], true);
                 $data['tag'] .= '<a href="' . $t['uri'] . '" title="' . $t['name_tag'] . '">';
                 $data['tag'] .= $t['name_tag'];
                 $data['tag'] .= '</a> ';
             }
         }
         if (isset($row['n_image'])) {
             $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => 's_' . $row['n_image'])), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'news', 'img' => $row['n_image'])));
         }
         $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/news/news-default.png'));
         $data['id'] = $row['idnews'];
         $data['name'] = $row['n_title'];
         $data['uri'] = $ModelRewrite->filter_news_url($row['iso'], $ModelDateformat->date_europeen_format($row['date_register']), $row['n_uri'], $row['keynews'], true);
         $data['current'] = false;
         if (isset($current['record']['id'])) {
             $data['active'] = $row['keynews'] == $current['record']['id'] ? true : false;
         }
         $data['date']['register'] = $ModelDateformat->SQLDate($row['date_register']);
         $data['date']['publish'] = $ModelDateformat->SQLDate($row['date_publish']);
         $data['content'] = $row['n_content'];
     }
     return $data;
 }
/**
 * Smarty {seo_rewrite module=""} function plugin
 *
 * Type:     function
 * Name:     SEO REWRITE METAS
 * Date:     JUNY 29, 2011
 * Update 		25/07/2011
 * Purpose:  
 * Examples: {seo_rewrite config_param=['level'=>'3','idmetas'=>'1','default'=>''] category="" subcategory="" record=""}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.1
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_seo_rewrite($params, $template)
{
    if (!isset($params['config_param'])) {
        trigger_error("config_param: missing 'config_param' parameter");
        return;
    }
    if (is_array($params['config_param'])) {
        $tabs = $params['config_param'];
    }
    $record = $params['record'];
    $category = $params['category'];
    $subcategory = $params['subcategory'];
    if (isset($_GET['magixmod'])) {
        $magixmod = magixcjquery_filter_var::clean($_GET['magixmod']);
    }
    $filename = substr($_SERVER['SCRIPT_NAME'], 1);
    $position = strpos($filename, '.');
    $attribute = substr($filename, 0, $position);
    if ($attribute == 'plugins') {
        $module = $attribute . ':' . $magixmod;
    } else {
        $module = $attribute;
    }
    $iniseo = new frontend_controller_seo($module, $tabs['level'], $tabs['idmetas'], frontend_model_template::current_Language());
    if ($iniseo->replace_var_rewrite($record, $category, $subcategory) != null) {
        return $iniseo->replace_var_rewrite($record, $category, $subcategory);
    } else {
        if (!isset($tabs['default'])) {
            trigger_error("default: missing 'default' parameter");
            return;
        } else {
            return $tabs['default'];
        }
    }
}
Example #3
0
 /**
  * Control, loading and display
  * @access public
  */
 public function run()
 {
     if (isset($this->getlang)) {
         $this->load_home_data();
         frontend_model_template::display('home/index.tpl');
     }
 }
Example #4
0
 /**
  * 
  */
 public static function frontendTheme()
 {
     if (!isset(self::$frontendtheme)) {
         self::$frontendtheme = new frontend_model_template();
     }
     return self::$frontendtheme;
 }
Example #5
0
 /**
  * @param $setParams
  * @return string
  */
 public function getData($setParams)
 {
     //Charge le fichier de traduction
     frontend_model_smarty::getInstance()->configLoad($this->modelSystem->base_path() . 'plugins/ogone/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
     $data = $this->setData();
     if ($data['formaction'] === 'test') {
         $urlOgone = Form::OGONE_TEST_URL;
     } elseif ($data['formaction'] === 'production') {
         $urlOgone = Form::OGONE_PRODUCTION_URL;
     }
     $url = magixcjquery_html_helpersHtml::getUrl() . '/' . frontend_model_template::current_Language() . '/';
     // Define form options
     // See Ogone_Form for list of supported options
     $options = array('sha1InPassPhrase' => $data['passphrase'], 'formAction' => $urlOgone, 'formSubmitType' => 'image', 'formSubmitImageUrl' => $setParams['formSubmitImageUrl'], 'formSubmitButtonName' => $this->template->getConfigVars('form_submit_button'), 'formSubmitButtonValue' => $this->template->getConfigVars('form_submit_button'), 'formSubmitButtonClass' => frontend_model_template::current_Language() . '_' . 'ogoneSubmitButton');
     $seturl = $this->setUrl();
     // https://github.com/jvandemo/Ogone
     // Define form parameters (see Ogone documentation for list)
     // Default parameter values can be set in Ogone_Form if required
     $params = array('PSPID' => $data['pspid'], 'orderID' => 'your_order_id / transaction ID', 'amount' => 100, 'currency' => 'EUR', 'language' => 'en_EN', 'COMPLUS' => 'custom data', 'OPERATION' => 'SAL', 'CN' => 'name of your client', 'EMAIL' => 'email of your client', 'accepturl' => $url . $setParams['plugin'] . $seturl['seturlok'], 'declineurl' => $url . $setParams['plugin'] . $seturl['seturlnook'], 'exceptionurl' => $url . $setParams['plugin'] . $seturl['seturlexception'], 'cancelurl' => $url . $setParams['plugin'] . $seturl['seturlcancel']);
     // Instantiate form
     $form = new Form($options, $params);
     // You can also add parameters after instantiation
     // with the addParam() method
     $form->addParam('CN', $setParams['lastname'] . ' ' . $setParams['firstname'])->addParam('EMAIL', $setParams['email'])->addParam('language', $setParams['language'])->addParam('orderID', $setParams['transaction'])->addParam('amount', $setParams['amount'])->addParam('COMPLUS', $setParams['COMPLUS'])->addParam('PARAMVAR', $setParams['PARAMVAR']);
     // Automatically generate HTML form with all params and SHA1Sign
     return $form->render();
 }
/**
* Smarty {widget_news_nav}
* function plugin
*
* Type:     function
* Name:     widget news nav
* Date:     September 26, 2012
* Update:   December  29, 2012
* Purpose:  
* Examples:

   {widget_news_nav}

   {widget_news_nav
       htmlAttribut=[
           'id_container' => 'secondary-nav',
           'class_container' => 'v-nav'
       ]
       title='<p class="title">Actualités par thèmes</p>'
   }

* Output: string (<ul><li><a>tag_name<///)
* @link
* @author   Gerits Aurelien
* @author   Samuel Lesre
* @version  1.1
* @param array
* @param Smarty
* @return string
*/
function smarty_function_widget_news_nav($params, $template)
{
    $ModelNews = new frontend_model_news();
    $ModelSystem = new magixglobal_model_system();
    // *** Load SQL DATA
    $current = $ModelSystem->setCurrentId();
    $conf = array('level' => 'tag', 'limit' => null);
    $data = $ModelNews->getData($conf, $current);
    $current = $current['news'];
    $output = null;
    if ($data != null) {
        // *** set default html attributs
        if ($params['htmlAttribut']) {
            $htmlAttr = $params['htmlAttribut'];
            $id_container = isset($htmlAttr['id_container']) ? ' id="' . $htmlAttr['id_container'] . '"' : null;
            $class_container = isset($htmlAttr['class_container']) ? ' class="' . $htmlAttr['class_container'] . '"' : null;
            $class_current = isset($htmlAttr['class_current']) ? $htmlAttr['class_current'] : 'current';
        }
        // *** Set translation var
        $tr_show_news = frontend_model_template::getConfigVars('show_news');
        // *** format items loop (foreach item)
        $items = null;
        foreach ($data as $row) {
            $current_item = $row['name_tag'] == $current['tag']['id'] ? $class_current : null;
            $uri_item = magixglobal_model_rewrite::filter_news_tag_url($row['iso'], urlencode($row['name_tag']), true);
            $name_item = $row['name_tag'];
            $class_item = $current_item != null ? ' class="' . $current_item . '"' : null;
            // *** item construct
            $item = '<li' . $class_item . '>';
            $item .= '<a href="' . $uri_item . '" title="' . $tr_show_news . ': ' . $name_item . '">';
            $item .= $name_item;
            $item .= '</a>';
            $item .= '</li>';
            $items .= $item;
        }
        // *** container construct
        $output = isset($params['title']) ? $params['title'] : '';
        $output .= '<ul' . $id_container . $class_container . '>';
        $output .= isset($params['prepend']) ? $params['prepend'] : null;
        $output .= $items;
        $output .= isset($params['append']) ? $params['append'] : null;
        $output .= '</ul>';
    }
    return $output;
}
/**
* Smarty {widget_cart_session} function plugin
*
* Type:     function
* Name:     widget_cart_session
* Date:     21 september 2012
* Update:   06 january 2014
* Purpose:
* USAGE:
   {widget_cartpay_session}
* Output:   
* @link 	http://www.magix-dev.be
* @author   Gerits Aurelien
* @version  1.5
* @param array
* @param Smarty
* @return string
*/
function smarty_function_widget_cartpay_session($params, $template)
{
    //    plugins_Autoloader::register(); //chargement des function plugins
    $session = new frontend_model_session();
    $session->_start_session('lang');
    //if session key_cart
    if (isset($_SESSION['key_cart'])) {
        $token_cart = $_SESSION['key_cart'];
    } else {
        $token_cart = magixglobal_model_cryptrsa::tokenId();
    }
    $array_sess = array('key_cart' => $token_cart);
    $session->session_run($array_sess);
    //    $session->debug();
    //@todo créer dans l'api une fonction public applicable dans les widgets.
    $modelSystem = new magixglobal_model_system();
    if ($_GET['magixmod'] != 'cartpay') {
        frontend_model_smarty::getInstance()->configLoad($modelSystem->base_path() . 'plugins/cartpay/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
    }
}
Example #8
0
 /**
  * Retourne un tableaux contenant les identifiant actif (int OR string)
  * @access public
  * @static
  * @param array $setRouter
  * @return array
  */
 public static function setCurrentId(array $setRouter)
 {
     $ModelTemplate = new frontend_model_template();
     //$HelperClean    =   new form_inputFilter();
     $inputEscape = new form_inputEscape();
     $current = array();
     $current['news']['record']['id'] = null;
     if ($setRouter['news']['idnews']) {
         $current['news']['record']['id'] = $inputEscape->alphaNumeric($setRouter['news']['idnews']);
     }
     $current['news']['pagination']['id'] = 1;
     if ($setRouter['news']['page']) {
         $current['news']['pagination']['id'] = $inputEscape->numeric($setRouter['news']['page']);
     }
     $current['news']['tag']['id'] = null;
     if ($setRouter['news']['tag']) {
         $current['news']['tag']['id'] = $inputEscape->tagClean($setRouter['news']['tag']);
     }
     $current['cms']['record']['id'] = null;
     if ($setRouter['cms']['getidpage']) {
         $current['cms']['record']['id'] = $inputEscape->numeric($setRouter['cms']['getidpage']);
     }
     $current['cms']['parent']['id'] = null;
     if ($setRouter['cms']['getidpage_p']) {
         $current['cms']['parent']['id'] = $inputEscape->numeric($setRouter['cms']['getidpage_p']);
     }
     $current['catalog']['category']['id'] = null;
     if ($setRouter['catalog']['idclc']) {
         $current['catalog']['category']['id'] = $inputEscape->numeric($setRouter['catalog']['idclc']);
     }
     $current['catalog']['subcategory']['id'] = null;
     if ($setRouter['catalog']['idcls']) {
         $current['catalog']['subcategory']['id'] = $inputEscape->numeric($setRouter['catalog']['idcls']);
     }
     $current['catalog']['product']['id'] = null;
     if ($setRouter['catalog']['idproduct']) {
         $current['catalog']['product']['id'] = $inputEscape->numeric($setRouter['catalog']['idproduct']);
     }
     $current['lang']['iso'] = $ModelTemplate->currentLanguage();
     return $current;
 }
Example #9
0
 /**
  * 
  * fonction run
  */
 public function run()
 {
     $template = new frontend_model_template();
     if (isset($this->idNews)) {
         $this->load_news_data();
         $template->display('news/news.tpl');
     } elseif (isset($this->idTag)) {
         $template->assign('tag', array('name' => urldecode($this->idTag)));
         $template->display('news/tag.tpl');
     } else {
         $template->display('news/index.tpl');
     }
 }
Example #10
0
 /**
  * Control, loading and display
  * @access public
  */
 public function run()
 {
     $template = new frontend_model_template();
     if (isset($this->idProduct)) {
         $this->load_product_data();
         $template->display('catalog/product.tpl');
     } elseif (isset($this->idSubcat)) {
         $this->load_subcategory_data();
         $template->display('catalog/subcategory.tpl');
     } elseif (isset($this->idCat)) {
         $this->load_category_data();
         $template->display('catalog/category.tpl');
     } else {
         $template->display('catalog/index.tpl');
     }
 }
Example #11
0
/**
 * Smarty {getlang} function plugin
 *
 * Type:     function
 * Name:     getUrl
 * Date:     September 11, 2009
 * Purpose:  Récupère la langue de en cours.
 * Examples: {getlang}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_getlang($params, $template)
{
    return frontend_model_template::currentLanguage();
}
Example #12
0
 /**
  * Inscription sur mailchimp
  * @param $mail
  * @param $fstname
  * @param $lstname
  * @param bool $notify
  */
 public function subscribe($mail, $fstname, $lstname, $notify = true)
 {
     if (self::install_table() == true) {
         $api = parent::getApi();
         if ($api != null) {
             $iso = frontend_model_template::current_Language();
             $list = parent::getCode($api['idapi'], $iso);
             if ($list != null) {
                 $code = $list['list_id'];
                 $MailChimp = new \Drewm\MailChimp($api['account_api']);
                 $result = $MailChimp->call('lists/subscribe', array('id' => $code, 'email' => array('email' => $mail), 'merge_vars' => array('FNAME' => $fstname, 'LNAME' => $lstname), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false, 'send_welcome' => false));
                 if ($notify) {
                     $this->getNotify('add');
                 }
             } else {
                 $this->getNotify('error');
             }
         } else {
             $this->getNotify('error');
         }
     }
 }
/**
 * 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)
{
    return frontend_model_template::configLoad();
}
Example #14
0
 /**
  * Retourne un tableaux contenant les identifiant actif (int OR string)
  * @access public
  * @static
  * @return array
  */
 public static function setCurrentId()
 {
     $ModelTemplate = new frontend_model_template();
     $FilterRequest = new magixcjquery_filter_request();
     $HelperClean = new magixcjquery_form_helpersforms();
     $current = array();
     $current['news']['record']['id'] = null;
     if ($FilterRequest->isGet('getnews')) {
         $current['news']['record']['id'] = $HelperClean->inputAlphaNumeric($_GET['getnews']);
     }
     $current['news']['pagination']['id'] = 1;
     if ($FilterRequest->isGet('page')) {
         $current['news']['pagination']['id'] = $HelperClean->inputNumeric($_GET['page']);
     }
     $current['news']['tag']['id'] = null;
     if ($FilterRequest->isGet('tag')) {
         $current['news']['tag']['id'] = $HelperClean->inputClean($_GET['tag']);
     }
     $current['cms']['record']['id'] = null;
     if ($FilterRequest->isGet('getidpage')) {
         $current['cms']['record']['id'] = $HelperClean->inputNumeric($_GET['getidpage']);
     }
     $current['cms']['parent']['id'] = null;
     if ($FilterRequest->isGet('getidpage_p')) {
         $current['cms']['parent']['id'] = $HelperClean->inputNumeric($_GET['getidpage_p']);
     }
     $current['catalog']['category']['id'] = null;
     if ($FilterRequest->isGet('idclc')) {
         $current['catalog']['category']['id'] = $HelperClean->inputNumeric($_GET['idclc']);
     }
     $current['catalog']['subcategory']['id'] = null;
     if ($FilterRequest->isGet('idcls')) {
         $current['catalog']['subcategory']['id'] = $HelperClean->inputNumeric($_GET['idcls']);
     }
     $current['catalog']['product']['id'] = null;
     if ($FilterRequest->isGet('idproduct')) {
         $current['catalog']['product']['id'] = $HelperClean->inputNumeric($_GET['idproduct']);
     }
     $current['lang']['iso'] = $ModelTemplate->current_Language();
     return $current;
 }
function patternCatalog($name = null)
{
    $ModelTemplate = new frontend_model_template();
    $tr = array('show_product' => $ModelTemplate->getConfigVars('show_product'));
    switch ($name) {
        case 'product':
            $pattern = array('container' => array('before' => '<div class="product-list row">', 'after' => '</div>'), 'item' => array('before' => '<div class="thumbnail col-sm-6 col-md-4 col-lg-3">', 'after' => '</div></div>'));
            break;
        case 'sidebar':
            $pattern = array('container' => array('before' => '<div class="news-list-last sidebar-list row">', 'after' => '</div>'), 'item' => array('before' => '<a class="thumbnail text-center col-xs-6 col-sm-12 #current-last#" href="#url#" title="' . $tr['show_news'] . '" >', 'after' => '</a>'), 'img' => array('before' => ' ', 'classLink' => 'none', 'after' => ' '), 'name' => array('before' => '<span class="panel-title">', 'classLink' => 'none', 'after' => '</span>'), 'price' => array('before' => '<span class="price label label-primary">', 'after' => '</span>'));
            break;
        default:
            $pattern = array('container' => array('before' => '<div class="product-list">', 'after' => '</div>'), 'item' => array('before' => '<div class="thumbnail">', 'after' => '</div></div>'), 'img' => array('before' => ' ', 'classLink' => 'none', 'after' => ' '), 'name' => array('before' => '<div class="caption"> <h3>', 'classLink' => 'name', 'after' => '</h3>'), 'descr' => array('before' => '<p>', 'lenght' => 250, 'delemiter' => '...', 'after' => '</p>'), 'price' => array('before' => '<a class="btn" href="#url#" title="' . $tr['show_product'] . '">', 'currency' => ' € TTC', 'after' => '</a>'), 'active' => array('class' => ' active'), 'last' => array('class' => ' last', 'col' => 1), 'allow' => array('', 'img', 'name', 'price', 'descr'), 'display' => array(1 => array('', 'img', 'name', 'descr', 'price'), 2 => array('', 'img', 'name', 'descr', 'price'), 3 => array('', 'img', 'name', 'descr', 'price')));
    }
    return $pattern;
}
Example #16
0
 /**
  *
  * Execute le plugin dans la partie public
  */
 public function run()
 {
     if (magixcjquery_filter_request::isSession('key_cart')) {
         $session_key = $_SESSION['key_cart'];
     } else {
         $session_key = null;
     }
     if (isset($this->module)) {
         $this->activeMods = $this->module->load_module(false);
     }
     //Chargement des données de traduction
     $this->_loadConfigVars();
     $create = frontend_controller_plugins::create();
     $header = new magixglobal_model_header();
     if (isset($this->mod) && isset($this->action)) {
         $cartMod = $this->activeMods[$this->mod];
         $params = array('params' => $_GET['params'], 'controller' => $this->template);
         call_user_func(array($cartMod, $this->action), $params);
     } elseif (isset($this->add_cart)) {
         $this->add_item_cart($_POST, $session_key);
     } elseif (isset($this->delete_item)) {
         $this->delete_item_cart($this->item_to_delete, $create);
     } elseif (isset($this->json_cart)) {
         $this->template->assign('getDataConfig', $this->getConfigData());
         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
         $header->pragma();
         $header->cache_control("nocache");
         $header->getStatus('200');
         $header->html_header("UTF-8");
         //$this->load_cart_ajax($this->json_cart);
         $cartData = $this->getItemCartData($this->json_cart);
         $this->template->assign('getItemCartData', $cartData);
         if (!empty($cartData)) {
             $this->template->assign('getItemPriceData', $this->getItemPriceData($this->json_cart));
             $this->template->assign('setParamsData', array('remove' => 'true', 'editQuantity' => 'true'));
             $this->template->display('loop/cart.tpl');
         } else {
             return false;
         }
     } elseif (isset($this->get_nbr_items)) {
         $this->load_cart_nbr_item($session_key);
     } elseif (isset($this->get_price_items)) {
         $this->load_cart_price_item($session_key);
     } elseif (isset($this->get_amount_to_pay)) {
         $prices = $this->load_cart_amount($this->get_amount_to_pay);
         $header->head_expires("Mon, 26 Jul 1997 05:00:00 GMT");
         $header->head_last_modified(gmdate("D, d M Y H:i:s") . "GMT");
         $header->pragma();
         $header->cache_control("nocache");
         $header->getStatus('200');
         $header->html_header("UTF-8");
         print $prices['amount_to_pay'];
     } elseif (isset($this->pstring1)) {
         $this->template->assign('getDataConfig', $this->getConfigData());
         if ($this->pstring2 == 'process') {
             $this->getProcessOrder($create);
         } elseif (isset($this->pstring2)) {
             if ($this->pstring2 == 'success') {
                 unset($_SESSION['key_cart']);
                 $this->getNotify('success', false);
             } elseif ($this->pstring2 == 'refused') {
                 unset($_SESSION['key_cart']);
                 $this->getNotify('refused', false);
             } elseif ($this->pstring2 == 'cancel') {
                 unset($_SESSION['key_cart']);
                 $this->getNotify('cancel', false);
             } elseif ($this->pstring2 == 'exception') {
                 unset($_SESSION['key_cart']);
                 $this->getNotify('exception', false);
             }
             $create->display('payment_statut.tpl');
         } else {
             if (isset($this->id_cart_to_send)) {
                 $this->validate_cart($this->id_cart_to_send, $create);
                 $this->load_cart_data($session_key, $create);
                 $create->assign('getItemCartData', $this->getItemCartData($this->id_cart_to_send));
                 $create->assign('getItemPriceData', $this->getItemPriceData($this->id_cart_to_send));
                 $create->assign('setParamsData', array('remove' => 'false', 'editQuantity' => 'false'));
                 $create->display('payment_resume.tpl');
             } else {
                 $this->load_cart_data($session_key, $create);
                 $create->assign('getItemCartData', $this->getItemCartData($this->id_cart_to_send));
                 $create->assign('getItemPriceData', $this->getItemPriceData($this->id_cart_to_send));
                 $create->assign('setParamsData', array('remove' => 'false', 'editQuantity' => 'false'));
                 $create->display('payment_resume.tpl');
             }
         }
     } else {
         if (magixcjquery_filter_request::isSession('key_cart')) {
             if (isset($this->devis_to_send)) {
                 //$this->validate_cart($this->id_cart_to_send,$create);
                 $dataCart = $this->getItemPriceData($this->id_cart_to_send);
                 parent::i_cart_order($this->id_cart_to_send, magixglobal_model_cryptrsa::uuid_generator(), $dataCart['amount_products'], $dataCart['shipping_ttc'], 'EUR', 'bank_wire');
                 $this->sendOrder($this->id_cart_to_send, $create, false);
                 parent::u_transmission_cart($this->id_cart_to_send, 1);
                 $this->getNotify('success', true);
                 //Supprime la session du panier après envoi du mail si le système de devis est activé
                 unset($_SESSION['key_cart']);
                 //return;
             } elseif (isset($this->quantity_qty)) {
                 $this->update_quantity_item();
             } elseif (isset($this->attr)) {
                 $this->update_attr_item();
             } elseif (isset($_GET['testmail'])) {
                 $cart = 1;
                 if (!empty($_GET['testmail'])) {
                     $testmail = intval($_GET['testmail']);
                     $cart = is_int($testmail) ? $testmail : 1;
                 }
                 $this->sendOrder($cart, $create, true);
             } else {
                 $this->modelSystem = new magixglobal_model_system();
                 frontend_model_template::addConfigFile(array($this->modelSystem->base_path() . 'plugins/cartpay/i18n/tools'), array('country_'), false);
                 $data_cart = parent::s_cart_session($session_key);
                 $id_cart = $data_cart['id_cart'];
                 $this->load_cart_data($session_key, $create);
                 $create->assign('getItemCartData', $this->getItemCartData($id_cart));
                 $create->assign('getItemPriceData', $this->getItemPriceData($id_cart));
                 $create->assign('setParamsData', array('remove' => 'true', 'editQuantity' => 'true'));
                 // getDataConfig
                 $getDataConfig = $this->getConfigData();
                 if ($getDataConfig['online_payment'] === '1') {
                     $create->assign('setPaymentType', 'secure');
                 } else {
                     $create->assign('setPaymentType', 'devis');
                 }
                 $this->template->assign('getDataConfig', $getDataConfig);
                 $this->template->assign('getItemsCountryData', $this->getItemsTvaData(array('fetch' => 'all', 'context' => 'country')));
                 $moduleJS = array();
                 $dynamicForm = false;
                 if (!empty($this->activeMods)) {
                     foreach ($this->activeMods as $name => $mod) {
                         if (property_exists($mod, 'js_impact')) {
                             if ($mod->js_impact) {
                                 $moduleJS[] = $name;
                             }
                         }
                         if ($name == 'profil' && $getDataConfig['profil'] || $name != 'profil') {
                             if (property_exists($mod, 'dynamicForm')) {
                                 if ($mod->dynamicForm) {
                                     $confdir = magixglobal_model_system::base_path() . 'plugins/' . $name . '/i18n/';
                                     $lang = frontend_model_template::getLanguage();
                                     if (file_exists($confdir)) {
                                         $translate = !empty($lang) ? $lang : 'fr';
                                         frontend_model_smarty::getInstance()->configLoad($confdir . 'public_local_' . $translate . '.conf', null);
                                         $dynamicForm = $this->template->fetch('forms/order.tpl', $name);
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $this->template->assign('moduleJS', $moduleJS);
                 $this->template->assign('dynamicForm', $dynamicForm);
                 $create->display('index.tpl');
             }
         }
     }
 }
Example #17
0
 /**
  * Formate les valeurs principales d'un élément suivant la ligne passées en paramètre
  * @param $row
  * @param $current
  * @return array|null
  * @todo revoir le nommage de 'current', lui préférant 'active'
  */
 public function setItemData($row, $current)
 {
     $ModelImagepath = new magixglobal_model_imagepath();
     $ModelTemplate = new frontend_model_template();
     $ModelRewrite = new magixglobal_model_rewrite();
     $data = null;
     if ($row != null) {
         // *** Product
         if (isset($row['titlecatalog'])) {
             $subcat['id'] = isset($row['idcls']) ? $row['idcls'] : null;
             $subcat['name'] = isset($row['pathslibelle']) ? $row['pathslibelle'] : null;
             if (isset($row['imgcatalog'])) {
                 $data['imgSrc'] = array('small' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => '')), 'medium' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'medium/' . $row['imgcatalog'], 'levelmod' => '')), 'large' => $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'product/' . $row['imgcatalog'], 'levelmod' => '')));
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/product-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_product_url($row['iso'], $row['pathclibelle'], $row['idclc'], $subcat['name'], $subcat['id'], $row['urlcatalog'], $row['idproduct'], true);
             $data['active'] = false;
             if (is_array($current)) {
                 $data['active'] = (isset($current['product']['id']) and $current['product']['id'] == $row['idproduct']) ? true : false;
             } elseif ($current === true) {
                 $data['active'] = true;
             }
             $data['id'] = $row['idproduct'];
             $data['name'] = $row['titlecatalog'];
             $data['price'] = $row['price'];
             $data['content'] = $row['desccatalog'];
             // *** Subcategory
         } elseif (isset($row['slibelle'])) {
             $data['active'] = false;
             if (is_array($current) and isset($current['subcategory']['id'])) {
                 $data['active'] = $current['subcategory']['id'] == $row['idcls'] ? true : false;
             }
             if (isset($row['img_s'])) {
                 $data['imgSrc'] = array();
                 $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_s'], 'levelmod' => 'subcategory'));
                 $data['imgSrc']['medium'] = $data['imgSrc']['small'];
                 $data['imgSrc']['large'] = $data['imgSrc']['small'];
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/subcategory-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_subcategory_url($row['iso'], $row['pathclibelle'], $row['idclc'], $row['pathslibelle'], $row['idcls'], true);
             $data['id'] = $row['idcls'];
             $data['name'] = $row['slibelle'];
             $data['content'] = $row['s_content'] != '' ? $row['s_content'] : null;
             // *** Category
         } elseif (isset($row['clibelle'])) {
             $data['active'] = false;
             if (is_array($current) and isset($current['category']['id'])) {
                 $data['active'] = $current['category']['id'] == $row['idclc'] ? true : false;
             }
             if (isset($row['img_c'])) {
                 $data['imgSrc'] = array();
                 $data['imgSrc']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => $row['img_c'], 'levelmod' => 'category'));
                 // I know it's like cheat
                 $data['imgSrc']['medium'] = $data['imgSrc']['small'];
                 $data['imgSrc']['large'] = $data['imgSrc']['small'];
             }
             $data['imgSrc']['default'] = $ModelImagepath->filterPathImg(array('img' => 'skin/' . $ModelTemplate->frontendTheme()->themeSelected() . '/img/catalog/category-default.png'));
             $data['url'] = $ModelRewrite->filter_catalog_category_url($row['iso'], $row['pathclibelle'], $row['idclc'], true);
             $data['id'] = $row['idclc'];
             $data['name'] = $row['clibelle'];
             $data['content'] = $row['c_content'] != '' ? $row['c_content'] : null;
             // *** Micro-gallery (product page)
         } elseif (isset($row['idmicro'])) {
             $data['id'] = $row['idmicro'];
             $data['img_src']['small'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'mini/' . $row['imgcatalog'], 'levelmod' => 'galery'));
             $data['img_src']['medium'] = $ModelImagepath->filterPathImg(array('filtermod' => 'catalog', 'img' => 'maxi/' . $row['imgcatalog'], 'levelmod' => 'galery'));
         }
         return $data;
     }
 }
Example #18
0
 /**
  * Modification du setlocale suivant la langue courante pour les dates
  */
 private function setTimeLocal()
 {
     if (frontend_model_template::current_Language() == 'nl') {
         if ($this->getOS() === 'windows') {
             setlocale(LC_TIME, 'nld_nld', 'nl');
         } else {
             setlocale(LC_TIME, 'nl_NL.UTF8', 'nl');
         }
     } elseif (frontend_model_template::current_Language() == 'fr') {
         setlocale(LC_TIME, 'fr_FR.UTF8', 'fra');
     } elseif (frontend_model_template::current_Language() == 'de') {
         setlocale(LC_TIME, 'de_DE.UTF8', 'de');
     } elseif (frontend_model_template::current_Language() == 'es') {
         setlocale(LC_TIME, 'es_ES.UTF8', 'es');
     } elseif (frontend_model_template::current_Language() == 'it') {
         setlocale(LC_TIME, 'it_IT.UTF8', 'it');
     } else {
         setlocale(LC_TIME, 'en_US.UTF8', 'en');
     }
 }
Example #19
0
 /**
  * Control, loading and display
  * @access public
  */
 public function run()
 {
     if (isset($this->idPage)) {
         $this->load_page_data();
         frontend_model_template::display('cms/index.tpl');
     }
 }
/**
* Smarty {widget_share_display} function plugin
*
* Type:     function
* Name:     widget_share_display
* Date:     04/01/2012
* Update:   12/01/2013
* Output:
* @author   Sire Sam (http://www.sire-sam.be)
* @author   Gerits Aurélien (http://www.magix-dev.be)
* @version  1.0
* @param array
* @param Smarty
* @return string
* <ul id="share-box" class="nav navbar-nav navbar-right">
   <li>
   <a href="#" class="dropdown-toggle" data-toggle="dropdown">
   <span class="glyphicon glyphicon-share">&nbsp;</span>
   <span class="dropdown-text">
   {#share#|ucfirst}
   </span>
   </a>
   {widget_share_display
   htmlStructure=[
   'container' => [
   'before' => '<ul id="share-nav" class="dropdown-menu">',
   'after' => '</ul>'
   ]
   ]
   }
   </li>
   </ul>
*/
function smarty_function_widget_share_display($params, $template)
{
    // *** Load active script var
    // ** Catch Domain var
    $url['root'] = magixcjquery_html_helpersHtml::getUrl();
    $url['relativ'] = $_SERVER["REQUEST_URI"];
    //strrpos récupère la dernière occurence de / et de .
    $url['share'] = $url['root'] . $url['relativ'];
    // ** Catch module's page name
    $smarty = frontend_model_smarty::getInstance();
    // ** find active module
    $script['fileName'] = substr($_SERVER['SCRIPT_NAME'], 1);
    $script['chartBeforeExt'] = strpos($script['fileName'], '.');
    $active_mod = substr($script['fileName'], 0, $script['chartBeforeExt']);
    // ** set active module name
    $name = null;
    switch ($active_mod) {
        case 'index':
            $name = $smarty->getTemplateVars('title');
            break;
        case 'catalog':
            if (isset($_GET['idproduct'])) {
                $productData = $smarty->getTemplateVars('product');
                $name = $productData['name'];
            } elseif (isset($_GET['idcls'])) {
                $subcatData = $smarty->getTemplateVars('subcat');
                $name = $subcatData['name'];
            } elseif (isset($_GET['idclc'])) {
                $catData = $smarty->getTemplateVars('cat');
                $name = $catData['name'];
            } else {
                $name = $smarty->getConfigVars('catalog_root_h1');
            }
            break;
        case 'cms':
            $name = $smarty->getTemplateVars('name_page');
            break;
        case 'news':
            if (isset($_GET['getnews'])) {
                $name = $smarty->getTemplateVars('name_news');
            } elseif (isset($_GET['tag'])) {
                $name = $smarty->getConfigVars('news_root_h1') . ': ' . $_GET['tag'];
            } else {
                $name = $smarty->getConfigVars('news_root_h1');
            }
            break;
        case 'plugin':
            $active_plugin = $_GET['magixmod'];
            switch ($active_plugin) {
                case 'contact':
                    $name = $smarty->getConfigVars('contact_root_h1');
                    break;
                default:
                    if (isset($_GET['pstring3'])) {
                        $name = ucfirst(str_replace('-', ' ', 'pstring3'));
                    } elseif (isset($_GET['pstring2'])) {
                        $name = ucfirst(str_replace('-', ' ', 'pstring2'));
                    } elseif (isset($_GET['pstring1'])) {
                        $name = ucfirst(str_replace('-', ' ', 'pstring1'));
                    } else {
                        $name = $smarty->getConfigVars($active_mod . '_root_h1');
                    }
            }
    }
    // *** Set share data
    $name = str_replace(' ', '%20', $name);
    // W3C validation require no ' ' in url
    $data_default = array('facebook' => array('name' => 'facebook', 'url' => 'http://www.facebook.com/share.php?u=' . $url['share'], 'img' => 'facebook.png'), 'twitter' => array('name' => 'twitter', 'url' => 'https://twitter.com/intent/tweet?text=' . $name . '&amp;url=' . $url['share'], 'img' => 'twitter.png'), 'viadeo' => array('name' => 'viadeo', 'url' => 'http://www.viadeo.com/shareit/share/?url=' . $url['share'] . '&amp;title=' . $name . '&amp;overview=' . $name, 'img' => 'viadeo.png'), 'google' => array('name' => 'google', 'url' => 'https://plus.google.com/share?url=' . $url['share'], 'onclick' => 'javascript:window.open(this.href,\'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;', 'img' => 'google.png'));
    // ** Select Data
    if (isset($params['dataSelect']['context'])) {
        $dataSelect = explode(',', $params['dataSelect']['context']);
        foreach ($dataSelect as $share) {
            if (array_key_exists($share, $data_default)) {
                $data[] = $data_default[$share];
            }
        }
    } else {
        $data = $data_default;
    }
    // *** Set default html structure
    $strucHtml_default = array('container' => array('before' => '<ul>', 'after' => '</ul>'), 'item' => array('before' => '<li>', 'after' => '</li>'), 'img' => array('before' => ' ', 'after' => ' '), 'name' => array('before' => ' ', 'after' => ' '), 'current' => array('class' => ' current'), 'last' => array('class' => ' last', 'col' => 1));
    // ** Set default elem to display
    $strucHtml_default['allow'] = array('', 'name', 'img');
    $strucHtml_default['display'] = array(1 => array('', 'img', 'name'));
    // ** Update html struct & item setting with custom var (params['htmlStructure'])
    $custom = $params['htmlStructure'] ? $params['htmlStructure'] : null;
    $default = $strucHtml_default;
    if (is_array($custom)) {
        $default['display'] = array();
        foreach ($custom as $k => $v) {
            foreach ($v as $sk => $sv) {
                if ($sv != null) {
                    $default[$k][$sk] = $sv;
                }
            }
            if (array_search($k, $default['allow'])) {
                $default['display'][1][] = $k;
            }
        }
    }
    // ** Update html struct with display params (params['htmlDisplay'])
    if (isset($params['htmlDisplay'])) {
        $default['display'] = $params['htmlDisplay'];
    }
    // * push null value on case[0] (allow array search on format function)
    foreach ($default['display'] as $k => $v) {
        array_unshift($default['display'][$k], null);
    }
    $strucHtml = $default;
    // ** in cas diplay is null, we take default value
    if ($strucHtml['display'][1] == null) {
        $strucHtml['display'][1] = $strucHtml_default['display'][1];
    }
    // *** Set translation var
    $t_share_on = frontend_model_template::getConfigVars('share_on');
    // *** format items loop (foreach item)
    $items = null;
    foreach ($data as $row) {
        // ** format item loop (foreach element)
        $elem = null;
        foreach ($strucHtml['display'][1] as $elem_type) {
            if (array_search($elem_type, $strucHtml['display'][1])) {
                switch ($elem_type) {
                    case 'name':
                        $elem .= ucfirst($row['name']);
                        break;
                    case 'img':
                        $elem .= '<img src="' . '/skin/' . frontend_model_template::frontendTheme()->themeSelected() . '/img/share/' . $row['img'] . '" alt="' . $row['name'] . '" />';
                }
            }
        }
        // ** item construct
        $items .= $strucHtml['item']['before'];
        $items .= '<a id="share-' . $row['name'] . '" class="targetblank" href="' . $row['url'] . '" title="' . ucfirst($t_share_on) . ': ' . $row['name'] . '">';
        $items .= $elem;
        $items .= '</a>';
        $items .= $strucHtml['item']['after'];
    }
    // *** container construct
    $output = $strucHtml['container']['before'];
    $output .= isset($params['htmlPrepend']) ? $params['htmlPrepend'] : null;
    $output .= $items;
    $output .= isset($params['htmlAppend']) ? $params['htmlAppend'] : null;
    $output .= $strucHtml['container']['after'];
    return $output;
}
/**
 * Smarty {widget_lang_display} function plugin
 *
 * Type:     function
 * Name:     widget_lang_display
 * Date:     03/01/2013
 * Date Update : 12/01/2013
 * Output:
 * @author   Sire Sam (http://www.sire-sam.be)
 * @author   Gerits Aurélien (http://www.magix-dev.be)
 * @link
 * @version  1.0
 * @param $params
 * @param $template
 * @return string
 */
function smarty_function_widget_lang_display($params, $template)
{
    $ModelConstructor = new magixglobal_model_constructor();
    // *** Catch location var
    $iso_current = magixcjquery_filter_request::isGet('strLangue');
    // *** Load SQL DATA
    $data = frontend_db_lang::s_fetch_lang();
    $output = null;
    if ($data != null) {
        // *** set default html structure
        $strucHtml_default = array('container' => array('before' => '<ul class="nav">', 'after' => '</ul>'), 'item' => array('before' => '<li>', 'after' => '</li>'), 'icon' => array('before' => ' ', 'after' => ' '), 'name' => array('before' => ' ', 'after' => ' '), 'iso' => array('before' => '(', 'after' => ')'), 'current' => array('class' => ' current'), 'last' => array('class' => ' last', 'col' => 1));
        // *** Set default elem to display
        $strucHtml_default['allow'] = array('', 'icon', 'name', 'iso');
        $strucHtml_default['display'] = array(1 => array('', 'icon', 'name', 'iso'));
        // *** Update html struct & item setting with custom var (params['structureHTML']) @TODO vérifier si le paramaètre htmlDispaly tj opérationnel
        $structHtml_custom = $params['htmlStructure'] ? $params['htmlStructure'] : null;
        $strucHtml = $ModelConstructor->mergeHtmlPattern($strucHtml_default, $structHtml_custom);
        // *** Set translation var
        $t_go_to_version = frontend_model_template::getConfigVars('go_to_version');
        // *** format items loop (foreach item)
        $items = null;
        $i = 0;
        foreach ($data as $row) {
            $i++;
            // *** set additional var in htmlStruct
            $strucHtml['is_current'] = $iso_current == $row['iso'] ? 1 : 0;
            $strucHtml['is_last'] = 0;
            if ($i == $strucHtml['last']['col']) {
                $strucHtml['is_last'] = 1;
                $i = 0;
            }
            // *** in case diplay is null, we take default value
            if ($strucHtml['display'][1] == null) {
                $strucHtml['display'][1] = $strucHtml_default['display'][1];
            }
            // *** set link class
            $item_classLink = null;
            if ($strucHtml['is_last'] == 1 or $strucHtml['is_current'] == 1) {
                $item_class = ' class="';
                $item_class .= $strucHtml['is_last'] == 1 ? $strucHtml['last']['class'] : '';
                $item_class .= $strucHtml['is_current'] == 1 ? $strucHtml['current']['class'] : '';
                $item_class .= '"';
            }
            // *** format item loop (foreach element)
            $item = null;
            foreach ($strucHtml['display'][1] as $elem_type) {
                $strucHtml_elem = $strucHtml[$elem_type];
                if (array_search($elem_type, $strucHtml['display'][1])) {
                    switch ($elem_type) {
                        case 'name':
                            $elem = ucfirst($row['language']);
                            break;
                        case 'icon':
                            $elem = '<img src="/skin/' . frontend_model_template::frontendTheme()->themeSelected() . '/img/lang/' . $row['iso'] . '.png" alt="' . $row['name'] . '"/>';
                            break;
                        case 'iso':
                            $elem = $row['iso'];
                            break;
                        default:
                            $elem = null;
                    }
                    // *** elem construct
                    if ($elem != null) {
                        $item .= $strucHtml_elem['before'];
                        $item .= $elem;
                        $item .= $strucHtml_elem['after'];
                    }
                }
            }
            // *** item construct
            $items .= $strucHtml['item']['before'];
            $items .= '<a href="/' . $row['iso'] . '/" hreflang="' . $row['iso'] . '" title="' . ucfirst($t_go_to_version) . ': ' . $row['language'] . '">';
            $items .= $item;
            $items .= '</a>';
            $items .= $strucHtml['item']['after'];
        }
        // *** container construct
        $output .= $strucHtml['container']['before'];
        $output .= isset($params['htmlPrepend']) ? $params['htmlPrepend'] : null;
        $output .= $items;
        $output .= isset($params['htmlAppend']) ? $params['htmlAppend'] : null;
        $output .= $strucHtml['container']['after'];
    }
    return $output;
}
function patternNews($name = null)
{
    $ModelTemplate = new frontend_model_template();
    $tr = array('show_news' => $ModelTemplate->getConfigVars('show_news_page'));
    switch ($name) {
        case 'sidebar':
            $pattern = array('container' => array('before' => '<div class="news-list-last sidebar-list row">', 'after' => '</div>'), 'item' => array('before' => '<a class="thumbnail text-center col-xs-6 col-sm-12 #current-last#" href="#url#" title="' . $tr['show_news'] . '" >', 'after' => '</span></a>'), 'img' => array('before' => ' ', 'after' => ' '), 'date' => array('before' => '<span class="date label label-default">', 'format' => array('day' => 'd/', 'month' => 'm/', 'year' => 'Y'), 'after' => '</span>'), 'name' => array('before' => '<span class="caption"></span><span class="panel-title">', 'after' => '</span>'), 'tag' => array('before' => '<span class="tag">', 'after' => '<span>'), 'display' => array(1 => array('img', 'name', 'date')));
            break;
        default:
            $pattern = array('container' => array('before' => '<div class="news-list">', 'after' => '</div>'), 'item' => array('before' => '<div class="thumbnail col-xs-6 col-lg-6">', 'after' => '</div></div>'), 'img' => array('before' => ' ', 'after' => ' '), 'date' => array('before' => '<div class="caption"><span class="date badge badge-info pull-right">', 'format' => array('day' => 'd/', 'month' => 'm/', 'year' => 'Y'), 'after' => '</span>'), 'name' => array('before' => '<h3>
                                <a href="#url#" title="' . $tr['show_news'] . '">', 'after' => '</a>
                            </h3>'), 'descr' => array('before' => '<p>', 'lenght' => 250, 'delemiter' => '...', 'after' => '</p>'), 'pagination' => array('before' => '<div>', 'class' => 'pagination', 'after' => '</div>'), 'tag' => array('before' => '<span class="tag">', 'after' => '</span>'), 'active' => array('class' => ' active'), 'last' => array('class' => ' last', 'col' => 1), 'display' => array(1 => array('img', 'date', 'name', 'descr')), 'allow' => array('', 'img', 'name', 'descr', 'date', 'tag'));
    }
    return $pattern;
}
Example #23
0
 /**
  * Les paramètres pour la configuration de smarty 3
  */
 protected function setParams()
 {
     /**
      * Path -> configs
      */
     $this->setConfigDir(array(self::setPath() . "locali18n/"));
     /**
      * Path -> templates
      */
     $this->setTemplateDir(array(self::setPath() . "skin/" . frontend_model_template::frontendTheme()->themeSelected() . '/'));
     /**
      * path plugins
      * @var void
      */
     $this->setPluginsDir(array(self::setPath() . 'lib/smarty3/plugins/', self::setPath() . 'app/wdcore/', self::setPath() . 'widget/'));
     /**
      * Ajout du dossier additionnels des plugins smarty dans le template courant
      */
     frontend_model_template::frontendTheme()->addWidgetDir($this, self::setPath(), false);
     /**
      * Path -> compile
      */
     $this->setCompileDir(self::setPath() . 'var/templates_c/');
     /**
      * debugging (true/false)
      */
     $this->debugging = false;
     /**
      * compile (true/false)
      */
     $this->compile_check = true;
     /**
      * Force compile
      * @var void
      * (true/false)
      */
     $this->force_compile = false;
     /**
      * caching (true/false)
      */
     frontend_model_template::frontendTheme()->setCache($this);
     //$this->setCaching(false);
     //$this->setCachingType('apc');
     /**
      * Use sub dirs (true/false)
      */
     $this->use_sub_dirs = false;
     /**
      * cache_dir -> cache
      */
     $this->setCacheDir(self::setPath() . 'var/tpl_caches/');
     /**
      * load pre filter
      */
     //$this->load_filter('pre','magixmin');
     $this->autoload_filters = array('pre' => array('magixmin'));
     $this->loadPlugin('smarty_compiler_switch');
     /**
      * 
      * @var error_reporting
      */
     $this->error_reporting = error_reporting() & ~E_NOTICE;
     /**
      * Security
      */
     //$this->enableSecurity();
     /**
      * security settings
      */
     //$this->enableSecurity('Security_Policy');
 }
/**
 * Smarty {template} function plugin
 *
 * Type:     function
 * Name:    load template
 * Date:     january 26 2010
 * Purpose:  
 * Examples: {template}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_template($params, $template)
{
    return frontend_model_template::frontendTheme()->themeSelected();
}
Example #25
0
 /**
  * Fonction multiple de sélection de produit
  * @param $data
  * @return array
  */
 protected static function fetchAllProduct($data)
 {
     $iso = frontend_model_template::current_Language();
     switch ($data['sort']) {
         case 'id':
             $order_clause = 'ORDER BY p.idproduct DESC';
             break;
         case 'product':
             $order_clause = 'ORDER BY p.orderproduct ASC';
             break;
         case 'name':
             $order_clause = 'ORDER BY catalog.titlecatalog ASC';
             break;
     }
     $limit_clause = null;
     $where_clause = 'WHERE lang.iso = :iso';
     if (is_int($data['limit'])) {
         $limit_clause = 'LIMIT ' . $data['limit'];
     }
     if (is_array($data)) {
         switch ($data['context']) {
             case 'last-product-cat':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idclc';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
             case 'last-product-subcat':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idcls';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
             case 'product':
                 if ($data['selectmode']) {
                     $where_clause .= ' AND p.idproduct';
                     $where_clause .= $data['selectmode'] != 'exclude' ? ' IN (' : ' NOT IN (';
                     $where_clause .= $data['selectmodeid'];
                     $where_clause .= ') ';
                 }
                 break;
         }
         $select = "SELECT\r\n                p.idproduct,p.idclc, p.idcls,\r\n                catalog.urlcatalog, catalog.titlecatalog, catalog.idlang,catalog.price,catalog.desccatalog,\r\n                c.pathclibelle,\r\n                s.pathslibelle,\r\n                catalog.imgcatalog,\r\n                lang.iso\r\n            FROM mc_catalog_product AS p\r\n            LEFT JOIN mc_catalog AS catalog ON ( catalog.idcatalog = p.idcatalog )\r\n            LEFT JOIN mc_catalog_c AS c ON ( c.idclc = p.idclc )\r\n            LEFT JOIN mc_catalog_s AS s ON ( s.idcls = p.idcls )\r\n            JOIN mc_lang AS lang ON ( catalog.idlang = lang.idlang )\r\n            {$where_clause}\r\n            {$order_clause}\r\n            {$limit_clause}";
         return magixglobal_model_db::layerDB()->select($select, array(':iso' => $iso));
     }
 }
Example #26
0
 /**
  * Configuration du texte à retourner suivant le status du code d'erreur
  * @param $http_error
  * @return mixed
  */
 private function setTxtHeader($http_error)
 {
     if (isset($http_error)) {
         switch ($http_error) {
             case 404:
                 $message = frontend_model_template::getConfigVars('txt_status_404');
                 $status = self::init()->setStatusCode(404, $message);
                 break;
             case 403:
                 $message = frontend_model_template::getConfigVars('txt_status_403');
                 $status = self::init()->setStatusCode(403, $message);
                 break;
         }
         return $status;
     }
 }
Example #27
0
 /**
  * Test si le cache est valide
  * @param string|object $template
  * @param string $plugin
  * @param mixed $cache_id
  * @param mixed $compile_id
  * @param object $parent
  */
 public function isCached($template = null, $plugin = '', $cache_id = null, $compile_id = null, $parent = null)
 {
     if (file_exists('skin/' . frontend_model_template::frontendTheme()->themeSelected() . '/' . self::controlGetPlugin($plugin))) {
         frontend_model_smarty::getInstance()->isCached('skin/' . frontend_model_template::frontendTheme()->themeSelected() . '/' . self::controlGetPlugin($plugin) . '/' . $template, $cache_id, $compile_id, $parent);
     } else {
         frontend_model_smarty::getInstance()->isCached($this->directory_plugins() . self::controlGetPlugin($plugin) . '/skin/public/' . $template, $cache_id, $compile_id, $parent);
     }
 }
Example #28
0
 /**
 * @param $setParams
 * @return string
 *
     $hipay = new plugins_hipay_public();
     $hipayProcess = $hipay->getData(
    array(
        'plugin'        =>  'cartpay',
        'key'           =>  $session_key,
        'order'         =>  $id_cart,
        'amount'        =>  $amount_pay_with_tax,
        'shipping'      =>  $shipping,
        'locale'        =>  'BE',
        'customerEmail' => $data_cart['email_cart']
    )
     );
 */
 public function getData($setParams)
 {
     try {
         frontend_model_smarty::getInstance()->configLoad($this->modelSystem->base_path() . 'plugins/hipay/i18n/public_local_' . frontend_model_template::current_Language() . '.conf');
         // Chargement des données Hipay en base de données
         $data = $this->setData();
         $collection = $this->about->getData();
         if ($data != null) {
             if ($data['formaction'] === 'test') {
                 $urlOrder = 'https://test-ws.hipay.com/soap/payment-v2?wsdl';
                 $urlCategory = 'https://test-payment.hipay.com/order/list-categories/id/';
             } elseif ($data['formaction'] === 'production') {
                 $urlOrder = 'https://ws.hipay.com/soap/payment-v2?wsdl';
                 $urlCategory = 'https://payment.hipay.com/order/list-categories/id/';
             }
             $getCategory = $this->getCategory(array('url' => $urlCategory . $data['websiteId'], 'debug' => false));
             $urlwebsite = magixcjquery_html_helpersHtml::getUrl() . '/' . $data['iso'] . '/';
             // seturl pour les notifications et process
             $seturl = $this->setUrl();
             if ($getCategory) {
                 // STEP 1 : soap flow options
                 $options = array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'cache_wsdl' => WSDL_CACHE_NONE, 'soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'exceptions' => true);
                 // STEP 2 : Soap client initialization
                 $client = new SoapClient($urlOrder, $options);
                 //https://test-ws.hipay.com/soap/payment-v2?wsdl
                 // L'interface de paiement sera, par défaut, en français international
                 $setlocal = $data['iso'] . '_' . strtoupper($setParams['locale']);
                 $executionDate = date('c');
                 // STEP 3 : Soap call on confirm method of manual-capture webservice
                 $result = $client->generate(array('parameters' => array('wsLogin' => $data['wsLogin'], 'wsPassword' => $data['wsPassword'], 'websiteId' => $data['websiteId'], 'categoryId' => $getCategory, 'description' => $this->template->getConfigVars('order_on') . ' ' . $collection['name'], 'freeData' => array(array('key' => 'order', 'value' => $setParams['order']), array('key' => 'shipping', 'value' => $setParams['shipping'])), 'currency' => 'EUR', 'amount' => $setParams['amount'], 'rating' => 'ALL', 'locale' => $setlocal, 'customerIpAddress' => $data['customerIpAddress'], 'manualCapture' => '0', 'executionDate' => $executionDate, 'customerEmail' => $setParams['customerEmail'], 'urlCallback' => $urlwebsite . $setParams['plugin'] . $seturl['seturlack'], 'urlAccept' => $urlwebsite . $setParams['plugin'] . $seturl['seturlok'], 'urlCancel' => $urlwebsite . $setParams['plugin'] . $seturl['seturlcancel'], 'urlDecline' => $urlwebsite . $setParams['plugin'] . $seturl['seturlexception'])));
                 //print_r($result);
                 $forms_hipay = '<a href="' . $result->{'generateResult'}->{'redirectUrl'} . '"><img src="https://www.hipaydirect.com/images/i18n/' . $data['iso'] . '/bt_payment_8.png" /></a>';
                 return $forms_hipay;
             }
         }
     } catch (SoapFault $e) {
         magixglobal_model_system::magixlog("SOAP Fault: (faultcode: {$e->faultcode}, faultstring: {$e->faultstring})", $e);
     }
 }
Example #29
0
 /**
  * 
  * Notification suivant la langue
  */
 public function notify_lang()
 {
     if (self::register_lang() != frontend_model_template::current_Language()) {
         switch (self::register_lang()) {
             case "fr":
                 return "test fr";
                 break;
             case "en":
                 return "test en";
                 break;
         }
     } elseif (self::register_lang() == null) {
         switch ($this->getlang) {
             case "fr":
                 return "test fr";
                 break;
             case "en":
                 return "test en";
                 break;
         }
     }
 }