Example #1
0
function getFluxRss()
{
    global $bdd;
    global $_TABLES;
    $ajax = new Ajax();
    $flux = "";
    $flux_items = "";
    $view_rss = new Template(dirname(dirname(__FILE__)) . '/html/rss.html');
    $view_item = new Template(dirname(dirname(__FILE__)) . '/html/rss-item.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objRss = new Rss($bdd, $_TABLES);
        $items = $objRss->getAll();
        if (!is_null($items)) {
            foreach ($items as $key => $value) {
                $flux_items .= $view_item->getView(array("guid" => 'http://' . $_SERVER['HTTP_HOST'] . '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "url" => 'http://' . $_SERVER['HTTP_HOST'] . '/to/' . $value->guid . '#' . $value->url, "description" => $value->description, "date_publication" => date("D, d M Y H:i:s", strtotime($value->date_publication)) . ' +0200'));
            }
            $flux = $view_rss->getView(array("flux_rss" => 'http://' . $_SERVER['HTTP_HOST'] . $ajax->env->flux_rss, "title_site" => $ajax->env->title_site, "url_site" => 'http://' . $_SERVER['HTTP_HOST'], "description_site" => $ajax->env->description_site, "items" => $flux_items, "date_publication_site" => date("D, d M Y H:i:s", strtotime("now")) . ' +0200'));
            $fp = fopen(dirname(dirname(dirname(dirname(__FILE__)))) . "/rss.xml", 'w+');
            fputs($fp, html_entity_decode(htmlspecialchars_decode($flux)));
            fclose($fp);
            return file_get_contents(dirname(dirname(dirname(dirname(__FILE__)))) . "/rss.xml");
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Example #2
0
 public function getContent()
 {
     $out = '';
     $User = $this->doorGets->user;
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     // Check if is content modo
     $is_modo = in_array($moduleInfos['id'], $User['liste_module_modo']) ? true : false;
     // Check if is module modo
     in_array('module', $User['liste_module_interne']) && in_array('module_' . $moduleInfos['type'], $User['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     // check if user can edit content
     $user_can_add = in_array($moduleInfos['id'], $User['liste_module_add']) ? true : false;
     // check if user can edit content
     $user_can_edit = in_array($moduleInfos['id'], $User['liste_module_edit']) ? true : false;
     // check if user can delete content
     $user_can_delete = in_array($moduleInfos['id'], $User['liste_module_delete']) ? true : false;
     $Rubriques = array('index' => $this->doorGets->__('Index'));
     // get Content for edit
     $params = $this->doorGets->Params();
     if (array_key_exists('uri', $params['GET'])) {
         $uri = $params['GET']['uri'];
         $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri_module', "AND langue = '" . $lgActuel . "' LIMIT 1 ");
     }
     $ActionFile = 'modules/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #3
0
 public function getContent()
 {
     $out = '';
     $me = $this->doorGets->user;
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_discountcode');
         if (!empty($isContent)) {
             // $isCheckedDefault = ($isContent['is_default'] === '1') ? 'checked': '';
         }
     }
     switch ($this->Action) {
         case 'index':
             $DiscountcodeQuery = new DiscountcodeQuery($this->doorGets);
             $DiscountcodeQuery->find();
             $Discountcodes = $DiscountcodeQuery->_getEntities('array');
             break;
         case 'add':
             break;
         case 'edit':
             break;
         case 'delete':
             break;
     }
     $ActionFile = 'user/discountcode/user_discountcode_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
function lastArticle()
{
    global $bdd;
    global $_TABLES;
    $content = "";
    $view = new Template(dirname(dirname(__FILE__)) . '/html/article.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        $objLastArticle = new LastArticle($bdd, $_TABLES);
        $articles = $objLastArticle->getLastArticles();
        if (!is_null($articles)) {
            foreach ($articles as $key => $value) {
                $temp_subscription = '';
                if (isset($_SESSION['user_auth']) && $_SESSION['user_auth'] == '1' && isset($_SESSION['user_subscription'])) {
                    if (in_array($value->website_id, $_SESSION['user_subscription'])) {
                        $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>";
                    } else {
                        $temp_subscription = "<div class='subscription' website_id='%%website_id%%'></div>";
                    }
                }
                $content .= $view->getView(array("url" => '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "width_image" => $value->width_image, "height_image" => $value->height_image, "image" => $value->image, "alt_image" => $value->alt_image, "description" => $value->description, "logo_site" => $value->logo, "alt_logo_site" => $value->website, "title_site" => $value->website, "subscription" => $temp_subscription, "website_id" => $value->website_id));
            }
            return $content;
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Example #5
0
 public function getContent()
 {
     $out = '';
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $listeCategories = $this->doorGets->categorieSimple;
     unset($listeCategories[0]);
     $aActivation = $this->doorGets->getArrayForms('activation');
     $Rubriques = array('index' => $this->doorGets->__('Index'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'));
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('uri', $params['GET'])) {
         $uri = $params['GET']['uri'];
         $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri');
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $isContent = array_merge($isContent, $isContentTraduction);
                     $this->isContent = $isContent;
                 }
             }
         }
     }
     $ActionFile = 'modules/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
function subscriptionList()
{
    global $bdd;
    global $_TABLES;
    $content = "";
    $view = new Template(dirname(dirname(__FILE__)) . '/html/media.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        if (isset($_SESSION['user_id'])) {
            $user_id = $_SESSION['user_id'];
            $objWebsiteSubscription = new WebsiteSubscription($bdd, $_TABLES);
            $website_subscriptions = $objWebsiteSubscription->getAllWebsiteSubscriptionsByUser($user_id);
            if (!is_null($website_subscriptions)) {
                $objWebsite = new Website($bdd, $_TABLES);
                foreach ($website_subscriptions as $key => $value) {
                    $website = $objWebsite->getData($value->website_id);
                    if (!is_null($website)) {
                        $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>";
                        $content .= $view->getView(array("url" => $website->url, "title" => $website->website, "logo_site" => $website->logo, "alt_logo_site" => $website->website, "title_site" => $website->website, "subscription" => $temp_subscription, "website_id" => $website->id));
                    }
                }
                return $content;
            } else {
                // 404
                return "404 Not Found";
            }
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
Example #7
0
 public function initContent()
 {
     $doorgets = $this->doorgets;
     $ActionFile = $this->doorgets->getStep();
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out = ob_get_clean();
     $this->content = $out;
 }
Example #8
0
 public function getContent()
 {
     $out = '';
     $nameController = $this->doorGets->controllerNameNow();
     $params = $this->doorGets->Params();
     $Rubriques = array('index' => $this->doorGets->__('Index de la page'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'));
     $isAllTheme = $this->doorGets->getAllThemesName();
     $nameTheme = $this->doorGets->configWeb['theme'];
     $countTheme = count($isAllTheme);
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 break;
             case 'add':
                 $allTheme = array();
                 if (!empty($isAllTheme)) {
                     foreach ($isAllTheme as $v) {
                         $allTheme[$v] = $v;
                     }
                 }
                 break;
             case 'edit':
                 $theme = $params['GET']['name'];
                 $fileSelected = $theme . '/css/doorgets.css';
                 if (array_key_exists('file', $params['GET'])) {
                     $fileSelected = $params['GET']['file'];
                 }
                 $themeListe = $this->doorGets->listThemeFiles($theme);
                 $fileContent = '';
                 if (array_key_exists($fileSelected, $themeListe['js'])) {
                     $fileContent = file_get_contents(THEME . $fileSelected);
                 } elseif (array_key_exists($fileSelected, $themeListe['css'])) {
                     $fileContent = file_get_contents(THEME . $fileSelected);
                 } elseif (array_key_exists($fileSelected, $themeListe['tpl'])) {
                     $fileContent = file_get_contents(THEME . $fileSelected);
                 }
                 break;
             case 'delete':
                 $theme = $params['GET']['name'];
                 break;
         }
         $ActionFile = 'user/' . $nameController . '/user_' . $nameController . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #9
0
 public function getContent()
 {
     $out = '';
     $tplAccountRubrique = Template::getView('user/account/user_account_rubrique');
     ob_start();
     if (is_file($tplAccountRubrique)) {
         include $tplAccountRubrique;
     }
     $htmlAccountRubrique = ob_get_clean();
     switch ($this->Action) {
         case 'index':
             $postFinish = false;
             $amount = 5000;
             $currency = 'eur';
             $orderId = '6735';
             $isUser = $this->doorGets->dbQS($this->user['id'], '_user_stripe', 'id_user');
             StripeService::init($this->doorGets);
             if (array_key_exists('stripeToken', $_POST)) {
                 $token = $_POST['stripeToken'];
                 $isUser = $this->doorGets->dbQS($this->user['id'], '_user_stripe', 'id_user');
                 if (empty($isUser)) {
                     $customer = \Stripe\Customer::create(array('email' => $this->user['login'], 'card' => $token));
                     $dataCharge = array('customer' => $customer->id, 'amount' => $amount, 'currency' => $currency, "metadata" => array("order_id" => $orderId));
                     $dataUser = array('id_stripe' => $customer->id, 'id_user' => $this->user['id'], 'date_creation' => time(), 'date_modification' => time());
                     $this->doorGets->dbQI($dataUser, '_user_stripe');
                 } else {
                     $dataCharge = array("amount" => $amount, "currency" => $currency, "customer" => $isUser['id_stripe'], "metadata" => array("order_id" => $orderId));
                 }
                 $charge = \Stripe\Charge::create($dataCharge);
                 $dataChargeToSave = array("id_user" => $this->user['id'], "id_stripe" => $isUser['id_stripe'], "id_charge" => $charge->id, "id_order" => $orderId, "status" => $charge->status, "amount" => $charge->amount, "currency" => $charge->currency, "data" => @serialize($charge), 'date_creation' => time(), 'date_modification' => time());
                 $idNewCharge = $this->doorGets->dbQI($dataChargeToSave, '_user_stripe_charge');
                 $postFinish = true;
             }
             break;
     }
     $ActionFile = 'user/purchase/user_purchase_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #10
0
 public function getContent()
 {
     $out = '';
     $Rubriques = array('index' => $this->doorGets->__('Index de la page'));
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 echo __FILE__;
                 break;
         }
         $ActionFile = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #11
0
 public function getContent()
 {
     $out = '';
     $User = $this->doorGets->user;
     $lgActuel = $this->doorGets->getLangueTradution();
     $isVersionActive = false;
     $version_id = 0;
     // Check if is content modo
     in_array('traduction', $User['liste_module_interne']) ? $is_modo = true : ($is_modo = false);
     // Check if is module modo
     in_array('traduction', $User['liste_module_interne']) && in_array('traduction_modo', $User['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     $Rubriques = array('index' => $this->doorGets->__('Traductions'));
     $fileTempTraductions = LANGUE . 'temp.lg.php';
     if (!is_file($fileTempTraductions)) {
         return $fileTempTraductions . ' not found.';
     }
     include $fileTempTraductions;
     $cFields = count($wTranslate);
     $_toLanguage = $this->doorGets->getLangueTradutionForTraduction();
     $allLanguages = $this->doorGets->getAllLanguages();
     $fileToTraductions = LANGUE . $_toLanguage . '.lg.php';
     include $fileToTraductions;
     $cFieldsTo = count($_w);
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 // to do
                 break;
         }
         $ActionFile = 'user/traductions/user_traductions_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #12
0
 public function getContent()
 {
     $out = '';
     $me = $this->doorGets->user;
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_users_address');
         if (!empty($isContent)) {
             $isCheckedDefault = $isContent['is_default'] === '1' ? 'checked' : '';
             $isCheckedIsBilling = $isContent['is_billing'] === '1' ? 'checked' : '';
             $isCheckedIsShipping = $isContent['is_shipping'] === '1' ? 'checked' : '';
         }
     }
     switch ($this->Action) {
         case 'index':
             $UsersAddressQuery = new UsersAddressQuery($this->doorGets);
             $UsersAddressQuery->filterByIdUser($me['id'])->find();
             $myAddress = $UsersAddressQuery->_getEntities('array');
             break;
         case 'add':
             break;
         case 'edit':
             break;
         case 'delete':
             break;
     }
     $ActionFile = 'user/address/user_address_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #13
0
 public function getBoxFile($displayDelete = false, $displayBox = false, $i = 0, $lLabel = '', $lValue = '', $lActive = '', $lObli = '', $lInfo = '', $lCss = '', $tZip = '', $tPng = '', $tJpg = '', $tGif = '', $tPdf = '', $tSwf = '', $tDoc = '')
 {
     $boxFile = 'user/modules/widgets/genform/user_modules_box_file';
     $tpl = Template::getView($boxFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out = $tpl;
     $out = ob_get_clean();
     return $out;
 }
Example #14
0
 public function getContent()
 {
     $out = '';
     $me = $this->doorGets->user;
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_promotion');
         if (!empty($isContent)) {
             $isContent['categories'] = @unserialize($isContent['categories']);
             // $isCheckedDefault = ($isContent['is_default'] === '1') ? 'checked': '';
         }
     }
     $storeMenuFile = 'user/user_store_menu';
     $tplStoreMenu = Template::getView($storeMenuFile);
     ob_start();
     if (is_file($tplStoreMenu)) {
         include $tplStoreMenu;
     }
     $storeMenuHtml = ob_get_clean();
     $aActivation = $this->doorGets->getArrayForms('yn');
     $currencyCode = $this->doorGets->configWeb['currency'];
     $currencyIcon = Constant::$currencyIcon[$currencyCode];
     $aPriority = range(0, 10);
     $aPercent = range(0, 100);
     $aStockmin = range(0, 100);
     $aType = array('percent' => $this->doorGets->__("Pourcentage") . ' %', 'amount' => $this->doorGets->__("Montant") . ' ' . $currencyIcon);
     switch ($this->Action) {
         case 'index':
             $PromotionQuery = new PromotionQuery($this->doorGets);
             $PromotionQuery->orderByPriority();
             $PromotionQuery->find();
             $Promotions = $PromotionQuery->_getEntities('array');
             break;
         case 'add':
             $shopModules = $this->doorGets->loadModules(true, true, 'shop');
             $categories = array();
             if (!empty($shopModules)) {
                 foreach ($shopModules as $module) {
                     $this->doorGets->loadCategories($module['uri']);
                     $categories[$module['id']] = $this->doorGets->categorieSimple__;
                     unset($categories[$module['id']][0]);
                 }
             }
             break;
         case 'edit':
             $shopModules = $this->doorGets->loadModules(true, true, 'shop');
             $categories = array();
             if (!empty($shopModules)) {
                 foreach ($shopModules as $module) {
                     $this->doorGets->loadCategories($module['uri']);
                     $categories[$module['id']] = $this->doorGets->categorieSimple__;
                     unset($categories[$module['id']][0]);
                 }
             }
             break;
         case 'delete':
             break;
     }
     $ActionFile = 'user/promotion/user_promotion_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #15
0
 public function getContent()
 {
     $out = '';
     $User = $this->doorGets->user;
     $lgActuel = $this->doorGets->getLangueTradution();
     $isVersionActive = false;
     $version_id = 0;
     // Check if is content modo
     in_array('emailnotification', $User['liste_module_interne']) ? $is_modo = true : ($is_modo = false);
     $is_modules_modo = true;
     $Rubriques = array('index' => $this->doorGets->__('Media'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Editer'), 'delete' => $this->doorGets->__('Supprimer'));
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, $this->doorGets->Table);
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $isContent = array_merge($isContent, $isContentTraduction);
                     $this->isContent = $isContent;
                 }
                 $field = 'id';
                 $idNextContent = $this->doorGets->getContentPaginatePosition($field, $isContent['id_content']);
                 $idPreviousContent = $this->doorGets->getContentPaginatePosition($field, $isContent['id_content'], 'prev');
                 $urlPrevious = '';
                 if (!empty($idPreviousContent)) {
                     $urlPrevious = '?controller=' . $this->doorGets->controllerNameNow() . '&action=edit&lg=' . $lgActuel . '&id=' . $idPreviousContent;
                 }
                 $urlNext = '';
                 if (!empty($idNextContent)) {
                     $urlNext = '?controller=' . $this->doorGets->controllerNameNow() . '&action=edit&lg=' . $lgActuel . '&id=' . $idNextContent;
                 }
                 $arrForCountSearchQuery = array();
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '.id', 'type' => '!=!', 'value' => $this->doorGets->Table . '_traduction.id_content');
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '_traduction.langue', 'type' => '=', 'value' => $lgActuel);
                 $tAll = $this->doorGets->Table . ', ' . $this->doorGets->Table . '_traduction';
                 $countTotal = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery);
             }
         }
     }
     if (array_key_exists('version', $params['GET']) && $id_modo) {
         $version_id = $params['GET']['version'];
         $isContentVesion = $this->getVersionById($version_id, $isContent);
         if (!empty($isContentVesion)) {
             $this->isConten = $isContent = array_merge($isContent, $isContentVesion);
             $isVersionActive = true;
         }
     }
     $yesno = $this->doorGets->getArrayForms();
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $isFieldArray = array("title" => $this->doorGets->__('Title'), "subject" => $this->doorGets->__('Sujet'), "uri" => $this->doorGets->__('Clé'), "date_creation" => $this->doorGets->__('Date'));
                 $isFieldArraySort = array('subject', 'uri', 'date_creation');
                 $isFieldArraySearch = array('subject', 'uri', 'date_creation_start', 'date_creation_end');
                 $isFieldArraySearchType = array('title' => array('type' => 'text', 'value' => ''), 'subject' => array('type' => 'text', 'value' => ''), 'uri' => array('type' => 'text', 'value' => ''));
                 $isFieldArrayDate = array('date_creation');
                 $urlOrderby = '&orderby=' . $isFieldArraySort[0];
                 $urlSearchQuery = '';
                 $urlSort = '&asc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = $this->doorGets->Table . ', ' . $this->doorGets->Table . '_traduction';
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '.id', 'type' => '!=!', 'value' => $this->doorGets->Table . '_traduction.id_content');
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '_traduction.langue', 'type' => '=', 'value' => $lgActuel);
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v]) || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             if (!empty($valueQP)) {
                                 $valEnd = str_replace('_start', '', $v);
                                 $valEnd = str_replace('_end', '', $v);
                                 if (in_array($valEnd, $isFieldArrayDate)) {
                                     if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                                         $fromFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     } else {
                                         $fromFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     }
                                     if (!empty($fromFormat)) {
                                         $from = strtotime($fromFormat);
                                     }
                                     if (!empty($toFormat)) {
                                         $to = strtotime($toFormat);
                                         $to = $to + 60 * 60 * 24;
                                     }
                                     if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                         $nameTable = $this->doorGets->Table . "." . $valEnd;
                                         $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                         $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                         $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_end=' . $toFormat;
                                     }
                                 } else {
                                     if (in_array($v, $isFieldArraySort)) {
                                         // table de traduction
                                         if ($v === 'subject' || $v === 'uri') {
                                             $sqlLabelSearch .= $this->doorGets->Table . "_traduction." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction." . $v, 'type' => 'like', 'value' => $valueQP);
                                         } else {
                                             $sqlLabelSearch .= $this->doorGets->Table . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                         }
                                     }
                                     $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP;
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                     $urlGroupBy = '&gby=' . $per;
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery);
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'ASC';
                 $getSort = '&desc';
                 if (isset($_GET['desc'])) {
                     $getDesc = 'DESC';
                     $getSort = '&asc';
                     $urlSort = '&desc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $this->doorGets->Table . '.id  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     $outFilterORDER = $this->doorGets->Table . '.' . $getFilter . '  ' . $getDesc;
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE " . $this->doorGets->Table . ".id = " . $this->doorGets->Table . "_traduction.id_content AND " . $this->doorGets->Table . "_traduction.langue ='{$lgActuel}' " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                 // Create url to go for pagination
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . '&lg=' . $lgActuel . "&page=";
                 $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow() . '&lg=' . $lgActuel;
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title center");
                     $iPos++;
                 }
                 $block->addTitle('', 'edit', 'td-title');
                 if ($is_modules_modo) {
                     $block->addTitle('', 'delete', 'td-title');
                 }
                 // Search
                 $outFilter = '';
                 foreach ($isFieldArraySearchType as $nameField => $value) {
                     $nameFieldVal = 'valFilter' . ucfirst($nameField);
                     $sNameFieldVar = 'sFilter' . ucfirst($nameField);
                     $keyNameField = 'q_' . $nameField;
                     $keyNameFieldVal = 'q_' . $nameField;
                     ${$nameFieldVal} = '';
                     if (array_key_exists($keyNameField, $aGroupeFilter)) {
                         ${$nameFieldVal} = $aGroupeFilter[$keyNameField];
                     }
                     switch ($value['type']) {
                         case 'text':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->input('', $keyNameFieldVal, 'text', ${$nameFieldVal});
                             break;
                         case 'select':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->select('', $keyNameFieldVal, $value['value'], ${$nameFieldVal});
                             break;
                     }
                     $block->addContent($nameField, ${$sNameFieldVar});
                 }
                 $block->addContent('edit', '--', 'center');
                 if ($is_modules_modo) {
                     $block->addContent('delete', '--', 'center');
                 }
                 // end Seach
                 $valFilterDateStart = '';
                 if (array_key_exists('q_date_creation_start', $aGroupeFilter)) {
                     $valFilterDateStart = $aGroupeFilter['q_date_creation_start'];
                 }
                 $valFilterDateEnd = '';
                 if (array_key_exists('q_date_creation_end', $aGroupeFilter)) {
                     $valFilterDateEnd = $aGroupeFilter['q_date_creation_end'];
                 }
                 $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                 $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                 $block->addContent('date_creation', $sFilterDate, 'center');
                 if (empty($cAll)) {
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         $block->addContent($nameField, '');
                     }
                     $block->addContent('date_creation', '', 'text-center');
                     $block->addContent('edit', '', 'text-center');
                     if ($is_modules_modo) {
                         $block->addContent('delete', '', 'text-center');
                     }
                 }
                 for ($i = 0; $i < $cAll; $i++) {
                     $urlId = $all[$i]["id_content"];
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=delete&id=' . $all[$i]['id_content'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=edit&id=' . $all[$i]['id_content'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>';
                     foreach ($isFieldArray as $nameField => $value) {
                         $css = '';
                         if ($nameField === 'date_creation') {
                             $css = 'tb-30 text-center';
                             $block->addContent($nameField, GetDate::in($all[$i][$nameField], 2, $this->doorGets->myLanguage()), $css);
                         } else {
                             $all[$i][$nameField] = $this->doorGets->_truncate($all[$i][$nameField], '50');
                             $all[$i][$nameField] = $all[$i][$nameField];
                             $block->addContent($nameField, $all[$i][$nameField], $css);
                         }
                     }
                     $block->addContent('edit', $urlEdit, 'tb-30 text-center');
                     if ($is_modules_modo) {
                         $block->addContent('delete', $urlDelete, 'tb-30 text-center');
                     }
                 }
                 $formMassDelete = '';
                 $fileFormMassDelete = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_massdelete_form';
                 $tplFormMassDelete = Template::getView($fileFormMassDelete);
                 ob_start();
                 if (is_file($tplFormMassDelete)) {
                     include $tplFormMassDelete;
                 }
                 $formMassDelete = ob_get_clean();
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
             case 'delete':
                 $htmlCanotDelete = '';
                 $fileCanotDelete = 'modules/' . $this->doorGets->zoneArea() . '_canot_delete';
                 $tplCanotDelete = Template::getView($fileCanotDelete);
                 ob_start();
                 if (is_file($tplCanotDelete)) {
                     include $tplCanotDelete;
                 }
                 $htmlCanotDelete = ob_get_clean();
                 break;
             case 'edit':
                 $cVersion = $this->getCountVersion();
                 $versions = $this->getAllVersion();
                 $url = "?controller=translator&action=edit&id=" . $isContent['id_content'] . "&lg=" . $lgActuel;
                 $yesno = $this->doorGets->getArrayForms();
                 unset($yesno[0]);
                 $lgToTranslate = $lgActuel;
                 if ($lgToTranslate === 'tu') {
                     $lgToTranslate = 'tr';
                 }
                 if ($lgToTranslate === 'po') {
                     $lgToTranslate = 'pt';
                 }
                 if ($lgToTranslate === 'su') {
                     $lgToTranslate = 'sv';
                 }
                 if ($lgToTranslate === 'cn') {
                     $lgToTranslate = 'zh-CN';
                 }
                 $googleTranslateUrl = '<a href="https://translate.google.com/#fr/' . $lgToTranslate . '/' . urlencode($isContent['subject']) . '" target="blank">' . $isContent['subject'] . ' <b class="glyphicon glyphicon-share-alt"></b></a>';
                 break;
         }
         $ActionFile = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #16
0
 public function movePositionCategories($type, $table, $id, $id_parent, $pos, $max, $class = "")
 {
     $out = '';
     if (!empty($this->Form['_position_up']->i)) {
         $this->checkMode();
         $id = $this->Form['_position_up']->i['id'];
         $type = $this->Form['_position_up']->i['type'];
         $pos = $this->Form['_position_up']->i['position'];
         $id_parent = $this->Form['_position_up']->i['id_parent'];
         $posPlus = $pos + 1;
         $posMoins = $pos - 1;
         if ($pos > 1) {
             $this->dbQL("UPDATE  {$table} SET ordre = ordre + 1 WHERE id_parent = {$id_parent} AND ordre = {$posMoins} LIMIT 1");
             $this->dbQL("UPDATE  {$table} SET ordre = {$posMoins} WHERE id_parent = {$id_parent} AND   id = {$id} LIMIT 1");
             $this->clearModuleDBCache($table);
             FlashInfo::set($this->l("La position a bien été mise à jour"));
             header('Location:' . $_SERVER['REQUEST_URI']);
             exit;
         }
     }
     if (!empty($this->Form['_position_down']->i)) {
         $this->checkMode();
         $id = $this->Form['_position_down']->i['id'];
         $type = $this->Form['_position_down']->i['type'];
         $pos = $this->Form['_position_down']->i['position'];
         $id_parent = $this->Form['_position_down']->i['id_parent'];
         $posPlus = $pos + 1;
         $posMoins = $pos - 1;
         if ($pos < $max) {
             $this->dbQL("UPDATE  {$table} SET ordre = ordre - 1 WHERE id_parent = {$id_parent} AND ordre = {$posPlus} LIMIT 1");
             $this->dbQL("UPDATE  {$table} SET ordre = {$posPlus} WHERE id_parent = {$id_parent} AND id = {$id} LIMIT 1");
             $this->clearModuleDBCache($table);
             FlashInfo::set($this->l("La position a bien été mise à jour"));
             header('Location:' . $_SERVER['REQUEST_URI']);
             exit;
         }
     }
     $tpl = Template::getView('user/rubriques/user_moveposition_categories');
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #17
0
 public function getContent()
 {
     $out = '';
     $Rubriques = array('index' => 'index');
     $lgActuel = $this->doorGets->getLangueTradution();
     $groupes = $this->doorGets->loadGroupesToSelect();
     $yesno = $this->doorGets->getArrayForms();
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $tableName = $this->doorGets->Table;
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $arFilterActivation = $this->doorGets->getArrayForms('activation_mod');
                 $groupes = $this->doorGets->loadGroupesOptionToSelect($this->doorGets->Table, 'type', Constant::$widgets);
                 $isFieldArray = array("titre" => $this->doorGets->__('Titre'), "uri" => $this->doorGets->__('Clée'), "active" => $this->doorGets->__('Statut'), "type" => $this->doorGets->__('Type'));
                 $isFieldArraySearchType = array('titre' => array('type' => 'text', 'value' => ''), 'uri' => array('type' => 'text', 'value' => ''), 'type' => array('type' => 'select', 'value' => $groupes), 'active' => array('type' => 'select', 'value' => $arFilterActivation));
                 $isFieldTraductionArray = array("titre");
                 $isFieldArraySort = array('titre', 'uri', 'active', 'type');
                 $isFieldArraySearch = array('titre', 'uri', 'active', 'type');
                 $isFieldArrayDate = array();
                 $urlOrderby = '&orderby=' . $isFieldArraySort[0];
                 $urlSearchQuery = '';
                 $urlSort = '&desc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = " " . $this->doorGets->Table . "," . $this->doorGets->Table . "_traduction ";
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.id_module", 'type' => '!=!', 'value' => $this->doorGets->Table . ".id");
                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.langue", 'type' => 'like', 'value' => $lgActuel);
                 $nextCondition = ' AND (';
                 foreach (Constant::$widgets as $key => $value) {
                     $nextCondition .= ' ' . $this->doorGets->Table . ".type = '{$value}' OR ";
                 }
                 $nextCondition = substr($nextCondition, 0, -3);
                 $nextCondition .= ')';
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active') || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) {
                             if (in_array($v, $isFieldArraySort)) {
                                 if (in_array($v, $isFieldTraductionArray)) {
                                     $sqlLabelSearch .= $tableName . "_traduction." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                     $arrForCountSearchQuery[] = array('key' => $tableName . "_traduction." . $v, 'type' => 'like', 'value' => $valueQP);
                                 } else {
                                     $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                     $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                     $urlGroupBy = '&gby=' . $per;
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, $nextCondition);
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'ASC';
                 $getSort = '&desc';
                 if (isset($_GET['desc'])) {
                     $getDesc = 'DESC';
                     $getSort = '&asc';
                     $urlSort = '&desc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $tableName . '_traduction.titre  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     if (in_array($getFilter, $isFieldTraductionArray)) {
                         $outFilterORDER = $tableName . '_traduction.' . $getFilter . '  ' . $getDesc;
                     } else {
                         $outFilterORDER = $tableName . $getFilter . '  ' . $getDesc;
                     }
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE 1=1 " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} AND " . $this->doorGets->Table . ".id = " . $this->doorGets->Table . "_traduction.id_module AND langue = '{$lgActuel}' {$nextCondition} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                 // Create url to go for pagination
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 $tAll = " " . $this->doorGets->Table . ", " . $this->doorGets->Table . "_traduction";
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page=";
                 $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow();
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title text-left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title ");
                     $iPos++;
                 }
                 $block->addTitle('', 'show', 'td-title');
                 $block->addTitle('', 'edit', 'td-title');
                 $block->addTitle('', 'delete', 'td-title');
                 // Search fields
                 $outFilter = '';
                 foreach ($isFieldArraySearchType as $nameField => $value) {
                     $nameFieldVal = 'valFilter' . ucfirst($nameField);
                     $sNameFieldVar = 'sFilter' . ucfirst($nameField);
                     $keyNameField = 'q_' . $nameField;
                     $keyNameFieldVal = 'q_' . $nameField;
                     ${$nameFieldVal} = '';
                     if (array_key_exists($keyNameField, $aGroupeFilter)) {
                         ${$nameFieldVal} = $aGroupeFilter[$keyNameField];
                     }
                     switch ($value['type']) {
                         case 'text':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->input('', $keyNameFieldVal, 'text', ${$nameFieldVal});
                             break;
                         case 'select':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->select('', $keyNameFieldVal, $value['value'], ${$nameFieldVal});
                             break;
                     }
                     $block->addContent($nameField, ${$sNameFieldVar});
                 }
                 $block->addContent('show', '--', 'tb-30 text-center');
                 $block->addContent('edit', '--', 'tb-30 text-center');
                 $block->addContent('delete', '--', 'tb-30 text-center');
                 // end Seach
                 if (empty($cAll)) {
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         $block->addContent($nameField, '');
                     }
                     $block->addContent('show', '', 'text-center');
                     $block->addContent('edit', '', 'text-center');
                     $block->addContent('delete', '', 'text-center');
                 }
                 include CONFIG . 'modules.php';
                 for ($i = 0; $i < $cAll; $i++) {
                     $imageIcone = BASE_IMG . 'ico_module.png';
                     if (array_key_exists($all[$i]['type'], $listeInfos)) {
                         $imageIcone = $listeInfos[$all[$i]['type']]['image'];
                     }
                     $urlImage = '<img src="' . $imageIcone . '" class="px36"> ';
                     $urlGerer = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font" ></b></a>';
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=modules&action=delete&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=modules&action=edit' . $all[$i]['type'] . '&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog" ></b></a>';
                     $all[$i]["active"] = $all[$i]["active"] ? '<i class="fa fa-check fa-lg green-c"></i>' : '<i class="fa fa-ban fa-lg red-c"></i>';
                     $block->addContent('titre', $urlImage . $all[$i]["titre"]);
                     $block->addContent('uri', $all[$i]["uri"]);
                     $block->addContent('type', $all[$i]["type"], 'tb-70 text-center');
                     $block->addContent('active', $all[$i]["active"], 'tb-30 text-center');
                     $block->addContent('show', $urlGerer, 'text-center');
                     $block->addContent('edit', $urlEdit, 'text-center');
                     $block->addContent('delete', $urlDelete, 'text-center');
                 }
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
             case 'edit':
                 break;
         }
         $ActionFile = 'user/modules/widgets/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #18
0
<?php

require_once dirname(dirname(__FILE__)) . "/common/php/class/class.system_preference.php";
global $bdd;
global $_TABLES;
$content = "";
$view = new Template(dirname(__FILE__) . '/html/social_list.html');
if (!is_null($bdd) && !is_null($_TABLES)) {
    $objSystemPreference = new SystemPreference($bdd, $_TABLES);
    $system_preference = $objSystemPreference->getSystemPreference();
    if (!is_null($system_preference)) {
        $content = $view->getView(array("url_facebook" => $system_preference->url_facebook, "url_instagram" => $system_preference->url_instagram, "url_twitter" => $system_preference->url_twitter));
        echo $content;
    } else {
        // 404
        echo "404 Not Found";
    }
} else {
    error_log("BDD ERROR : " . json_encode($bdd));
    error_log("TABLES ERROR : " . json_encode($_TABLES));
}
Example #19
0
function search($searched = '%')
{
    global $bdd;
    global $_TABLES;
    $articlesParPage = 8;
    $content = "";
    $view = new Template(dirname(dirname(__FILE__)) . '/html/article.html');
    if (!is_null($bdd) && !is_null($_TABLES)) {
        // Pré-traitement de la data
        $sql = "";
        if ($searched !== "%") {
            $recherche = strtolower($searched);
            // on passe les mots recherchés en minuscules
            $mots = str_replace("+", " ", trim($recherche));
            // on remplace les + par des espaces
            $mots = str_replace("\"", " ", $mots);
            // on remplace les " par des espaces
            $mots = str_replace(",", " ", $mots);
            // on remplace les , par des espaces
            $mots = str_replace(":", " ", $mots);
            // on remplace les : par des espaces
            $tab = explode(" ", $mots);
            // on place les differents mots dans un tableau
            $nb = count($tab);
            $sql = "I.title LIKE \"%{$tab['0']}%\" OR I.description LIKE \"%{$tab['0']}%\" ";
            //on prépare la requête SQL.
            for ($i = 1; $i < $nb; $i++) {
                $sql .= "OR I.title LIKE \"%{$tab[$i]}%\"  OR I.description LIKE \"%{$tab[$i]}%\" ";
                // on boucle pour integrer tous les mots dans la requête
            }
        } else {
            $sql = "I.title LIKE '%{$search}%' OR I.description LIKE '%{$search}%'";
        }
        // Preparation de la pagination
        $objSearch = new Search($bdd, $_TABLES);
        $articles = $objSearch->getSearch($sql);
        $total = count($articles);
        $nombreDePages = ceil($total / $articlesParPage);
        $pageCourante = 1;
        // Stockage en session des informations de pagination
        if (!isset($_SESSION['pageCourante'])) {
            $_SESSION['pageCourante'] = $pageCourante;
        } else {
            $pageCourante = $_SESSION['pageCourante'];
            if ($pageCourante > $nombreDePages) {
                $pageCourante = $nombreDePages;
            }
            if ($pageCourante < 1) {
                $pageCourante = 1;
            }
            $_SESSION['pageCourante'] = $pageCourante;
        }
        $start = ($pageCourante - 1) * $articlesParPage;
        $limit = $articlesParPage;
        // Recherche
        $articles = $objSearch->getSearchWithLimit($sql, $start, $limit);
        if (!is_null($articles)) {
            foreach ($articles as $key => $value) {
                $temp_subscription = '';
                if (isset($_SESSION['user_auth']) && $_SESSION['user_auth'] == '1' && isset($_SESSION['user_subscription'])) {
                    if (in_array($value->website_id, $_SESSION['user_subscription'])) {
                        $temp_subscription = "<div class='unsubscription' website_id='%%website_id%%'></div>";
                    } else {
                        $temp_subscription = "<div class='subscription' website_id='%%website_id%%'></div>";
                    }
                }
                $content .= $view->getView(array("url" => '/to/' . $value->guid . '#' . $value->url, "title" => $value->title, "width_image" => $value->width_image, "height_image" => $value->height_image, "image" => $value->image, "alt_image" => $value->alt_image, "description" => $value->description, "logo_site" => $value->logo, "alt_logo_site" => $value->website, "title_site" => $value->website, "subscription" => $temp_subscription, "website_id" => $value->website_id));
            }
            $content .= '<br/><br/><div class="row"><p class="col-xs-12" align="center">Page : ';
            //Pour l'affichage, on centre la liste des pages
            for ($i = 1; $i <= $nombreDePages; $i++) {
                //On va faire notre condition
                if ($i == $pageCourante) {
                    $content .= " [ {$i} ] ";
                } else {
                    $content .= " <span class='pagination-search' nbpage='{$i}'>{$i}</span> ";
                }
            }
            $content .= '</p></div>';
            return $content;
        } else {
            // 404
            return "404 Not Found";
        }
    } else {
        error_log("BDD ERROR : " . json_encode($bdd));
        error_log("TABLES ERROR : " . json_encode($_TABLES));
    }
}
 public function getContent()
 {
     $out = '';
     $User = $this->doorGets->user;
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $isVersionActive = false;
     $version_id = 0;
     // Check if is content modo
     $is_modo = in_array($moduleInfos['id'], $User['liste_module_modo']) ? true : false;
     // Check if is content admin
     $is_admin = in_array($moduleInfos['id'], $User['liste_module_admin']) ? true : false;
     // Check if is module modo
     in_array('module', $User['liste_module_interne']) && in_array('module_' . $moduleInfos['type'], $User['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     // check if user can edit content
     $user_can_add = in_array($moduleInfos['id'], $User['liste_module_add']) ? true : false;
     // check if user can edit content
     $user_can_edit = in_array($moduleInfos['id'], $User['liste_module_edit']) ? true : false;
     // check if user can delete content
     $user_can_delete = in_array($moduleInfos['id'], $User['liste_module_delete']) ? true : false;
     // Init count total contents
     $countContents = 0;
     $arrForCountSearchQuery[] = array('key' => "id_user", 'type' => '=', 'value' => $User['id']);
     $countContents = $this->doorGets->getCountTable($this->doorGets->Table, $arrForCountSearchQuery);
     // Check limit to add content
     $isLimited = 0;
     if (array_key_exists($moduleInfos['id'], $User['liste_module_limit']) && $User['liste_module_limit'] !== '0') {
         $isLimited = (int) $User['liste_module_limit'][$moduleInfos['id']];
     }
     $listeCategories = $this->doorGets->categorieSimple_;
     unset($listeCategories[0]);
     $aActivation = $this->doorGets->getArrayForms('activation');
     $Rubriques = array('index' => $this->doorGets->__('Index'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'), 'massdelete' => $this->doorGets->__('Supprimer par groupe'));
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, $this->doorGets->Table);
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $isContent = array_merge($isContent, $isContentTraduction);
                     $this->isContent = $isContent;
                 }
             }
             $idNextContent = $this->doorGets->getIdContentPosition($isContent['id_content']);
             $idPreviousContent = $this->doorGets->getIdContentPosition($isContent['id_content'], 'prev');
             $urlPrevious = '';
             if (!empty($idPreviousContent)) {
                 $urlPrevious = '?controller=' . $this->doorGets->controllerNameNow() . '&uri=' . $this->doorGets->Uri . '&action=edit&id=' . $idPreviousContent . '&lg=' . $lgActuel;
             }
             $urlNext = '';
             if (!empty($idNextContent)) {
                 $urlNext = '?controller=' . $this->doorGets->controllerNameNow() . '&uri=' . $this->doorGets->Uri . '&action=edit&id=' . $idNextContent . '&lg=' . $lgActuel;
             }
         }
     }
     if (array_key_exists('version', $params['GET']) && $is_modo) {
         $version_id = $params['GET']['version'];
         $isContentVesion = $this->getVersionById($version_id, $isContent);
         if (!empty($isContentVesion)) {
             $isContent = array_merge($isContent, $isContentVesion);
             $isVersionActive = true;
         }
     }
     $fileIndexTop = 'modules/' . $this->doorGets->zoneArea() . '_index_top';
     $tplIndexTop = Template::getView($fileIndexTop);
     ob_start();
     if (is_file($tplIndexTop)) {
         include $tplIndexTop;
     }
     $htmlIndexTop = ob_get_clean();
     $fileCategoryLeft = 'modules/' . $this->doorGets->zoneArea() . '_category_left';
     $tplCategoryLeft = Template::getView($fileCategoryLeft);
     ob_start();
     if (is_file($tplCategoryLeft)) {
         include $tplCategoryLeft;
     }
     $htmlCategoryLeft = ob_get_clean();
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 if (!empty($this->doorGets->Uri) && !empty($this->doorGets->Table)) {
                     $q = '';
                     $urlSearchQuery = '';
                     $p = 1;
                     $ini = 0;
                     $per = 10;
                     $params = $this->doorGets->Params();
                     $lgActuel = $this->doorGets->getLangueTradution();
                     $isFieldArray = array("titre" => $this->doorGets->__('Titre'), "active" => $this->doorGets->__('Statut'), "pseudo" => $this->doorGets->__('Pseudo'), "date_creation" => $this->doorGets->__('Date'));
                     $isFieldArraySort = array('ordre', 'active', 'titre', 'pseudo', 'date_creation');
                     $isInClassicTable = array('ordre', 'active', 'pseudo');
                     $isFieldArraySearch = array('titre', 'active', 'pseudo', 'date_creation_start', 'date_creation_end');
                     $isFieldArrayDate = array('date_creation');
                     if ($is_modo && $is_modules_modo) {
                         $isFieldArray["ordre"] = $this->doorGets->__('Position');
                     }
                     $urlOrderby = '&orderby=' . $isFieldArraySort[0];
                     $urlSearchQuery = '';
                     $urlSort = '&desc';
                     $urlLg = '&lg=' . $lgActuel;
                     $urlCategorie = '';
                     $urlGroupBy = '&gby=' . $per;
                     // Init table query
                     $tAll = $this->doorGets->Table . " , " . $this->doorGets->Table . "_traduction ";
                     // Create query search for mysql
                     $sqlLabelSearch = '';
                     $arrForCountSearchQuery = array();
                     $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.id_content", 'type' => '!=!', 'value' => $this->doorGets->Table . ".id");
                     $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.langue", 'type' => '=', 'value' => $lgActuel);
                     // Check if is not modo
                     if (!$is_modo) {
                         $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . ".id_user", 'type' => '=', 'value' => $User['id']);
                     }
                     $sqlUserOther = '';
                     if ($is_modo) {
                         if (!empty($User['liste_enfant'])) {
                             $sqlUserOther .= " AND ( ( " . $this->doorGets->Table . ".id_user = '******'id'] . "' AND " . $this->doorGets->Table . ".id_groupe = '" . $User['groupe'] . "' ) ";
                             foreach ($User['liste_enfant'] as $id_groupe) {
                                 $sqlUserOther .= " OR " . $this->doorGets->Table . ".id_groupe = '" . $id_groupe . "' ";
                             }
                             $sqlUserOther .= ')';
                         }
                     } else {
                         $sqlUserOther = " AND " . $this->doorGets->Table . ".id_user = '******'id'] . "' AND " . $this->doorGets->Table . ".id_groupe = '" . $User['groupe'] . "' ";
                     }
                     // Init Query Search
                     $aGroupeFilter = array();
                     if (!empty($isFieldArraySearch)) {
                         // Récupére les paramêtres du get et post pour la recherche par filtre
                         foreach ($isFieldArraySearch as $v) {
                             $valueQP = '';
                             if (array_key_exists('q_' . $v, $params['GET']) && !empty($params['GET']['q_' . $v])) {
                                 $valueQP = trim($params['GET']['q_' . $v]);
                                 $aGroupeFilter['q_' . $v] = $valueQP;
                             }
                             if (array_key_exists('q_' . $v, $params['POST']) && !array_key_exists('q_' . $v, $params['GET']) && !empty($params['POST']['q_' . $v])) {
                                 $valueQP = trim($params['POST']['q_' . $v]);
                                 $aGroupeFilter['q_' . $v] = $valueQP;
                             }
                             if (array_key_exists('q_' . $v, $params['GET']) && !empty($params['GET']['q_' . $v]) || array_key_exists('q_' . $v, $params['POST']) && !array_key_exists('q_' . $v, $params['GET']) && !empty($params['POST']['q_' . $v])) {
                                 if (!empty($valueQP)) {
                                     $valEnd = str_replace('_start', '', $v);
                                     $valEnd = str_replace('_end', '', $v);
                                     if (in_array($valEnd, $isFieldArrayDate)) {
                                         if (array_key_exists('q_' . $v, $params['GET']) && !empty($params['GET']['q_' . $v])) {
                                             $fromFormat = trim($params['GET']['q_' . $valEnd . '_start']);
                                             $toFormat = trim($params['GET']['q_' . $valEnd . '_end']);
                                         } else {
                                             $fromFormat = trim($params['POST']['q_' . $valEnd . '_start']);
                                             $toFormat = trim($params['POST']['q_' . $valEnd . '_end']);
                                         }
                                         $isValStart = $this->doorGets->validateDate($fromFormat);
                                         $isValEnd = $this->doorGets->validateDate($toFormat);
                                         $from = "";
                                         $to = "";
                                         if ($isValStart && $isValEnd) {
                                             if (!empty($fromFormat)) {
                                                 $from = strtotime($fromFormat);
                                             }
                                             if (!empty($toFormat)) {
                                                 $to = strtotime($toFormat);
                                                 $to = $to + 60 * 60 * 24;
                                             }
                                             if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                                 $valEnd = filter_var($valEnd, FILTER_SANITIZE_STRING);
                                                 $nameTable = $tableName . "." . $valEnd;
                                                 $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                                 $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                                 $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                                 $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                                 $urlSearchQuery .= '&q_' . $valEnd . '_end=' . $toFormat;
                                             }
                                         }
                                     } else {
                                         if (in_array($v, $isInClassicTable)) {
                                             $sqlLabelSearch .= $this->doorGets->Table . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                         } elseif (in_array($v, $isFieldArraySort)) {
                                             $sqlLabelSearch .= $this->doorGets->Table . "_traduction." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             if ($v === 'pseudo') {
                                                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                             } else {
                                                 $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction." . $v, 'type' => 'like', 'value' => $valueQP);
                                             }
                                         }
                                         $urlSearchQuery .= '&q_' . $valEnd . '=' . $valueQP;
                                     }
                                 }
                             }
                         }
                         // préparation de la requête mysql
                         if (!empty($sqlLabelSearch)) {
                             $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                             $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                         }
                     }
                     // Init Group By
                     if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                         $per = $params['GET']['gby'];
                         $urlGroupBy = '&gby=' . $per;
                     }
                     // Init count total fields
                     $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery);
                     // Init categorie
                     $sqlCategorie = '';
                     if (array_key_exists('categorie', $params['GET']) && !empty($params['GET']['categorie']) && array_key_exists($params['GET']['categorie'], $this->doorGets->categorieSimple)) {
                         $getCategorie = $params['GET']['categorie'];
                         $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '.categorie', 'type' => 'like', 'value' => '#' . $getCategorie . ',');
                         $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery);
                         $sqlCategorie = " AND " . $this->doorGets->Table . ".categorie LIKE '%#" . $getCategorie . ",%'";
                         $urlCategorie = '&categorie=' . $getCategorie;
                     }
                     // Init sort
                     $getDesc = 'DESC';
                     $getSort = '&asc';
                     if (isset($_GET['asc'])) {
                         $getDesc = 'ASC';
                         $getSort = '&desc';
                         $urlSort = '&asc';
                     }
                     // Init filter for order by
                     $outFilterORDER = $this->doorGets->Table . '_traduction.date_modification  ' . $getDesc;
                     $getFilter = '';
                     if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                         $getFilter = $params['GET']['orderby'];
                         $outFilterORDER = $this->doorGets->Table . '_traduction.' . $getFilter . '  ' . $getDesc;
                         // Execption for field that not in traduction table
                         if (in_array($getFilter, $isInClassicTable)) {
                             $outFilterORDER = $this->doorGets->Table . '.' . $getFilter . '  ' . $getDesc;
                         }
                         $urlOrderby = '&orderby=' . $getFilter;
                     }
                     // Init page position
                     if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                         $p = $params['GET']['page'];
                         $ini = $p * $per - $per;
                     }
                     $finalPer = $ini + $per;
                     if ($finalPer > $cResultsInt) {
                         $finalPer = $cResultsInt;
                     }
                     // Create sql query for transaction
                     $outSqlGroupe = " WHERE " . $this->doorGets->Table . "_traduction.id_content = " . $this->doorGets->Table . ".id\n                        AND " . $this->doorGets->Table . "_traduction.langue = '" . $lgActuel . "' " . $sqlCategorie . " " . $sqlUserOther . " " . $sqlLabelSearch;
                     $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                     // Create url to go for pagination
                     $urlPage = "./?controller=module" . $moduleInfos['type'] . "&uri=" . $this->doorGets->Uri . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                     $urlPagePosition = "./?controller=module" . $moduleInfos['type'] . "&uri=" . $this->doorGets->Uri . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                     // Generate the pagination system
                     $valPage = '';
                     if ($cResultsInt > $per) {
                         $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                     }
                     // Select all contents / Query SQL
                     $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                     $cAll = count($all);
                     /**********
                      *
                      *  Start block creation for listing fields
                      * 
                      **********/
                     $block = new BlockTable();
                     $imgTop = '<div class="d-top"></div>';
                     $imgBottom = '<div class="d-bottom"></div>';
                     $block->setClassCss('doorgets-listing');
                     $iPos = 0;
                     $dgSelMass = '';
                     $urlPage = "./?controller=module" . $moduleInfos['type'] . "&uri=" . $this->doorGets->Uri . $urlCategorie . "&lg={$lgActuel}&page=";
                     $urlPageGo = './?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . $urlCategorie . '&lg=' . $lgActuel;
                     //$block->addTitle($dgSelMass,'sel_mass','td-title');
                     foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                         $_css = '_css_' . $fieldName;
                         $_img = '_img_' . $fieldName;
                         $_desc = '_desc_' . $fieldName;
                         ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                         if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) {
                             ${$_css} = ' class="green" ';
                             ${$_img} = $imgTop;
                             ${$_desc} = $getSort;
                             if ($getDesc === 'ASC') {
                                 ${$_img} = $imgBottom;
                                 ${$_desc} = '';
                             }
                         }
                         if ($iPos === 0) {
                             $leftFirst = 'first-title left';
                         }
                         $dgLabel = $fieldNameLabel;
                         if (in_array($fieldName, $isFieldArraySort)) {
                             $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                         }
                         $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title text-center");
                         $iPos++;
                     }
                     if ($getFilter === 'ordre' && empty($urlCategorie) && $is_modo && $is_modules_modo) {
                         $block->addTitle('', 'topup', 'td-title');
                         $block->addTitle('', 'topbottom', 'td-title');
                     }
                     $block->addTitle('', 'edit', 'td-title');
                     $block->addTitle('', 'delete', 'td-title');
                     $arFilterActivation = $this->doorGets->getArrayForms('activation');
                     $valFilterTitre = '';
                     if (array_key_exists('q_titre', $aGroupeFilter)) {
                         $valFilterTitre = $aGroupeFilter['q_titre'];
                     }
                     $valFilterPseudo = '';
                     if (array_key_exists('q_pseudo', $aGroupeFilter)) {
                         $valFilterPseudo = $aGroupeFilter['q_pseudo'];
                     }
                     $valFilterActive = 0;
                     if (array_key_exists('q_active', $aGroupeFilter)) {
                         $valFilterActive = $aGroupeFilter['q_active'];
                     }
                     $valFilterDateStart = '';
                     if (array_key_exists('q_date_creation_start', $aGroupeFilter)) {
                         $valFilterDateStart = $aGroupeFilter['q_date_creation_start'];
                     }
                     $valFilterDateEnd = '';
                     if (array_key_exists('q_date_creation_end', $aGroupeFilter)) {
                         $valFilterDateEnd = $aGroupeFilter['q_date_creation_end'];
                     }
                     $sFilterActive = $this->doorGets->Form['_search_filter']->select('', 'q_active', $arFilterActivation, $valFilterActive);
                     $sFilterTitre = $this->doorGets->Form['_search_filter']->input('', 'q_titre', 'text', $valFilterTitre);
                     $sFilterPseudo = $this->doorGets->Form['_search_filter']->input('', 'q_pseudo', 'text', $valFilterPseudo);
                     $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                     $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                     // Search
                     $urlMassdelete = '<input type="checkbox" class="check-me-mass-all" />';
                     $urlMassdelete = '';
                     //$block->addContent('sel_mass',$urlMassdelete );
                     $block->addContent('titre', $sFilterTitre);
                     $block->addContent('active', $sFilterActive, 'text-center');
                     $block->addContent('pseudo', $sFilterPseudo, 'text-center');
                     $block->addContent('date_creation', $sFilterDate, 'text-center');
                     if ($is_modo && $is_modules_modo) {
                         $block->addContent('ordre', '--', 'text-center');
                     }
                     if ($getFilter === 'ordre' && empty($urlCategorie) && $is_modo && $is_modules_modo) {
                         $block->addContent('topbottom', '--', 'text-center');
                         $block->addContent('topup', '--', 'text-center');
                     }
                     $block->addContent('edit', '--', 'text-center');
                     $block->addContent('delete', '--', 'text-center');
                     // end Seach
                     if (empty($cAll)) {
                         //$block->addContent('sel_mass','' );
                         $block->addContent('titre', '');
                         $block->addContent('active', '', 'center');
                         $block->addContent('pseudo', '', 'center');
                         $block->addContent('date_creation', '', 'center');
                         if ($is_modo && $is_modules_modo) {
                             $block->addContent('ordre', '', 'center');
                         }
                         if ($getFilter === 'ordre' && empty($urlCategorie) && $is_modo && $is_modules_modo) {
                             $block->addContent('topbottom', '--', 'center');
                             $block->addContent('topup', '--', 'center');
                         }
                         $block->addContent('edit', '', 'center');
                         $block->addContent('delete', '', 'center');
                     }
                     for ($i = 0; $i < $cAll; $i++) {
                         $ImageStatut = 'fa-ban red';
                         if ($all[$i]['active'] == '2') {
                             $ImageStatut = 'fa-eye green-c';
                         } elseif ($all[$i]['active'] == '3') {
                             $ImageStatut = 'fa-hourglass-start orange-c';
                         } elseif ($all[$i]['active'] == '4') {
                             $ImageStatut = 'fa-pencil gris-c';
                         }
                         $urlStatut = '<i class="fa ' . $ImageStatut . ' fa-lg" ></i>';
                         $urlMassdelete = $all[$i]['id_content'];
                         $urlTitle = $all[$i]["titre"];
                         $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&action=delete&id=' . $all[$i]['id_content'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                         $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&action=edit&id=' . $all[$i]['id_content'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>';
                         $urlMovedown = '';
                         if ($all[$i]['ordre'] != $cResultsInt) {
                             $urlMovedown = $this->doorGets->movePosition('down', $this->doorGets->Table, $all[$i]['id_content'], $all[$i]['ordre'], $cResultsInt);
                         }
                         $urlMoveup = '';
                         if ($all[$i]['ordre'] != 1) {
                             $urlMoveup = $this->doorGets->movePosition('up', $this->doorGets->Table, $all[$i]['id_content'], $all[$i]['ordre'], $cResultsInt);
                         }
                         $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage());
                         //$block->addContent('sel_mass',$urlMassdelete ,'tb-30');
                         $block->addContent('titre', $urlTitle);
                         $block->addContent('active', $urlStatut, 'tb-150 text-center');
                         $block->addContent('pseudo', $all[$i]['pseudo'], 'tb-150 text-center');
                         $block->addContent('date_creation', $dateCreation, 'tb-150 text-center');
                         if ($is_modo && $is_modules_modo) {
                             $block->addContent('ordre', $all[$i]["ordre"], 'tb-30 text-center');
                         }
                         if ($getFilter === 'ordre' && empty($urlCategorie)) {
                             $block->addContent('topbottom', $urlMovedown, 'tb-30 text-center');
                             $block->addContent('topup', $urlMoveup, 'tb-30 text-center');
                         }
                         $block->addContent('edit', $urlEdit, 'tb-30 text-center');
                         $block->addContent('delete', $urlDelete, 'tb-30 text-center');
                     }
                     $fileSearchTop = 'modules/' . $this->doorGets->zoneArea() . '_search_top';
                     $tplSearchTop = Template::getView($fileSearchTop);
                     ob_start();
                     if (is_file($tplSearchTop)) {
                         include $tplSearchTop;
                     }
                     $htmlSearchTop = ob_get_clean();
                     /**********
                      *
                      *  End block creation for listing fields
                      * 
                      */
                 }
                 break;
             case 'add':
                 if ($isLimited && $countContents >= $isLimited) {
                     $fileLimited = 'modules/' . $this->doorGets->zoneArea() . '_limited';
                     $tplLimited = Template::getView($fileLimited);
                     ob_start();
                     if (is_file($tplLimited)) {
                         include $tplLimited;
                     }
                     $htmlLimited = ob_get_clean();
                     return $htmlLimited;
                 }
                 unset($aActivation[3]);
                 $isAuthorBadge = '';
                 if ($moduleInfos['author_badge']) {
                     $isAuthorBadge = 'checked';
                 }
                 $listeCategories = $this->doorGets->categorieSimple;
                 unset($listeCategories[0]);
                 $formAddTop = $formAddBottom = '';
                 $fileFormAddTop = 'modules/' . $this->doorGets->zoneArea() . '_form_add_top';
                 $tplFormAddTop = Template::getView($fileFormAddTop);
                 ob_start();
                 if (is_file($tplFormAddTop)) {
                     include $tplFormAddTop;
                 }
                 $formAddTop = ob_get_clean();
                 $formAddTopExtra = $formAddBottomExtra = '';
                 $fileFormAddTopExtra = 'modules/' . $this->doorGets->zoneArea() . '_form_add_top_extra';
                 $tplFormAddTopExtra = Template::getView($fileFormAddTopExtra);
                 ob_start();
                 if (is_file($tplFormAddTopExtra)) {
                     include $tplFormAddTopExtra;
                 }
                 $formAddTopExtra = ob_get_clean();
                 $fileAddTop = 'modules/' . $this->doorGets->zoneArea() . '_add_top';
                 $tplAddTop = Template::getView($fileAddTop);
                 ob_start();
                 if (is_file($tplAddTop)) {
                     include $tplAddTop;
                 }
                 $htmlAddTop = ob_get_clean();
                 $fileFormAddBottom = 'modules/' . $this->doorGets->zoneArea() . '_form_add_bottom';
                 $tplFormAddBottom = Template::getView($fileFormAddBottom);
                 ob_start();
                 if (is_file($tplFormAddBottom)) {
                     include $tplFormAddBottom;
                 }
                 $formAddBottom = ob_get_clean();
                 $fileFormAddBottomExtra = 'modules/' . $this->doorGets->zoneArea() . '_form_add_bottom_extra';
                 $tplFormAddBottomExtra = Template::getView($fileFormAddBottomExtra);
                 ob_start();
                 if (is_file($tplFormAddBottomExtra)) {
                     include $tplFormAddBottomExtra;
                 }
                 $formAddBottomExtra = ob_get_clean();
                 break;
             case 'edit':
                 $isActiveContent = $isActiveComments = $isActiveEmail = '';
                 $isAuthorBadge = $isActivePartage = $isActiveFacebook = $isActiveDisqus = $isActiveRss = '';
                 if (!empty($isContent['active'])) {
                     $isActiveContent = 'checked';
                 }
                 if (!empty($isContent['author_badge'])) {
                     $isAuthorBadge = 'checked';
                 }
                 if (!empty($isContent['comments'])) {
                     $isActiveComments = 'checked';
                 }
                 if (!empty($isContent['partage'])) {
                     $isActivePartage = 'checked';
                 }
                 if (!empty($isContent['mailsender'])) {
                     $isActiveEmail = 'checked';
                 }
                 if (!empty($isContent['facebook'])) {
                     $isActiveFacebook = 'checked';
                 }
                 if (!empty($isContent['in_rss'])) {
                     $isActiveRss = 'checked';
                 }
                 if (!empty($isContent['disqus'])) {
                     $isActiveDisqus = 'checked';
                 }
                 if (!empty($isContent) && in_array($moduleInfos['type'], Constant::$modulesWithGallery)) {
                     $image_gallery = $this->doorGets->_toArray($isContent['image_gallery'], ';');
                 }
                 $listeCategories = $this->doorGets->categorieSimple;
                 unset($listeCategories[0]);
                 $listeCategoriesContent = $this->doorGets->_toArray($isContent['categorie']);
                 $phpOpen = '[[php/o]]';
                 $phpClose = '[[php/c]]';
                 $article = $this->doorGets->_cleanPHP($isContent['article_tinymce']);
                 $htmlCanotEdit = '';
                 $fileCanotEdit = 'modules/' . $this->doorGets->zoneArea() . '_canot_edit';
                 $tplCanotEdit = Template::getView($fileCanotEdit);
                 ob_start();
                 if (is_file($tplCanotEdit)) {
                     include $tplCanotEdit;
                 }
                 $htmlCanotEdit = ob_get_clean();
                 $formEditTop = $formEditBottom = '';
                 $fileFormEditTop = 'modules/' . $this->doorGets->zoneArea() . '_form_edit_top';
                 $tplFormEditTop = Template::getView($fileFormEditTop);
                 ob_start();
                 if (is_file($tplFormEditTop)) {
                     include $tplFormEditTop;
                 }
                 $formEditTop = ob_get_clean();
                 $fileFormEditBottom = 'modules/' . $this->doorGets->zoneArea() . '_form_edit_bottom';
                 $tplFormEditBottom = Template::getView($fileFormEditBottom);
                 ob_start();
                 if (is_file($tplFormEditBottom)) {
                     include $tplFormEditBottom;
                 }
                 $formEditBottom = ob_get_clean();
                 $formEditTopExtra = $formEditBottomExtra = '';
                 $fileFormEditTopExtra = 'modules/' . $this->doorGets->zoneArea() . '_form_edit_top_extra';
                 $tplFormEditTopExtra = Template::getView($fileFormEditTopExtra);
                 ob_start();
                 if (is_file($tplFormEditTopExtra)) {
                     include $tplFormEditTopExtra;
                 }
                 $formEditTopExtra = ob_get_clean();
                 $fileFormEditBottomExtra = 'modules/' . $this->doorGets->zoneArea() . '_form_edit_bottom_extra';
                 $tplFormEditBottomExtra = Template::getView($fileFormEditBottomExtra);
                 ob_start();
                 if (is_file($tplFormEditBottomExtra)) {
                     include $tplFormEditBottomExtra;
                 }
                 $formEditBottomExtra = ob_get_clean();
                 $fileEditTop = 'modules/' . $this->doorGets->zoneArea() . '_edit_top';
                 $tplEditTop = Template::getView($fileEditTop);
                 ob_start();
                 if (is_file($tplEditTop)) {
                     include $tplEditTop;
                 }
                 $htmlEditTop = ob_get_clean();
                 break;
             case 'delete':
                 $htmlCanotDelete = '';
                 $fileCanotDelete = 'modules/' . $this->doorGets->zoneArea() . '_canot_delete';
                 $tplCanotDelete = Template::getView($fileCanotDelete);
                 ob_start();
                 if (is_file($tplCanotDelete)) {
                     include $tplCanotDelete;
                 }
                 $htmlCanotDelete = ob_get_clean();
                 $formDelete = '';
                 $fileFormDelete = 'modules/' . $this->doorGets->zoneArea() . '_form_delete';
                 $tplFormDelete = Template::getView($fileFormDelete);
                 ob_start();
                 if (is_file($tplFormDelete)) {
                     include $tplFormDelete;
                 }
                 $formDelete = ob_get_clean();
                 break;
         }
         $ActionFile = 'modules/' . $this->doorGets->controllerNameNow() . '/' . $this->doorGets->zoneArea() . '_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #21
