* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')) { include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// //////////// Check Droits utilisateur //////////// if (!$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// include_once(override('../vote/display.php')); if(isset($_GET['statut']) && $_GET['statut'] != -1) { $status=$_GET['statut']; $status_q=array($_GET['statut']); } else { $status = -1; $status_q = array('P', 'D', 'E'); } if(isset($_GET['module']) ) { $module=$_GET['module']; } else { $module= 'all'; } if(!isset($_GET['debut'])) $debut=0; else $debut=$_GET['debut']; $mask_statut_1=''; $mask_statut_2=''; $mask_statut_3=''; $mask_statut_4=''; $mask_statut_5=''; $mask_statut_6=''; $mask_statut_7=''; if($status=='public') $mask_statut_1='selected="selected"'; if($status=='draft') $mask_statut_2='selected="selected"'; // Nombre d'enregistrement total dans la bdd $r = $sql_object->DBSelect(SQL_getTotalCountNumber()); $nb=$r[0]['nb']; $nb_comments = sprintf(_t('comment','nb_total'), $nb); $comm = new comment(); if($module=='all') { // tous les commentaires sont retournés !!! // et la pagination est effectuée ici via array_slice() // @todo Optimiser $data = $data_all = $comm->getAllByModule($status_q, $sql_object, false, 'date'); !is_array($data) ? $nb_q_comments = 0 : $nb_q_comments = count($data); $data = array_slice($data, $debut, SELECT_LIMIT); $html_comments = getMarkup($data, true); } else { $data = $data_all = $comm->getByModule(array('module' => $module, 'status' => $status_q, 'limit' => false), $sql_object); !is_array($data) ? $nb_q_comments = 0 : $nb_q_comments = count($data); if(is_array($data)) $data = array_slice($data, $debut, SELECT_LIMIT); $html_comments = getMarkup($data, true); } echo getAjaxFunction(); // for ajax call if($module != 'all' || $status != -1) { $link_back="
"; } else { $link_back=''; } if($nb_q_comments<=1) $query_count = _t('divers','query_result')." : ".$nb_q_comments." "._t('divers','record'); else $query_count = _t('divers','query_result')." : ".$nb_q_comments." "._t('divers','records'); // handle comments exports if(isset($data[0]['comment_id'])) { $content = ''; // if vote is enabled on contribution and it is a contribution if(defined('MOD_VOTE') && MOD_VOTE == 1) { $voteFlag = true; } else { $voteFlag = false; } foreach ($data_all as $c) { if($voteFlag) $likes_number = getNbVotes(array('module' => $c['comment_module'], 'module_id' => $c['comment_id'])); $cdate = $c['comment_date_crea_display']; $cdateshort = substr($c['comment_date_crea_display'], 0, 10); $ctitle = formatText($c['comment_title']); $cbody = formatText($c['comment_body']); $cname= $c['user_login']; $item = itemMapping($c['comment_module']); // status if($c['comment_status']== 'E') { $cstatus = _t('comment', 'disapproved'); } if($c['comment_status']== 'P') { $cstatus= _t('comment', 'approved'); } if($c['comment_status']== 'D') { $cstatus= _t('comment', 'awaiting'); } // get fullname if(!empty($c['profile_firstname']) || !empty($c['profile_lastname'])) { $cname .= ' ('.$c['profile_firstname']. ' '.$c['profile_lastname'].')'; } else { $cname .= $c['comment_name']; } if($c['comment_user_id']!=0) { $dataU = $GLOBALS['sql_object']->DBSelect(SQL_getUserInfo($c['comment_user_id'])); $cemail = $dataU[0]['profile_email']; $cregistered = _t('divers', 'yes'); } else { $cemail = $c['comment_email']; $cregistered = _t('divers', 'no'); } $content .=''. mb_ucfirst(_t('comment', 'module')) . ' | '; $table_export .= ''. mb_ucfirst(_t('comment', 'posted_in')) . ' | '; $table_export .= ''. mb_ucfirst(_t('comment', 'name')) . ' | '; $table_export .= '' . mb_ucfirst(_t('comment', 'registered_user')) .' | '; $table_export .= ''. mb_ucfirst(_t('contact', 'email')) . ' | '; $table_export .= ''. mb_ucfirst(_t('comment', 'title')) . ' | '; $table_export .= ''. mb_ucfirst(_t('comment', 'body')) . ' | '; if($voteFlag) $table_export .= ''. mb_ucfirst(_t('like', 'like_plural')) . ' | '; $table_export .= ''. mb_ucfirst(_t('divers', 'date')) . ' | '; $table_export .= ''. mb_ucfirst(_t('divers', 'statut')) . ' | '; $table_export .= '