public function __construct(&$doorGets) { $this->doorGets = $doorGets; $time = time(); $range = array('month'); $limitMax = $time - 86400; $isUser = $doorGets->dbQA('_users_info', ' ORDER BY date_creation ASC LIMIT 1'); if (!empty($isUser)) { $limitMax = (int) $isUser[0]['date_creation']; } //$limitMax = $time - (86400 * 30); $timeleft = $time - $limitMax; $hourLeft = ceil($timeleft / 3600); $dayLeft = ceil($timeleft / 86400); $monthLeft = ceil($timeleft / (86400 * 30)); $yearLeft = ceil($timeleft / (86400 * 364)); $final = 31; foreach ($range as $unit) { switch ($unit) { // case 'day': // $final = $dayLeft; // $timeAdd = 86400; // break; case 'month': $final = $monthLeft; $timeAdd = 86400 * 31; break; // case 'year': // $final = $yearLeft; // $timeAdd = 86400 * 364; // break; } for ($i = 0; $i <= $final; $i++) { $timeStart = $time - $i * $timeAdd; $date = getDate($timeStart); $dateFormat = $date['year'] . '-' . $date['mon'] . '-' . $date['mday']; $timeEnd = $time - ($i + 1) * $timeAdd; $dateEnd = getDate($timeEnd); $dateEndFormat = $dateEnd['year'] . '-' . $dateEnd['mon'] . '-' . $dateEnd['mday']; $start = strtotime($dateFormat . ' 23:59:59'); $end = strtotime($dateEndFormat . ' 23:59:59'); if ($unit === 'day') { $dateFormat = GetDate::in($start, 2, $this->doorGets->myLanguage); } elseif ($unit === 'year') { $dateFormat = ' ' . $date['year']; } else { $dateFormat = $date['mon'] . '-' . $date['year']; } $this->data['accounts'][$unit]["{$dateFormat}"] = $this->getAccounts($start, $end); //$this->data['orders'][$unit]["$dateFormat"] = $this->getOrders($start,$end); $this->data['comments'][$unit]["{$dateFormat}"] = $this->getComments($start, $end); //$this->data['carts'][$unit]["$dateFormat"] = $this->getCarts($start,$end); $this->data['contributions'][$unit]["{$dateFormat}"] = $this->getContributions($start, $end); $this->data['tickets'][$unit]["{$dateFormat}"] = $this->getTickets($start, $end); $this->data['cloud'][$unit]["{$dateFormat}"] = $this->getCloud($start, $end); } $this->data['accounts'][$unit] = array_reverse($this->data['accounts'][$unit]); } }
public function getContent() { $Website = $this->Website; $Module = $Website->getModule(); $moduleInfo = $Website->activeModules; $tplPassword = $this->checkModulePassword($moduleInfo[$Module]['all']['with_password'], $moduleInfo[$Module]['all']['password'], $Module); if (!empty($tplPassword)) { return $tplPassword; } $templateDefault = 'modules/page/page_content'; if (array_key_exists($Module, $moduleInfo)) { if (!empty($moduleInfo[$Module]['all']['template_index'])) { $templateDefault = $moduleInfo[$Module]['all']['template_index']; $templateDefault = str_replace('.tpl.php', '', $templateDefault); } } $nameTable = '_dg_page'; $content = $Website->getContent(); $isContentActiveVersion = $Website->dbQS($content['id_content'], $nameTable . '_version', 'id_content', " AND active = 2 AND langue = '" . $Website->myLanguage . "' LIMIT 1"); if ($content['active'] != '2' && !empty($isContentActiveVersion)) { $content['article'] = html_entity_decode($isContentActiveVersion['article_tinymce']); $content['article'] = $Website->_convertMethod($content['article']); $content['title'] = $isContentActiveVersion['titre']; } else { $content['article'] = html_entity_decode($content['article_tinymce']); $content['article'] = $Website->_convertMethod($content['article']); $content['title'] = $content['titre']; } $content['sharethis'] = $content['partage']; unset($content['partage']); unset($content['titre']); unset($content['article_tinymce']); unset($content['id']); unset($content['id_content']); unset($content['langue']); unset($content['uri']); unset($content['meta_titre']); unset($content['meta_description']); unset($content['meta_keys']); unset($content['groupe_traduction']); $content['date_creation'] = GetDate::in($content['date_creation'], 1, $Website->myLanguage); $labelModuleGroup = $Website->activeModules; $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom']; $allModules = $Website->activeModules; $urlAfterAction = urlencode($Website->getCurrentUrl()); $urlEdition = URL_USER . $Website->_lgUrl . '?controller=modulepage&uri=' . $Website->getModule() . '&lg=' . $Website->getLangueTradution() . '&back=' . $urlAfterAction; extract($content); $tplModulePage = Template::getWebsiteView($templateDefault, $Website->getTheme()); ob_start(); if (is_file($tplModulePage)) { include $tplModulePage; } $out = ob_get_clean(); return $out; }
public function getContent() { $out = ''; $Rubriques = array('index' => $this->doorGets->__('Utilisateurs'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer')); $lgActuel = $this->doorGets->getLangueTradution(); $arrayFilter = $isContent = array(); $aYesNo = $this->doorGets->getArrayForms(); $groups = $this->doorGets->loadGroupes(); $groups = array_merge(array(''), $groups); $tranches = range(0, 12, 1); $Attributes = $this->doorGets->loadAttributes(); $groupesAttributes = $this->doorGets->loadGroupesAttributes(); // 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_groupes'); if (!empty($isContent)) { $arrayFilter[] = array('key' => 'network', 'type' => '=', 'value' => $isContent['id']); if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_users_groupes_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $this->isContent = $isContent; } $AttributesActifs = array(); foreach ($groupesAttributes[$id] as $key => $value) { if (array_key_exists($value, $Attributes)) { $AttributesActifs[$value] = $Attributes[$value]; unset($Attributes[$value]); } } } } } $groupes = $this->doorGets->loadGroupes(); $modules = $this->doorGets->loadModules(true); $widgets = $this->doorGets->loadWidgets(); $cBlocks = count($widgets['blok']); $cCarousel = count($widgets['carousel']); $cGenforms = count($widgets['genform']); $cSurvey = count($widgets['survey']); $cWidgets = $cBlocks + $cCarousel + $cGenforms + $cSurvey; $noLimitType = array('inbox', 'page', 'link'); $saas_constant['SAAS_TRADUCTION'] = false; $saas_constant['SAAS_TRADUCTION'] = false; $saas_constant['SAAS_ATTRIBUTS'] = true; $saas_constant['SAAS_GROUPES'] = true; $saas_constant['SAAS_NOTIFICATION'] = false; $saas_constant['SAAS_NEWSLETTER'] = false; $saas_constant['SAAS_MEDIA'] = true; $saas_constant['SAAS_CLOUD'] = true; $saas_constant['SAAS_USERS'] = true; $saas_constant['SAAS_MENU'] = true; $saas_constant['SAAS_STATS'] = true; $saas_constant['SAAS_MODERATION'] = true; $saas_constant['SAAS_INBOX'] = true; $saas_constant['SAAS_COMMENT'] = true; $saas_constant['SAAS_SUPPORT'] = true; $saas_constant['SAAS_ORDER'] = true; $saas_constant['SAAS_MYINBOX'] = true; $saas_constant['SAAS_THEME'] = true; $saas_constant['SAAS_THEME_ADD'] = true; $saas_constant['SAAS_THEME_EDIT'] = true; $saas_constant['SAAS_THEME_DELETE'] = true; $saas_constant['SAAS_THEME_JS'] = false; $saas_constant['SAAS_ADDRESS'] = true; $saas_constant['SAAS_SIZE_LIMIT'] = 200; // Mo $saas_constant['SAAS_MODULES'] = true; $saas_constant['SAAS_MODULES_PAGE'] = true; $saas_constant['SAAS_MODULES_MULTIPAGE'] = true; $saas_constant['SAAS_MODULES_ONEPAGE'] = true; $saas_constant['SAAS_MODULES_BLOG'] = true; $saas_constant['SAAS_MODULES_SHOP'] = true; $saas_constant['SAAS_MODULES_NEWS'] = true; $saas_constant['SAAS_MODULES_SHAREDLINKS'] = true; $saas_constant['SAAS_MODULES_VIDEO'] = true; $saas_constant['SAAS_MODULES_IMAGE'] = true; $saas_constant['SAAS_MODULES_FAQ'] = true; $saas_constant['SAAS_MODULES_PARTNER'] = true; $saas_constant['SAAS_MODULES_CONTACT'] = true; $saas_constant['SAAS_MODULES_LINK'] = true; $saas_constant['SAAS_WIDGET_CAROUSEL'] = true; $saas_constant['SAAS_WIDGET_BLOCK'] = true; $saas_constant['SAAS_WIDGET_FORM'] = true; $saas_constant['SAAS_WIDGET_SURVEY'] = true; $saas_constant['SAAS_CONFIGURATION'] = true; $saas_constant['SAAS_CONFIG_LANGUE'] = true; $saas_constant['SAAS_CONFIG_MODULES'] = false; $saas_constant['SAAS_CONFIG_PARAMS'] = false; $saas_constant['SAAS_CONFIG_BACKUPS'] = false; $saas_constant['SAAS_CONFIG_UPDATE'] = false; $saas_constant['SAAS_CONFIG_SMTP'] = true; $saas_constant['SAAS_CONFIG_CACHE'] = true; $saas_constant['SAAS_CONFIG_SETUP'] = true; $saas_constant['SAAS_CONFIG_OAUTH2'] = true; $saas_constant['SAAS_CONFIG_NETWORK'] = true; $saas_constant['SAAS_CONFIG_MEDIA'] = true; $saas_constant['SAAS_CONFIG_ANALYTICS'] = true; $saas_constant['SAAS_CONFIG_CLOUD'] = true; $saas_constant['SAAS_CONFIG_SOCIAL'] = true; $saas_constant['SAAS_CONFIG_STRIPE'] = true; $saas_constant['SAAS_CONFIG_PAYPAL'] = true; $saas_constant['SAAS_CONFIG_TRANSFER'] = true; $saas_constant['SAAS_CONFIG_CHECK'] = true; $saas_constant['SAAS_CONFIG_CASH'] = true; $activeSaasOptions = array('saas_add' => false, 'saas_delete' => false, 'saas_limit' => 0, 'saas_constant' => $saas_constant); $cUsers = $this->doorGets->getCountTable('_users_info', $arrayFilter); $cModules = count($modules); if (!empty($isContent)) { $activeWidgets = $this->doorGets->_toArray($isContent['liste_widget']); $activeModules = $this->doorGets->_toArray($isContent['liste_module']); $activeModulesLimit = $this->doorGets->_toArrayKeys($isContent['liste_module_limit']); $activeModulesList = $this->doorGets->_toArray($isContent['liste_module_list']); $activeModulesShow = $this->doorGets->_toArray($isContent['liste_module_show']); $activeModulesAdd = $this->doorGets->_toArray($isContent['liste_module_add']); $activeModulesEdit = $this->doorGets->_toArray($isContent['liste_module_edit']); $activeModulesDelete = $this->doorGets->_toArray($isContent['liste_module_delete']); $activeModulesModo = $this->doorGets->_toArray($isContent['liste_module_modo']); $activeModulesAdmin = $this->doorGets->_toArray($isContent['liste_module_admin']); $activeModulesInterne = $this->doorGets->_toArray($isContent['liste_module_interne']); $activeModulesInterneModo = $this->doorGets->_toArray($isContent['liste_module_interne_modo']); $activeGroupesEnfants = $this->doorGets->_toArray($isContent['liste_enfant']); $activeGroupesEnfantsModo = $this->doorGets->_toArray($isContent['liste_enfant_modo']); $activeGroupesParents = $this->doorGets->_toArray($isContent['liste_parent']); $activeEditorCkeditor = (bool) (int) $isContent['editor_ckeditor']; $activeEditorTinymce = (bool) (int) $isContent['editor_tinymce']; $activeGroupePayment = (bool) (int) $isContent['payment']; if (empty($isContent['saas_options'])) { $isContent['saas_options'] = $activeSaasOptions; } else { $isContent['saas_options'] = unserialize(base64_decode($isContent['saas_options'])); // vdump($isContent['saas_options']); foreach ($saas_constant as $key => $value) { if (!array_key_exists($key, $isContent['saas_options']['saas_constant'])) { $isContent['saas_options']['saas_constant'][$key] = $value; } } } $activeSaasOptions = $isContent['saas_options']; $iEnfant = count($activeGroupesEnfants); $iParent = count($activeGroupesParents); } include CONFIG . 'modules.php'; $modulesInterneModules['module'] = $this->doorGets->__("Gestion des modules"); foreach ($liste as $key => $value) { $modulesInterneModules['module_' . $key] = $this->doorGets->__("Modules") . ' ' . $value; } $modulesInterneWidgets['widget'] = $this->doorGets->__("Gestion des widgets"); foreach ($listeWidgets as $key => $value) { $modulesInterneWidgets['module_' . $key] = $this->doorGets->__("Widgets") . ' ' . $value; } $modulesInterneMedia['media'] = $this->doorGets->__("Gestion des fichiers"); $modulesInterneProfile['showprofile'] = $this->doorGets->__("Afficher mon profil"); $modulesInterneProfile['myinbox'] = $this->doorGets->__("Boîte de réception"); //$modulesInterneProfile['address'] = $this->doorGets->__("Adresse"); $modulesInterneApi['api'] = $this->doorGets->__("Api Access Token"); $modulesInterneApi['saas'] = $this->doorGets->__("Cloud"); $modulesInterneApi['support_client'] = $this->doorGets->__("Support"); $modulesInterneShop['order'] = $this->doorGets->__("Commandes"); $modulesInterneShop['promotion'] = $this->doorGets->__("Promotion"); $modulesInterneShop['discountcode'] = $this->doorGets->__("Code de réduction"); $modulesInterneShop['taxes'] = $this->doorGets->__("Gestion des taxes"); $modulesInterneModeration['comment'] = $this->doorGets->__("Gestion des commentaires"); $modulesInterneModeration['inbox'] = $this->doorGets->__("Gestion des messages"); $modulesInterneModeration['moderation'] = $this->doorGets->__("Modérateur"); $modulesInterneModeration['support'] = $this->doorGets->__("Support"); $modulesInterneStats['stats_dash'] = $this->doorGets->__("Statistique du tableau de bord"); $modulesInterneStats['stats_order'] = $this->doorGets->__("Statistique des commandes"); $modulesInterneStats['stats_user'] = $this->doorGets->__("Statistique des utilisateurs"); $modulesInterneStats['stats_cart'] = $this->doorGets->__("Statistique des paniers"); $modulesInterneStats['stats_comment'] = $this->doorGets->__("Statistique des commentaires"); $modulesInterneStats['stats_contrib'] = $this->doorGets->__("Statistique des contributions"); $modulesInterneStats['stats_cloud'] = $this->doorGets->__("Statistique du cloud"); $modulesInterneStats['stats_tickets'] = $this->doorGets->__("Statistique des tickets"); $modulesInterneMenu['menu'] = $this->doorGets->__("Gestion du menu principal"); $modulesInterneUsers['users'] = $this->doorGets->__("Gestion des utilisateurs"); $modulesInterneUsers['groupes'] = $this->doorGets->__("Gestion des groupes"); $modulesInterneUsers['attributes'] = $this->doorGets->__("Gestion des attributs"); $modulesInterneTemplates['traduction'] = $this->doorGets->__("Traducteur"); $modulesInterneTemplates['traduction_modo'] = $this->doorGets->__("Modérateur des traducteurs"); $modulesInterneTemplates['themes'] = $this->doorGets->__("Gestion des thèmes"); $modulesInterneTemplates['emailnotification'] = $this->doorGets->__("Gestion des notifications"); $modulesInterneCampagnes['campagne_email'] = $this->doorGets->__("Gestion des inscriptions à la newsletter"); $modulesInterneConfiguration['configuration'] = $this->doorGets->__('Configuration'); $modulesInterneConfiguration['siteweb'] = $this->doorGets->__('Site Web'); $modulesInterneConfiguration['langue'] = $this->doorGets->__('Langue') . ' / ' . $this->doorGets->__('Heure'); $modulesInterneConfiguration['logo'] = $this->doorGets->__('Logo') . ' & ' . $this->doorGets->__('Icône'); $modulesInterneConfiguration['modules'] = $this->doorGets->__('Modules internes'); $modulesInterneConfiguration['adresse'] = $this->doorGets->__('Addresse') . ' & ' . $this->doorGets->__('Contact'); $modulesInterneConfiguration['network'] = $this->doorGets->__('Réseaux sociaux'); $modulesInterneConfiguration['analytics'] = $this->doorGets->__('Google analytics'); $modulesInterneConfiguration['sitemap'] = $this->doorGets->__('Plan du site'); $modulesInterneConfiguration['backups'] = $this->doorGets->__('Sauvegardes'); $modulesInterneConfiguration['updater'] = $this->doorGets->__('Mise à jour'); $modulesInterneConfiguration['cache'] = $this->doorGets->__('Cache'); $modulesInterneConfiguration['setup'] = $this->doorGets->__("Système d'installation"); $modulesInterneConfiguration['oauth'] = 'OAuth2'; $modulesInterneConfiguration['smtp'] = 'SMTP'; $modulesInterneConfiguration['stripe'] = 'Stripe'; $modulesInterneConfiguration['paypal'] = 'Paypal'; $modulesInterneConfiguration['transfer'] = $this->doorGets->__('Virement bancaire'); $modulesInterneConfiguration['saas_config'] = $this->doorGets->__('Cloud'); $modulesInterneConfiguration['check'] = $this->doorGets->__('Chèque'); $modulesInterneConfiguration['cash'] = $this->doorGets->__('Paiement en liquide'); $modulesInterneConfiguration['params'] = $this->doorGets->__('Paramètres'); $subModule = $this->doorGets->getArrayForms('sub_module'); $fileman = array('none' => $this->doorGets->__('Aucun'), 'admin' => $this->doorGets->__('Administrateur'), 'modo' => $this->doorGets->__('Modérateur'), 'contrib' => $this->doorGets->__('Contributeur')); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $nbStringCount = ''; $per = 500; $ini = 0; $filters = array(); $sqlFilters = ''; $cList = count($this->doorGets->user['liste_enfant_modo']); if ($cList > 1) { $sqlFilters .= ' AND ('; $ii = 0; foreach ($this->doorGets->user['liste_enfant_modo'] as $idGroup) { $ii++; $filters[] = array('key' => 'id', 'type' => '!=!', 'value' => $idGroup); $sqlFilters .= " g.id = {$idGroup} OR "; } $sqlFilters = substr($sqlFilters, 0, -3); $sqlFilters .= ')'; } $countGroupes = $this->doorGets->getCountTable('_users_groupes', $filters, '', ' OR '); $sqlLimit = " WHERE g.id = t.id_groupe AND t.langue = '" . $lgActuel . "' {$sqlFilters} ORDER BY g.date_creation LIMIT " . $ini . "," . $per; $all = $this->doorGets->dbQA('_users_groupes g, _users_groupes_traduction t', $sqlLimit); $cAll = count($all); if ($cAll > 1) { $nbStringCount = $countGroupes . ' ' . $this->doorGets->__('Groupes'); } $block = new BlockTable(); $block->setClassCss('doorgets-listing'); if ($cAll != 0) { $block->addTitle($nbStringCount, 'title', 'first-title td-title left'); $block->addTitle($this->doorGets->__('Utilisateurs'), 'users', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); for ($i = 0; $i < $cAll; $i++) { $filter = array(array('key' => 'network', 'type' => '=', 'value' => $all[$i]['id_groupe'])); $countUsers = $this->doorGets->getCountTable('_users_info', $filter); $urlVoirTitle = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=groupes&action=edit&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-cloud"></b> ' . $all[$i]['title'] . '</a>'; $urlUsers = $countUsers; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=groupes&action=delete&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-remove red"></b> </a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=groupes&action=edit&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-pencil green-font"></b> </a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage()); $block->addContent('title', $urlVoirTitle); $block->addContent('users', $urlUsers, 'text-center tb-30'); $block->addContent('edit', $urlEdit, 'text-center tb-30'); $block->addContent('delete', $urlDelete, 'text-center tb-30'); } } break; } $ActionFile = 'user/groupes/user_groupes_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ****************************************************************************** ******************************************************************************/ if ($hasUser) { $count = 1; $subscription['amount_total'] = $this->doorGets->setCurrencyIcon($subscription['amount_total'], $subscription['currency']); $subscription['amount_month'] = $this->doorGets->setCurrencyIcon($subscription['amount_month'], $subscription['currency']); $dateEnd = GetDate::in(time() + 84600 * 30 * (int) $subscription['tranche'], 2, $this->langue); } ?> <div class="container payment-to-go"> [{?($hasUser):}] [{!$this->doorGets->Form['address']->open('post','','','form-login-payment');}] <div class="row"> <div class="col-md-4"> <div class="head-payment"> <div class="head-payment-title"><i class="fa fa-coffee"></i> [{!$this->doorGets->__("Abonnement")!}]</div> </div> <!-- cart listing --> [{!$this->getView('payment/payment_listing_cart',$listingCartParams)!}] <div class="separateur-tb"></div> <div class="row"> <div class="col-md-6">
public function initContribution() { $id = $this->id; $out = array(); $isUser = $this->doorGets->dbQS($id, '_users_info', 'id_user'); if (!empty($isUser)) { $info['count_notification'] = 0; $info['count_track'] = 0; $info['last_connexion'] = 0; $info['total_contribution'] = 0; $info['network_name'] = '-'; $info['network_id'] = '0'; $info['email'] = $isUser['email']; $groupes = $this->doorGets->loadGroupes(); if (array_key_exists($isUser['network'], $groupes)) { $info['network_name'] = $groupes[$isUser['network']]; $info['network_id'] = $isUser['network']; } $info['date_creation'] = GetDate::in($isUser['date_creation'], 2, $this->doorGets->myLanguage); $isUserNotification = $this->doorGets->dbQ("SELECT count(*) as counter FROM _users_notification WHERE id_user = "******"SELECT date FROM _users_notification WHERE id_user = "******" ORDER BY date DESC LIMIT 1"); if (!empty($isUserLastConnexion)) { $info['last_connexion'] = GetDate::in($isUserLastConnexion[0]['date'], 2, $this->doorGets->myLanguage); } $isUserTrack = $this->doorGets->dbQ("SELECT count(*) as counter FROM _users_track WHERE id_user = "******"SELECT count(*) as counter FROM _m_" . $nameModule . " WHERE id_user = "******" "); $countContents = (int) $isCounterContents[0]['counter']; $realCount = $realCount + $countContents; $outListeTypeModule[$isModule['uri']]['count'] = $countContents; } } } $info['total_contribution'] = $realCount; $out = $outListeTypeModule; } } $this->info = $info; } return $out; }
public function getContent() { $out = ''; $Rubriques = array('index' => $this->doorGets->__('Utilisateurs'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer')); $lgActuel = $this->doorGets->getLangueTradution(); $arrayFilter = $isContent = array(); $aYesNo = $this->doorGets->getArrayForms(); $groups = $this->doorGets->loadGroupes(); $groups = array_merge(array(''), $groups); $tranches = range(0, 12, 1); $Attributes = $this->doorGets->loadAttributes(); $groupesAttributes = $this->doorGets->loadGroupesAttributes(); // 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_groupes'); if (!empty($isContent)) { $arrayFilter[] = array('key' => 'network', 'type' => '=', 'value' => $isContent['id']); if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_users_groupes_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $this->isContent = $isContent; } $AttributesActifs = array(); foreach ($groupesAttributes[$id] as $key => $value) { if (array_key_exists($value, $Attributes)) { $AttributesActifs[$value] = $Attributes[$value]; unset($Attributes[$value]); } } } } } $groupes = $this->doorGets->loadGroupes(); $modules = $this->doorGets->loadModules(true); $widgets = $this->doorGets->loadWidgets(); $cBlocks = count($widgets['blok']); $cGenforms = count($widgets['genform']); $cWidgets = $cBlocks + $cGenforms; $noLimitType = array('inbox', 'page', 'link'); $cUsers = $this->doorGets->getCountTable('_users_info', $arrayFilter); $cModules = count($modules); if (!empty($isContent)) { $activeWidgets = $this->doorGets->_toArray($isContent['liste_widget']); $activeModules = $this->doorGets->_toArray($isContent['liste_module']); $activeModulesLimit = $this->doorGets->_toArrayKeys($isContent['liste_module_limit']); $activeModulesList = $this->doorGets->_toArray($isContent['liste_module_list']); $activeModulesShow = $this->doorGets->_toArray($isContent['liste_module_show']); $activeModulesAdd = $this->doorGets->_toArray($isContent['liste_module_add']); $activeModulesEdit = $this->doorGets->_toArray($isContent['liste_module_edit']); $activeModulesDelete = $this->doorGets->_toArray($isContent['liste_module_delete']); $activeModulesModo = $this->doorGets->_toArray($isContent['liste_module_modo']); $activeModulesAdmin = $this->doorGets->_toArray($isContent['liste_module_admin']); $activeModulesInterne = $this->doorGets->_toArray($isContent['liste_module_interne']); $activeModulesInterneModo = $this->doorGets->_toArray($isContent['liste_module_interne_modo']); $activeGroupesEnfants = $this->doorGets->_toArray($isContent['liste_enfant']); $activeGroupesEnfantsModo = $this->doorGets->_toArray($isContent['liste_enfant_modo']); $activeGroupesParents = $this->doorGets->_toArray($isContent['liste_parent']); $activeEditorCkeditor = (bool) (int) $isContent['editor_ckeditor']; $activeEditorTinymce = (bool) (int) $isContent['editor_tinymce']; $activeGroupePayment = (bool) (int) $isContent['payment']; $iEnfant = count($activeGroupesEnfants); $iParent = count($activeGroupesParents); } $liste['page'] = $this->doorGets->__('Page Statique'); $liste['multipage'] = $this->doorGets->__('Multi-Pages Statiques'); $liste['blog'] = $this->doorGets->__("Blog"); $liste['news'] = $this->doorGets->__("Fil d'actualités"); $liste['video'] = $this->doorGets->__('Galerie vidéos'); $liste['image'] = $this->doorGets->__("Galerie d'images"); $liste['faq'] = $this->doorGets->__('FAQ'); $liste['partner'] = $this->doorGets->__('Partenaires'); $liste['inbox'] = $this->doorGets->__('Formulaire de contact'); $liste['sharedlinks'] = $this->doorGets->__('Partage de liens'); $liste['link'] = $this->doorGets->__('Lien de redirection'); $listeWidgets['block'] = $this->doorGets->__('Bloc Statique'); $listeWidgets['genform'] = $this->doorGets->__('Formulaire'); $modulesInterneModules['module'] = $this->doorGets->__("Gestion des modules"); foreach ($liste as $key => $value) { $modulesInterneModules['module_' . $key] = $this->doorGets->__("Modules") . ' ' . $value; } $modulesInterneWidgets['widget'] = $this->doorGets->__("Gestion des widgets"); foreach ($listeWidgets as $key => $value) { $modulesInterneWidgets['module_' . $key] = $this->doorGets->__("Widgets") . ' ' . $value; } $modulesInterneMedia['media'] = $this->doorGets->__("Gestion des fichiers"); $modulesInterneInbox['myinbox'] = $this->doorGets->__("Boîte de réception"); $modulesInterneApi['api'] = $this->doorGets->__("Api Access Token"); $modulesInterneModeration['comment'] = $this->doorGets->__("Gestion des commentaires"); $modulesInterneModeration['inbox'] = $this->doorGets->__("Gestion des messages"); $modulesInterneModeration['moderation'] = $this->doorGets->__("Modérateur"); $modulesInterneMenu['menu'] = $this->doorGets->__("Gestion du menu principal"); $modulesInterneUsers['users'] = $this->doorGets->__("Gestion des utilisateurs"); $modulesInterneUsers['groupes'] = $this->doorGets->__("Gestion des groupes"); $modulesInterneUsers['attributes'] = $this->doorGets->__("Gestion des attributs"); $modulesInterneTemplates['traduction'] = $this->doorGets->__("Traducteur"); $modulesInterneTemplates['traduction_modo'] = $this->doorGets->__("Modérateur des traducteurs"); $modulesInterneTemplates['themes'] = $this->doorGets->__("Gestion des thèmes"); $modulesInterneTemplates['emailnotification'] = $this->doorGets->__("Gestion des notifications"); $modulesInterneCampagnes['campagne_email'] = $this->doorGets->__("Gestion des inscriptions à la newsletter"); $modulesInterneConfiguration['configuration'] = $this->doorGets->__('Configuration'); $modulesInterneConfiguration['siteweb'] = $this->doorGets->__('Site Web'); $modulesInterneConfiguration['langue'] = $this->doorGets->__('Langue') . ' / ' . $this->doorGets->__('Heure'); $modulesInterneConfiguration['logo'] = $this->doorGets->__('Logo') . ' & ' . $this->doorGets->__('Icône'); $modulesInterneConfiguration['modules'] = $this->doorGets->__('Modules internes'); $modulesInterneConfiguration['adresse'] = $this->doorGets->__('Addresse') . ' & ' . $this->doorGets->__('Contact'); $modulesInterneConfiguration['network'] = $this->doorGets->__('Réseaux sociaux'); $modulesInterneConfiguration['analytics'] = $this->doorGets->__('Google analytics'); $modulesInterneConfiguration['sitemap'] = $this->doorGets->__('Plan du site'); $modulesInterneConfiguration['backups'] = $this->doorGets->__('Sauvegardes'); $modulesInterneConfiguration['updater'] = $this->doorGets->__('Mise à jour'); $modulesInterneConfiguration['cache'] = $this->doorGets->__('Cache'); $modulesInterneConfiguration['setup'] = $this->doorGets->__('Installer'); $modulesInterneConfiguration['oauth'] = 'OAuth2'; $modulesInterneConfiguration['smtp'] = 'SMTP'; $modulesInterneConfiguration['stripe'] = 'stripe'; $modulesInterneConfiguration['params'] = $this->doorGets->__('Paramètres'); $subModule = $this->doorGets->getArrayForms('sub_module'); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $nbStringCount = ''; $per = 500; $ini = 0; $filters = array(); $sqlFilters = ' AND ('; foreach ($this->doorGets->user['liste_enfant_modo'] as $idGroup) { $filters[] = array('key' => 'id', 'type' => '!=!', 'value' => $idGroup); $sqlFilters .= " g.id = {$idGroup} OR "; } $sqlFilters = substr($sqlFilters, 0, -3); $sqlFilters .= ')'; $countGroupes = $this->doorGets->getCountTable('_users_groupes', $filters, '', ' OR '); $sqlLimit = " WHERE g.id = t.id_groupe AND t.langue = '" . $lgActuel . "' {$sqlFilters} ORDER BY g.date_creation LIMIT " . $ini . "," . $per; $all = $this->doorGets->dbQA('_users_groupes g, _users_groupes_traduction t', $sqlLimit); $cAll = count($all); if ($cAll > 1) { $nbStringCount = $countGroupes . ' ' . $this->doorGets->__('Groupes'); } $block = new BlockTable(); $block->setClassCss('doorgets-listing'); if ($cAll != 0) { $block->addTitle($nbStringCount, 'title', 'first-title td-title left'); $block->addTitle($this->doorGets->__('Utilisateurs'), 'users', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); for ($i = 0; $i < $cAll; $i++) { $filter = array(array('key' => 'network', 'type' => '=', 'value' => $all[$i]['id_groupe'])); $countUsers = $this->doorGets->getCountTable('_users_info', $filter); $urlVoirTitle = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=groupes&action=edit&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-cloud"></b> ' . $all[$i]['title'] . '</a>'; $urlUsers = $countUsers; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=groupes&action=delete&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-remove red"></b> </a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=groupes&action=edit&id=' . $all[$i]['id_groupe'] . '&lg=' . $this->doorGets->getLangueTradution() . '"><b class="glyphicon glyphicon-pencil green-font"></b> </a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage()); $block->addContent('title', $urlVoirTitle); $block->addContent('users', $urlUsers, 'text-center tb-30'); $block->addContent('edit', $urlEdit, 'text-center tb-30'); $block->addContent('delete', $urlDelete, 'text-center tb-30'); } } break; } $ActionFile = 'user/groupes/user_groupes_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
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; }
public function getContent() { $out = ''; $Website = $this->Website; $Module = $Website->getModule(); $moduleInfo = $Website->getActiveModules(); $tplPassword = $this->checkModulePassword($moduleInfo[$Module]['all']['with_password'], $moduleInfo[$Module]['all']['password'], $Module); if (!empty($tplPassword)) { return $tplPassword; } $templateDefault = 'modules/multipage/multipage_listing'; if (array_key_exists($Module, $moduleInfo)) { if (!empty($moduleInfo[$Module]['all']['template_index'])) { $templateDefault = $moduleInfo[$Module]['all']['template_index']; $templateDefault = str_replace('.tpl.php', '', $templateDefault); } } $nameTable = '_m_' . $Website->getRealUri($Module); $uri = $Website->getUri(); $isContent = array(); $urlAfterAction = urlencode(BASE_URL . '?' . $Website->getModule() . '=' . $uri); if (empty($uri)) { $isContentFirst = $Website->dbQS(1, $nameTable, 'ordre'); if (!empty($isContentFirst)) { $groupeTraduction = @unserialize($isContentFirst['groupe_traduction']); $idGroupeTraduction = $groupeTraduction[$Website->myLanguage]; $isContent = $Website->dbQS($idGroupeTraduction, $nameTable . '_traduction'); } } else { $isContent = $Website->dbQS($uri, $nameTable . '_traduction', 'uri'); } if (!empty($isContent)) { $isContentActive = $Website->dbQS($isContent['id_content'], $nameTable); $isContentActiveVersion = $Website->dbQS($isContent['id_content'], $nameTable . '_version', 'id_content', " AND active = 2 AND langue = '" . $Website->myLanguage . "' LIMIT 1"); if ($isContentActive['active'] != '2' && !empty($isContentActiveVersion)) { $isContent['article_tinymce'] = $isContentActiveVersion['article_tinymce']; $isContent['titre'] = $isContentActiveVersion['titre']; } $isContent['article'] = html_entity_decode($isContent['article_tinymce']); $isContent['article'] = $Website->_convertMethod($isContent['article']); unset($isContent['article_tinymce']); unset($isContent['id']); unset($isContent['meta_titre']); unset($isContent['meta_description']); unset($isContent['meta_keys']); unset($isContent['langue']); $isContent['id_user'] = $isContentActive['id_user']; $isContent['id_groupe'] = $isContentActive['id_groupe']; $isContent['comments'] = $isContentActive['comments']; $isContent['sharethis'] = $isContentActive['partage']; $isContent['facebook'] = $isContentActive['facebook']; $isContent['disqus'] = $isContentActive['disqus']; $isContent['date_creation'] = GetDate::in($isContentActive['date_creation'], 1, $Website->myLanguage); $labelModuleGroup = $Website->getActiveModules(); $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom']; $this->userPrivilege['modo'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant_modo'])) ? true : false; $this->userPrivilege['edit'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['edit'] || $this->userPrivilege['modo']) ? true : false; $this->userPrivilege['delete'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['delete'] || $this->userPrivilege['modo']) ? true : false; $urlAdd = URL_USER . $Website->_lgUrl . '?controller=modulemultipage&uri=' . $Website->getModule() . '&action=add&back=' . urlencode(BASE_URL . '?' . $Website->getModule()); $allModules = $Website->getActiveModules(); $nexContent = $Website->getUrlNextContent(); $prevContent = $Website->getUrlPreviousContent(); $urlEdition = URL_USER . $Website->_lgUrl . '?controller=modulemultipage&uri=' . $Website->getModule() . '&action=edit&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution() . '&back=' . $urlAfterAction; $urlDelete = URL_USER . $Website->_lgUrl . '?controller=modulemultipage&uri=' . $Website->getModule() . '&action=delete&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution() . '&back=' . $urlAfterAction; $urlAdd = URL_USER . $Website->_lgUrl . '?controller=modulemultipage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction; $labelModuleGroup = $Website->getActiveModules(); $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom']; } $urlAdd = URL_USER . $Website->_lgUrl . '?controller=modulemultipage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction; extract($isContent); $tplModuleMultipageListing = Template::getWebsiteView($templateDefault, $Website->getTheme()); ob_start(); if (is_file($tplModuleMultipageListing)) { include $tplModuleMultipageListing; } $out .= ob_get_clean(); return $out; }
public function getContent() { $out = ''; $Rubriques = array('siteweb' => $this->doorGets->__('Site Web'), 'langue' => $this->doorGets->__('Langue') . ' / ' . $this->doorGets->__('Heure'), 'media' => $this->doorGets->__('Logo') . ' & ' . $this->doorGets->__('Icône'), 'modules' => $this->doorGets->__('Modules internes'), 'adresse' => $this->doorGets->__('Adresses'), 'email' => $this->doorGets->__('Adresses e-mail de notifications'), 'network' => $this->doorGets->__('Réseaux sociaux'), 'analytics' => $this->doorGets->__('Google analytics'), 'sitemap' => $this->doorGets->__('Plan du site'), 'updater' => $this->doorGets->__('Mise à jour'), 'cache' => $this->doorGets->__('Cache'), 'oauth' => 'OAuth2', 'smtp' => 'SMTP', 'saas' => $this->doorGets->__('Cloud'), 'setup' => $this->doorGets->__("Système d'installation"), 'params' => $this->doorGets->__('Paramètres')); $RubriquesImage = array('siteweb' => '<b class="glyphicon glyphicon-home"></b>', 'langue' => '<b class="glyphicon glyphicon-globe"></b>', 'media' => '<b class="glyphicon glyphicon-picture"></b>', 'modules' => '<b class="glyphicon glyphicon-asterisk"></b>', 'adresse' => '<i class="fa fa-map-marker"></i>', 'email' => '<b class="glyphicon glyphicon-bullhorn"></b>', 'network' => '<b class="glyphicon glyphicon-link"></b>', 'analytics' => '<b class="glyphicon glyphicon-stats"></b>', 'sitemap' => '<b class="glyphicon glyphicon-tree-deciduous"></b>', 'updater' => '<b class="glyphicon glyphicon-open"></b>', 'cache' => '<b class="glyphicon glyphicon-refresh"></b>', 'oauth' => '<b class="glyphicon glyphicon-magnet"></b>', 'smtp' => '<b class="glyphicon glyphicon-road"></b>', 'saas' => '<b class="glyphicon glyphicon-cloud-upload"></b>', 'setup' => '<b class="glyphicon glyphicon-compressed"></b>', 'params' => '<b class="glyphicon glyphicon-cog"></b>'); if (SAAS_ENV && !SAAS_CONFIG_UPDATE) { unset($Rubriques['updater']); } if (SAAS_ENV && !SAAS_CONFIG_MODULES) { unset($Rubriques['modules']); } if (SAAS_ENV && !SAAS_CONFIG_ANALYTICS) { unset($Rubriques['analytics']); } if (SAAS_ENV && !SAAS_CONFIG_BACKUPS) { unset($Rubriques['backups']); } if (SAAS_ENV && !SAAS_CONFIG_PARAMS) { unset($Rubriques['params']); } if (SAAS_ENV && !SAAS_CONFIG_ANALYTICS) { unset($Rubriques['smtp']); } if (SAAS_ENV && !SAAS_CONFIG_MEDIA) { unset($Rubriques['media']); } if (SAAS_ENV && !SAAS_CONFIG_SETUP) { unset($Rubriques['setup']); } if (SAAS_ENV && !SAAS_CONFIG_OAUTH2) { unset($Rubriques['oauth']); } if (SAAS_ENV && !SAAS_CONFIG_CACHE) { unset($Rubriques['cache']); } if (SAAS_ENV && !SAAS_CONFIG_SMTP) { unset($Rubriques['smtp']); } if (SAAS_ENV && !SAAS_CONFIG_NETWORK) { unset($Rubriques['network']); } if (SAAS_ENV && !SAAS_CONFIG_CLOUD) { unset($Rubriques['saas']); } // if (SAAS_ENV && !SAAS_CONFIG_STRIPE) { unset($Rubriques['stripe']); } // if (SAAS_ENV && !SAAS_CONFIG_PAYPAL) { unset($Rubriques['paypal']); } // if (SAAS_ENV && !SAAS_CONFIG_TRANSFER) { unset($Rubriques['transfer']); } // if (SAAS_ENV && !SAAS_CONFIG_CHECK) { unset($Rubriques['check']); } // if (SAAS_ENV && !SAAS_CONFIG_CASH) { unset($Rubriques['cash']); } $params = $this->doorGets->Params(); $tplSelect = Template::getView('user/configuration/user_configuration_oauth_select'); ob_start(); if (is_file($tplSelect)) { include $tplSelect; } $htmlConfigSelect = ob_get_clean(); if (array_key_exists($this->Action, $Rubriques) || $this->Action === 'index') { switch ($this->Action) { case 'smtp': $isMandrillActive = $this->doorGets->configWeb['smtp_mandrill_active'] ? 'checked' : ''; $isMandrillSSL = $this->doorGets->configWeb['smtp_mandrill_ssl'] ? 'checked' : ''; break; case 'oauth': $isGoogleActive = $this->doorGets->configWeb['oauth_google_active'] ? 'checked' : ''; $isFacebookActive = $this->doorGets->configWeb['oauth_facebook_active'] ? 'checked' : ''; break; case 'siteweb': $yDateNow = date("Y"); $dateCreation = array(); for ($i = $yDateNow; $i > $yDateNow - 100; $i--) { $dateCreation[(string) $i] = (int) $i; } $statutImage = '<img src="' . BASE_IMG . 'puce-verte.png" title="' . $this->doorGets->__('Activer') . '" class="ico-image" />'; if ($this->doorGets->configWeb['statut'] == '2') { $statutImage = '<img src="' . BASE_IMG . 'puce-rouge.png" title="' . $this->doorGets->__('Désactiver') . '" class="ico-image" />'; } $aValidation = $this->doorGets->getArrayForms('website_activation'); break; case 'langue': $arrLangue = $this->doorGets->getAllLanguages(); break; // case 'stripe': // $isStripeActive = ($this->doorGets->configWeb['stripe_active']) ? 'checked' : ''; // break; // case 'paypal': // $isPaypalActive = ($this->doorGets->configWeb['paypal_active']) ? 'checked' : ''; // $isPaypalDemo = ($this->doorGets->configWeb['paypal_demo']) ? 'checked' : ''; // break; // case 'transfer': // $isTransferActive = ($this->doorGets->configWeb['transfer_active']) ? 'checked' : ''; // break; // case 'check': // $isCheckActive = ($this->doorGets->configWeb['check_active']) ? 'checked' : ''; // break; // case 'cash': // $isCashActive = ($this->doorGets->configWeb['cash_active']) ? 'checked' : ''; // break; // case 'stripe': // $isStripeActive = ($this->doorGets->configWeb['stripe_active']) ? 'checked' : ''; // break; // case 'paypal': // $isPaypalActive = ($this->doorGets->configWeb['paypal_active']) ? 'checked' : ''; // $isPaypalDemo = ($this->doorGets->configWeb['paypal_demo']) ? 'checked' : ''; // break; // case 'transfer': // $isTransferActive = ($this->doorGets->configWeb['transfer_active']) ? 'checked' : ''; // break; // case 'check': // $isCheckActive = ($this->doorGets->configWeb['check_active']) ? 'checked' : ''; // break; // case 'cash': // $isCashActive = ($this->doorGets->configWeb['cash_active']) ? 'checked' : ''; // break; case 'backups': $urlTop = '<a href="?controller=configuration&action=backups&do=create"><img src="' . BASE_IMG . 'add.png" alt="' . $this->doorGets->__("Créer une sauvegarde") . '" class="ico-image" /> ' . $this->doorGets->__('Créer une sauvegarde') . '</a>'; if (array_key_exists('do', $params['GET'])) { $urlTop = '<a class="doorGets-comebackform" href="?controller=configuration&action=backups"><img src="' . BASE_IMG . 'retour.png" class="Retour-img"> ' . $this->doorGets->__('Retour') . '</a>'; } $backups = new doorgetsBackups($this->doorGets); break; case 'modules': $imgOk = '<img src="' . BASE_IMG . 'activer.png" > '; $imgNo = '<img src="' . BASE_IMG . 'pause.png" > '; $isActive = ''; $isChecked = ''; break; case 'updater': $checkNow = $this->doorGets->_ckeckVersion(); extract($checkNow); break; case 'sitemap': $fileSitemap = BASE . 'sitemap.xml'; $urlSitemap = URL . 'sitemap.xml'; $dateEdit = $this->doorGets->__("Jamais"); if (is_file($fileSitemap)) { $dateEdit = GetDate::in($fileSitemap, 1, $this->doorGets->myLanguage()); } break; case 'params': $ouinon = array(1 => $this->doorGets->__('Oui'), 2 => $this->doorGets->__('Non')); $valCache = 2; if (ACTIVE_CACHE) { $valCache = 1; } $valDemo = 2; if (ACTIVE_DEMO) { $valDemo = 1; } $aProtocol = array('http://' => 'http://', 'https://' => 'https://'); $val_url = strtolower(URL); break; case 'setup': $urlTop = '<a href="?controller=configuration&action=setup&do=create"><img src="' . BASE_IMG . 'add.png" alt="' . $this->doorGets->__("Créer un système d'installation") . '" class="ico-image" /> ' . $this->doorGets->__("Créer un système d'installation") . '</a>'; if (array_key_exists('do', $params['GET'])) { $urlTop = '<a class="doorGets-comebackform" href="?controller=configuration&action=setup"><img src="' . BASE_IMG . 'retour.png" class="Retour-img"> ' . $this->doorGets->__('Retour') . '</a>'; } $setup = new doorgetsInstaller($this->doorGets); break; } $ActionFile = 'user/configuration/user_configuration_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
public function getLastModuleContents($module, $count = 3, $catId = '') { $out = ''; $iMaxDescription = 500; $nameTable = '_m_' . $module; $nameTableTrad = $nameTable . '_traduction'; //echo $module; $isModule = $this->dbQS($module, '_modules', 'uri'); $valActive = array("blog", "news", "video", "image", "sharedlinks"); if (empty($isModule)) { return '# Error Class doorgetsWebsite line ' . __LINE__; } if (!in_array($isModule['type'], $valActive)) { return '# Error Class doorgetsWebiste [' . $isModule['type'] . '] line ' . __LINE__; } $catSql = ''; if (!empty($catId) && is_numeric($catId)) { $catSql = " AND categorie LIKE '%" . $catId . ",%'"; } if (!empty($isModule)) { $Contents = $this->dbQ("SELECT * FROM {$nameTable} WHERE active = 2 {$catSql} ORDER BY id DESC LIMIT {$count}"); if (!empty($Contents)) { switch ($isModule['type']) { case 'news': foreach ($Contents as $k => $content) { $lgTrad = unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']); $lenArticle = strlen($Contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $Contents[$k]['article'] = substr(strip_tags($Contents[$k]['article']), 0, $iMaxDescription) . '...'; } } $tplNews = Template::getWebsiteView('modules/news/news_last_contents', $this->getTheme()); ob_start(); if (is_file($tplNews)) { include $tplNews; } $out = ob_get_clean(); break; case 'sharedlinks': foreach ($Contents as $k => $content) { $lgTrad = unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = $Contents[$k]['content_traduction']['article_tinymce']; } $tplSharedlinks = Template::getWebsiteView('modules/sharedlinks/sharedlinks_last_contents', $this->getTheme()); ob_start(); if (is_file($tplSharedlinks)) { include $tplSharedlinks; } $out = ob_get_clean(); break; case 'blog': foreach ($Contents as $k => $content) { $lgTrad = unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['image'] = $isContent['image']; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']); $lenArticle = strlen($Contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $Contents[$k]['article'] = substr(strip_tags($Contents[$k]['article']), 0, $iMaxDescription) . '...'; } } $tplNews = Template::getWebsiteView('modules/blog/blog_last_contents', $this->getTheme()); ob_start(); if (is_file($tplNews)) { include $tplNews; } $out = ob_get_clean(); break; case 'video': foreach ($Contents as $k => $content) { $lgTrad = unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); } $tplVideo = Template::getWebsiteView('modules/video/video_last_contents', $this->getTheme()); ob_start(); if (is_file($tplVideo)) { include $tplVideo; } $out = ob_get_clean(); break; case 'image': foreach ($Contents as $k => $content) { $lgTrad = unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); } $tplImage = Template::getWebsiteView('modules/image/image_last_contents', $this->getTheme()); ob_start(); if (is_file($tplImage)) { include $tplImage; } $out = ob_get_clean(); break; } } } return $out; }
public function getContent() { $out = ''; $Rubriques = array('index' => $this->doorGets->__('Gestion des rubriques'), 'select' => $this->doorGets->__('Voir une rubrique'), 'add' => $this->doorGets->__('Ajouter une rubrique'), 'edit' => $this->doorGets->__('Modifier une rubrique'), 'delete' => $this->doorGets->__('Supprimer une rubrique')); $listeModules = $this->doorGets->loadModulesRubrique(); $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_rubrique'); if (empty($isContent)) { return null; } $listeModules = $this->doorGets->loadModulesRubrique($isContent['idModule']); } $cListeModules = count($listeModules); $listeModulesForm = array('--'); $listeModules = $listeModulesForm + $listeModules; $ouinon = $this->doorGets->getArrayForms(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $nbStringCount = ''; $per = 300; $ini = 0; $cResultsInt = $this->doorGets->getCountTable('_rubrique'); $sqlLimit = " ORDER BY ordre LIMIT " . $ini . "," . $per; $all = $this->doorGets->dbQA('_rubrique', $sqlLimit); $cAll = count($all); if ($cAll > 4) { $nbStringCount = $cResultsInt . ' ' . $this->doorGets->__('Rubriques'); } $block = new BlockTable(); $block->setClassCss('doorgets-listing'); if ($cAll != 0) { $block->addTitle($nbStringCount, 'titre', 'first-title td-title'); $block->addTitle('', 'statut', 'td-title'); $block->addTitle('', 'topup', 'td-title'); $block->addTitle('', 'topbottom', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); for ($i = 0; $i < $cAll; $i++) { $urlStatut = BASE_IMG . 'puce-verte.png'; $bCss = 'backddd'; $nModule = ''; $tModule = ''; $tiModule = ''; $isModule = $this->doorGets->dbQS($all[$i]['idModule'], '_modules'); $isModuleTrad = $this->doorGets->dbQS($all[$i]['idModule'], '_modules_traduction', 'id_module', " AND langue = '" . $this->doorGets->myLanguage() . "' LIMIT 1 "); if (!empty($isModule) && !empty($isModuleTrad)) { $nModule = $isModule['uri']; $tModule = '[' . $isModule['type'] . ']'; $tiModule = '<span class="right"><small>' . $all[$i]['name'] . ' #</small></span> ' . $isModuleTrad['nom'] . ' - ' . $isModuleTrad['titre']; $bCss = ' hover'; if ($all[$i]['showinmenu'] === '2') { $urlStatut = BASE_IMG . 'puce-orange.png'; } } else { $tiModule = $all[$i]['name']; if ($all[$i]['showinmenu'] === '2') { $urlStatut = BASE_IMG . 'puce-rouge.png'; } else { $urlStatut = BASE_IMG . 'puce-orange.png'; } } $urlStatut = '<img src="' . $urlStatut . '" >'; $urlVoirTitle = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=rubriques&action=edit&id=' . $all[$i]['id'] . '"><img src="' . BASE_IMG . 'list-rubrique.png' . '" style="width: 20px;height: 20px;vertical-align: middle;margin-right: 5px;"> ' . $tiModule . ' ' . $tModule . '</a>'; $urlVoir = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=rubriques&action=edit&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-file"></b></a>'; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=rubriques&action=delete&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=rubriques&action=edit&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>'; $urlMovedown = ''; if ($all[$i]['ordre'] != $cResultsInt) { $urlMovedown = $this->doorGets->movePosition('down', '_rubrique', $all[$i]['id'], $all[$i]['ordre'], $cResultsInt); } $urlMoveup = ''; if ($all[$i]['ordre'] != 1) { $urlMoveup = $this->doorGets->movePosition('up', '_rubrique', $all[$i]['id'], $all[$i]['ordre'], $cResultsInt); } $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage()); $block->addContent('titre', $urlVoirTitle); $block->addContent('statut', $urlStatut, 'center tb-30'); $block->addContent('topbottom', $urlMovedown, 'center tb-30'); $block->addContent('topup', $urlMoveup, 'center tb-30'); $block->addContent('edit', $urlEdit, 'center tb-30'); $block->addContent('delete', $urlDelete, 'center tb-30'); } } break; } $ActionFile = 'user/rubriques/user_rubriques_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
public function __construct($id) { parent::__construct(); $isUser = $this->dbQS($id, '_users_info', 'id_user'); if (!empty($isUser)) { $isUser['count_notification'] = 0; $isUser['count_track'] = 0; $isUser['last_connexion'] = 0; $isUser['total_contribution'] = 0; $isUser['network_name'] = '-'; $nameGroupe = $this->dbQS($isUser['network'], '_users_groupes'); if (!empty($nameGroupe)) { $isUser['network_name'] = $nameGroupe['title']; } $isUser['date_creation'] = GetDate::in($isUser['date_creation']); $isUserNotification = $this->dbQ("SELECT count(*) as counter FROM _users_notification WHERE id_user = "******"SELECT date FROM _users_notification WHERE id_user = "******" ORDER BY date DESC LIMIT 1"); if (!empty($isUserLastConnexion)) { $isUser['last_connexion'] = GetDate::in($isUserLastConnexion[0]['date']); } $isUserTrack = $this->dbQ("SELECT count(*) as counter FROM _users_track WHERE id_user = "******"SELECT count(*) as counter FROM _m_" . $nameModule . " WHERE id_user = "******" "); $countContents = (int) $isCounterContents[0]['counter']; $realCount = $realCount + $countContents; } $outListeTypeModule[$nameModule]['count'] = $countContents; } } $isUser['total_contribution'] = $realCount; $isUser['liste_module'] = $outListeTypeModule; } } /* $out = ''; $blockInfos = new BlockTable(); $blockInfos->setClassCass('doorgets-listing'); $blockInfos->addTitle($this->getWords("Date d'inscription"),'date_inscription',' td-title center'); $blockInfos->addTitle($this->getWords("Dérnnière connexion"),'date_connexion',' td-title center'); $blockInfos->addTitle($this->getWords("Nbre de contibution"),'nb_contribution',' td-title center'); $blockInfos->addTitle($this->getWords("Nbre d'action"),'nb_action',' td-title center'); $blockInfos->addTitle($this->getWords("Nbre de page afficher"),'nb_page',' td-title center'); $blockInfos->addContent('date_inscription',$isUser['date_creation'],'center'); $blockInfos->addContent('date_connexion',$isUser['last_connexion'],'center' ); $blockInfos->addContent('nb_contribution',$isUser['total_contribution'],'center' ); $blockInfos->addContent('nb_action',$isUser['count_track'],'center' ); $blockInfos->addContent('nb_page',$isUser['count_notification'],'center' ); if (!empty($isUser['liste_module'])) { $blockModule = new BlockTable(); $blockModule->setClassCass('doorgets-listing'); $blockModule->addTitle($this->getWords("Module"),'module','first-title td-title left'); $blockModule->addTitle($this->getWords("Type"),'titre','td-title center'); $blockModule->addTitle($this->getWords("Nbre de contribution"),'nb_contribution','td-title center'); foreach($isUser['liste_module'] as $k=>$v) { $blockModule->addContent('module',$k ); $blockModule->addContent('titre',$v['type'],'center' ); $blockModule->addContent('nb_contribution',$v['count'],'center' ); } } $fTpl = GenView::getAdmin('doorgets','users/info.dguser.tpl.php'); ob_start(); include $fTpl; $out = ob_get_clean(); $this->user = $out; */ } return $isUser; }
public function getContent() { $out = ''; $tableName = '_moderation'; $lgActuel = $this->doorGets->getLangueTradution(); $controllerName = $this->doorGets->controllerNameNow(); $User = $this->doorGets->user; $Rubriques = array('index' => $this->doorGets->__('Index de la page')); $lgActuel = $this->doorGets->getLangueTradution(); $params = $this->doorGets->Params(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $p = 1; $ini = 0; $per = 25; $iPos = 0; $urlToGo = "./?controller={$controllerName}"; $urlPage = "./?controller={$controllerName}&page="; $isFieldArray = array("id" => array('label' => $this->doorGets->__('Id'), 'type' => 'text', 'options' => null, 'name' => 'Id', 'sort' => true, 'search' => true), "id_user" => array('label' => $this->doorGets->__('Id') . ' ' . $this->doorGets->__('User'), 'type' => 'text', 'options' => null, 'name' => 'IdUser', 'sort' => true, 'search' => true), "pseudo" => array('label' => $this->doorGets->__('Pseudo'), 'type' => 'text', 'options' => null, 'name' => 'Pseudo', 'sort' => true, 'search' => true), "id_groupe" => array('label' => $this->doorGets->__('Id') . ' ' . $this->doorGets->__('Module'), 'type' => 'text', 'options' => null, 'name' => 'IdGroupe', 'sort' => true, 'search' => true), "type_module" => array('label' => $this->doorGets->__('Type') . ' ' . $this->doorGets->__('Module'), 'type' => 'select', 'options' => array('blog' => $this->doorGets->__('Blog'), 'news' => $this->doorGets->__("Fil d'actualités"), 'video' => $this->doorGets->__('Galerie vidéos'), 'image' => $this->doorGets->__("Galerie d'image")), 'name' => 'TypeModule', 'sort' => true, 'search' => true), "action" => array('label' => $this->doorGets->__('Action'), 'type' => 'select', 'options' => array('add' => $this->doorGets->__('Ajout'), 'edit' => $this->doorGets->__("Modification")), 'name' => 'TypeModule', 'sort' => true, 'search' => true), "date_creation" => array('label' => $this->doorGets->__('Date'), 'type' => 'date', 'options' => null, 'name' => 'DateCreation', 'sort' => true, 'search' => true)); $iniUrlSortBy = 'id'; $isFieldArraySort = array('id', 'id_user', 'id_groupe', 'type_module', 'pseudo', 'action', 'date_creation'); $isFieldArraySearch = array('id', 'id_user', 'id_groupe', 'id_content', 'type_module', 'pseudo', 'action', 'date_creation', 'date_creation_start', 'date_creation_end'); $isFieldArrayDate = array('date_creation'); $urlOrderby = '&orderby=' . $iniUrlSortBy; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; if (array_key_exists('gby', $_GET) && is_numeric($_GET['gby']) && $_GET['gby'] < 300) { $per = $_GET['gby']; } if (array_key_exists('page', $_GET) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $p = $_GET['page']; $ini = $p * $per - $per; } $backUrl = urlencode('?controller=moderation&page=' . $p); // Init sort $getDesc = 'DESC'; $getSort = '&asc'; if (isset($_GET['asc'])) { $getDesc = 'ASC'; $getSort = '&desc'; $urlSort = '&asc'; } // Init Query $moderationQuery = new ModerationQuery($this->doorGets); if (!empty($User['liste_enfant'])) { foreach ($User['liste_enfant'] as $id_groupe) { $moderationQuery->filterByIdGroupe($id_groupe, 'OR'); } } $moderationCollection = $moderationQuery->paginate($p, $per); // Init Filters $getFilter = ''; if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) { $getFilter = $params['GET']['orderby']; $getFilterOrderBy = 'orderBy' . $isFieldArray[$getFilter]['name']; $urlOrderby = '&orderby=' . $getFilter; $moderationCollection->{$getFilterOrderBy}($getDesc); } else { $moderationCollection->orderById($getDesc); } $aGroupeFilter = array(); if (!empty($isFieldArraySearch)) { // Récupére les paramêtres du get et post pour la recherche par filtre foreach ($isFieldArraySearch as $fieldName) { $valueQP = ''; if (array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $fieldName])) { $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $fieldName]); $aGroupeFilter['doorGets_search_filter_q_' . $fieldName] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $fieldName])) { $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $fieldName]); $aGroupeFilter['doorGets_search_filter_q_' . $fieldName] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $fieldName]) || array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['GET']) && !empty($params['POST']['doorGets_search_filter_q_' . $fieldName])) { if (!empty($valueQP)) { $valEnd = str_replace('_start', '', $fieldName); $valEnd = str_replace('_end', '', $fieldName); if (in_array($valEnd, $isFieldArrayDate)) { if (array_key_exists('doorGets_search_filter_q_' . $fieldName, $params['GET']) && !empty($params['GET']['doorGets_search_filter_q_' . $fieldName])) { $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', '', $fieldName)) !== strlen($fieldName)) { $filterRangeByFieldTable = 'filterRangeBy' . $isFieldArray[$valEnd]['name']; $moderationCollection->{$filterRangeByFieldTable}($from, $to); $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_start=' . $fromFormat; $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '_end=' . $toFormat; } } else { if (in_array($fieldName, $isFieldArraySort)) { $nameFieldTable = 'filterBy' . $isFieldArray[$fieldName]['name']; $moderationCollection->{$nameFieldTable}($valueQP); $urlSearchQuery .= '&doorGets_search_filter_q_' . $valEnd . '=' . $valueQP; } } } } } } // Join traduction //$moderationCollection->join('DgFilesTraduction', array('id'=>'id_file'), array('langue' => $lgActuel)); // var_dump($moderationCollection); // exit(); // Execute Query $moderationCollection->find(); $count = $moderationCollection->count(); $countTotal = $moderationCollection->countTotal(); $moderationEntities = $moderationCollection->_getEntities('array'); $imgTop = '<div class="d-top"></div>'; $imgBottom = '<div class="d-bottom"></div>'; $block = new BlockTable(); $block->setClassCss('doorgets-listing'); foreach ($isFieldArray as $fieldName => $field) { $_css = '_css_' . $fieldName; $_img = '_img_' . $fieldName; $_desc = '_desc_' . $fieldName; ${$_css} = ${$_img} = ${$_desc} = $leftFirst = ''; if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $iniUrlSortBy) { ${$_css} = ' class="green" '; ${$_img} = $imgTop; ${$_desc} = $getSort; if ($getDesc === 'ASC') { ${$_img} = $imgBottom; ${$_desc} = ''; } } $leftFirst = $iPos === 0 && $fieldName !== 'id' ? 'first-title left' : ''; $dgLabel = $field['label']; if (in_array($fieldName, $isFieldArraySort)) { $dgLabel = '<a href="' . $urlToGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . ' >' . ${$_img} . $field['label'] . '</a>'; } $block->addTitle($dgLabel, $fieldName, "{$leftFirst} text-center"); $iPos++; } // Search field foreach ($isFieldArray as $fieldName => $field) { // Check field value $valFilter = array_key_exists('doorGets_search_filter_q_' . $fieldName, $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName] : ''; // Check type and put field switch ($field['type']) { case 'text': $sFilter = $this->doorGets->Form['_search_filter']->input('', 'doorGets_search_filter_q_' . $fieldName, 'text', $valFilter); break; case 'select': if (is_array($field['options'])) { $field['options'] = array_merge(array(''), $field['options']); $sFilter = $this->doorGets->Form['_search_filter']->select('', 'doorGets_search_filter_q_' . $fieldName, $field['options'], $valFilter); } break; case 'date': $valFilterStart = array_key_exists('doorGets_search_filter_q_' . $fieldName . '_start', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_start'] : ''; $valFilterEnd = array_key_exists('doorGets_search_filter_q_' . $fieldName . '_end', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_end'] : ''; $sFilter = $this->doorGets->Form['_search_filter']->input('', 'doorGets_search_filter_q_' . $fieldName . '_start', 'text', $valFilterStart, 'doorGets-date-input datepicker-from text-center'); $sFilter .= $this->doorGets->Form['_search_filter']->input('', 'doorGets_search_filter_q_' . $fieldName . '_end', 'text', $valFilter, 'doorGets-date-input datepicker-to text-center'); break; default: $sFilter = '#'; break; } $block->addContent($fieldName, $sFilter); } if (empty($moderationEntities)) { foreach ($isFieldArray as $fieldName => $field) { $block->addContent($fieldName, ''); } } else { for ($i = 0; $i < $count; $i++) { foreach ($isFieldArray as $fieldName => $field) { if (is_array($field['options']) && array_key_exists($moderationEntities[$i][$fieldName], $field['options'])) { $moderationEntities[$i][$fieldName] = $field['options'][$moderationEntities[$i][$fieldName]]; } $id = $moderationEntities[$i]['id']; $cssClass = 'text-center'; switch ($fieldName) { case 'date_creation': $moderationEntities[$i][$fieldName] = GetDate::in($moderationEntities[$i]['date_creation'], 1, $this->doorGets->myLanguage()); break; } $urlToGoNext = '?controller=module' . strtolower($moderationEntities[$i]['type_module']) . '&uri=' . $moderationEntities[$i]['uri_module'] . '&action=edit&id=' . $moderationEntities[$i]['id_content'] . '&lg=' . $moderationEntities[$i]['langue'] . '&back=' . $backUrl; $content = '<a href="' . $urlToGoNext . '" class="td-block">' . $moderationEntities[$i][$fieldName] . '</a>'; $block->addContent($fieldName, $content, $cssClass); } } } $finalPer = $ini + $per; if ($finalPer > $countTotal) { $finalPer = $countTotal; } $urlPage = "./?controller={$controllerName}" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller={$controllerName}" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p; $valPage = $countTotal > $per ? Pagination::page($countTotal, $p, $per, $urlPage) : ''; break; } $ActionFile = 'user/' . $controllerName . '/user_' . $controllerName . '_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
public function getContent() { $out = ''; $tableName = '_dg_saas'; $User = $this->doorGets->user; $lgActuel = $this->doorGets->getLangueTradution(); $controllerName = $this->doorGets->controllerNameNow(); $domaine = str_replace(array('http://', 'https://', 'builder.', 'www.'), '', URL); // 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->__('Cloud'), '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)) { $this->isContent = $isContent; $arrForCountSearchQuery = array(); $countTotal = $this->doorGets->getCountTable($tableName, $arrForCountSearchQuery); $userContent = $this->doorGets->getProfileInfos($isContent['id_user']); } } // Init count total contents $countContents = 0; // $arrForCountSearchQuery[] = array('key'=>"id_user",'type'=>'=','value'=>c); // $countContents = $this->doorGets->getCountTable($this->doorGets->Table,$arrForCountSearchQuery); // Check limit to add content $isLimited = false; if ($User['saas_options']['saas_add'] && $User['saas_options']['saas_limit'] !== '0') { $isLimited = (int) $User['saas_options']['saas_limit']; } $lgActuel = $this->doorGets->getLangueTradution(); $params = $this->doorGets->Params(); 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("id" => $this->doorGets->__('id'), "domain" => $this->doorGets->__('Domaine'), "pseudo" => $this->doorGets->__('Pseudo'), "title" => $this->doorGets->__('Titre'), "description" => $this->doorGets->__('Desciption'), "date_creation" => $this->doorGets->__('Date')); $isFieldTraductionArray = array(); $isFieldArraySort = array('id', 'domain', 'pseudo', 'title', 'description', 'date_creation'); $isFieldArraySearchInput = array('id', 'domain', 'pseudo', 'title', 'description', 'date_creation'); $isFieldArraySearch = array('id', 'domain', 'pseudo', 'title', 'description', 'date_creation_start', 'date_creation_end'); $isFieldArrayDate = array('date_creation'); $urlOrderby = '&orderby=' . $isFieldArraySort[5]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " _dg_saas "; // Create query search for mysql $sqlLabelSearch = ''; $arrForCountSearchQuery = array(); $filters = array(); $sqlLabelSearchModo = " ( id_user = '******'id'] . "' "; if (!empty($this->doorGets->user['liste_enfant_modo'])) { $sqlLabelSearchModo .= ' OR '; foreach ($this->doorGets->user['liste_enfant_modo'] as $idGroup) { //$arrForCountSearchQuery[] = array('key'=>'network','type'=>'=','value'=> $idGroup); $sqlLabelSearchModo .= " id_groupe = {$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 = $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 "; } $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, 'WHERE ' . $sqlLabelSearchModo . ' ' . $sqlLabelSearch, ' 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=saas" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=saas" . $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=saas&page="; $urlPageGo = './?controller=saas'; 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[5]) { ${$_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 field foreach ($isFieldArraySearchInput as $fieldName) { // Check field value $valFilter = array_key_exists('q_' . $fieldName, $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName] : ''; // Check type and put field switch ($fieldName) { case 'id': case 'pseudo': case 'domain': case 'title': case 'description': case 'action': $sFilter = $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName, 'text', $valFilter); break; case 'date_creation': $valFilterStart = array_key_exists('q_' . $fieldName . '_start', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_start'] : ''; $valFilterEnd = array_key_exists('q_' . $fieldName . '_end', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_end'] : ''; $sFilter = $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName . '_start', 'text', $valFilterStart, 'doorGets-date-input datepicker-from text-center'); $sFilter .= $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName . '_end', 'text', $valFilter, 'doorGets-date-input datepicker-to text-center'); break; default: $sFilter = '#'; break; } $block->addContent($fieldName, $sFilter); } $block->addContent('edit', ''); $block->addContent('delete', ''); // end Seach if (empty($cAll)) { $block->addContent('id', ''); $block->addContent('pseudo', ''); $block->addContent('domain', ''); $block->addContent('title', '', 'center'); $block->addContent('description', '', 'center'); $block->addContent('date_creation', '', 'tb-150 text-center'); $block->addContent('edit', '', 'center'); $block->addContent('delete', '', 'center'); } for ($i = 0; $i < $cAll; $i++) { $urlEdit = '<a href="?controller=saas&action=edit&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><i class="glyphicon glyphicon-pencil green-font"></i></a>'; $urlDelete = '<a href="?controller=saas&action=delete&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><i class="glyphicon glyphicon-remove red-c"></i></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); $urlDomain = URL . $this->doorGets->configWeb['saas_position'] . $all[$i]['domain']; $all[$i]['domain'] = '<a href="' . $urlDomain . '" target="_blank">' . $urlDomain . '</a>'; $block->addContent('id', $all[$i]['id'], 'tb-30 text-center'); $block->addContent('pseudo', $all[$i]['pseudo'], 'tb-50 text-center'); $block->addContent('domain', $all[$i]['domain'], 'tb-150 text-center'); $block->addContent('title', $all[$i]['title'], 'tb-150 text-center'); $block->addContent('description', $all[$i]['description'], 'tb-150 text-center'); $block->addContent('date_creation', $dateCreation, 'tb-150 text-center'); $block->addContent('edit', $urlEdit, 'tb-30 text-center'); $block->addContent('delete', $urlDelete, 'tb-30 text-center'); } /********** * * End block creation for listing fields * */ break; case 'edit': $domaine = str_replace(array('http://', 'https://', 'builder.', 'www.'), '', URL); //$saasUrl = PROTOCOL.$isContent['domain'].'.'.$domaine; $saasUrl = URL . $this->doorGets->configWeb['saas_position'] . $isContent['domain'] . '/'; $countDaysToDelete = (int) $userContent['saas_options']['saas_date_end']; $countDaysToDeleteSeconde = $countDaysToDelete * 86400; $now = time(); $dateCreation = (int) $isContent['date_creation']; $dateToDelete = $dateCreation + $countDaysToDeleteSeconde; $daysLeft = ceil(($dateToDelete - $now) / 86400); $removeInProgress = $daysLeft >= 0 || $countDaysToDelete === 0 ? false : true; break; } $ActionFile = 'user/' . $controllerName . '/user_' . $controllerName . '_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
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')); $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('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_users_groupes_attributes'); if (!empty($isContent)) { if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgAttribute = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgAttribute, '_users_groupes_attributes_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $isContent['params'] = @unserialize(base64_decode($isContent['params'])); $isContent['groupe_traduction'] = @unserialize($isContent['groupe_traduction']); $this->isContent = $isContent; } } } } $aUsersActivation = $this->doorGets->getArrayForms('users_activation'); $typeField = array(); $typeField['text'] = $this->doorGets->__('Champ texte'); $typeField['textarea'] = $this->doorGets->__('Champ texte multiligne'); $typeField['select'] = $this->doorGets->__('Sélection'); $typeField['checkbox'] = $this->doorGets->__('Case à cocher'); $typeField['radio'] = $this->doorGets->__('Bouton radio'); $typeField['file'] = $this->doorGets->__('Envoyer un fichier'); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $tableName = '_users_groupes_attributes'; $q = ''; $urlSearchQuery = ''; $p = 1; $ini = 0; $per = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $arFilterActivation = $this->doorGets->getArrayForms('content_activation'); $groupes = $this->doorGets->loadGroupesOptionToSelect($this->doorGets->Table, 'type'); $isFieldArray = array("id" => $this->doorGets->__('Id'), "title" => $this->doorGets->__('Titre'), 'uri' => $this->doorGets->__('Clé'), "type" => $this->doorGets->__('Type'), "active" => $this->doorGets->__('Actif')); $isFieldArraySearchType = array('id' => array('type' => 'text', 'value' => ''), 'title' => array('type' => 'text', 'value' => ''), 'uri' => array('type' => 'text', 'value' => ''), 'type' => array('type' => 'select', 'value' => $groupes), 'active' => array('type' => 'select', 'value' => $arFilterActivation)); $isFieldTraductionArray = array("title"); $isFieldArraySort = array('id', 'uri', 'title', 'type', 'active'); $isFieldArraySearch = array('id', 'uri', 'title', 'type', 'active'); $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 . '.id', 'type' => '!=!', 'value' => $this->doorGets->Table . '_traduction.id_attribute'); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '.id', 'type' => '>', 'value' => 0); $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 = $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 (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); // 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} AND _users_groupes_attributes.id = _users_groupes_attributes_traduction.id_attribute AND langue = '{$lgActuel}' ORDER BY {$outFilterORDER} LIMIT " . $ini . "," . $per; // Create url to go for pagination $urlPage = "./?controller=attributes" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=attributes" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p; // Generate the pagination system $valPage = ''; if ($cResultsInt > $per) { $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage); } $tAll = " _users_groupes_attributes, _users_groupes_attributes_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=attributes&page="; $urlPageGo = './?controller=attributes'; $block->addTitle($dgSelMass, 'id', '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++; } $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('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('edit', '', 'text-center'); $block->addContent('delete', '', 'text-center'); } for ($i = 0; $i < $cAll; $i++) { $ImageStatut = 'fa-ban red'; if ($all[$i]['active'] == '1') { $ImageStatut = 'fa-eye green-c'; } $urlStatut = '<i class="fa ' . $ImageStatut . ' fa-lg" ></i> '; $urlId = $all[$i]["id_attribute"]; $urlTitle = $all[$i]["title"]; $urlType = $all[$i]["type"]; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=attributes&action=delete&id=' . $all[$i]['id_attribute'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=attributes&action=edit&id=' . $all[$i]['id_attribute'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font" ></b></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); $block->addContent('id', $urlId, 'tb-70 text-center'); $block->addContent('uri', $all[$i]['uri'], 'tb-100 text-center'); $block->addContent('title', $urlTitle); $block->addContent('type', $urlType, 'tb-50 text-center'); $block->addContent('active', $urlStatut, 'tb-30 text-center'); $block->addContent('edit', $urlEdit, 'center'); $block->addContent('delete', $urlDelete, 'center'); } /********** * * End block creation for listing fields * */ break; case 'edit': break; } $ActionFile = 'user/attributes/user_attributes_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
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; }
public function getContent() { $out = ''; $tableName = '_moderation'; $lgActuel = $this->doorGets->getLangueTradution(); $controllerName = $this->doorGets->controllerNameNow(); $User = $this->doorGets->user; $Rubriques = array('index' => $this->doorGets->__('Index de la page')); $lgActuel = $this->doorGets->getLangueTradution(); $params = $this->doorGets->Params(); 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("id" => $this->doorGets->__('id'), "pseudo" => $this->doorGets->__('Pseudo'), "type_module" => $this->doorGets->__('Module'), "action" => $this->doorGets->__('Action'), "date_creation" => $this->doorGets->__('Date')); $isFieldArraySort = array('id', 'pseudo', 'type_module', 'action', 'date_creation'); $isFieldArraySearchInput = array('id', 'pseudo', 'type_module', 'action', 'date_creation'); $isFieldArraySearch = array('id', 'pseudo', 'type_module', 'action', 'date_creation_start', 'date_creation_end'); $isFieldArrayDate = array('date_creation'); $urlOrderby = '&orderby=' . $isFieldArraySort[4]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " _moderation "; // 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 .= " id_groupe = {$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 = $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 === 'active' || $v === 'network') { $sqlLabelSearch .= $v . " = " . $valueQP . " AND "; //$arrForCountSearchQuery[] = array('key'=>$tableName.".".$v,'type'=>'!=!','value'=>$valueQP,'',' AND '); } else { $sqlLabelSearch .= $v . " LIKE '%" . $valueQP . "%' AND "; //$arrForCountSearchQuery[] = array('key'=>$tableName.".".$v,'type'=>'like','value'=>$valueQP,'',' AND '); } } $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, 'WHERE ' . $sqlLabelSearchModo . ' ' . $sqlLabelSearch, ' 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; } $backUrl = urlencode('?controller=moderation&page=' . $p); $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=moderation" . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=moderation" . $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=moderation&page="; $urlPageGo = './?controller=moderation'; 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[4]) { ${$_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'); // Search field foreach ($isFieldArraySearchInput as $fieldName) { // Check field value $valFilter = array_key_exists('q_' . $fieldName, $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName] : ''; // Check type and put field switch ($fieldName) { case 'id': case 'pseudo': case 'type_module': case 'action': $sFilter = $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName, 'text', $valFilter); break; case 'date_creation': $valFilterStart = array_key_exists('q_' . $fieldName . '_start', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_start'] : ''; $valFilterEnd = array_key_exists('q_' . $fieldName . '_end', $aGroupeFilter) ? $aGroupeFilter['doorGets_search_filter_q_' . $fieldName . '_end'] : ''; $sFilter = $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName . '_start', 'text', $valFilterStart, 'doorGets-date-input datepicker-from text-center'); $sFilter .= $this->doorGets->Form['_search_filter']->input('', 'q_' . $fieldName . '_end', 'text', $valFilter, 'doorGets-date-input datepicker-to text-center'); break; default: $sFilter = '#'; break; } $block->addContent($fieldName, $sFilter); } $block->addContent('edit', ''); // end Seach if (empty($cAll)) { $block->addContent('id', ''); $block->addContent('pseudo', ''); $block->addContent('type_module', ''); $block->addContent('action', '', 'center'); $block->addContent('date_creation', 'tb-150 text-center'); $block->addContent('edit', '', 'center'); } for ($i = 0; $i < $cAll; $i++) { $urlToGoNext = '<a href="?controller=module' . strtolower($all[$i]['type_module']) . '&uri=' . $all[$i]['uri_module'] . '&action=edit&id=' . $all[$i]['id_content'] . '&lg=' . $all[$i]['langue'] . '&back=' . $backUrl . '"><i class="glyphicon glyphicon-pencil green-font"></i></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); $block->addContent('id', $all[$i]['id'], 'tb-30 text-center'); $block->addContent('pseudo', $all[$i]['pseudo'], 'tb-300 text-center'); $block->addContent('type_module', $all[$i]['type_module'], 'tb-150 text-center'); $block->addContent('action', $all[$i]['action'], 'tb-150 text-center'); $block->addContent('date_creation', $dateCreation, 'tb-150 text-center'); $block->addContent('edit', $urlToGoNext, 'tb-30 text-center'); } /********** * * End block creation for listing fields * */ break; } $ActionFile = 'user/moderation/user_moderation_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
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; }
public function getContent() { $out = ''; $nameController = $this->doorGets->controllerNameNow(); $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); $listeCategories = $this->doorGets->categorieSimple; unset($listeCategories[0]); $aActivation = $this->doorGets->getArrayForms('activation'); $extras = unserialize(base64_decode($moduleInfos['all']['extras'])); $Rubriques = array('index' => 'index', 'select' => 'Selection', 'delete' => 'Supprimer', 'massdelete' => '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)) { header('Location:?controller=modules'); } $idNextContent = $this->doorGets->getIdContentPositionDate($isContent['id']); $idPreviousContent = $this->doorGets->getIdContentPositionDate($isContent['id'], 'prev'); $urlPrevious = ''; if (!empty($idPreviousContent)) { $urlPrevious = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&uri=' . $this->doorGets->Uri . '&id=' . $idPreviousContent; } $urlNext = ''; if (!empty($idNextContent)) { $urlNext = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&uri=' . $this->doorGets->Uri . '&id=' . $idNextContent; } } 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 = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $isFieldArray = array("id" => $this->doorGets->__('ID'), "adresse_ip" => $this->doorGets->__('Adresse IP'), "date_creation" => $this->doorGets->__('Date')); $isFieldArraySort = array('id', 'adresse_ip', 'date_creation'); $isInClassicTable = array('id', 'adresse_ip'); $isFieldArraySearch = array('id', 'adresse_ip', '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 = $this->doorGets->Table . " "; // 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']); } $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 .= '&doorGets_search_filter_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 "; $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction." . $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 = " WHERE ( {$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 . '.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 = $this->doorGets->Table . '.' . $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 = $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 center"); $iPos++; } $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); $arFilterActivation = $this->doorGets->getArrayForms('activation'); $valFilterId = ''; if (array_key_exists('doorGets_search_filter_q_id', $aGroupeFilter)) { $valFilterId = $aGroupeFilter['q_id']; } $valFilterIp = ''; if (array_key_exists('doorGets_search_filter_q_adresse_ip', $aGroupeFilter)) { $valFilterIp = $aGroupeFilter['q_adresse_ip']; } $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']; } $sFilterId = $this->doorGets->Form['_search_filter']->input('', 'q_id', 'text', $valFilterId); $sFilterIp = $this->doorGets->Form['_search_filter']->input('', 'q_adresse_ip', 'text', $valFilterIp); $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('id', $sFilterId); $block->addContent('adresse_ip', $sFilterIp); $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('id', ''); $block->addContent('adresse_ip', ''); $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'; $urlStatut = '<img src="' . $ImageStatut . '" style="vertical-align: middle;" >'; $urlMassdelete = '<input id="' . $all[$i]["id"] . '" type="checkbox" class="check-me-mass" >'; $urlTitle = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&action=select&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '">' . $all[$i]["id"] . '</a>'; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&action=delete&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=module' . $moduleInfos['type'] . '&uri=' . $this->doorGets->Uri . '&action=select&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-zoom-in"></b></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 1, $this->doorGets->myLanguage()); // $block->addContent('sel_mass',$urlMassdelete,'tb-30 ' ); $block->addContent('id', $urlTitle, 'tb-30 '); $block->addContent('adresse_ip', $all[$i]["adresse_ip"]); $block->addContent('date_creation', $dateCreation, 'center'); $block->addContent('edit', $urlEdit, 'tb-30 center'); $block->addContent('delete', $urlDelete, 'tb-30 center'); } $formMassDelete = ''; $fileFormMassDelete = 'modules/' . $this->doorGets->zoneArea() . '/' . $this->doorGets->zoneArea() . '_form_massdelete'; $tplFormMassDelete = Template::getView($fileFormMassDelete); ob_start(); if (is_file($tplFormMassDelete)) { include $tplFormMassDelete; } $formMassDelete = ob_get_clean(); /********** * * End block creation for listing fields * */ } break; case 'select': $dataContent = array(); if (!empty($extras)) { foreach ($extras as $k => $v) { if ($v['type'] !== 'tag-title' && $v['type'] !== 'tag-quote' && $v['type'] !== 'tag-separatteur' && array_key_exists('value', $v)) { $value = str_replace('-', '_', $v['value']); if (array_key_exists($value, $isContent)) { $dataContent[$v['label']] = $isContent[$value]; if ($v['type'] === 'file') { if (!empty($isContent[$value])) { $dataContent[$v['label']] = '<a href="' . BASE . 'data/_form/' . $isContent[$value] . '" target="_blank">' . URL . 'data/_form/' . $isContent[$value] . '</a>'; $rest = substr($isContent[$value], -3); if ($rest === 'jpg' || $rest === 'png' || $rest === 'gif') { $dataContent[$v['label']] = '<a href="' . BASE . 'data/_form/' . $isContent[$value] . '" target="_blank"><img class="px200" src="' . BASE . 'data/_form/' . $isContent[$value] . '" ></a>'; } } } } } } } break; case 'delete': $formDelete = ''; $fileFormDelete = 'modules/' . $this->doorGets->zoneArea() . '/' . $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; }
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; }
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; }
public function getContent() { $out = $q = $qN = ''; $Website = $this->Website; $Profile = $Website->profile; $User = $Website->_User; $hasMe = $Website->isMyProfile($User, $Profile); $Module = $Website->getModule(); $moduleInfo = $Website->getActiveModules(); $templateDefault = 'modules/image/image_listing'; $templateDefaultContent = 'modules/image/image_content'; if (array_key_exists($Module, $moduleInfo)) { if (!empty($moduleInfo[$Module]['all']['template_index'])) { $templateDefault = $moduleInfo[$Module]['all']['template_index']; $templateDefault = str_replace('.tpl.php', '', $templateDefault); } if (!empty($moduleInfo[$Module]['all']['template_content'])) { $templateDefaultContent = $moduleInfo[$Module]['all']['template_content']; $templateDefaultContent = str_replace('.tpl.php', '', $templateDefaultContent); } } $nameTable = '_m_' . $Website->getRealUri($Website->getModule()); $categories = $Website->loadCategories($Website->getModule()); $categoriesIds = $Website->categoriesIds; $_imgTime = URL . 'themes/' . $Website->getTheme() . '/img/icone_time.png'; $_imgTag = URL . 'themes/' . $Website->getTheme() . '/img/icone_tag.png'; $_imgCalendar = URL . 'themes/' . $Website->getTheme() . '/img/icone_calendar.png'; $_imgComment = URL . 'themes/' . $Website->getTheme() . '/img/icone_comment.png'; if ($Website->getPosition() === 'root' || $Website->getPosition() === 'category') { $Params = $Website->getParams(); $ModuleInfos = $Website->moduleInfos($Website->getModule()); $par = $ModuleInfos['groupe_by']; if (array_key_exists('q', $Params['GET']) && !empty($Params['GET']['q'])) { $q = mb_strtolower($Params['GET']['q'], 'UTF-8'); } if (!empty($q)) { $qN = '&q=' . $q; } $outFilterAND = $sqlGroupe = $getCategory = ''; $outGroupe = 'all'; $valFilter = 'date'; $outFilterORDER = ' ' . $nameTable . '.date_creation DESC '; $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND "; if ($hasMe) { $outSqlGroupe = " WHERE "; } $outSqlGroupe .= $nameTable . ".id_user = '******'id'] . "'"; $outSqlGroupe .= " AND " . $nameTable . "_traduction.id_content = " . $nameTable . ".id\n AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "'\n ORDER BY " . $nameTable . ".date_creation DESC "; $outRub = $Website->getModule(); $categoryLabel = ''; if (array_key_exists('doorgets', $Params['GET'])) { $getCategory = $Params['GET']['doorgets']; $isCategorie = $Website->dbQS($getCategory, '_categories_traduction', 'uri'); if (!empty($isCategorie)) { $outGroupe = $getCategory; $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND "; if ($hasMe) { $outSqlGroupe = " WHERE "; } $outSqlGroupe .= " " . $nameTable . ".id_user = '******'id'] . "'"; $outSqlGroupe .= " AND " . $nameTable . "_traduction.id_content = " . $nameTable . ".id\n AND " . $nameTable . ".categorie LIKE '%" . $isCategorie['id_cat'] . ",%'\n AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "'\n ORDER BY " . $nameTable . ".date_creation DESC "; $outRub = 'doorgets=' . $getCategory; if (array_key_exists($getCategory, $categories)) { $categoryLabel = $categories[$getCategory]; } $parentCategories = $Website->getBreadcrumb($Website->getModule(), $isCategorie['id_cat']); sort($parentCategories); } } if (!empty($q)) { $outSqlGroupe = " WHERE " . $nameTable . ".active = 2 AND "; if ($hasMe) { $outSqlGroupe = " WHERE "; } $outSqlGroupe .= $nameTable . "_traduction.id_content = " . $nameTable . ".id\n AND " . $nameTable . "_traduction.langue = '" . $Website->myLanguage() . "' "; } $champsliste[] = $nameTable . '_traduction.titre'; $champsliste[] = $nameTable . '_traduction.description'; $champsliste[] = $nameTable . '_traduction.uri'; $champsliste[] = $nameTable . '_traduction.article_tinymce'; $champsliste[] = $nameTable . '_traduction.meta_titre'; $champsliste[] = $nameTable . '_traduction.meta_description'; $champsliste[] = $nameTable . '_traduction.meta_keys'; if (!empty($q) && !empty($champsliste)) { $sqlGroupe .= " AND ("; foreach ($champsliste as $v) { $sqlGroupe .= " " . $v . " LIKE '%" . $q . "%' OR"; } $sqlGroupe = substr($sqlGroupe, 0, -2); $sqlGroupe .= ") "; } $outSqlGroupe = $outSqlGroupe . $sqlGroupe; $isContents = $Website->dbQ('SELECT COUNT(*) as counter FROM ' . $nameTable . ', ' . $nameTable . '_traduction ' . $outSqlGroupe); $totalContents = (int) $isContents[0]['counter']; $urlPage = $Website->getBaseUrl() . "?{$outRub}{$qN}&p="; $p = 1; $ini = 0; $per = $par; if (array_key_exists('p', $Params['GET']) && is_numeric($Params['GET']['p']) && $Params['GET']['p'] <= ceil($totalContents / $per)) { $p = $Params['GET']['p']; $ini = $p * $per - $per; } $sqlLimit = " {$outSqlGroupe} LIMIT " . $ini . "," . $per; $getPagination = ''; if ($totalContents > $per) { $getPagination = Pagination::pagePublic($totalContents, $p, $per, $urlPage); } $all = $Website->dbQ('SELECT * FROM ' . $nameTable . ', ' . $nameTable . '_traduction ' . $sqlLimit); $cAll = count($all); $finalPer = $ini + $per; if ($finalPer > $totalContents) { $finalPer = $totalContents; } $out = ''; $contents = array(); $iMaxDescription = 500; if (!empty($all)) { foreach ($all as $k => $data) { $contents[$k]['active'] = $data['active']; $contents[$k]['uri'] = $data['uri']; $contents[$k]['title'] = $data['titre']; $contents[$k]['image'] = $data['image']; $contents[$k]['description'] = $data['description']; $contents[$k]['article'] = html_entity_decode($data['article_tinymce']); $lenArticle = strlen($contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $contents[$k]['article'] = substr(strip_tags($contents[$k]['article']), 0, $iMaxDescription) . '...'; } $contents[$k]['order'] = $data['ordre']; $contents[$k]['categories'] = $data['categorie']; $contents[$k]['date'] = GetDate::in($data['date_creation'], 2, $Website->myLanguage); } } $groupeBy = $par; if (!empty($contents)) { $ini = $ini + 1; } $labelModuleGroup = $Website->getActiveModules(); $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom']; $urlAfterAction = urlencode($Website->getCurrentUrl()); $urlAdd = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction; $tplModuleNewsListing = Template::getWebsiteUserView($templateDefault, $Website->getTheme()); ob_start(); if (is_file($tplModuleNewsListing)) { include $tplModuleNewsListing; } $out .= ob_get_clean(); } else { $linksToCategories = ''; $isContent = $Website->dbQS($Website->getUri(), $nameTable . '_traduction', 'uri'); if (!empty($isContent)) { $isContentActive = $Website->dbQS($isContent['id_content'], $nameTable, 'id', " AND active = 2 LIMIT 1"); $isContentActiveVersion = $Website->dbQS($isContent['id_content'], $nameTable . '_version', 'id_content', " AND active = 2 AND langue = '" . $Website->myLanguage . "' LIMIT 1"); if (!empty($isContentActive)) { $isContent['article'] = htmlspecialchars_decode(html_entity_decode($isContent['article_tinymce'])); $isContent['article'] = $Website->_convertMethod($isContent['article']); $isContent['title'] = $isContent['titre']; unset($isContent['titre']); unset($isContent['article_tinymce']); unset($isContent['id']); unset($isContent['meta_titre']); unset($isContent['meta_description']); unset($isContent['meta_keys']); unset($isContent['langue']); $isContent['active'] = $isContentActive['active']; $isContent['author_badge'] = $isContentActive['author_badge']; $isContent['id_user'] = $isContentActive['id_user']; $isContent['id_groupe'] = $isContentActive['id_groupe']; $isContent['comments'] = $isContentActive['comments']; $isContent['sharethis'] = $isContentActive['partage']; $isContent['facebook'] = $isContentActive['facebook']; $isContent['disqus'] = $isContentActive['disqus']; $isContent['image_gallery'] = $Website->_toArray($isContent['image_gallery'], ';'); $isContent['date_creation'] = GetDate::in($isContent['date_modification'], 2, $Website->myLanguage); $aCategories = $Website->_toArray($isContentActive['categorie']); if (!empty($aCategories)) { foreach ($aCategories as $id_category) { if (array_key_exists($id_category, $categoriesIds)) { $linksToCategories .= '<a href="' . BASE_URL . '?doorgets=' . $categoriesIds[$id_category] . '">' . $Website->categorieSimple[$id_category] . '</a>'; } } } } elseif (empty($isContentActive) && !empty($isContentActiveVersion)) { $isContentActive = $Website->dbQS($isContent['id_content'], $nameTable); if (!empty($isContentActive)) { $isContent['article'] = htmlspecialchars_decode(html_entity_decode($isContentActiveVersion['article_tinymce'])); $isContent['article'] = $Website->_convertMethod($isContent['article']); $isContent['title'] = $isContentActiveVersion['titre']; unset($isContent['titre']); unset($isContent['article_tinymce']); unset($isContent['id']); unset($isContent['meta_titre']); unset($isContent['meta_description']); unset($isContent['meta_keys']); unset($isContent['langue']); $isContent['active'] = $isContentActive['active']; $isContent['author_badge'] = $isContentActive['author_badge']; $isContent['id_user'] = $isContentActive['id_user']; $isContent['id_groupe'] = $isContentActive['id_groupe']; $isContent['comments'] = $isContentActive['comments']; $isContent['sharethis'] = $isContentActive['partage']; $isContent['facebook'] = $isContentActive['facebook']; $isContent['disqus'] = $isContentActive['disqus']; $isContent['image_gallery'] = $Website->_toArray($isContent['image_gallery'], ';'); $isContent['date_creation'] = GetDate::in($isContent['date_modification'], 2, $Website->myLanguage); $aCategories = $Website->_toArray($isContentActive['categorie']); if (!empty($aCategories)) { foreach ($aCategories as $id_category) { if (array_key_exists($id_category, $categoriesIds)) { $linksToCategories .= '<a href="' . BASE_URL . '?doorgets=' . $categoriesIds[$id_category] . '">' . $Website->categorieSimple[$id_category] . '</a>'; } } } } } } $nexContent = $Website->getUrlNextContent(); $prevContent = $Website->getUrlPreviousContent(); $cComment = $Website->getCountComment($Website->getModule(), $isContent['uri']); $urlAfterAction = $Website->getBaseUrl() . '?' . $Website->getModule() . '=' . urlencode($isContent['uri']); $urlGoToComments = $urlAfterAction . '#comments'; $urlEdition = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=edit&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution() . '&back=' . $urlAfterAction; $urlDelete = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=delete&id=' . $isContent['id_content'] . '&lg=' . $Website->getLangueTradution(); $urlAdd = URL_USER . $Website->_lgUrl . '?controller=moduleimage&uri=' . $Website->getModule() . '&action=add&back=' . $urlAfterAction; $labelModuleGroup = $Website->getActiveModules(); $labelModule = $labelModuleGroup[$Website->getModule()]['all']['nom']; $this->userPrivilege['modo'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant']) && in_array($isContent['id_groupe'], $Website->_User['liste_enfant_modo'])) ? true : false; $this->userPrivilege['edit'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['edit'] || $this->userPrivilege['modo']) ? true : false; $this->userPrivilege['delete'] = $Website->isUser && (in_array($labelModuleGroup[$Website->getModule()]['all']['id'], $Website->_User['liste_module']) && $isContent['id_user'] === $Website->_User['id'] && $this->userPrivilege['delete'] || $this->userPrivilege['modo']) ? true : false; extract($isContent); $tplModuleNewsContent = Template::getWebsiteUserView($templateDefaultContent, $Website->getTheme()); ob_start(); if (is_file($tplModuleNewsContent)) { include $tplModuleNewsContent; } $out .= ob_get_clean(); } return $out; }
public function getContent() { $out = ''; $tableName = '_support'; $lgActuel = $this->doorGets->getLangueTradution(); $controllerName = $this->doorGets->controllerNameNow(); $User = $this->doorGets->user; // Check if is content modo $is_modo = in_array('support', $this->doorGets->user['liste_module_interne']) ? true : false; $Rubriques = array('index' => 'index', 'add' => 'add', 'ticket' => 'ticket', 'close' => 'Close'); $lgActuel = $this->doorGets->getLangueTradution(); // get Content for edit / delete $params = $this->doorGets->Params(); $avatar = 'skin/img/no-image.png'; if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_support'); if (!empty($isContent)) { $this->isContent = $isContent; $isUser = $this->doorGets->dbQS($isContent['id_user'], '_users_info', 'id_user'); if (!empty($isUser)) { $avatar = 'data/users/' . $isUser['avatar']; } } } $params = $this->doorGets->Params(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'ticket': if (!empty($isContent)) { $supportMessages = new SupportMessagesQuery($this->doorGets); $supportMessages->filterByIdSupport($isContent['id']); $supportMessages->find(); $supportMessagesEntities = $supportMessages->_getEntities('array'); } break; case 'index': $sqlInboxUser = ''; $q = ''; $urlSearchQuery = ''; $urlToGo = "./?controller={$controllerName}"; $p = 1; $ini = 0; $per = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $optionStatus = array(0 => '', 1 => $this->doorGets->__('Ouvert'), 2 => $this->doorGets->__('Fermé')); $isFieldArray = array("reference" => $this->doorGets->__('Référence'), "subject" => $this->doorGets->__('Sujet'), "pseudo" => $this->doorGets->__('Pseudo'), "status" => $this->doorGets->__('Statut'), "count_messages" => $this->doorGets->__('Réponse'), "date_creation" => $this->doorGets->__('Date')); $isFieldArraySort = array('reference', 'subject', 'pseudo', 'status', 'count_messages', 'date_creation'); $isFieldArraySearch = array('reference', 'subject', 'pseudo', 'status', 'count_messages', 'date_creation_start', 'date_creation_end'); $isFieldArraySearchType = array('reference' => array('type' => 'text', 'value' => ''), 'subject' => array('type' => 'text', 'value' => ''), 'pseudo' => array('type' => 'text', 'value' => ''), 'count_messages' => array('type' => 'text', 'value' => ''), 'status' => array('type' => 'select', 'value' => $optionStatus)); $isFieldArrayDate = array('date_creation'); $urlOrderby = '&orderby=' . $isFieldArraySort[5]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " {$tableName} "; // Create query search for mysql $sqlLabelSearch = ''; $arrForCountSearchQuery = array(); // $sqlUserOther = ''; // if ($is_modo) { // if (!empty($User['liste_enfant'])) { // $sqlUserOther .= " AND ( ( id_user = '******'id']."' AND id_groupe = '".$User['groupe']."' ) "; // foreach($User['liste_enfant'] as $id_groupe) { // $sqlUserOther .= " OR id_groupe = '".$id_groupe."' "; // } // $sqlUserOther .= ')'; // } // }else{ // $sqlUserOther = " AND id_user = '******'id']."' AND id_groupe = '".$User['groupe']."' "; // } $sqlUserOther = " ( id_user = '******'id'] . "' "; if (!empty($this->doorGets->user['liste_enfant_modo'])) { $sqlUserOther .= ' OR '; foreach ($this->doorGets->user['liste_enfant_modo'] as $idGroup) { //$arrForCountSearchQuery[] = array('key'=>'network','type'=>'=','value'=> $idGroup); $sqlUserOther .= " id_groupe = {$idGroup} OR "; } $sqlUserOther = substr($sqlUserOther, 0, -3); } $sqlUserOther .= ')'; // 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, 'WHERE ' . $sqlUserOther . ' ' . $sqlInboxUser . ' ' . $sqlLabelSearch, ' 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 {$sqlUserOther} " . $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-tickets'); $iPos = 0; $dgSelMass = ''; $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page="; $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow(); //$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[5]) { ${$_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>'; } $css = ''; if ($fieldName === 'reference' || $fieldName === 'pseudo') { $css = ' tb-150 '; } if ($fieldName === 'count_messages') { $css = ' tb-30 '; } $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title {$css}"); $iPos++; } $block->addTitle('', 'edit', 'td-title'); //$block->addTitle('','delete','td-title'); // Search //$urlMassdelete = '<input type="checkbox" class="check-me-mass-all" />'; $urlMassdelete = ''; //$block->addContent('sel_mass',$urlMassdelete ); $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['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']; } $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, 'text-center tb-50'); $block->addContent('edit', '--', 'text-center tb-30'); //$block->addContent('delete','--','text-center tb-30'); // end Seach if (empty($cAll)) { //$block->addContent('sel_mass','' ); 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++) { $urlMassdelete = ''; $isSupportAgent = $all[$i]['id_user'] !== $User['id'] && in_array('support', $this->doorGets->user['liste_module_interne']) ? true : false; //$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=ticket&id=' . $all[$i]['id'] . '"><b class="glyphicon glyphicon-file"></b></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); //$block->addContent('sel_mass',$urlMassdelete ); foreach ($isFieldArraySearchType as $nameField => $value) { $cssHover = ''; $css = ''; if ($nameField === 'status') { $css = ' tb-30 text-center '; $all[$i][$nameField] = $all[$i][$nameField] === '1' ? '<b class="glyphicon glyphicon-time"></b>' : '<b class="glyphicon glyphicon-ok "></b>'; } if ($nameField === 'count_messages' || $nameField === 'pseudo') { $css = ' tb-30 text-center '; } if ($isSupportAgent && $all[$i]['readed_support'] !== '2') { $cssHover .= ' not-readed '; } if (!$isSupportAgent && $all[$i]['readed_user'] !== '2') { $cssHover .= ' not-readed '; } $block->addContent($nameField, $all[$i][$nameField], $css . $cssHover); } $block->addContent('date_creation', $dateCreation, 'text-center ' . $cssHover); $block->addContent('edit', $urlSelect, 'text-center ' . $cssHover); //$block->addContent('delete',$urlDelete,'center'); } /********** * * End block creation for listing fields * */ break; } $ActionFile = 'user/' . $controllerName . '/user_' . $controllerName . '_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
public function getContent() { $out = ''; $User = $this->doorGets->user; $lgActuel = $this->doorGets->getLangueTradution(); $isModo = false; if (!empty($User) && in_array('media', $User['liste_module_interne']) && in_array('media', $User['liste_module_interne_modo'])) { $isModo = true; } // files type start $typeFile["image/png"] = "data/upload/png/"; $typeFile["image/jpeg"] = "data/upload/jpg/"; $typeFile["image/gif"] = "data/upload/gif/"; $typeFile["application/zip"] = "data/upload/zip/"; $typeFile["application/x-zip-compressed"] = "data/upload/xzip/"; $typeFile["application/pdf"] = "data/upload/pdf/"; $typeFile["application/x-shockwave-flash"] = "data/upload/swf/"; $typeExtension["image/png"] = "png"; $typeExtension["image/jpeg"] = "jpg"; $typeExtension["image/gif"] = "gif"; $typeExtension["application/zip"] = "zip"; $typeExtension["application/x-zip-compressed"] = "xzip"; $typeExtension["application/pdf"] = "pdf"; $typeExtension["application/x-shockwave-flash"] = "swf"; $typeImage["image/png"] = '<img src="' . BASE_IMG . 'png.png" class="ico_fichier" >'; $typeImage["image/jpeg"] = '<img src="' . BASE_IMG . 'jpg.png" class="ico_fichier" >'; $typeImage["image/gif"] = '<img src="' . BASE_IMG . 'gif.png" class="ico_fichier" >'; $typeImage["application/zip"] = '<img src="' . BASE_IMG . 'zip.png" class="ico_fichier" >'; $typeImage["application/x-zip-compressed"] = '<img src="' . BASE_IMG . 'zip.png" class="ico_fichier" >'; $typeImage["application/pdf"] = '<img src="' . BASE_IMG . 'pdf.png" class="ico_fichier" >'; $typeImage["application/x-shockwave-flash"] = '<img src="' . BASE_IMG . 'swf.png" class="ico_fichier" >'; $this->typeFile = $typeFile; $this->typeExtension = $typeExtension; $this->typeImage = $typeImage; // files type end $Rubriques = array('index' => $this->doorGets->__('Media'), 'add' => $this->doorGets->__('Ajouter un media'), 'select' => $this->doorGets->__('Voir un media'), 'edit' => $this->doorGets->__('Editer un media'), 'delete' => $this->doorGets->__('Supprimer un media'), 'massdelete' => $this->doorGets->__('Suppression par media')); // 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; } } } $printImage = ''; $isContent['size'] = number_format((int) $isContent['size'] / 1000000, 2, ',', ' ') . ' Mo'; $urlFile = URL . $this->typeFile[$isContent['type']] . $isContent['path']; if ($isContent['type'] === 'image/png' || $isContent['type'] === 'image/jpeg' || $isContent['type'] === 'image/gif') { $printImage = '<img src="' . $urlFile . '" alt="' . $isContent['title'] . '" class="img img-responsive" />'; } } $gTypes = $this->doorGets->loadGroupesOptionToSelect($this->doorGets->Table, 'type'); $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("title" => $this->doorGets->__('Titre'), "type" => $this->doorGets->__('Type'), "size" => $this->doorGets->__('Poids'), "date_creation" => $this->doorGets->__('Date')); $isFieldArraySort = array('title', 'type', 'size', 'date_creation'); $isFieldArraySearch = array('title', 'type', 'size', 'date_creation_start', 'date_creation_end'); $isFieldArraySearchType = array('title' => array('type' => 'text', 'value' => ''), 'type' => array('type' => 'select', 'value' => $gTypes), 'size' => 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 = $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_file'); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '.id', 'type' => '>', 'value' => 0); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . '_traduction.langue', 'type' => '=', 'value' => $lgActuel); $sqlMediaOther = ''; if ($isModo && !empty($User['liste_enfant'])) { $sqlMediaOther .= " AND ( ( " . $this->doorGets->Table . ".id_user = '******'id'] . "' AND " . $this->doorGets->Table . ".id_groupe = '" . $User['groupe'] . "' ) "; foreach ($User['liste_enfant'] as $id_groupe) { $sqlMediaOther .= " OR " . $this->doorGets->Table . ".id_groupe = '" . $id_groupe . "' "; } $sqlMediaOther .= ')'; } else { $sqlMediaOther = " 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('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)) { if ($v === 'uri_module') { $sqlLabelSearch .= $this->doorGets->Table . "." . $v . " = '" . $valueQP . "' AND "; $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "." . $v, 'type' => '=', 'value' => $valueQP); } else { if ($v === 'title') { $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, $sqlMediaOther); // 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 = $this->doorGets->Table . '.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']; if ($getFilter === 'title') { $getFilter = 'date_creation'; } $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_file AND " . $this->doorGets->Table . "_traduction.langue ='{$lgActuel}' " . $sqlMediaOther . $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; //$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[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 text-center d"); $iPos++; } $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); // Search $urlMassdelete = '<input type="checkbox" class="check-me-mass-all" />'; $urlMassdelete = ''; //$block->addContent('sel_mass',$urlMassdelete ); $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('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'); $block->addContent('edit', '--', 'center'); $block->addContent('delete', '--', 'center'); // end Seach if (empty($cAll)) { //$block->addContent('sel_mass','' ); foreach ($isFieldArraySearchType as $nameField => $value) { $block->addContent($nameField, ''); } $block->addContent('date_creation', '', 'text-center'); $block->addContent('edit', '', 'text-center'); $block->addContent('delete', '', 'text-center'); } for ($i = 0; $i < $cAll; $i++) { $urlId = $all[$i]["id_file"]; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=delete&id=' . $all[$i]['id_file'] . '&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_file'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); //$block->addContent('sel_mass',$urlId ,'tb-30 text-center'); foreach ($isFieldArraySearchType as $nameField => $value) { $css = ''; if ($nameField === 'type') { $all[$i][$nameField] = $this->typeImage[$all[$i][$nameField]]; $css = 'tb-150 text-center'; } if ($nameField === 'size') { $all[$i][$nameField] = number_format((int) $all[$i][$nameField] / 1000000, 2, ',', ' ') . ' Mo'; $css = 'tb-50 text-right'; } if ($nameField === 'title') { $all[$i][$nameField] = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=select&id=' . $all[$i]['id_file'] . '&lg=' . $lgActuel . '">' . $all[$i][$nameField] . '</a>'; } $block->addContent($nameField, $all[$i][$nameField], $css); } $block->addContent('date_creation', $dateCreation, 'tb-150 text-center'); $block->addContent('edit', $urlEdit, 'tb-30 text-center'); $block->addContent('delete', $urlDelete, 'tb-30 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; }
public function getLastModuleContentsByModification($module, $count = 3, $catId = '') { $out = ''; $iMaxDescription = 500; $nameTableReal = $this->getRealUri($module); $nameTable = '_m_' . $nameTableReal; $nameTableTrad = $nameTable . '_traduction'; //echo $module; $isModule = $this->dbQS($module, '_modules', 'uri'); $valActive = array("shop", "blog", "news", "video", "image", "sharedlinks"); if (empty($isModule)) { return '# Error Class doorgetsWebsite line ' . __LINE__; } if (!in_array($isModule['type'], $valActive)) { return '# Error Class doorgetsWebiste [' . $isModule['type'] . '] line ' . __LINE__; } $catSql = ''; if (!empty($catId) && is_numeric($catId)) { $catSql = " AND " . $nameTable . ".categorie LIKE '#%" . $catId . ",%'"; } if (!empty($isModule) && $isModule['active'] == '1') { $lg = $this->myLanguage(); $nameTableTrad = $nameTable . '_traduction'; $Contents = $this->dbQ("\n SELECT " . $nameTableTrad . ".id as id , " . $nameTable . ".id as id_content \n FROM {$nameTable},{$nameTableTrad} \n WHERE \n {$nameTable}.active = 2 \n AND {$nameTable}.id = {$nameTableTrad}.id_content\n AND {$nameTableTrad}.langue = '{$lg}'\n {$catSql} \n ORDER BY {$nameTableTrad}.date_modification DESC LIMIT {$count}"); if (!empty($Contents)) { foreach ($Contents as $k => $content) { $isContent = $this->dbQS($content['id_content'], $nameTable); $isContentTrad = $this->dbQS($content['id'], $nameTableTrad); $Contents[$k] = array_merge($isContent, $isContentTrad); } switch ($isModule['type']) { case 'news': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']); $lenArticle = strlen($Contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $Contents[$k]['article'] = $this->_truncate($Contents[$k]['article'], $iMaxDescription); } } $tplNews = Template::getWebsiteView('modules/news/news_last_contents', $this->getTheme()); ob_start(); if (is_file($tplNews)) { include $tplNews; } $out = ob_get_clean(); break; case 'sharedlinks': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = $Contents[$k]['content_traduction']['url']; } $tplSharedlinks = Template::getWebsiteView('modules/sharedlinks/sharedlinks_last_contents', $this->getTheme()); ob_start(); if (is_file($tplSharedlinks)) { include $tplSharedlinks; } $out = ob_get_clean(); break; case 'blog': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['image'] = $isContent['image']; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = html_entity_decode($Contents[$k]['content_traduction']['article_tinymce']); $lenArticle = strlen($Contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $Contents[$k]['article'] = $this->_truncate($Contents[$k]['article'], $iMaxDescription); } } $tplNews = Template::getWebsiteView('modules/blog/blog_last_contents', $this->getTheme()); ob_start(); if (is_file($tplNews)) { include $tplNews; } $out = ob_get_clean(); break; case 'shop': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $content = array_merge($isContent, $Contents[$k]); $Contents[$k] = $content; $Contents[$k]['image'] = $isContent['image']; $cart = new Cart($this); $Contents[$k]['price'] = $cart->getPriceWithPromotionWebsite($content, $id_module); $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); $Contents[$k]['article'] = html_entity_decode($Contents[$k]['article_tinymce']); $lenArticle = strlen($Contents[$k]['article']); if ($lenArticle > $iMaxDescription - 1) { $Contents[$k]['article'] = $this->_truncate($Contents[$k]['article'], $iMaxDescription); } } $tplNews = Template::getWebsiteView('modules/shop/shop_last_contents', $this->getTheme()); ob_start(); if (is_file($tplNews)) { include $tplNews; } $out = ob_get_clean(); break; case 'video': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); } $tplVideo = Template::getWebsiteView('modules/video/video_last_contents', $this->getTheme()); ob_start(); if (is_file($tplVideo)) { include $tplVideo; } $out = ob_get_clean(); break; case 'image': foreach ($Contents as $k => $content) { $lgTrad = @unserialize($content['groupe_traduction']); $Contents[$k]['groupe_traduction'] = $lgTrad; $idLg = $Contents[$k]['groupe_traduction'][$this->myLanguage()]; $isContent = $this->dbQS($idLg, $nameTableTrad); $Contents[$k]['content_traduction'] = $isContent; $Contents[$k]['date'] = GetDate::in($Contents[$k]['date_creation'], 2, $this->myLanguage); } $tplImage = Template::getWebsiteView('modules/image/image_last_contents', $this->getTheme()); ob_start(); if (is_file($tplImage)) { include $tplImage; } $out = ob_get_clean(); break; } } } return $out; }
private function getHtmlIndex() { $translate = $this->doorGets; $allFiles = $this->getFiles(); /********** * * Start block creation for listing fields * **********/ if (!empty($allFiles)) { $block = new BlockTable(); $block->setClassCss('doorgets-listing'); $block->addTitle('', 'title', 'first-title td-title'); $block->addTitle('', 'size', 'td-title'); $block->addTitle('', 'download', 'td-title'); $block->addTitle('', 'install', 'td-title'); $block->addTitle('', 'delete', 'td-title'); $allFiles = array_reverse($allFiles); foreach ($allFiles as $k => $v) { $dataInfo = json_decode(file_get_contents(BASE . 'io/' . $v)); $date = '<span class="pull-right">' . GetDate::in($dataInfo->date) . '</span>'; $sizeFile = 0; if (is_file(BASE . 'io/' . $dataInfo->file)) { $sizeFile = filesize(BASE . 'io/' . $dataInfo->file); } $linkDownload = '<a href="' . URL . 'io/' . $dataInfo->file . '" ><b class="glyphicon glyphicon-download-alt" title="' . $translate->__('Telecharger') . '"></b></a>'; $linkInstall = '<a href="?controller=configuration&action=backups&do=install&file=' . $dataInfo->file . '" ><b title="' . $translate->l('Installer') . '" class="glyphicon glyphicon-transfer"></b></a>'; $linkDelete = '<a href="?controller=configuration&action=backups&do=delete&file=' . $dataInfo->file . '" ><b title="' . $translate->__('Supprimer') . '" class="glyphicon glyphicon-floppy-remove red"></b></a>'; $block->addContent('title', '<b class="glyphicon glyphicon-floppy-disk"></b> <b>' . $dataInfo->title . '</b>' . $date, 'first-title td-title'); $block->addContent('size', '<span class="badge">' . number_format((int) $sizeFile / 1000000, 2, ',', ' ') . ' Mo </span>', 'tb-30 '); $block->addContent('download', $linkDownload, 'tb-30 center'); $block->addContent('install', $linkInstall, 'tb-30 center'); $block->addContent('delete', $linkDelete, 'tb-30 center'); } } $fTpl = Template::getView('user/configuration/backups/user_configuration_backups_index'); ob_start(); include $fTpl; $out = ob_get_clean(); return $out; }
public function getContent() { $out = ''; $lgActuel = $this->doorGets->getLangueTradution(); $Rubriques = array('index' => $this->doorGets->__('Commentaire'), 'add' => $this->doorGets->__('Ajouter un commentaire'), 'select' => $this->doorGets->__('Afficher un commentaire'), 'delete' => $this->doorGets->__('Supprimer un commentaire'), 'massdelete' => $this->doorGets->__('Suppression par groupe')); // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET'])) { include CONFIGURATION . 'status.php'; $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, $this->doorGets->Table); if (empty($isContent)) { return NULL; } $countries = $this->doorGets->getArrayForms('country'); if (empty($isContent['shipping_country'])) { $isContent['shipping_country'] = 'FR'; } if (empty($isContent['billing_country'])) { $isContent['billing_country'] = 'FR'; } //$isContent['products'] = @unserialize($isContent['products']); $isContent['products'] = unserialize(base64_decode($isContent['products'])); $isContent['status_ico'] = Constant::$orderStatus[$isContent['status']]; $isContent['status_label'] = $statusPayment[$isContent['status']]; $isContent['amount_with_shipping'] = $this->doorGets->setCurrencyIcon($isContent['amount_with_shipping'], $isContent['currency']); $isContent['shipping_amount'] = $this->doorGets->setCurrencyIcon($isContent['shipping_amount'], $isContent['currency']); $isContent['amount_profit'] = $this->doorGets->setCurrencyIcon($isContent['amount_profit'], $isContent['currency']); $isContent['amount_vat'] = $this->doorGets->setCurrencyIcon($isContent['amount_vat'], $isContent['currency']); $isContent['shipping_country'] = $countries[$isContent['shipping_country']]; $isContent['billing_country'] = $countries[$isContent['billing_country']]; $idNextContent = $this->doorGets->getIdContentPositionDate($isContent['id']); $idPreviousContent = $this->doorGets->getIdContentPositionDate($isContent['id'], 'prev'); $urlPrevious = ''; if (!empty($idPreviousContent)) { $urlPrevious = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&uri=' . $this->doorGets->Uri . '&id=' . $idPreviousContent; } $urlNext = ''; if (!empty($idNextContent)) { $urlNext = '?controller=' . $this->doorGets->controllerNameNow() . '&action=select&uri=' . $this->doorGets->Uri . '&id=' . $idNextContent; } } $storeMenuFile = 'user/user_store_menu'; $tplStoreMenu = Template::getView($storeMenuFile); ob_start(); if (is_file($tplStoreMenu)) { include $tplStoreMenu; } $storeMenuHtml = ob_get_clean(); $groupes = array(); $aStatutComment = $this->doorGets->getArrayForms('comment_activation'); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $q = ''; $urlSearchQuery = ''; $p = 1; $ini = 0; $per = 50; $isFieldArray = array("id" => $this->doorGets->__('Id'), "status" => $this->doorGets->__('Statut'), "reference" => $this->doorGets->__('Référence'), "amount" => $this->doorGets->__('Valeur'), "currency" => $this->doorGets->__('Devise'), "transaction_id" => $this->doorGets->__('Transaction'), "method_billing" => $this->doorGets->__('Méthode'), "date_creation" => $this->doorGets->__('Date')); $isFieldArraySort = array('id', 'status', 'reference', 'amount', 'currency', 'transaction_id', 'method_billing', 'date_creation'); $isFieldArraySearch = array('id', 'status', 'reference', 'amount', 'currency', 'transaction_id', 'method_billing', 'date_creation_start', 'date_creation_end'); $isFieldArraySearchType = array('id' => array('type' => 'text', 'value' => ''), 'status' => array('type' => 'text', 'value' => ''), 'reference' => array('type' => 'text', 'value' => ''), 'amount' => array('type' => 'text', 'value' => ''), 'currency' => array('type' => 'text', 'value' => ''), 'transaction_id' => array('type' => 'text', 'value' => ''), 'method_billing' => array('type' => 'text', 'value' => '')); $isFieldArrayDate = array('date_creation'); $urlOrderby = '&orderby=' . $isFieldArraySort[0]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = $this->doorGets->Table; // 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']); } $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 = $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)) { if ($v === 'uri_module') { $sqlLabelSearch .= $this->doorGets->Table . "." . $v . " = '" . $valueQP . "' AND "; $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "." . $v, 'type' => '=', '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 = 'DESC'; $getSort = '&asc'; if (isset($_GET['asc'])) { $getDesc = 'ASC'; $getSort = '&desc'; $urlSort = '&asc'; } // Init filter for order by $outFilterORDER = $this->doorGets->Table . '.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 = $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 1=1 " . $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,'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 tb-50 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++; } $block->addTitle('', 'edit', 'td-title text-center'); // $block->addTitle('','delete','td-title text-center'); // 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}); } $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']; } $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('sel_mass','' ); foreach ($isFieldArraySearchType as $nameField => $value) { $block->addContent($nameField, '', ' text-center'); } $block->addContent('date_creation', '', 'tb-150 text-center'); $block->addContent('edit', '', ' text-center'); // $block->addContent('delete','',' text-center'); } for ($i = 0; $i < $cAll; $i++) { $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-zoom-in"></b></a>'; $dateCreation = GetDate::in($all[$i]['date_creation'], 2, $this->doorGets->myLanguage()); foreach ($isFieldArraySearchType as $nameField => $value) { $css = ' text-center'; switch ($nameField) { case 'status': if (array_key_exists($all[$i][$nameField], Constant::$orderStatus)) { $all[$i][$nameField] = Constant::$orderStatus[$all[$i][$nameField]]; } break; case 'currency': if (array_key_exists($all[$i][$nameField], Constant::$currencyIcon)) { $all[$i][$nameField] = Constant::$currencyIcon[$all[$i][$nameField]]; } break; } $block->addContent($nameField, $all[$i][$nameField], $css); } $block->addContent('date_creation', $dateCreation, ' text-center'); $block->addContent('edit', $urlSelect, ' text-center'); // $block->addContent('delete',$urlDelete,' text-center'); } /********** * * End block creation for listing fields * */ break; case 'select': break; case 'massdelete': $varListeFile = ''; $cListe = 0; if (array_key_exists('' . $this->doorGets->controllerNameNow() . '_massdelete_groupe_delete', $params['POST'])) { $varListeFile = $params['POST']['' . $this->doorGets->controllerNameNow() . '_massdelete_groupe_delete']; $ListeForDeleted = $this->doorGets->_toArray($varListeFile); $cListe = count($ListeForDeleted); } $formMassDeleteIndex = ''; $fileFormMassDeleteIndex = 'user/' . $this->doorGets->controllerNameNow() . '/user_' . $this->doorGets->controllerNameNow() . '_massdelete'; $tplFormMassDeleteIndex = Template::getView($fileFormMassDeleteIndex); ob_start(); if (is_file($tplFormMassDeleteIndex)) { include $tplFormMassDeleteIndex; } $formMassDeleteIndex = ob_get_clean(); 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; }