0
 public function getContent()
 {
     $out = '';
     $tableName = '_dg_newsletter';
     $Rubriques = array('index' => $this->doorGets->__('Contact'), 'add' => $this->doorGets->__('Ajouter un contact'), 'edit' => $this->doorGets->__('Editer un contact'), 'delete' => $this->doorGets->__('Supprimer un contact'), 'massdelete' => $this->doorGets->__('Suppression par groupe'));
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, $tableName);
         if (empty($isContent)) {
             return NULL;
         }
     }
     $groupes = $this->doorGets->loadGroupesToSelect();
     $aUsersActivation = $this->doorGets->getArrayForms('users_activation');
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $isFieldArray = array("nom" => $this->doorGets->__('Nom'), "email" => $this->doorGets->__('E-Mail'), "date_creation" => $this->doorGets->__('Date'));
                 $isFieldArraySort = array('nom', 'email', 'date_creation');
                 $isFieldArraySearch = array('nom', 'email', 'date_creation_start', 'date_creation_end');
                 $isFieldArrayDate = array('date_creation');
                 $urlOrderby = '&orderby=' . $isFieldArraySort[0];
                 $urlSearchQuery = '';
                 $urlSort = '&desc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = " _dg_newsletter ";
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v]) || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             if (!empty($valueQP)) {
                                 $valEnd = str_replace('_start', '', $v);
                                 $valEnd = str_replace('_end', '', $v);
                                 if (in_array($valEnd, $isFieldArrayDate)) {
                                     if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                                         $fromFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     } else {
                                         $fromFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     }
                                     if (!empty($fromFormat)) {
                                         $from = strtotime($fromFormat);
                                     }
                                     if (!empty($toFormat)) {
                                         $to = strtotime($toFormat);
                                         $to = $to + 60 * 60 * 24;
                                     }
                                     if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                         $nameTable = $tableName . "." . $valEnd;
                                         $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                         $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                         $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_start=' . $fromFormat;
                                         //$urlSearchQuery .= '&doorGets_search_filter_q_'.$valEnd.'_end='.$toFormat;
                                     }
                                 } else {
                                     if (in_array($v, $isFieldArraySort)) {
                                         $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                         $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                     }
                                     $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP;
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                     $urlGroupBy = '&gby=' . $per;
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery);
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'DESC';
                 $getSort = '&asc';
                 if (isset($_GET['asc'])) {
                     $getDesc = 'ASC';
                     $getSort = '&desc';
                     $urlSort = '&asc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $tableName . '.date_creation  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     $outFilterORDER = $tableName . '.' . $getFilter . '  ' . $getDesc;
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE 1=1 " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $finalPer;
                 // Create url to go for pagination
                 $urlPage = "./?controller=emailing" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=emailing" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=emailing&page=";
                 $urlPageGo = './?controller=emailing';
                 $block->addTitle($dgSelMass, 'sel_mass', 'td-title');
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title center");
                     $iPos++;
                 }
                 $block->addTitle('', 'edit', 'td-title');
                 $block->addTitle('', 'delete', 'td-title');
                 $arFilterActivation = $this->doorGets->getArrayForms('activation');
                 $valFilterNom = '';
                 if (array_key_exists('doorGets_search_filter_q_nom', $aGroupeFilter)) {
                     $valFilterNom = $aGroupeFilter['q_nom'];
                 }
                 $valFilterEmail = '';
                 if (array_key_exists('doorGets_search_filter_q_email', $aGroupeFilter)) {
                     $valFilterEmail = $aGroupeFilter['q_email'];
                 }
                 $valFilterActive = 0;
                 if (array_key_exists('doorGets_search_filter_q_active', $aGroupeFilter)) {
                     $valFilterActive = $aGroupeFilter['q_active'];
                 }
                 $valFilterGroupe = 0;
                 if (array_key_exists('doorGets_search_filter_q_network', $aGroupeFilter)) {
                     $valFilterGroupe = $aGroupeFilter['q_network'];
                 }
                 $valFilterDateStart = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_start', $aGroupeFilter)) {
                     $valFilterDateStart = $aGroupeFilter['q_date_creation_start'];
                 }
                 $valFilterDateEnd = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_end', $aGroupeFilter)) {
                     $valFilterDateEnd = $aGroupeFilter['q_date_creation_end'];
                 }
                 $sFilterActive = $this->doorGets->Form['_search_filter']->select('', 'q_active', $arFilterActivation, $valFilterActive);
                 $sFilterNom = $this->doorGets->Form['_search_filter']->input('', 'q_nom', 'text', $valFilterNom);
                 $sFilterEmail = $this->doorGets->Form['_search_filter']->input('', 'q_email', 'text', $valFilterEmail);
                 $sFilterGroupe = $this->doorGets->Form['_search_filter']->select('', 'q_network', $groupes, $valFilterGroupe);
                 $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                 $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                 // Search
                 $urlMassdelete = '<input type="checkbox" class="check-me-mass-all" />';
                 $urlMassdelete = '';
                 $block->addContent('sel_mass', $urlMassdelete);
                 $block->addContent('nom', $sFilterNom);
                 $block->addContent('email', $sFilterEmail);
                 $block->addContent('date_creation', $sFilterDate, 'center');
                 $block->addContent('edit', '--', 'center');
                 $block->addContent('delete', '--', 'center');
                 // end Seach
                 if (empty($cAll)) {
                     $block->addContent('sel_mass', '');
                     $block->addContent('nom', '');
                     $block->addContent('email', '');
                     $block->addContent('date_creation', '', 'center');
                     $block->addContent('edit', '', 'center');
                     $block->addContent('delete', '', 'center');
                 }
                 for ($i = 0; $i < $cAll; $i++) {
                     $ImageStatut = BASE_IMG . 'puce-rouge.png';
                     if ($all[$i]['newsletter'] == '1') {
                         $ImageStatut = BASE_IMG . 'puce-verte.png';
                     }
                     $urlStatut = '<img src="' . $ImageStatut . '" style="vertical-align: middle;" >';
                     $urlMassdelete = '<input id="' . $all[$i]["id"] . '" type="checkbox" class="check-me-mass" >';
                     $urlNom = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=emailing&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["nom"] . '</a>';
                     $urlEmail = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=emailing&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["email"] . '</a>';
                     $urlGroupe = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=emailing&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["id_groupe"] . '</a>';
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=emailing&action=delete&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=emailing&action=edit&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>';
                     $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage());
                     $block->addContent('sel_mass', $urlMassdelete);
                     $block->addContent('nom', $urlNom);
                     $block->addContent('email', $urlEmail);
                     $block->addContent('date_creation', $dateCreation, 'center');
                     $block->addContent('edit', $urlEdit, 'tb-30 center');
                     $block->addContent('delete', $urlDelete, 'tb-30 center');
                 }
                 $formMassDelete = '';
                 $fileFormMassDelete = 'user/emailing/user_emailing_massdelete_form';
                 $tplFormMassDelete = Template::getView($fileFormMassDelete);
                 ob_start();
                 if (is_file($tplFormMassDelete)) {
                     include $tplFormMassDelete;
                 }
                 $formMassDelete = ob_get_clean();
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
             case 'massdelete':
                 $varListeFile = '';
                 $cListe = 0;
                 if (array_key_exists('emailing_massdelete_groupe_delete', $params['POST'])) {
                     $varListeFile = $params['POST']['emailing_massdelete_groupe_delete'];
                     $ListeForDeleted = $this->doorGets->_toArray($varListeFile);
                     $cListe = count($ListeForDeleted);
                 }
                 $formMassDeleteIndex = '';
                 $fileFormMassDeleteIndex = 'user/users/user_emailing_massdelete';
                 $tplFormMassDeleteIndex = Template::getView($fileFormMassDeleteIndex);
                 ob_start();
                 if (is_file($tplFormMassDeleteIndex)) {
                     include $tplFormMassDeleteIndex;
                 }
                 $formMassDeleteIndex = ob_get_clean();
                 break;
         }
         $ActionFile = 'user/emailing/user_emailing_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #22
