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 = ''; $lgActuel = $this->doorGets->getLangueTradution(); $moduleInfos = $this->doorGets->moduleInfos($this->doorGets->Uri, $lgActuel); $this->doorGets->loadCategories($moduleInfos['uri']); $this->doorGets->categorieSimple[0] = '-- ' . $this->doorGets->__('Ancune') . ' --'; $Categories = $this->doorGets->getAllCategories($this->doorGets->Uri); $categoriesOptions = $this->doorGets->getMenuCategoriesOptions(0, 0, $Categories); $categoriesOptions[0] = '-- ' . $this->doorGets->__('Ancune') . ' --'; $menuCategories = $this->doorGets->getMenuCategories(0, 0, $Categories); $Rubriques = array('index' => $this->doorGets->__('Index des catégories'), 'add' => $this->doorGets->__('Ajouter une catégorie'), 'edit' => $this->doorGets->__('Modifier une catégorie'), 'delete' => $this->doorGets->__('Supprimer une catégorie')); // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_categories'); if (!empty($isContent)) { if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_categories_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); } } } } if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $all = $menuCategories; $nbStringCount = ''; $cAll = count($all); if ($cAll > 4) { $nbStringCount = '<b>' . $cAll . ' ' . $this->doorGets->__('Catégories') . '<b>'; } $block = new BlockTable(); $block->setClassCss('doorgets-listing'); if ($cAll != 0) { $block->addTitle($nbStringCount, 'titre', 'first-title td-title left'); $block->addTitle('', 'topup', 'td-title'); $block->addTitle('', 'topbottom', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); foreach ($all as $Categorie) { $cResultsInt = (int) $menuCategories[$Categorie['id']]['nb_brother']; $urlMovedown = ''; if ($Categorie['ordre'] != $cResultsInt && $cResultsInt !== 0) { $urlMovedown = $this->doorGets->movePositionCategories('down', '_categories', $Categorie['id'], $Categorie['id_parent'], $Categorie['ordre'], $cResultsInt, 'cat-order-' . $Categorie['level']); } $urlMoveup = ''; if ($Categorie['ordre'] != 1 && $cResultsInt !== 0) { $urlMoveup = $this->doorGets->movePositionCategories('up', '_categories', $Categorie['id'], $Categorie['id_parent'], $Categorie['ordre'], $cResultsInt, 'cat-order-' . $Categorie['level']); } $urlAction = './?controller=modulecategory&uri=' . $this->doorGets->Uri . '&id=' . $Categorie['id'] . '&lg=' . $lgActuel; $urlVoirTitle = '<a class="cat-img-' . $Categorie['level'] . '" title="' . $this->doorGets->__('Modifier') . '" href="' . $urlAction . '&action=edit">'; $urlVoirTitle .= '<img src="' . BASE_IMG . 'list-rubrique.png' . '" style="width: 25px;height: 25px;vertical-align: middle;margin-right: 5px;float:left;">'; $urlVoirTitle .= $Categorie['nom'] . ' <small class="badge pull-right badge-lg">' . $Categorie['count'] . '</small>'; $urlVoirTitle .= '</a>'; //$urlVoirTitle .= '<span class="doorGets-sub-title-categorie"> '.$Categorie['titre'].'</span>'; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="' . $urlAction . '&action=delete"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="' . $urlAction . '&action=edit"><b class="glyphicon glyphicon-pencil green-font"></b></a>'; $classLevel = 'tb-level-' . $Categorie['level']; $block->addContent('titre', $urlVoirTitle, '' . $classLevel); $block->addContent('topbottom', $urlMovedown, 'tb-30 center ' . $classLevel); $block->addContent('topup', $urlMoveup, 'tb-30 center' . $classLevel); $block->addContent('edit', $urlEdit, 'tb-30 center' . $classLevel); $block->addContent('delete', $urlDelete, 'tb-30 center' . $classLevel); } } break; case 'delete': $isArcticleIn = $this->doorGets->dbQ("SELECT * FROM " . $this->doorGets->Table . " WHERE categorie = '" . $isContent['id_cat'] . "' LIMIT 1 "); break; } $ActionFile = 'modules/category/user_category_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
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 = '_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 = ''; $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; }
public function getContent() { $out = ''; $Rubriques = array('index' => 'index'); $lgActuel = $this->doorGets->getLangueTradution(); $groupes = $this->doorGets->loadGroupesToSelect(); $yesno = $this->doorGets->getArrayForms(); // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $tableName = $this->doorGets->Table; $q = ''; $urlSearchQuery = ''; $p = 1; $ini = 0; $per = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $arFilterActivation = $this->doorGets->getArrayForms('activation_mod'); $groupes = $this->doorGets->loadGroupesOptionToSelect($this->doorGets->Table, 'type', Constant::$widgets); $isFieldArray = array("titre" => $this->doorGets->__('Titre'), "uri" => $this->doorGets->__('Clée'), "active" => $this->doorGets->__('Statut'), "type" => $this->doorGets->__('Type')); $isFieldArraySearchType = array('titre' => array('type' => 'text', 'value' => ''), 'uri' => array('type' => 'text', 'value' => ''), 'type' => array('type' => 'select', 'value' => $groupes), 'active' => array('type' => 'select', 'value' => $arFilterActivation)); $isFieldTraductionArray = array("titre"); $isFieldArraySort = array('titre', 'uri', 'active', 'type'); $isFieldArraySearch = array('titre', 'uri', 'active', 'type'); $isFieldArrayDate = array(); $urlOrderby = '&orderby=' . $isFieldArraySort[0]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " " . $this->doorGets->Table . "," . $this->doorGets->Table . "_traduction "; // Create query search for mysql $sqlLabelSearch = ''; $arrForCountSearchQuery = array(); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.id_module", 'type' => '!=!', 'value' => $this->doorGets->Table . ".id"); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.langue", 'type' => 'like', 'value' => $lgActuel); $nextCondition = ' AND ('; foreach (Constant::$widgets as $key => $value) { $nextCondition .= ' ' . $this->doorGets->Table . ".type = '{$value}' OR "; } $nextCondition = substr($nextCondition, 0, -3); $nextCondition .= ')'; // Init Query Search $aGroupeFilter = array(); if (!empty($isFieldArraySearch)) { // Récupére les paramêtres du get et post pour la recherche par filtre foreach ($isFieldArraySearch as $v) { $valueQP = ''; if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]); $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]); $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active') || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { if (in_array($v, $isFieldArraySort)) { if (in_array($v, $isFieldTraductionArray)) { $sqlLabelSearch .= $tableName . "_traduction." . $v . " LIKE '%" . $valueQP . "%' AND "; $arrForCountSearchQuery[] = array('key' => $tableName . "_traduction." . $v, 'type' => 'like', 'value' => $valueQP); } else { $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND "; $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP); } } } } // préparation de la requête mysql if (!empty($sqlLabelSearch)) { $sqlLabelSearch = substr($sqlLabelSearch, 0, -4); $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) "; } } // Init Group By if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) { $per = $params['GET']['gby']; $urlGroupBy = '&gby=' . $per; } // Init count total fields $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, $nextCondition); // Init categorie $sqlCategorie = ''; // Init sort $getDesc = 'ASC'; $getSort = '&desc'; if (isset($_GET['desc'])) { $getDesc = 'DESC'; $getSort = '&asc'; $urlSort = '&desc'; } // Init filter for order by $outFilterORDER = $tableName . '_traduction.titre ' . $getDesc; $getFilter = ''; if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) { $getFilter = $params['GET']['orderby']; if (in_array($getFilter, $isFieldTraductionArray)) { $outFilterORDER = $tableName . '_traduction.' . $getFilter . ' ' . $getDesc; } else { $outFilterORDER = $tableName . $getFilter . ' ' . $getDesc; } $urlOrderby = '&orderby=' . $getFilter; } // Init page position if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) { $p = $params['GET']['page']; $ini = $p * $per - $per; } $finalPer = $ini + $per; if ($finalPer > $cResultsInt) { $finalPer = $cResultsInt; } // Create sql query for transaction $outSqlGroupe = " WHERE 1=1 " . $sqlLabelSearch; $sqlLimit = " {$outSqlGroupe} AND " . $this->doorGets->Table . ".id = " . $this->doorGets->Table . "_traduction.id_module AND langue = '{$lgActuel}' {$nextCondition} ORDER BY {$outFilterORDER} LIMIT " . $ini . "," . $per; // Create url to go for pagination $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p; // Generate the pagination system $valPage = ''; if ($cResultsInt > $per) { $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage); } $tAll = " " . $this->doorGets->Table . ", " . $this->doorGets->Table . "_traduction"; // Select all contents / Query SQL $all = $this->doorGets->dbQA($tAll, $sqlLimit); $cAll = count($all); /********** * * Start block creation for listing fields * **********/ $block = new BlockTable(); $imgTop = '<div class="d-top"></div>'; $imgBottom = '<div class="d-bottom"></div>'; $block->setClassCss('doorgets-listing'); $iPos = 0; $dgSelMass = ''; $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page="; $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow(); foreach ($isFieldArray as $fieldName => $fieldNameLabel) { $_css = '_css_' . $fieldName; $_img = '_img_' . $fieldName; $_desc = '_desc_' . $fieldName; ${$_css} = ${$_img} = ${$_desc} = $leftFirst = ''; if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) { ${$_css} = ' class="green" '; ${$_img} = $imgTop; ${$_desc} = $getSort; if ($getDesc === 'ASC') { ${$_img} = $imgBottom; ${$_desc} = ''; } } if ($iPos === 0) { $leftFirst = 'first-title text-left'; } $dgLabel = $fieldNameLabel; if (in_array($fieldName, $isFieldArraySort)) { $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . ' >' . ${$_img} . $fieldNameLabel . '</a>'; } $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title "); $iPos++; } $block->addTitle('', 'show', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); // Search fields $outFilter = ''; foreach ($isFieldArraySearchType as $nameField => $value) { $nameFieldVal = 'valFilter' . ucfirst($nameField); $sNameFieldVar = 'sFilter' . ucfirst($nameField); $keyNameField = 'q_' . $nameField; $keyNameFieldVal = 'q_' . $nameField; ${$nameFieldVal} = ''; if (array_key_exists($keyNameField, $aGroupeFilter)) { ${$nameFieldVal} = $aGroupeFilter[$keyNameField]; } switch ($value['type']) { case 'text': ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->input('', $keyNameFieldVal, 'text', ${$nameFieldVal}); break; case 'select': ${$sNameFieldVar} = $this->doorGets->Form['_search_filter']->select('', $keyNameFieldVal, $value['value'], ${$nameFieldVal}); break; } $block->addContent($nameField, ${$sNameFieldVar}); } $block->addContent('show', '--', 'tb-30 text-center'); $block->addContent('edit', '--', 'tb-30 text-center'); $block->addContent('delete', '--', 'tb-30 text-center'); // end Seach if (empty($cAll)) { foreach ($isFieldArraySearchType as $nameField => $value) { $block->addContent($nameField, ''); } $block->addContent('show', '', 'text-center'); $block->addContent('edit', '', 'text-center'); $block->addContent('delete', '', 'text-center'); } include CONFIG . 'modules.php'; for ($i = 0; $i < $cAll; $i++) { $imageIcone = BASE_IMG . 'ico_module.png'; if (array_key_exists($all[$i]['type'], $listeInfos)) { $imageIcone = $listeInfos[$all[$i]['type']]['image']; } $urlImage = '<img src="' . $imageIcone . '" class="px36"> '; $urlGerer = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font" ></b></a>'; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=modules&action=delete&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=modules&action=edit' . $all[$i]['type'] . '&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog" ></b></a>'; $all[$i]["active"] = $all[$i]["active"] ? '<i class="fa fa-check fa-lg green-c"></i>' : '<i class="fa fa-ban fa-lg red-c"></i>'; $block->addContent('titre', $urlImage . $all[$i]["titre"]); $block->addContent('uri', $all[$i]["uri"]); $block->addContent('type', $all[$i]["type"], 'tb-70 text-center'); $block->addContent('active', $all[$i]["active"], 'tb-30 text-center'); $block->addContent('show', $urlGerer, 'text-center'); $block->addContent('edit', $urlEdit, 'text-center'); $block->addContent('delete', $urlDelete, 'text-center'); } /********** * * End block creation for listing fields * */ break; case 'edit': break; } $ActionFile = 'user/modules/widgets/user_' . $this->doorGets->controllerNameNow() . '_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out .= ob_get_clean(); } return $out; }
public function getContent() { $out = ''; $lgActuel = $this->doorGets->getLangueTradution(); // Init action $Rubriques = array('index' => $this->doorGets->__('Index'), 'addblock' => $this->doorGets->__('Ajouter'), 'addcarousel' => $this->doorGets->__('Ajouter'), 'addblog' => $this->doorGets->__('Ajouter'), 'addpage' => $this->doorGets->__('Ajouter'), 'addgendata' => $this->doorGets->__('Ajouter'), 'addgenform' => $this->doorGets->__('Ajouter'), 'addmultipage' => $this->doorGets->__('Ajouter'), 'addinbox' => $this->doorGets->__('Ajouter'), 'addlink' => $this->doorGets->__('Ajouter'), 'addnews' => $this->doorGets->__('Ajouter'), 'addsharedlinks' => $this->doorGets->__('Ajouter'), 'addimage' => $this->doorGets->__('Ajouter'), 'addvideo' => $this->doorGets->__('Ajouter'), 'addfaq' => $this->doorGets->__('Ajouter'), 'addpartner' => $this->doorGets->__('Ajouter'), 'editblock' => $this->doorGets->__('Modifier'), 'editcarousel' => $this->doorGets->__('Modifier'), 'editblog' => $this->doorGets->__('Modifier'), 'editpage' => $this->doorGets->__('Modifier'), 'editmultipage' => $this->doorGets->__('Modifier'), 'editinbox' => $this->doorGets->__('Modifier'), 'editgenform' => $this->doorGets->__('Modifier'), 'editlink' => $this->doorGets->__('Modifier'), 'editnews' => $this->doorGets->__('Modifier'), 'editsharedlinks' => $this->doorGets->__('Modifier'), 'editimage' => $this->doorGets->__('Modifier'), 'editvideo' => $this->doorGets->__('Modifier'), 'editfaq' => $this->doorGets->__('Modifier'), 'editpartner' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'), 'type' => $this->doorGets->__('Chox du module'), 'massdelete' => $this->doorGets->__('Supprimer par groupe')); // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET']) && !array_key_exists('uri', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_modules'); if (!empty($isContent)) { $lgGroupe = @unserialize($isContent['groupe_traduction']); $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_modules_traduction'); if (!empty($isContentTraduction)) { unset($isContentTraduction['id']); $isContent = array_merge($isContent, $isContentTraduction); } $imageIcone = BASE_DATA . '/_gestion/' . $isContent['image']; if (!is_file($imageIcone)) { $imageIcone = BASE_IMG . '/ico_module.png'; } $isActiveModule = ''; if (!empty($isContent['active'])) { $isActiveModule = 'checked'; } $isPasswordModule = ''; if (!empty($isContent['with_password'])) { $isPasswordModule = 'checked'; } $isAuthorBadge = ''; if (array_key_exists('author_badge', $isContent) && !empty($isContent['author_badge'])) { $isAuthorBadge = 'checked'; } $isActiveNotification = ''; if (!empty($isContent['notification_mail'])) { $isActiveNotification = 'checked'; } $isPublicModule = ''; if (!empty($isContent['public_module'])) { $isPublicModule = 'checked'; } $isPublicComment = ''; if (!empty($isContent['public_comment'])) { $isPublicComment = 'checked'; } $isPublicAdd = ''; if (!empty($isContent['public_add'])) { $isPublicAdd = 'checked'; } $isHomePage = ''; if (!empty($isContent['is_first'])) { $isHomePage = 'checked'; } $this->isContent = $isContent; } } // Init variables form $numGroupe = array(); for ($i = 1; $i < 100; $i++) { $numGroupe[$i] = $i; } $editMode = true; // include config/modules.php include CONFIG . 'modules.php'; $arrayEmpty = array('' => ' -------'); $notifications = $this->doorGets->getAllEmailNotifications(); $allNotifications = array_merge($arrayEmpty, $notifications); $ouinon = $this->doorGets->getArrayForms(); $modules = $allModules = $this->doorGets->loadModules(true, true); $modulesBlocks = $this->doorGets->loadModulesBlocks(true); $modulesGenforms = $this->doorGets->loadModulesGenforms(true); $canAddType = array('blog', 'news', 'multipage', 'video', 'faq', 'image', 'partner', 'genform', 'sharedlinks'); $moduleType = array('page', 'blog', 'news', 'multipage', 'video', 'faq', 'image', 'partner', 'inbox', 'sharedlinks'); $iCountContents = 0; $_uri_module = str_replace('add', '', $this->Action); $_uri_module = str_replace('edit', '', $_uri_module); $__uri = $_uri_module . '/'; in_array($_uri_module, $moduleType) ? $_type = 'modules/' : ($_type = 'widgets/'); if (!array_key_exists($_uri_module, $liste)) { $__uri = $_type = ''; } foreach ($modules as $k => $v) { $allModules[$k]['url_edit'] = "?controller=modules&action=edit" . $v['type'] . "&id=" . $v['id']; if (!in_array($v['type'], $canAddType)) { unset($modules[$k]); $allModules[$k]['count'] = ''; $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } else { $allModules[$k]['count'] = $this->doorGets->getCountTable('_m_' . $v['uri']); $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } if ($v['type'] === 'inbox') { $allModules[$k]['count'] = $this->doorGets->getCountTable('_dg_inbox', array(array('key' => 'uri_module', 'type' => '=', 'value' => $v['uri']))); $allModules[$k]['url'] = "?controller=inbox&q_uri_module=" . $v['uri']; } if ($v['type'] === 'genform') { $allModules[$k]['count'] = $this->doorGets->getCountTable('_m_' . $v['uri']); $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } $iCountContents += $allModules[$k]['count']; } $htmlFormAddTop = 'user/modules/user_modules_form_add'; $tpl = Template::getView($htmlFormAddTop); ob_start(); if (is_file($tpl)) { include $tpl; } $getHtmlFormAddTop = ob_get_clean(); $htmlFormAddTop = 'user/modules/user_modules_form_edit'; $tpl = Template::getView($htmlFormAddTop); ob_start(); if (is_file($tpl)) { include $tpl; } $getHtmlFormEditTop = ob_get_clean(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'addgenform': $Form = $this->doorGets->Form->i; $label = 'input-label'; $cLabel = strlen($label); $iLabel = 0; if (!empty($Form)) { foreach ($Form as $k => $v) { $restLabel = substr($k, 0, $cLabel); if ($restLabel === $label) { $iLabel++; } } } break; case 'editgenform': $isContent['extras'] = unserialize($isContent['extras']); $this->genArraysForm($isContent['extras']); $isSendEmailTo = ''; if ($isContent['notification_mail'] === '1') { $isSendEmailTo = 'checked'; } $isSendEmailUser = ''; if ($isContent['send_mail_user'] === '1') { $isSendEmailUser = '******'; } $isActiveRecaptcha = ''; if ($isContent['recaptcha'] === '1') { $isActiveRecaptcha = 'checked'; } $Form = $this->doorGets->Form->i; $label = 'input-label'; $cLabel = strlen($label); $iLabel = 0; if (!empty($Form)) { foreach ($Form as $k => $v) { $restLabel = substr($k, 0, $cLabel); if ($restLabel === $label) { $iLabel++; } } } break; case 'type': $editMode = false; // include config/modules.php include CONFIG . 'modules.php'; break; case 'index': $out = ''; // Modules without blocks and genforms $nbStringCount = ''; $per = 300; $ini = 0; $cResultsInt = $this->doorGets->getCountTable('_modules', array(), " WHERE type != 'block' AND type != 'genform'"); $sqlLimit = " WHERE type != 'block' AND type != 'genform' ORDER BY type LIMIT " . $ini . "," . $per; $all = $this->doorGets->dbQA('_modules', $sqlLimit); foreach ($all as $key => $value) { if (!array_key_exists($value['id'], $allModules)) { unset($all[$key]); } } sort($all); $cAll = count($all); if ($cAll > 4) { $nbStringCount = $cResultsInt . ' ' . $this->doorGets->__('Modules'); } $block = new BlockTable(); $block->setClassCss('doorgets-listing'); $block->addTitle('', 'statut', 'td-title'); $block->addTitle('', 'image', 'td-title'); $block->addTitle('', 'titre', 'first-title td-title left'); $block->addTitle('', 'rubrique', 'td-title'); $block->addTitle('', 'gerer', 'td-title'); $block->addTitle('', 'editer', 'td-title'); $block->addTitle('', 'supprimer', 'td-title'); $isHomePageIn = ''; for ($i = 0; $i < $cAll; $i++) { $lgGroupe = unserialize($all[$i]['groupe_traduction']); $idTraduction = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idTraduction, '_modules_traduction'); $cResultsComInt = ''; $cResultsContentsInt = ''; $cResultsCatInt = ''; $cResultsRub = '-'; $idRub = 0; if ($all[$i]['type'] !== 'page' && $all[$i]['type'] !== 'inbox' && $all[$i]['type'] !== 'block' && $all[$i]['type'] !== 'link') { $iComments = $this->doorGets->dbQ("SELECT COUNT(*) as counter FROM _dg_comments WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsComInt = (int) $iComments[0]['counter']; $iContents = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _m_" . $this->doorGets->getRealUri($all[$i]['uri']) . " "); $cResultsContentsInt = (int) $iContents[0]['counters']; $iCat = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _categories WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsCatInt = (int) $iCat[0]['counters']; $aRubrique = $this->doorGets->dbQS($all[$i]['id'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name']; $idRub = $aRubrique['id']; } } if ($all[$i]['type'] === 'page' || $all[$i]['type'] === 'link' || $all[$i]['type'] === 'block' || $all[$i]['type'] === 'genform') { $aRubrique = $this->doorGets->dbQS($all[$i]['id'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name']; $idRub = $aRubrique['id']; } } if ($all[$i]['type'] === 'inbox') { $iContents = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _dg_inbox WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsContentsInt = (int) $iContents[0]['counters']; $aRubrique = $this->doorGets->dbQS($all[$i]['id'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name']; $idRub = $aRubrique['id']; } } $isFirstr = $imgFirst = ''; if ($all[$i]['is_first']) { $imgFirst = '<img src="' . BASE_IMG . 'home.png" class="ico-home" />'; $isHomePageIn = 1; } $imgRubrique = '<img src="' . BASE_IMG . 'list-rubrique.png" class="px20 doorgets-img-ico" />'; $ImageStatut = BASE_IMG . 'puce-orange.png'; if ($all[$i]['active'] == '1' and $cResultsRub !== '-') { $ImageStatut = BASE_IMG . 'puce-verte.png'; } elseif ($all[$i]['active'] == '0') { $ImageStatut = BASE_IMG . 'puce-rouge.png'; } $imageIcone = BASE_IMG . 'ico_module.png'; if (array_key_exists($all[$i]['type'], $listeInfos)) { $imageIcone = $listeInfos[$all[$i]['type']]['image']; } if ($all[$i]['type'] === 'block' || $all[$i]['type'] === 'genform') { $ImageStatut = BASE_IMG . 'puce-verte.png'; } if (!empty($isContentTraduction)) { $tGerer = $this->doorGets->__("Gérer le contenu du module") . ' ' . $all[$i]['uri']; $tEditer = $this->doorGets->__("Paramètres du module") . ' ' . $all[$i]['uri']; $tDel = $this->doorGets->__("Supprimer le module") . ' ' . $all[$i]['uri']; $urlGerer = '<a title="' . $tGerer . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b>'; $urlEditer = '<a title="' . $tEditer . '" href="./?controller=modules&action=edit' . $all[$i]['type'] . '&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog"></b>'; $urlSupprimer = '<a title="' . $tDel . '" href="./?controller=modules&action=delete&id=' . $all[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlImage = '<a title="' . $tGerer . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '" title="' . ucfirst($isContentTraduction['nom']) . '" ><img src="' . $imageIcone . '" class="px36" alt="' . ucfirst($isContentTraduction['nom']) . '" ></a>'; $urlTitre = '<a title="' . $tGerer . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '" style="font-size:12pt;padding:8px;" >' . $imgFirst . '<b> ' . ucfirst($isContentTraduction['titre']) . '</b>'; if ($all[$i]['type'] === 'inbox') { $urlImage = '<a title="' . $tGerer . '" href="./?controller=' . $all[$i]['type'] . '&q_uri_module=' . $all[$i]['uri'] . '" title="' . ucfirst($isContentTraduction['nom']) . '" ><img src="' . $imageIcone . '" class="px36" ></a>'; $urlTitre = '<a title="' . $tGerer . '" href="./?controller=' . $all[$i]['type'] . '&q_uri_module=' . $all[$i]['uri'] . '" style="font-size:12pt;padding:8px;" >' . $imgFirst . ' <b>' . ucfirst($isContentTraduction['titre']) . '</b>'; $urlGerer = '<a title="' . $tGerer . '" href="./?controller=' . $all[$i]['type'] . '&q_uri_module=' . $all[$i]['uri'] . '"><b class="glyphicon glyphicon-pencil green-font"></b>'; } $urlStatut = '<img src="' . $ImageStatut . '" style="vertical-align: middle;" >'; $urlType = '<em>' . $all[$i]['type'] . '</em>'; $urlName = '<small><em>' . $all[$i]['uri'] . '</em></small>'; $urlRubrique = '<a class="size12" href="./?controller=rubriques&action=edit&id=' . $idRub . '">' . $imgRubrique . ' ' . $cResultsRub . '</a>'; if ($cResultsRub === '-') { $urlRubrique = ''; } if (!empty($cResultsContentsInt)) { $urlTitre = $urlTitre . ' ' . '<span class="badge right">' . $cResultsContentsInt . '</span>'; } $block->addContent('statut', $urlStatut, 'tb-30'); $block->addContent('image', $urlImage, 'tb-30'); $block->addContent('titre', $urlTitre); $block->addContent('rubrique', $urlRubrique, 'tb-250 '); $block->addContent('gerer', $urlGerer, 'tb-30'); $block->addContent('editer', $urlEditer, 'tb-30'); $block->addContent('supprimer', $urlSupprimer, 'tb-30'); } } // Modules blocks, genforms $nbStringCount = ''; $per = 300; $ini = 0; $cResultsInt = $this->doorGets->getCountTable('_modules', array(), " WHERE type = 'block' OR type = 'genform' "); $sqlLimit = " WHERE type = 'block' OR type = 'genform' ORDER BY type LIMIT " . $ini . "," . $per; $allWidgets = $this->doorGets->dbQA('_modules', $sqlLimit); foreach ($allWidgets as $key => $value) { if (!array_key_exists($value['id'], $modulesBlocks) && !array_key_exists($value['id'], $modulesGenforms)) { unset($allWidgets[$key]); } } sort($allWidgets); $callWidgets = count($allWidgets); if ($callWidgets > 4) { $nbStringCount = $cResultsInt . ' ' . $this->doorGets->__('Modules'); } $blockWidgets = new BlockTable(); $blockWidgets->setClassCss('doorgets-listing'); $blockWidgets->addTitle('', 'statut', 'td-title'); $blockWidgets->addTitle('', 'image', 'td-title'); $blockWidgets->addTitle('', 'titre', 'first-title td-title left'); //$blockWidgets->addTitle('','rubrique','td-title'); $blockWidgets->addTitle('', 'gerer', 'td-title'); $blockWidgets->addTitle('', 'editer', 'td-title'); $blockWidgets->addTitle('', 'supprimer', 'td-title'); $isHomePageIn = ''; for ($i = 0; $i < $callWidgets; $i++) { $lgGroupe = unserialize($allWidgets[$i]['groupe_traduction']); $idTraduction = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idTraduction, '_modules_traduction'); $cResultsComInt = ''; $cResultsContentsInt = ''; $cResultsCatInt = ''; $cResultsRub = '-'; $idRub = 0; $imageIcone = BASE_IMG . 'ico_module.png'; if (array_key_exists($allWidgets[$i]['type'], $listeInfos)) { $imageIcone = $listeInfos[$allWidgets[$i]['type']]['image']; } if (!empty($isContentTraduction)) { $tGerer = $this->doorGets->__("Gérer le contenu du module") . ' ' . $allWidgets[$i]['uri']; $tEditer = $this->doorGets->__("Paramètres du module") . ' ' . $allWidgets[$i]['uri']; $tDel = $this->doorGets->__("Supprimer le module") . ' ' . $allWidgets[$i]['uri']; $urlGerer = '<a title="' . $tGerer . '" href="./?controller=module' . $allWidgets[$i]['type'] . '&uri=' . $allWidgets[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b>'; $urlEditer = '<a title="' . $tEditer . '" href="./?controller=modules&action=edit' . $allWidgets[$i]['type'] . '&id=' . $allWidgets[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog"></b>'; $urlSupprimer = '<a title="' . $tDel . '" href="./?controller=modules&action=delete&id=' . $allWidgets[$i]['id'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlImage = '<a title="' . $tGerer . '" href="./?controller=module' . $allWidgets[$i]['type'] . '&uri=' . $allWidgets[$i]['uri'] . '&lg=' . $lgActuel . '" title="' . ucfirst($isContentTraduction['nom']) . '" ><img src="' . $imageIcone . '" class="px36" alt="' . ucfirst($isContentTraduction['nom']) . '" ></a>'; $urlTitre = '<a title="' . $tGerer . '" href="./?controller=module' . $allWidgets[$i]['type'] . '&uri=' . $allWidgets[$i]['uri'] . '&lg=' . $lgActuel . '" style="font-size:12pt;padding:8px;" ><b> ' . ucfirst($isContentTraduction['titre']) . '</b>'; $urlStatut = ''; $urlType = '<em>' . $allWidgets[$i]['type'] . '</em>'; $urlName = '<small><em>' . $allWidgets[$i]['uri'] . '</em></small>'; $urlRubrique = '<a href="./?controller=rubriques&action=edit&id=' . $idRub . '">' . $cResultsRub . '</a>'; if ($cResultsRub === '-') { $urlRubrique = ''; } if (!empty($cResultsContentsInt)) { $urlTitre = $urlTitre . ' ' . '<span class="badge right">' . $cResultsContentsInt . '</span>'; } $blockWidgets->addContent('statut', $urlStatut, 'tb-30'); $blockWidgets->addContent('image', $urlImage, 'tb-30'); $blockWidgets->addContent('titre', $urlTitre); //$blockWidgets->addContent('rubrique',$urlRubrique,'nb-link '); $blockWidgets->addContent('gerer', $urlGerer, 'tb-30'); $blockWidgets->addContent('editer', $urlEditer, 'tb-30'); $blockWidgets->addContent('supprimer', $urlSupprimer, 'tb-30'); } } break; } $ActionFile = 'user/modules/' . $_type . $__uri . 'user_modules_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out = $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 = ''; $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 = ''; $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 = ''; $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 getContent() { $out = ''; $Rubriques = array('index' => $this->doorGets->__('Index'), 'add' => $this->doorGets->__('Ajouter'), 'edit' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer')); $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, $this->doorGets->Table); if (!empty($isContent)) { if ($lgGroupe = @unserialize($isContent['groupe_traduction'])) { $idLgAttribute = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgAttribute, $this->doorGets->Table . '_traduction'); if (!empty($isContentTraduction)) { $isContent = array_merge($isContent, $isContentTraduction); $isContent['groupe_traduction'] = @unserialize($isContent['groupe_traduction']); $this->isContent = $isContent; } } } } $storeMenuFile = 'user/user_store_menu'; $tplStoreMenu = Template::getView($storeMenuFile); ob_start(); if (is_file($tplStoreMenu)) { include $tplStoreMenu; } $storeMenuHtml = ob_get_clean(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'index': $tableName = $this->doorGets->Table; $q = ''; $urlSearchQuery = ''; $p = 1; $ini = 0; $per = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $isFieldArray = array("title" => $this->doorGets->__('Titre')); $isFieldTraductionArray = array("title"); $isFieldArraySort = array('title'); $isFieldArraySearch = array('title'); $isFieldArrayDate = array(); $urlOrderby = '&orderby=' . $isFieldArraySort[0]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " " . $this->doorGets->Table . "," . $this->doorGets->Table . "_traduction "; // Create query search for mysql $sqlLabelSearch = ''; $arrForCountSearchQuery = array(); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.id_content", 'type' => '!=!', 'value' => $this->doorGets->Table . ".id"); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.langue", 'type' => 'like', '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 (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 . '_traduction.title ' . $getDesc; $getFilter = ''; if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) { $getFilter = $params['GET']['orderby']; if (in_array($getFilter, $isFieldTraductionArray)) { $outFilterORDER = $tableName . '_traduction.' . $getFilter . ' ' . $getDesc; } else { $outFilterORDER = $tableName . '.' . $getFilter . ' ' . $getDesc; } $urlOrderby = '&orderby=' . $getFilter; } // Init page position if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) { $p = $params['GET']['page']; $ini = $p * $per - $per; } $finalPer = $ini + $per; if ($finalPer > $cResultsInt) { $finalPer = $cResultsInt; } // Create sql query for transaction $outSqlGroupe = " WHERE 1=1 " . $sqlLabelSearch; $sqlLimit = " {$outSqlGroupe} AND " . $this->doorGets->Table . ".id = " . $this->doorGets->Table . "_traduction.id_content AND langue = '{$lgActuel}' ORDER BY {$outFilterORDER} LIMIT " . $ini . "," . $per; // Create url to go for pagination $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p; // Generate the pagination system $valPage = ''; if ($cResultsInt > $per) { $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage); } $tAll = " " . $this->doorGets->Table . ", " . $this->doorGets->Table . "_traduction"; // Select all contents / Query SQL $all = $this->doorGets->dbQA($tAll, $sqlLimit); $cAll = count($all); /********** * * Start block creation for listing fields * **********/ $block = new BlockTable(); $imgTop = '<div class="d-top"></div>'; $imgBottom = '<div class="d-bottom"></div>'; $block->setClassCss('doorgets-listing'); $iPos = 0; $dgSelMass = ''; $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page="; $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow(); foreach ($isFieldArray as $fieldName => $fieldNameLabel) { $_css = '_css_' . $fieldName; $_img = '_img_' . $fieldName; $_desc = '_desc_' . $fieldName; ${$_css} = ${$_img} = ${$_desc} = $leftFirst = ''; if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) { ${$_css} = ' class="green" '; ${$_img} = $imgTop; ${$_desc} = $getSort; if ($getDesc === 'ASC') { ${$_img} = $imgBottom; ${$_desc} = ''; } } if ($iPos === 0) { $leftFirst = 'first-title text-left'; } $dgLabel = $fieldNameLabel; if (in_array($fieldName, $isFieldArraySort)) { $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . ' >' . ${$_img} . $fieldNameLabel . '</a>'; } $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title "); $iPos++; } $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); $arFilterActivation = $this->doorGets->getArrayForms('activation'); $yesno = $this->doorGets->getArrayForms(); $valFilterTitle = ''; if (array_key_exists('doorGets_search_filter_q_title', $aGroupeFilter)) { $valFilterTitle = $aGroupeFilter['doorGets_search_filter_q_title']; } $sFilterTitle = $this->doorGets->Form['_search_filter']->input('', 'q_title', 'text', $valFilterTitle); // Search $block->addContent('title', $sFilterTitle); $block->addContent('edit', '--', 'tb-30 text-center'); $block->addContent('delete', '--', 'tb-30 text-center'); // end Seach if (empty($cAll)) { $block->addContent('title', ''); $block->addContent('edit', '', 'center'); $block->addContent('delete', '', 'center'); } for ($i = 0; $i < $cAll; $i++) { $urlTitle = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=' . $this->doorGets->controllerNameNow() . '&action=edit&id=' . $all[$i]['id_content'] . '&lg=' . $lgActuel . '">' . $all[$i]["title"] . '</a>'; $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>'; $block->addContent('title', $urlTitle); $block->addContent('edit', $urlEdit, 'center'); $block->addContent('delete', $urlDelete, 'center'); } /********** * * End block creation for listing fields * */ break; case 'edit': 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 = ''; $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 = ''; $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(); $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 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 = ''; $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; }
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 = ''; $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; }
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(); // Init action $Rubriques = array('index' => $this->doorGets->__('Index'), 'addblock' => $this->doorGets->__('Ajouter'), 'addsurvey' => $this->doorGets->__('Ajouter'), 'addcarousel' => $this->doorGets->__('Ajouter'), 'addblog' => $this->doorGets->__('Ajouter'), 'addpage' => $this->doorGets->__('Ajouter'), 'addgendata' => $this->doorGets->__('Ajouter'), 'addgenform' => $this->doorGets->__('Ajouter'), 'addmultipage' => $this->doorGets->__('Ajouter'), 'addinbox' => $this->doorGets->__('Ajouter'), 'addlink' => $this->doorGets->__('Ajouter'), 'addnews' => $this->doorGets->__('Ajouter'), 'addsharedlinks' => $this->doorGets->__('Ajouter'), 'addonepage' => $this->doorGets->__('Ajouter'), 'addimage' => $this->doorGets->__('Ajouter'), 'addvideo' => $this->doorGets->__('Ajouter'), 'addfaq' => $this->doorGets->__('Ajouter'), 'addpartner' => $this->doorGets->__('Ajouter'), 'editblock' => $this->doorGets->__('Modifier'), 'editsurvey' => $this->doorGets->__('Modifier'), 'editcarousel' => $this->doorGets->__('Modifier'), 'editblog' => $this->doorGets->__('Modifier'), 'editpage' => $this->doorGets->__('Modifier'), 'editmultipage' => $this->doorGets->__('Modifier'), 'editinbox' => $this->doorGets->__('Modifier'), 'editgenform' => $this->doorGets->__('Modifier'), 'editlink' => $this->doorGets->__('Modifier'), 'editnews' => $this->doorGets->__('Modifier'), 'editonepage' => $this->doorGets->__('Modifier'), 'editsharedlinks' => $this->doorGets->__('Modifier'), 'editimage' => $this->doorGets->__('Modifier'), 'editvideo' => $this->doorGets->__('Modifier'), 'editfaq' => $this->doorGets->__('Modifier'), 'editpartner' => $this->doorGets->__('Modifier'), 'delete' => $this->doorGets->__('Supprimer'), 'type' => $this->doorGets->__('Module'), 'massdelete' => $this->doorGets->__('Supprimer par groupe')); // get Content for edit / delete $params = $this->doorGets->Params(); if (array_key_exists('id', $params['GET']) && !array_key_exists('uri', $params['GET'])) { $id = $params['GET']['id']; $isContent = $this->doorGets->dbQS($id, '_modules'); if (!empty($isContent)) { $lgGroupe = @unserialize($isContent['groupe_traduction']); $idLgGroupe = $lgGroupe[$lgActuel]; $isContentTraduction = $this->doorGets->dbQS($idLgGroupe, '_modules_traduction'); if (!empty($isContentTraduction)) { unset($isContentTraduction['id']); $isContent = array_merge($isContent, $isContentTraduction); } $imageIcone = BASE_DATA . '/_gestion/' . $isContent['image']; if (!is_file($imageIcone)) { $imageIcone = BASE_IMG . '/ico_module.png'; } $isActiveModule = ''; if (!empty($isContent['active'])) { $isActiveModule = 'checked'; } $isPasswordModule = ''; if (!empty($isContent['with_password'])) { $isPasswordModule = 'checked'; } $isAuthorBadge = ''; if (array_key_exists('author_badge', $isContent) && !empty($isContent['author_badge'])) { $isAuthorBadge = 'checked'; } $isActiveNotification = ''; if (!empty($isContent['notification_mail'])) { $isActiveNotification = 'checked'; } $isPublicModule = ''; if (!empty($isContent['public_module'])) { $isPublicModule = 'checked'; } $isPublicComment = ''; if (!empty($isContent['public_comment'])) { $isPublicComment = 'checked'; } $isPublicAdd = ''; if (!empty($isContent['public_add'])) { $isPublicAdd = 'checked'; } $isHomePage = ''; if (!empty($isContent['is_first'])) { $isHomePage = 'checked'; } $this->isContent = $isContent; } } // Init variables form $numGroupe = array(); for ($i = 1; $i < 100; $i++) { $numGroupe[$i] = $i; } $editMode = true; include CONFIG . 'modules.php'; $arrayEmpty = array('' => ' -------'); $notifications = $this->doorGets->getAllEmailNotifications(); $allNotifications = array_merge($arrayEmpty, $notifications); $ouinon = $this->doorGets->getArrayForms(); $modules = $allModules = $this->doorGets->loadModules(true, true); $modulesBlocks = $this->doorGets->loadModulesBlocks(true); $modulesSurvey = $this->doorGets->loadModulesSurvey(true); $modulesCarousel = $this->doorGets->loadModulesCarousel(true); $modulesGenforms = $this->doorGets->loadModulesGenforms(true); $canAddType = array_merge(Constant::$modulesCanAdd, array('genform', 'carousel')); $moduleType = array('page', 'blog', 'news', 'multipage', 'video', 'faq', 'image', 'partner', 'inbox', 'sharedlinks', 'onepage'); $iCountContents = 0; $_uri_module = str_replace('add', '', $this->Action); $_uri_module = str_replace('edit', '', $_uri_module); $__uri = $_uri_module . '/'; in_array($_uri_module, $moduleType) ? $_type = 'modules/' : ($_type = 'widgets/'); if (!array_key_exists($_uri_module, $liste) && array_key_exists($_uri_module, $listeWidgets)) { $liste = $listeWidgets; } if (!array_key_exists($_uri_module, $liste)) { $__uri = $_type = ''; } foreach ($modules as $k => $v) { $allModules[$k]['url_edit'] = "?controller=modules&action=edit" . $v['type'] . "&id=" . $v['id']; if (!in_array($v['type'], $canAddType)) { unset($modules[$k]); $allModules[$k]['count'] = ''; $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } else { $allModules[$k]['count'] = $this->doorGets->getCountTable('_m_' . $v['uri']); $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } if ($v['type'] === 'inbox') { $allModules[$k]['count'] = $this->doorGets->getCountTable('_dg_inbox', array(array('key' => 'uri_module', 'type' => '=', 'value' => $v['uri']))); $allModules[$k]['url'] = "?controller=inbox&q_uri_module=" . $v['uri']; } if ($v['type'] === 'genform') { $allModules[$k]['count'] = $this->doorGets->getCountTable('_m_' . $v['uri']); $allModules[$k]['url'] = "?controller=module" . $v['type'] . "&uri=" . $v['uri']; } $iCountContents += $allModules[$k]['count']; } $htmlFormAddTop = 'user/modules/user_modules_form_add'; $tpl = Template::getView($htmlFormAddTop); ob_start(); if (is_file($tpl)) { include $tpl; } $getHtmlFormAddTop = ob_get_clean(); $htmlFormAddTop = 'user/modules/user_modules_form_edit'; $tpl = Template::getView($htmlFormAddTop); ob_start(); if (is_file($tpl)) { include $tpl; } $getHtmlFormEditTop = ob_get_clean(); if (array_key_exists($this->Action, $Rubriques)) { switch ($this->Action) { case 'addgenform': $Form = $this->doorGets->Form->i; $label = 'input-label'; $cLabel = strlen($label); $iLabel = 0; if (!empty($Form)) { foreach ($Form as $k => $v) { $restLabel = substr($k, 0, $cLabel); if ($restLabel === $label) { $iLabel++; } } } break; case 'editgenform': $isContent['extras'] = unserialize(base64_decode($isContent['extras'])); $this->genArraysForm($isContent['extras']); $isSendEmailTo = ''; if ($isContent['notification_mail'] === '1') { $isSendEmailTo = 'checked'; } $isSendEmailUser = ''; if ($isContent['send_mail_user'] === '1') { $isSendEmailUser = '******'; } $isActiveRecaptcha = ''; if ($isContent['recaptcha'] === '1') { $isActiveRecaptcha = 'checked'; } $Form = $this->doorGets->Form->i; $label = 'input-label'; $cLabel = strlen($label); $iLabel = 0; if (!empty($Form)) { foreach ($Form as $k => $v) { $restLabel = substr($k, 0, $cLabel); if ($restLabel === $label) { $iLabel++; } } } break; case 'type': $editMode = false; include CONFIG . 'modules.php'; break; case 'index': $tableName = $this->doorGets->Table; $q = ''; $urlSearchQuery = ''; $p = 1; $ini = 0; $per = 50; $params = $this->doorGets->Params(); $lgActuel = $this->doorGets->getLangueTradution(); $arFilterActivation = $this->doorGets->getArrayForms('activation_mod'); $groupes = $this->doorGets->loadGroupesOptionToSelect($this->doorGets->Table, 'type', Constant::$_modules); $isFieldArray = array("titre" => $this->doorGets->__('Titre'), "uri" => $this->doorGets->__('Clée'), "active" => $this->doorGets->__('Statut'), "type" => $this->doorGets->__('Type')); $isFieldArraySearchType = array('titre' => array('type' => 'text', 'value' => ''), 'uri' => array('type' => 'text', 'value' => ''), 'type' => array('type' => 'select', 'value' => $groupes), 'active' => array('type' => 'select', 'value' => $arFilterActivation)); $isFieldTraductionArray = array("titre"); $isFieldArraySort = array('titre', 'uri', 'active', 'type'); $isFieldArraySearch = array('titre', 'uri', 'active', 'type'); $isFieldArrayDate = array(); $urlOrderby = '&orderby=' . $isFieldArraySort[0]; $urlSearchQuery = ''; $urlSort = '&desc'; $urlLg = '&lg=' . $lgActuel; $urlCategorie = ''; $urlGroupBy = '&gby=' . $per; // Init table query $tAll = " " . $this->doorGets->Table . "," . $this->doorGets->Table . "_traduction "; // Create query search for mysql $sqlLabelSearch = ''; $arrForCountSearchQuery = array(); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.id_module", 'type' => '!=!', 'value' => $this->doorGets->Table . ".id"); $arrForCountSearchQuery[] = array('key' => $this->doorGets->Table . "_traduction.langue", 'type' => 'like', 'value' => $lgActuel); $nextCondition = ' AND ('; foreach (Constant::$_modules as $key => $value) { $nextCondition .= ' ' . $this->doorGets->Table . ".type = '{$value}' OR "; } $nextCondition = substr($nextCondition, 0, -3); $nextCondition .= ')'; // Init Query Search $aGroupeFilter = array(); if (!empty($isFieldArraySearch)) { // Récupére les paramêtres du get et post pour la recherche par filtre foreach ($isFieldArraySearch as $v) { $valueQP = ''; if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { $valueQP = trim($params['GET']['doorGets_search_filter_q_' . $v]); $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { $valueQP = trim($params['POST']['doorGets_search_filter_q_' . $v]); $aGroupeFilter['doorGets_search_filter_q_' . $v] = $valueQP; } if (array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['GET']['doorGets_search_filter_q_' . $v]) || $params['GET']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active') || array_key_exists('doorGets_search_filter_q_' . $v, $params['POST']) && !array_key_exists('doorGets_search_filter_q_' . $v, $params['GET']) && (!empty($params['POST']['doorGets_search_filter_q_' . $v]) || $params['POST']['doorGets_search_filter_q_' . $v] === '0' && $v === 'active')) { if (in_array($v, $isFieldArraySort)) { if (in_array($v, $isFieldTraductionArray)) { $sqlLabelSearch .= $tableName . "_traduction." . $v . " LIKE '%" . $valueQP . "%' AND "; $arrForCountSearchQuery[] = array('key' => $tableName . "_traduction." . $v, 'type' => 'like', 'value' => $valueQP); } else { $sqlLabelSearch .= $tableName . "." . $v . " LIKE '%" . $valueQP . "%' AND "; $arrForCountSearchQuery[] = array('key' => $tableName . "." . $v, 'type' => 'like', 'value' => $valueQP); } } } } // préparation de la requête mysql if (!empty($sqlLabelSearch)) { $sqlLabelSearch = substr($sqlLabelSearch, 0, -4); $sqlLabelSearch = " AND ( {$sqlLabelSearch} ) "; } } // Init Group By if (array_key_exists('gby', $params['GET']) && is_numeric($params['GET']['gby']) && $params['GET']['gby'] < 300) { $per = $params['GET']['gby']; $urlGroupBy = '&gby=' . $per; } // Init count total fields $cResultsInt = $this->doorGets->getCountTable($tAll, $arrForCountSearchQuery, $nextCondition); // Init categorie $sqlCategorie = ''; // Init sort $getDesc = 'ASC'; $getSort = '&desc'; if (isset($_GET['desc'])) { $getDesc = 'DESC'; $getSort = '&asc'; $urlSort = '&desc'; } // Init filter for order by $outFilterORDER = $tableName . '_traduction.titre ' . $getDesc; $getFilter = ''; if (array_key_exists('orderby', $params['GET']) && !empty($params['GET']['orderby']) && in_array($params['GET']['orderby'], $isFieldArraySort)) { $getFilter = $params['GET']['orderby']; if (in_array($getFilter, $isFieldTraductionArray)) { $outFilterORDER = $tableName . '_traduction.' . $getFilter . ' ' . $getDesc; } else { $outFilterORDER = $tableName . '.' . $getFilter . ' ' . $getDesc; } $urlOrderby = '&orderby=' . $getFilter; } // Init page position if (array_key_exists('page', $params['GET']) && is_numeric($params['GET']['page']) && $params['GET']['page'] <= ceil($cResultsInt / $per)) { $p = $params['GET']['page']; $ini = $p * $per - $per; } $finalPer = $ini + $per; if ($finalPer > $cResultsInt) { $finalPer = $cResultsInt; } // Create sql query for transaction $outSqlGroupe = " WHERE 1=1 " . $sqlLabelSearch; $sqlLimit = " {$outSqlGroupe} AND " . $this->doorGets->Table . ".id = " . $this->doorGets->Table . "_traduction.id_module AND langue = '{$lgActuel}' {$nextCondition} ORDER BY {$outFilterORDER} LIMIT " . $ini . "," . $per; // Create url to go for pagination $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlGroupBy . $urlLg . '&page='; $urlPagePosition = "./?controller=" . $this->doorGets->controllerNameNow() . $urlCategorie . $urlOrderby . $urlSearchQuery . $urlSort . $urlLg . '&page=' . $p; // Generate the pagination system $valPage = ''; if ($cResultsInt > $per) { $valPage = Pagination::page($cResultsInt, $p, $per, $urlPage); } $tAll = " " . $this->doorGets->Table . ", " . $this->doorGets->Table . "_traduction"; // Select all contents / Query SQL $all = $this->doorGets->dbQA($tAll, $sqlLimit); $cAll = count($all); /********** * * Start block creation for listing fields * **********/ $block = new BlockTable(); $imgTop = '<div class="d-top"></div>'; $imgBottom = '<div class="d-bottom"></div>'; $block->setClassCss('doorgets-listing'); $iPos = 0; $dgSelMass = ''; $urlPage = "./?controller=" . $this->doorGets->controllerNameNow() . "&page="; $urlPageGo = './?controller=' . $this->doorGets->controllerNameNow(); foreach ($isFieldArray as $fieldName => $fieldNameLabel) { $_css = '_css_' . $fieldName; $_img = '_img_' . $fieldName; $_desc = '_desc_' . $fieldName; ${$_css} = ${$_img} = ${$_desc} = $leftFirst = ''; if ($getFilter === $fieldName || empty($getFilter) && $fieldName === $isFieldArraySort[0]) { ${$_css} = ' class="green" '; ${$_img} = $imgTop; ${$_desc} = $getSort; if ($getDesc === 'ASC') { ${$_img} = $imgBottom; ${$_desc} = ''; } } if ($iPos === 0) { $leftFirst = 'first-title text-left'; } $dgLabel = $fieldNameLabel; if (in_array($fieldName, $isFieldArraySort)) { $dgLabel = '<a href="' . $urlPageGo . '&orderby=' . $fieldName . $urlSearchQuery . '&gby=' . $per . ${$_desc} . '" ' . ${$_css} . ' >' . ${$_img} . $fieldNameLabel . '</a>'; } $block->addTitle($dgLabel, $fieldName, "{$leftFirst} td-title "); $iPos++; } $block->addTitle('', 'show', 'td-title'); $block->addTitle('', 'edit', 'td-title'); $block->addTitle('', 'delete', 'td-title'); // $valFilterTitle = ''; // if (array_key_exists('doorGets_search_filter_q_titre',$aGroupeFilter)) { // $valFilterTitle = $aGroupeFilter['doorGets_search_filter_q_titre']; // } // $sFilterTitle = $this->doorGets->Form['_search_filter']->input('','q_titre','text',$valFilterTitle); $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}); } // Search $block->addContent('show', '--', 'tb-30 text-center'); $block->addContent('edit', '--', 'tb-30 text-center'); $block->addContent('delete', '--', 'tb-30 text-center'); // end Seach if (empty($cAll)) { foreach ($isFieldArraySearchType as $nameField => $value) { $block->addContent($nameField, ''); } $block->addContent('show', '', 'text-center'); $block->addContent('edit', '', 'text-center'); $block->addContent('delete', '', 'text-center'); } include CONFIG . 'modules.php'; for ($i = 0; $i < $cAll; $i++) { $cResultsComInt = ''; $cResultsContentsInt = ''; $cResultsCatInt = ''; $cResultsRub = '-'; $idRub = 0; $urlActive = '<i class="fa fa-ban fa-lg red-c"></i>'; if ($all[$i]['type'] !== 'page' && $all[$i]['type'] !== 'inbox' && $all[$i]['type'] !== 'block' && $all[$i]['type'] !== 'carousel' && $all[$i]['type'] !== 'survey' && $all[$i]['type'] !== 'link' && $all[$i]['type'] !== 'onepage') { $iComments = $this->doorGets->dbQ("SELECT COUNT(*) as counter FROM _dg_comments WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsComInt = (int) $iComments[0]['counter']; $iContents = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _m_" . $this->doorGets->getRealUri($all[$i]['uri']) . " "); $cResultsContentsInt = (int) $iContents[0]['counters']; $iCat = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _categories WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsCatInt = (int) $iCat[0]['counters']; $aRubrique = $this->doorGets->dbQS($all[$i]['id_module'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name'] . ' <i class="fa fa-sort"></i> ' . $aRubrique['ordre']; $idRub = $aRubrique['id']; } } if ($all[$i]['type'] === 'page' || $all[$i]['type'] === 'onepage' || $all[$i]['type'] === 'link' || $all[$i]['type'] === 'block' || $all[$i]['type'] === 'genform' || $all[$i]['type'] === 'carousel' || $all[$i]['type'] === 'survey') { $aRubrique = $this->doorGets->dbQS($all[$i]['id_module'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name'] . ' <i class="fa fa-sort"></i> ' . $aRubrique['ordre']; $idRub = $aRubrique['id']; } } if ($all[$i]['type'] === 'inbox') { $iContents = $this->doorGets->dbQ("SELECT COUNT(*) as counters FROM _dg_inbox WHERE uri_module = '" . $all[$i]['uri'] . "' "); $cResultsContentsInt = (int) $iContents[0]['counters']; $aRubrique = $this->doorGets->dbQS($all[$i]['id_module'], '_rubrique', 'idModule'); if (!empty($aRubrique)) { $cResultsRub = $aRubrique['name'] . ' <i class="fa fa-sort"></i> ' . $aRubrique['ordre']; $idRub = $aRubrique['id']; } } $isFirstr = $imgFirst = ''; if ($all[$i]['is_first']) { $imgFirst = '<img src="' . BASE_IMG . 'home.png" class="ico-home" />'; $isHomePageIn = 1; } $imgRubrique = '<i class="fa fa-list"></i>'; $imageIcone = BASE_IMG . 'ico_module.png'; if (array_key_exists($all[$i]['type'], $listeInfos)) { $imageIcone = $listeInfos[$all[$i]['type']]['image']; } $urlImage = '<img src="' . $imageIcone . '" class="px36"> '; $urlGerer = '<a title="' . $this->doorGets->__('Afficher') . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font" ></b></a>'; $urlDelete = '<a title="' . $this->doorGets->__('Supprimer') . '" href="./?controller=modules&action=delete&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlEdit = '<a title="' . $this->doorGets->__('Modifier') . '" href="./?controller=modules&action=edit' . $all[$i]['type'] . '&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog" ></b></a>'; if ($all[$i]['active'] === '1') { $urlActive = '<i class="fa fa-check fa-lg green-c"></i>'; } $tGerer = $this->doorGets->__("Gérer le contenu du module") . ' ' . $all[$i]['uri']; $tEditer = $this->doorGets->__("Paramètres du module") . ' ' . $all[$i]['uri']; $tDel = $this->doorGets->__("Supprimer le module") . ' ' . $all[$i]['uri']; $urlGerer = '<a title="' . $tGerer . '" href="./?controller=module' . $all[$i]['type'] . '&uri=' . $all[$i]['uri'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>'; $urlEditer = '<a title="' . $tEditer . '" href="./?controller=modules&action=edit' . $all[$i]['type'] . '&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-cog"></b></a>'; $urlSupprimer = '<a title="' . $tDel . '" href="./?controller=modules&action=delete&id=' . $all[$i]['id_module'] . '&lg=' . $lgActuel . '"><b class="glyphicon glyphicon-remove red"></b></a>'; $urlImage = '<img src="' . $imageIcone . '" class="px36" alt="' . ucfirst($all[$i]['nom']) . '" > '; $urlTitre = $imgFirst . ucfirst($all[$i]['titre']); if ($all[$i]['type'] === 'inbox') { $urlImage = '<img src="' . $imageIcone . '" class="px36" >'; $urlTitre = $imgFirst . ' ' . ucfirst($all[$i]['titre']) . ''; $urlGerer = '<a title="' . $tGerer . '" href="./?controller=' . $all[$i]['type'] . '&q_uri_module=' . $all[$i]['uri'] . '"><b class="glyphicon glyphicon-pencil green-font"></b></a>'; } $urlType = '<em>' . $all[$i]['type'] . '</em>'; $urlName = '<small><em>' . $all[$i]['uri'] . '</em></small>'; $urlRubrique = '<a class="size12" href="./?controller=rubriques&action=edit&id=' . $idRub . '">' . $imgRubrique . ' ' . $cResultsRub . '</a>'; if ($cResultsRub === '-') { $urlRubrique = ''; } $all[$i]["uri"] = ' <span class="pull-right">' . $urlRubrique . '</span>' . $all[$i]["uri"]; if (!empty($cResultsContentsInt)) { $cResultsContentsInt = number_format($cResultsContentsInt, 0, ',', ' '); $urlTitre = $urlTitre . ' ' . '<span class="badge right">' . $cResultsContentsInt . '</span>'; } $block->addContent('active', $urlActive, 'tb-30 text-center'); $block->addContent('titre', $urlImage . $urlTitre); $block->addContent('uri', $all[$i]["uri"]); $block->addContent('type', $all[$i]["type"], 'tb-70 text-center'); $block->addContent('show', $urlGerer, 'text-center'); $block->addContent('edit', $urlEdit, 'text-center'); $block->addContent('delete', $urlDelete, 'text-center'); // $block->addContent('image',$urlImage,'tb-30'); // $block->addContent('titre',$urlTitre); // $block->addContent('rubrique',$urlRubrique,'tb-250 '); // $block->addContent('gerer',$urlGerer,'tb-30'); // $block->addContent('editer',$urlEditer,'tb-30'); // $block->addContent('supprimer',$urlSupprimer,'tb-30'); } /********** * * End block creation for listing fields * */ break; } $ActionFile = 'user/modules/' . $_type . $__uri . 'user_modules_' . $this->Action; $tpl = Template::getView($ActionFile); ob_start(); if (is_file($tpl)) { include $tpl; } $out = $tpl; $out = ob_get_clean(); } return $out; }