0
    $tplRubrique = Template::getView('user/user_rubrique_left');
    include $tplRubrique;
    ?>
  <!-- Page Content -->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <div id="page-content-wrapper-content">
                        <?php 
    echo FlashInfo::get();
    ?>
 
                        <?php 
    echo $doorGets->Controller()->getContent();
    ?>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php 
} else {
    // Flash info
    echo FlashInfo::get();
    $tplHeader = Template::getView('index_header');
    include $tplHeader;
    echo $doorGets->Controller()->getContent();
}
Example #23
0
 public function getContent()
 {
     $out = '';
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $listeCategories = $this->doorGets->categorieSimple;
     $isVersionActive = false;
     $version_id = 0;
     unset($listeCategories[0]);
     $aActivation = $this->doorGets->getArrayForms('activation');
     $Rubriques = array('index' => $this->doorGets->__('Index'));
     in_array($moduleInfos['id'], $this->doorGets->user['liste_module_modo']) ? $is_modo = true : ($is_modo = false);
     in_array('module', $this->doorGets->user['liste_module_interne']) && in_array('module_' . $moduleInfos['type'], $this->doorGets->user['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('uri', $params['GET'])) {
         $uri = $params['GET']['uri'];
         $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri');
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $this->isContent = $isContent = array_merge($isContent, $isContentTraduction);
                 }
             }
         }
     }
     if (array_key_exists('version', $params['GET'])) {
         $version_id = $params['GET']['version'];
         $isContentVesion = $this->getVersionById($version_id, $isContent);
         if (!empty($isContentVesion)) {
             $isContent = array_merge($isContent, $isContentVesion);
             $isVersionActive = true;
         }
     }
     $user_can_edit = true;
     $htmlCanotEdit = '';
     $isActiveContent = $isActiveComments = $isActiveEmail = '';
     $isActivePartage = $isActiveFacebook = $isActiveDisqus = $isActiveRss = '';
     if (!empty($isContent['active'])) {
         $isActiveContent = 'checked';
     }
     if (!empty($isContent['comments'])) {
         $isActiveComments = 'checked';
     }
     if (!empty($isContent['partage'])) {
         $isActivePartage = 'checked';
     }
     if (!empty($isContent['mailsender'])) {
         $isActiveEmail = 'checked';
     }
     if (!empty($isContent['facebook'])) {
         $isActiveFacebook = 'checked';
     }
     if (!empty($isContent['in_rss'])) {
         $isActiveRss = 'checked';
     }
     if (!empty($isContent['disqus'])) {
         $isActiveDisqus = 'checked';
     }
     $phpOpen = '[[php/o]]';
     $phpClose = '[[php/c]]';
     $article = $isContent['article_tinymce'];
     $iContent = 1;
     $opacity = array('0.1' => '10%', '0.2' => '20%', '0.3' => '30%', '0.4' => '40%', '0.5' => '50%', '0.6' => '60%', '0.7' => '70%', '0.8' => '80%', '0.9' => '90%', '1.0' => '100%');
     $type = array('page' => 'Page', 'module' => 'Contenu de module', '');
     $positionMenu = array('top' => 'Haut', 'right' => 'Droite', 'bottom' => 'Bas', 'left' => 'Gauche');
     $yesNo = array('yes' => 'Oui', 'no' => 'Non');
     $article = unserialize(base64_decode($article));
     if (!empty($this->doorGets->Form->i)) {
         $countPages = 0;
         // gestion des champs vide
         foreach ($this->doorGets->Form->i as $k => $v) {
             $valTitle = substr($k, 0, 5);
             if ($valTitle === 'title') {
                 $countPages++;
             }
         }
         $article = array();
         for ($i = 0; $i < $countPages + 1; $i++) {
             $z = $i + 1;
             if (array_key_exists('title_' . $z, $this->doorGets->Form->i)) {
                 $article[$z]['title'] = $this->doorGets->Form->i['title_' . $z];
                 $article[$z]['page'] = $this->doorGets->Form->i['page_' . $z . '_tinymce'];
                 $article[$z]['marqueur'] = $this->doorGets->Form->i['marqueur_' . $z];
                 $article[$z]['backcolor'] = $this->doorGets->Form->i['backcolor_' . $z];
                 $article[$z]['backimage'] = $this->doorGets->Form->i['backimage_' . $z];
                 $article[$z]['opacity'] = $this->doorGets->Form->i['opacity_' . $z];
                 $article[$z]['height'] = $this->doorGets->Form->i['height_' . $z];
                 $article[$z]['showinmenu'] = $this->doorGets->Form->i['showinmenu_' . $z];
             }
         }
     }
     $formEditTop = $formEditBottom = '';
     $fileFormEditTop = 'modules/user_form_edit_top';
     $tplFormEditTop = Template::getView($fileFormEditTop);
     ob_start();
     if (is_file($tplFormEditTop)) {
         include $tplFormEditTop;
     }
     $formEditTop = ob_get_clean();
     $fileFormEditBottom = 'modules/user_form_edit_bottom';
     $tplFormEditBottom = Template::getView($fileFormEditBottom);
     ob_start();
     if (is_file($tplFormEditBottom)) {
         include $tplFormEditBottom;
     }
     $formEditBottom = ob_get_clean();
     $ActionFile = 'modules/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }
Example #24
0
 public function getContent()
 {
     $out = '';
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $this->doorGets->loadCategories($moduleInfos['uri']);
     $this->doorGets->categorieSimple[0] = '-- ' . $this->doorGets->__('Ancune') . ' --';
     $Categories = $this->doorGets->getAllCategories($this->doorGets->Uri);
     $categoriesOptions = $this->doorGets->getMenuCategoriesOptions(0, 0, $Categories);
     $categoriesOptions[0] = '-- ' . $this->doorGets->__('Ancune') . ' --';
     $menuCategories = $this->doorGets->getMenuCategories(0, 0, $Categories);
     $Rubriques = array('index' => $this->doorGets->__('Index des catégories'), 'add' => $this->doorGets->__('Ajouter une catégorie'), 'edit' => $this->doorGets->__('Modifier une catégorie'), 'delete' => $this->doorGets->__('Supprimer une catégorie'));
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_categories');
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_categories_traduction');
                 if (!empty($isContentTraduction)) {
                     $isContent = array_merge($isContent, $isContentTraduction);
                 }
             }
         }
     }
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $all = $menuCategories;
                 $nbStringCount = '';
                 $cAll = count($all);
                 if ($cAll > 4) {
                     $nbStringCount = '<b>' . $cAll . ' ' . $this->doorGets->__('Catégories') . '<b>';
                 }
                 $block = new BlockTable();
                 $block->setClassCss('doorgets-listing');
                 if ($cAll != 0) {
                     $block->addTitle($nbStringCount, 'titre', 'first-title td-title left');
                     $block->addTitle('', 'topup', 'td-title');
                     $block->addTitle('', 'topbottom', 'td-title');
                     $block->addTitle('', 'edit', 'td-title');
                     $block->addTitle('', 'delete', 'td-title');
                     foreach ($all as $Categorie) {
                         $cResultsInt = (int) $menuCategories[$Categorie['id']]['nb_brother'];
                         $urlMovedown = '';
                         if ($Categorie['ordre'] != $cResultsInt && $cResultsInt !== 0) {
                             $urlMovedown = $this->doorGets->movePositionCategories('down', '_categories', $Categorie['id'], $Categorie['id_parent'], $Categorie['ordre'], $cResultsInt, 'cat-order-' . $Categorie['level']);
                         }
                         $urlMoveup = '';
                         if ($Categorie['ordre'] != 1 && $cResultsInt !== 0) {
                             $urlMoveup = $this->doorGets->movePositionCategories('up', '_categories', $Categorie['id'], $Categorie['id_parent'], $Categorie['ordre'], $cResultsInt, 'cat-order-' . $Categorie['level']);
                         }
                         $urlAction = './?controller=modulecategory&uri=' . $this->doorGets->Uri . '&id=' . $Categorie['id'] . '&lg=' . $lgActuel;
                         $urlVoirTitle = '<a class="cat-img-' . $Categorie['level'] . '"  title="' . $this->doorGets->__('Modifier') . '" href="' . $urlAction . '&action=edit">';
                         $urlVoirTitle .= '<img src="' . BASE_IMG . 'list-rubrique.png' . '" style="width: 25px;height: 25px;vertical-align: middle;margin-right: 5px;float:left;">';
                         $urlVoirTitle .= $Categorie['nom'] . ' <small class="badge pull-right badge-lg">' . $Categorie['count'] . '</small>';
                         $urlVoirTitle .= '</a>';
                         //$urlVoirTitle .= '<span class="doorGets-sub-title-categorie"> '.$Categorie['titre'].'</span>';
                         $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="' . $urlAction . '&action=delete"><b class="glyphicon glyphicon-remove red"></b></a>';
                         $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="' . $urlAction . '&action=edit"><b class="glyphicon glyphicon-pencil green-font"></b></a>';
                         $classLevel = 'tb-level-' . $Categorie['level'];
                         $block->addContent('titre', $urlVoirTitle, '' . $classLevel);
                         $block->addContent('topbottom', $urlMovedown, 'tb-30 center ' . $classLevel);
                         $block->addContent('topup', $urlMoveup, 'tb-30 center' . $classLevel);
                         $block->addContent('edit', $urlEdit, 'tb-30 center' . $classLevel);
                         $block->addContent('delete', $urlDelete, 'tb-30 center' . $classLevel);
                     }
                 }
                 break;
             case 'delete':
                 $isArcticleIn = $this->doorGets->dbQ("SELECT * FROM " . $this->doorGets->Table . " WHERE categorie = '" . $isContent['id_cat'] . "' LIMIT 1 ");
                 break;
         }
         $ActionFile = 'modules/category/user_category_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #25
0
 public function getHtmlDeleteBackup()
 {
     $form = $this->doorGets->Form['backups_delete'];
     $translate = $this->doorGets;
     $fTpl = Template::getView('user/configuration/backups/user_configuration_backups_delete');
     ob_start();
     include $fTpl;
     $out = ob_get_clean();
     return $out;
 }
Example #26
0
 public function getContent()
 {
     $out = '';
     $tableName = $this->doorGets->Table;
     $User = $this->doorGets->user;
     $allModules = $this->doorGets->loadModules(true);
     $hasSender = false;
     $myActivatedInboxUri = array();
     $sqlInboxUser = '';
     $Rubriques = array('new' => $this->doorGets->__('Envoyer un message'), 'index' => $this->doorGets->__('Messages'), 'sent' => $this->doorGets->__('Messages envoyés'), 'select' => $this->doorGets->__('Voir un message'), 'trash' => $this->doorGets->__('Corbeille'), 'delete' => $this->doorGets->__('Supprimer un message'));
     $menuFile = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_menu';
     $tplMenu = Template::getView($menuFile);
     ob_start();
     if (is_file($tplMenu)) {
         include $tplMenu;
     }
     $htmlMenu = ob_get_clean();
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, $tableName);
         if (empty($isContent)) {
             return NULL;
         }
         $isLabelVisible = $isContent["readed"] == 2 ? '<b class="glyphicon glyphicon-eye-close inbox-is-visible"></b>' : '<b class="glyphicon glyphicon-eye-open inbox-is-visible"></b>';
         $isVisibleMessage = $isContent["readed"] == 2 ? $this->doorGets->__("Message non lu") : $this->doorGets->__("Message lu");
         $hasSender = $isContent["id_user"] == $User['id'] ? false : true;
         if ($hasSender) {
             $idNextContent = $this->doorGets->getMyInboxContentPositionDate($isContent['id'], $User['id'], true);
             $idPreviousContent = $this->doorGets->getMyInboxContentPositionDate($isContent['id'], $User['id'], true, 'prev');
         } else {
             $idNextContent = $this->doorGets->getMyInboxContentPositionDate($isContent['id'], $User['id']);
             $idPreviousContent = $this->doorGets->getMyInboxContentPositionDate($isContent['id'], $User['id'], false, 'prev');
         }
         $urlPrevious = '';
         if (!empty($idPreviousContent)) {
             $urlPrevious = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $idPreviousContent;
         }
         $urlNext = '';
         if (!empty($idNextContent)) {
             $urlNext = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $idNextContent;
         }
     }
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $isFieldArray = array("subject" => $this->doorGets->__('Sujet'), "name" => $this->doorGets->__('Nom'), "email" => $this->doorGets->__('E-mail'), "date_creation" => $this->doorGets->__('Date'));
                 $isFieldArraySort = array('subject', 'name', 'email', 'date_creation');
                 $isFieldArraySearch = array('subject', 'name', 'email', 'date_creation_start', 'date_creation_end');
                 $isFieldArraySearchType = array('subject' => array('type' => 'text', 'value' => ''), 'name' => array('type' => 'text', 'value' => ''), 'email' => array('type' => 'text', 'value' => ''));
                 $isFieldArrayDate = array('date_creation');
                 $urlOrderby = '&orderby=' . $isFieldArraySort[3];
                 $urlSearchQuery = '';
                 $urlSort = '&desc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = " {$tableName} ";
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 $arrForCountSearchQuery[] = array('key' => 'user_delete', 'type' => '=', 'value' => 0);
                 $arrForCountSearchQuery[] = array('key' => 'id_user', 'type' => '=', 'value' => $User['id']);
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v]) || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             if (!empty($valueQP)) {
                                 $valEnd = str_replace('_start', '', $v);
                                 $valEnd = str_replace('_end', '', $v);
                                 if (in_array($valEnd, $isFieldArrayDate)) {
                                     if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                                         $fromFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     } else {
                                         $fromFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     }
                                     if (!empty($fromFormat)) {
                                         $from = strtotime($fromFormat);
                                     }
                                     if (!empty($toFormat)) {
                                         $to = strtotime($toFormat);
                                         $to = $to + 60 * 60 * 24;
                                     }
                                     if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                         $nameTable = $tableName . "." . $valEnd;
                                         $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                         $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                         $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_end=' . $toFormat;
                                     }
                                 } else {
                                     if (in_array($v, $isFieldArraySort)) {
                                         if ($v === 'uri_module') {
                                             $sqlLabelSearch .= $tableName . "." . $v . " = '" . $valueQP . "' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => '=', 'value' => $valueQP);
                                         } else {
                                             $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                         }
                                     }
                                     $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP;
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                     $urlGroupBy = '&gby=' . $per;
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, $sqlInboxUser);
                 //if (empty($myActivatedInboxUri)) { $cResultsInt = 0; }
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'DESC';
                 $getSort = '&asc';
                 if (isset($_GET['asc'])) {
                     $getDesc = 'ASC';
                     $getSort = '&desc';
                     $urlSort = '&asc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $tableName . '.date_creation  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     $outFilterORDER = $tableName . '.' . $getFilter . '  ' . $getDesc;
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE {$tableName}.id_user = "******" AND {$tableName}.user_delete = 0 " . $sqlInboxUser . " " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                 // Create url to go for pagination
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page=";
                 $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow();
                 $block->addTitle($dgSelMass, 'is_visible', 'td-title');
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[3]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title center");
                     $iPos++;
                 }
                 $block->addTitle('', 'edit', 'td-title');
                 $block->addTitle('', 'delete', 'td-title');
                 // Search
                 $isVisible = '<input type="checkbox" class="check-me-mass-all" />';
                 $isVisible = '';
                 $block->addContent('is_visible', $isVisible);
                 $outFilter = '';
                 foreach ($isFieldArraySearchType as $nameField => $value) {
                     $nameFieldVal = 'valFilter' . ucfirst($nameField);
                     $sNameFieldVar = 'sFilter' . ucfirst($nameField);
                     $keyNameField = 'q_' . $nameField;
                     $keyNameFieldVal = 'q_' . $nameField;
                     ${$nameFieldVal} = '';
                     if (array_key_exists($keyNameField, $aGroupeFilter)) {
                         ${$nameFieldVal} = $aGroupeFilter[$keyNameField];
                     }
                     switch ($value['type']) {
                         case 'text':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->input('', $keyNameFieldVal, 'text', ${$nameFieldVal});
                             break;
                         case 'select':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->select('', $keyNameFieldVal, $value['value'], ${$nameFieldVal});
                             break;
                     }
                     $block->addContent($nameField, ${$sNameFieldVar});
                 }
                 $valFilterDateStart = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_start', $aGroupeFilter)) {
                     $valFilterDateStart = $aGroupeFilter['q_date_creation_start'];
                 }
                 $valFilterDateEnd = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_end', $aGroupeFilter)) {
                     $valFilterDateEnd = $aGroupeFilter['q_date_creation_end'];
                 }
                 $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                 $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                 $block->addContent('date_creation', $sFilterDate, 'center');
                 $block->addContent('edit', '--', 'center');
                 $block->addContent('delete', '--', 'center');
                 // end Seach
                 if (empty($cAll)) {
                     $block->addContent('is_visible', '');
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         $block->addContent($nameField, '');
                     }
                     $block->addContent('date_creation', '', 'center');
                     $block->addContent('edit', '', 'center');
                     $block->addContent('delete', '', 'center');
                 }
                 for ($i = 0; $i < $cAll; $i++) {
                     $isVisible = $all[$i]["readed"] == 2 ? '<b class="glyphicon glyphicon-hand-right inbox-is-visible"></b>' : '<b class="glyphicon glyphicon-eye-open inbox-is-visible"></b>';
                     $urlVisible = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '">' . $isVisible . '</a>';
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=delete&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlSelect = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-file"></b></a>';
                     $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage());
                     $block->addContent('is_visible', $urlVisible);
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         if ($nameField === 'sujet') {
                             $all[$i][$nameField] = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '">' . $all[$i][$nameField] . '</a>';
                         }
                         $block->addContent($nameField, $all[$i][$nameField]);
                     }
                     $block->addContent('date_creation', $dateCreation, 'center');
                     $block->addContent('edit', $urlSelect, 'center');
                     $block->addContent('delete', $urlDelete, 'center');
                 }
                 $formMassDelete = '';
                 $fileFormMassDelete = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_massdelete_form';
                 $tplFormMassDelete = Template::getView($fileFormMassDelete);
                 ob_start();
                 if (is_file($tplFormMassDelete)) {
                     include $tplFormMassDelete;
                 }
                 $formMassDelete = ob_get_clean();
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
             case 'sent':
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $isFieldArray = array("subject" => $this->doorGets->__('Sujet'), "pseudo_user" => $this->doorGets->__('Pseudo'), "date_creation" => $this->doorGets->__('Date'));
                 $isFieldArraySort = array('subject', 'pseudo_user', 'date_creation');
                 $isFieldArraySearch = array('subject', 'pseudo_user', 'date_creation_start', 'date_creation_end');
                 $isFieldArraySearchType = array('subject' => array('type' => 'text', 'value' => ''), 'pseudo_user' => array('type' => 'text', 'value' => ''));
                 $isFieldArrayDate = array('date_creation');
                 $urlOrderby = '&orderby=' . $isFieldArraySort[2];
                 $urlSearchQuery = '';
                 $urlSort = '&desc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = " {$tableName} ";
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 $arrForCountSearchQuery[] = array('key' => 'user_sent_delete', 'type' => '=', 'value' => 0);
                 $arrForCountSearchQuery[] = array('key' => 'id_user_sent', 'type' => '=', 'value' => $User['id']);
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v]) || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             if (!empty($valueQP)) {
                                 $valEnd = str_replace('_start', '', $v);
                                 $valEnd = str_replace('_end', '', $v);
                                 if (in_array($valEnd, $isFieldArrayDate)) {
                                     if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                                         $fromFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     } else {
                                         $fromFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     }
                                     if (!empty($fromFormat)) {
                                         $from = strtotime($fromFormat);
                                     }
                                     if (!empty($toFormat)) {
                                         $to = strtotime($toFormat);
                                         $to = $to + 60 * 60 * 24;
                                     }
                                     if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                         $nameTable = $tableName . "." . $valEnd;
                                         $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                         $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                         $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_end=' . $toFormat;
                                     }
                                 } else {
                                     if (in_array($v, $isFieldArraySort)) {
                                         if ($v === 'uri_module') {
                                             $sqlLabelSearch .= $tableName . "." . $v . " = '" . $valueQP . "' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => '=', 'value' => $valueQP);
                                         } else {
                                             $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                             $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                         }
                                     }
                                     $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP;
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                     $urlGroupBy = '&gby=' . $per;
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, $sqlInboxUser);
                 //if (empty($myActivatedInboxUri)) { $cResultsInt = 0; }
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'DESC';
                 $getSort = '&asc';
                 if (isset($_GET['asc'])) {
                     $getDesc = 'ASC';
                     $getSort = '&desc';
                     $urlSort = '&asc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $tableName . '.date_creation  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     $outFilterORDER = $tableName . '.' . $getFilter . '  ' . $getDesc;
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE {$tableName}.id_user_sent = " . $User['id'] . " AND {$tableName}.user_sent_delete = 0 " . $sqlInboxUser . " " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                 // Create url to go for pagination
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&action=sent" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . "&action=sent" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&action=sent&page=";
                 $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow() . "&action=sent";
                 $block->addTitle($dgSelMass, 'is_visible', 'td-title');
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[2]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title center");
                     $iPos++;
                 }
                 $block->addTitle('', 'edit', 'td-title');
                 $block->addTitle('', 'delete', 'td-title');
                 // Search
                 $isVisible = '<input type="checkbox" class="check-me-mass-all" />';
                 $isVisible = '';
                 $block->addContent('is_visible', $isVisible);
                 $outFilter = '';
                 foreach ($isFieldArraySearchType as $nameField => $value) {
                     $nameFieldVal = 'valFilter' . ucfirst($nameField);
                     $sNameFieldVar = 'sFilter' . ucfirst($nameField);
                     $keyNameField = 'q_' . $nameField;
                     $keyNameFieldVal = 'q_' . $nameField;
                     ${$nameFieldVal} = '';
                     if (array_key_exists($keyNameField, $aGroupeFilter)) {
                         ${$nameFieldVal} = $aGroupeFilter[$keyNameField];
                     }
                     switch ($value['type']) {
                         case 'text':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->input('', $keyNameFieldVal, 'text', ${$nameFieldVal});
                             break;
                         case 'select':
                             ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->select('', $keyNameFieldVal, $value['value'], ${$nameFieldVal});
                             break;
                     }
                     $block->addContent($nameField, ${$sNameFieldVar});
                 }
                 $valFilterDateStart = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_start', $aGroupeFilter)) {
                     $valFilterDateStart = $aGroupeFilter['q_date_creation_start'];
                 }
                 $valFilterDateEnd = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_end', $aGroupeFilter)) {
                     $valFilterDateEnd = $aGroupeFilter['q_date_creation_end'];
                 }
                 $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                 $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                 $block->addContent('date_creation', $sFilterDate, 'center');
                 $block->addContent('edit', '--', 'center');
                 $block->addContent('delete', '--', 'center');
                 // end Seach
                 if (empty($cAll)) {
                     $block->addContent('is_visible', '');
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         $block->addContent($nameField, '');
                     }
                     $block->addContent('date_creation', '', 'center');
                     $block->addContent('edit', '', 'center');
                     $block->addContent('delete', '', 'center');
                 }
                 for ($i = 0; $i < $cAll; $i++) {
                     $isVisible = $all[$i]["readed"] == 2 ? '<b class="glyphicon glyphicon-eye-close inbox-is-visible"></b>' : '<b class="glyphicon glyphicon-eye-open inbox-is-visible"></b>';
                     $urlVisible = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '">' . $isVisible . '</a>';
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=delete&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlSelect = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-file"></b></a>';
                     $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage());
                     $block->addContent('is_visible', $urlVisible);
                     foreach ($isFieldArraySearchType as $nameField => $value) {
                         if ($nameField === 'sujet') {
                             $all[$i][$nameField] = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id'] . '">' . $all[$i][$nameField] . '</a>';
                         }
                         $block->addContent($nameField, $all[$i][$nameField]);
                     }
                     $block->addContent('date_creation', $dateCreation, 'center');
                     $block->addContent('edit', $urlSelect, 'center');
                     $block->addContent('delete', $urlDelete, 'center');
                 }
                 $formMassDelete = '';
                 $fileFormMassDelete = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_massdelete_form';
                 $tplFormMassDelete = Template::getView($fileFormMassDelete);
                 ob_start();
                 if (is_file($tplFormMassDelete)) {
                     include $tplFormMassDelete;
                 }
                 $formMassDelete = ob_get_clean();
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
         }
         $ActionFile = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #27
0
 public function getContent()
 {
     $out = '';
     $Rubriques = array('index' => $this->doorGets->__('Utilisateurs'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'), 'massdelete' => $this->doorGets->__('Supprimer par groupe'));
     $groupes = $this->doorGets->loadGroupesToSelect();
     $canAddUser = false;
     if (!empty($this->doorGets->user['liste_enfant_modo'])) {
         $canAddUser = true;
         foreach ($groupes as $idGroupe => $label) {
             if (!empty($idGroupe) && !in_array($idGroupe, $this->doorGets->user['liste_enfant_modo'])) {
                 unset($groupes[$idGroupe]);
             }
         }
     }
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('id', $params['GET'])) {
         $id = $params['GET']['id'];
         $isContent = $this->doorGets->dbQS($id, '_users_info');
         $LogineExistInfoGroupe = $this->doorGets->dbQS($isContent['network'], '_users_groupes');
         if (!empty($LogineExistInfoGroupe)) {
             $LogineExistInfoGroupe['attributes'] = @unserialize($LogineExistInfoGroupe['attributes']);
         }
         $isActiveNotificationNewsletter = $isActiveNotificationMail = '';
         if (!empty($isContent['notification_mail'])) {
             $isActiveNotificationMail = 'checked';
         }
         if (!empty($isContent['notification_newsletter'])) {
             $isActiveNotificationNewsletter = 'checked';
         }
         $img['facebook'] = '<img  src="' . BASE_IMG . 'icone_facebook.png" > ';
         $img['twitter'] = '<img  src="' . BASE_IMG . 'icone_twitter.png" > ';
         $img['youtube'] = '<img  src="' . BASE_IMG . 'icone_youtube.png" > ';
         $img['google'] = '<img  src="' . BASE_IMG . 'icone_google.png" > ';
         $img['pinterest'] = '<img  src="' . BASE_IMG . 'icone_pinterest.png" > ';
         $img['linkedin'] = '<img  src="' . BASE_IMG . 'icone_linkedin.png" > ';
         $img['myspace'] = '<img  src="' . BASE_IMG . 'icone_myspace.png" > ';
         $nFace = $img['facebook'] . 'http://www.facebook.com/<span style="color:#000099;">' . $isContent['id_facebook'] . '</span>';
         $nTwitter = $img['twitter'] . 'http://www.twitter.com/<span style="color:#000099;">' . $isContent['id_twitter'] . '</span>';
         $nYoutube = $img['youtube'] . 'http://www.youtube.com/user/<span style="color:#000099;">' . $isContent['id_youtube'] . '</span>';
         $nGoogle = $img['google'] . 'https://plus.google.com/u/0/<span style="color:#000099;">' . $isContent['id_google'] . '</span>';
         $nPinterest = $img['pinterest'] . 'https://www.pinterest.com/<span style="color:#000099;">' . $isContent['id_pinterest'] . '</span>';
         $nLinkedin = $img['linkedin'] . 'http://www.linkedin.com/in/<span style="color:#000099;">' . $isContent['id_linkedin'] . '</span>';
         $nMyspace = $img['myspace'] . 'http://www.myspace.com/<span style="color:#000099;">' . $isContent['id_myspace'] . '</span>';
         $genderAr = $this->doorGets->getArrayForms('gender');
     }
     $aUsersActivation = $this->doorGets->getArrayForms('users_activation');
     if (array_key_exists($this->Action, $Rubriques)) {
         switch ($this->Action) {
             case 'index':
                 $tableName = '_users_info';
                 $q = '';
                 $urlSearchQuery = '';
                 $p = 1;
                 $ini = 0;
                 $per = 50;
                 $params = $this->doorGets->Params();
                 $lgActuel = $this->doorGets->getLangueTradution();
                 $isFieldArray = array("pseudo" => $this->doorGets->__('Pseudo'), "last_name" => $this->doorGets->__('Nom'), "first_name" => $this->doorGets->__('Prénom'), "network" => $this->doorGets->__('Groupe'), "active" => $this->doorGets->__('Statut'), "date_creation" => $this->doorGets->__('Date'));
                 $isFieldArraySort = array('pseudo', 'last_name', 'first_name', 'pseudo', 'active', 'network', 'date_creation');
                 $isFieldArraySearch = array('pseudo', 'last_name', 'first_name', 'active', 'network', 'date_creation_start', 'date_creation_end');
                 $isFieldArrayDate = array('date_creation');
                 $urlOrderby = '&orderby=' . $isFieldArraySort[0];
                 $urlSearchQuery = '';
                 $urlSort = '&desc';
                 $urlLg = '&lg=' . $lgActuel;
                 $urlCategorie = '';
                 $urlGroupBy = '&gby=' . $per;
                 // Init table query
                 $tAll = " _users_info ";
                 // Create query search for mysql
                 $sqlLabelSearch = '';
                 $arrForCountSearchQuery = array();
                 $filters = array();
                 $sqlLabelSearchModo = '  (';
                 foreach ($this->doorGets->user['liste_enfant_modo'] as $idGroup) {
                     $arrForCountSearchQuery[] = array('key' => 'network', 'type' => '=', 'value' => $idGroup);
                     $sqlLabelSearchModo .= "  network = {$idGroup} OR ";
                 }
                 $sqlLabelSearchModo = substr($sqlLabelSearchModo, 0, -3);
                 $sqlLabelSearchModo .= ')';
                 // Init Query Search
                 $aGroupeFilter = array();
                 if (!empty($isFieldArraySearch)) {
                     // Récupére les paramêtres du get et post pour la recherche par filtre
                     foreach ($isFieldArraySearch as $v) {
                         $valueQP = '';
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]);
                             $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP;
                         }
                         if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v]) || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $v])) {
                             if (!empty($valueQP)) {
                                 $valEnd = str_replace('_start', '', $v);
                                 $valEnd = str_replace('_end', '', $v);
                                 if (in_array($valEnd, $isFieldArrayDate)) {
                                     if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $v])) {
                                         $fromFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['GET']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     } else {
                                         $fromFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_start']);
                                         $toFormat = trim($params['POST']['doorGets_search_filter_q_' . $valEnd . '_end']);
                                     }
                                     if (!empty($fromFormat)) {
                                         $from = strtotime($fromFormat);
                                     }
                                     if (!empty($toFormat)) {
                                         $to = strtotime($toFormat);
                                         $to = $to + 60 * 60 * 24;
                                     }
                                     if (strlen(str_replace('_end', '', $v)) !== strlen($v)) {
                                         $nameTable = $tableName . "." . $valEnd;
                                         $sqlLabelSearch .= $nameTable . " >= {$from} AND ";
                                         $sqlLabelSearch .= $nameTable . " <= {$to} AND ";
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '>', 'value' => $from);
                                         $arrForCountSearchQuery[] = array('key' => $nameTable, 'type' => '<', 'value' => $to);
                                         $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_end=' . $toFormat;
                                     }
                                 } else {
                                     if (in_array($v, $isFieldArraySort)) {
                                         $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND ";
                                         $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP);
                                     }
                                     $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP;
                                 }
                             }
                         }
                     }
                     // préparation de la requête mysql
                     if (!empty($sqlLabelSearch)) {
                         $sqlLabelSearch = substr($sqlLabelSearch, 0, -4);
                         $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) ";
                     }
                 }
                 // Init Group By
                 if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) {
                     $per = $params['GET']['gby'];
                 }
                 // Init count total fields
                 $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, '', ' OR ');
                 // Init categorie
                 $sqlCategorie = '';
                 // Init sort
                 $getDesc = 'DESC';
                 $getSort = '&asc';
                 if (isset($_GET['asc'])) {
                     $getDesc = 'ASC';
                     $getSort = '&desc';
                     $urlSort = '&asc';
                 }
                 // Init filter for order by
                 $outFilterORDER = $tableName . '.date_creation  ' . $getDesc;
                 $getFilter = '';
                 if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) {
                     $getFilter = $params['GET']['orderby'];
                     $outFilterORDER = $tableName . '.' . $getFilter . '  ' . $getDesc;
                     $urlOrderby = '&orderby=' . $getFilter;
                 }
                 // Init page position
                 if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) {
                     $p = $params['GET']['page'];
                     $ini = $p * $per - $per;
                 }
                 $finalPer = $ini + $per;
                 if ($finalPer > $cResultsInt) {
                     $finalPer = $cResultsInt;
                 }
                 // Create sql query for transaction
                 $outSqlGroupe = " WHERE {$sqlLabelSearchModo} " . $sqlLabelSearch;
                 $sqlLimit = " {$outSqlGroupe} ORDER BY {$outFilterORDER}  LIMIT " . $ini . "," . $per;
                 // Create url to go for pagination
                 $urlPage = "./?controller=users" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page=';
                 $urlPagePosition = "./?controller=users" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p;
                 // Generate the pagination system
                 $valPage = '';
                 if ($cResultsInt > $per) {
                     $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage);
                 }
                 // Select all contents / Query SQL
                 $all = $this->doorGets->dbQA($tAll, $sqlLimit);
                 $cAll = count($all);
                 /**********
                  *
                  *  Start block creation for listing fields
                  * 
                  **********/
                 $block = new BlockTable();
                 $imgTop = '<div class="d-top"></div>';
                 $imgBottom = '<div class="d-bottom"></div>';
                 $block->setClassCss('doorgets-listing');
                 $iPos = 0;
                 $dgSelMass = '';
                 $urlPage = "./?controller=users&page=";
                 $urlPageGo = './?controller=users';
                 $block->addTitle($dgSelMass, 'sel_mass', 'td-title');
                 foreach ($isFieldArray as $fieldName => $fieldNameLabel) {
                     $_css = '_css_' . $fieldName;
                     $_img = '_img_' . $fieldName;
                     $_desc = '_desc_' . $fieldName;
                     ${$_css} = ${$_img} = ${$_desc} = $leftFirst = '';
                     if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) {
                         ${$_css} = ' class="green" ';
                         ${$_img} = $imgTop;
                         ${$_desc} = $getSort;
                         if ($getDesc === 'ASC') {
                             ${$_img} = $imgBottom;
                             ${$_desc} = '';
                         }
                     }
                     if ($iPos === 0) {
                         $leftFirst = 'first-title left';
                     }
                     $dgLabel = $fieldNameLabel;
                     if (in_array($fieldName, $isFieldArraySort)) {
                         $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . '  >' . ${$_img} . $fieldNameLabel . '</a>';
                     }
                     $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title center");
                     $iPos++;
                 }
                 $block->addTitle('', 'edit', 'td-title');
                 $block->addTitle('', 'delete', 'td-title');
                 $arFilterActivation = $this->doorGets->getArrayForms('users_activation');
                 $valFilterPseudo = '';
                 if (array_key_exists('doorGets_search_filter_q_pseudo', $aGroupeFilter)) {
                     $valFilterPseudo = $aGroupeFilter['doorGets_search_filter_q_pseudo'];
                 }
                 $valFilterLastName = '';
                 if (array_key_exists('doorGets_search_filter_q_last_name', $aGroupeFilter)) {
                     $valFilterLastName = $aGroupeFilter['doorGets_search_filter_q_last_name'];
                 }
                 $valFilterFirstName = '';
                 if (array_key_exists('doorGets_search_filter_q_first_name', $aGroupeFilter)) {
                     $valFilterFirstName = $aGroupeFilter['doorGets_search_filter_q_first_name'];
                 }
                 $valFilterActive = 0;
                 if (array_key_exists('doorGets_search_filter_q_active', $aGroupeFilter)) {
                     $valFilterActive = $aGroupeFilter['doorGets_search_filter_q_active'];
                 }
                 $valFilterGroupe = 0;
                 if (array_key_exists('doorGets_search_filter_q_network', $aGroupeFilter)) {
                     $valFilterGroupe = $aGroupeFilter['doorGets_search_filter_q_network'];
                 }
                 $valFilterDateStart = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_start', $aGroupeFilter)) {
                     $valFilterDateStart = $aGroupeFilter['doorGets_search_filter_q_date_creation_start'];
                 }
                 $valFilterDateEnd = '';
                 if (array_key_exists('doorGets_search_filter_q_date_creation_end', $aGroupeFilter)) {
                     $valFilterDateEnd = $aGroupeFilter['doorGets_search_filter_q_date_creation_end'];
                 }
                 $sFilterActive = $this->doorGets->Form['_search_filter']->select('', 'q_active', $arFilterActivation, $valFilterActive);
                 $sFilterPseudo = $this->doorGets->Form['_search_filter']->input('', 'q_pseudo', 'text', $valFilterPseudo);
                 $sFilterLastName = $this->doorGets->Form['_search_filter']->input('', 'q_last_name', 'text', $valFilterLastName);
                 $sFilterFirstName = $this->doorGets->Form['_search_filter']->input('', 'q_first_name', 'text', $valFilterFirstName);
                 $sFilterGroupe = $this->doorGets->Form['_search_filter']->select('', 'q_network', $groupes, $valFilterGroupe);
                 $sFilterDate = $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_start', 'text', $valFilterDateStart, 'doorGets-date-input datepicker-from');
                 $sFilterDate .= $this->doorGets->Form['_search_filter']->input('', 'q_date_creation_end', 'text', $valFilterDateEnd, 'doorGets-date-input datepicker-to');
                 // Search
                 $urlMassdelete = '<input type="checkbox" class="check-me-mass-all" />';
                 $urlMassdelete = '';
                 $block->addContent('sel_mass', $urlMassdelete);
                 $block->addContent('pseudo', $sFilterPseudo);
                 $block->addContent('last_name', $sFilterLastName);
                 $block->addContent('first_name', $sFilterFirstName);
                 $block->addContent('network', $sFilterGroupe, 'center');
                 $block->addContent('active', $sFilterActive, 'center');
                 $block->addContent('date_creation', $sFilterDate, 'center');
                 $block->addContent('edit', '--', 'center');
                 $block->addContent('delete', '--', 'center');
                 // end Seach
                 if (empty($cAll)) {
                     $block->addContent('sel_mass', '');
                     $block->addContent('pseudo', '');
                     $block->addContent('last_name', '');
                     $block->addContent('first_name', '');
                     $block->addContent('network', '', 'center');
                     $block->addContent('active', '', 'center');
                     $block->addContent('date_creation', '', 'center');
                     $block->addContent('edit', '', 'center');
                     $block->addContent('delete', '', 'center');
                 }
                 for ($i = 0; $i < $cAll; $i++) {
                     $ImageStatut = BASE_IMG . 'puce-rouge.png';
                     if ($all[$i]['active'] == '2') {
                         $ImageStatut = BASE_IMG . 'puce-verte.png';
                     } elseif ($all[$i]['active'] == '3') {
                         $ImageStatut = BASE_IMG . 'puce-orange.png';
                     } elseif ($all[$i]['active'] == '5') {
                         $ImageStatut = BASE_IMG . 'icone_redaction.png';
                     }
                     $urlStatut = '<img src="' . $ImageStatut . '" style="vertical-align: middle;" >';
                     $tGroupes = '-';
                     if (array_key_exists($all[$i]["network"], $groupes)) {
                         $tGroupes = $groupes[$all[$i]["network"]];
                     }
                     $imgUser = '******' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '"><img class="avatar-listing" src="' . URL . 'data/users/' . $all[$i]["avatar"] . '" title="' . $all[$i]["pseudo"] . '" /></a>';
                     $urlMassdelete = '<input id="' . $all[$i]["id"] . '" type="checkbox" class="check-me-mass" >';
                     $urlPseudo = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["pseudo"] . '</a>';
                     $urlLastName = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["last_name"] . '</a>';
                     $urlFirstName = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '">' . $all[$i]["first_name"] . '</a>';
                     $urlGroupe = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '">' . $tGroupes . '</a>';
                     $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=users&action=delete&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-remove red"></b></a>';
                     $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=users&action=edit&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-pencil green-font" ></b></a>';
                     $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage());
                     $block->addContent('sel_mass', $imgUser);
                     $block->addContent('pseudo', $urlPseudo);
                     $block->addContent('last_name', $urlLastName);
                     $block->addContent('first_name', $urlFirstName);
                     $block->addContent('network', $urlGroupe, 'center');
                     $block->addContent('active', $urlStatut, 'center');
                     $block->addContent('date_creation', $dateCreation, 'center');
                     $block->addContent('edit', $urlEdit, 'center');
                     $block->addContent('delete', $urlDelete, 'center');
                 }
                 $formMassDelete = '';
                 $fileFormMassDelete = 'user/users/user_users_massdelete_form';
                 $tplFormMassDelete = Template::getView($fileFormMassDelete);
                 ob_start();
                 if (is_file($tplFormMassDelete)) {
                     include $tplFormMassDelete;
                 }
                 $formMassDelete = ob_get_clean();
                 /**********
                  *
                  *  End block creation for listing fields
                  * 
                  */
                 break;
             case 'edit':
                 $Attributes = $this->doorGets->loadUserAttributesWithValues($isContent['id'], $LogineExistInfoGroupe['attributes']);
                 break;
         }
         $ActionFile = 'user/users/user_users_' . $this->Action;
         $tpl = Template::getView($ActionFile);
         ob_start();
         if (is_file($tpl)) {
             include $tpl;
         }
         $out .= ob_get_clean();
     }
     return $out;
 }
Example #28
0
 public function getView($name, &$params = array(), $debug = false)
 {
     if ($debug) {
         echo '<pre>';
         var_dump($params);
     }
     if (!empty($params)) {
         foreach ($params as $key => $value) {
             ${$key} = $value;
         }
     }
     $tpl = Template::getView($name);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out = ob_get_clean();
     return $out;
 }
Example #29
0
 public function getHtmlNavigationUser()
 {
     $out = '';
     $User = $this->getCurrentUser();
     $isUser = $User->isConnected();
     if (!empty($isUser)) {
         $tplNavigationUser = Template::getView('user/user_rubrique_public');
         ob_start();
         if (is_file($tplNavigationUser)) {
             include $tplNavigationUser;
         }
         $out = ob_get_clean();
     }
     return $out;
 }
Example #30
0
 public function getContent()
 {
     $out = '';
     $lgActuel = $this->doorGets->getLangueTradution();
     $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel);
     $listeCategories = $this->doorGets->categorieSimple;
     $isVersionActive = false;
     $version_id = 0;
     unset($listeCategories[0]);
     $aActivation = $this->doorGets->getArrayForms('activation');
     $Rubriques = array('index' => $this->doorGets->__('Index'));
     in_array($moduleInfos['id'], $this->doorGets->user['liste_module_modo']) ? $is_modo = true : ($is_modo = false);
     in_array('module', $this->doorGets->user['liste_module_interne']) && in_array('module_' . $moduleInfos['type'], $this->doorGets->user['liste_module_interne']) ? $is_modules_modo = true : ($is_modules_modo = false);
     // get Content for edit / delete
     $params = $this->doorGets->Params();
     if (array_key_exists('uri', $params['GET'])) {
         $uri = $params['GET']['uri'];
         $isContent = $this->doorGets->dbQS($uri, $this->doorGets->Table, 'uri');
         if (!empty($isContent)) {
             if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) {
                 $idLgGroupe = $lgGroupe[$lgActuel];
                 $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, $this->doorGets->Table . '_traduction');
                 if (!empty($isContentTraduction)) {
                     $this->isContent = $isContent = array_merge($isContent, $isContentTraduction);
                 }
             }
         }
     }
     if (array_key_exists('version', $params['GET'])) {
         $version_id = $params['GET']['version'];
         $isContentVesion = $this->getVersionById($version_id, $isContent);
         if (!empty($isContentVesion)) {
             $isContent = array_merge($isContent, $isContentVesion);
             $isVersionActive = true;
         }
     }
     $user_can_edit = true;
     $htmlCanotEdit = '';
     $isActiveContent = $isActiveComments = $isActiveEmail = '';
     $isActivePartage = $isActiveFacebook = $isActiveDisqus = $isActiveRss = '';
     if (!empty($isContent['active'])) {
         $isActiveContent = 'checked';
     }
     if (!empty($isContent['comments'])) {
         $isActiveComments = 'checked';
     }
     if (!empty($isContent['partage'])) {
         $isActivePartage = 'checked';
     }
     if (!empty($isContent['mailsender'])) {
         $isActiveEmail = 'checked';
     }
     if (!empty($isContent['facebook'])) {
         $isActiveFacebook = 'checked';
     }
     if (!empty($isContent['in_rss'])) {
         $isActiveRss = 'checked';
     }
     if (!empty($isContent['disqus'])) {
         $isActiveDisqus = 'checked';
     }
     $formEditTop = $formEditBottom = '';
     $fileFormEditTop = 'modules/user_form_edit_top';
     $tplFormEditTop = Template::getView($fileFormEditTop);
     ob_start();
     if (is_file($tplFormEditTop)) {
         include $tplFormEditTop;
     }
     $formEditTop = ob_get_clean();
     $fileFormEditBottom = 'modules/user_form_edit_bottom';
     $tplFormEditBottom = Template::getView($fileFormEditBottom);
     ob_start();
     if (is_file($tplFormEditBottom)) {
         include $tplFormEditBottom;
     }
     $formEditBottom = ob_get_clean();
     $ActionFile = 'modules/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action;
     $tpl = Template::getView($ActionFile);
     ob_start();
     if (is_file($tpl)) {
         include $tpl;
     }
     $out .= ob_get_clean();
     return $out;
 }