diff --git a/main/wiki/index.php b/main/wiki/index.php index 1db294413e..7f15714eda 100644 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -35,8 +35,7 @@ require_once (api_get_path(LIBRARY_PATH).'events.lib.inc.php'); require_once (api_get_path(LIBRARY_PATH).'security.lib.php'); require_once(api_get_path(INCLUDE_PATH).'lib/mail.lib.inc.php'); require_once(api_get_path(INCLUDE_PATH).'conf/mail.conf.php'); - - +require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php'); /* ----------------------------------------------------------- ADDITIONAL STYLE INFORMATION @@ -543,38 +542,67 @@ if ($_GET['action']=='mvisited') echo '
'; echo ''.get_lang('MostVisitedPages').'
'; echo '
'; - - if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden - { - $sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY tsum DESC, reflink LIMIT 10'; //first ten pages - } - else - { - $sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND visibility=1 GROUP BY reflink ORDER BY tsum DESC, reflink LIMIT 10'; //first ten pages - } + if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden + { + $sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' GROUP BY reflink ORDER BY tsum DESC, reflink'; + } + else + { + $sql='SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND visibility=1 GROUP BY reflink ORDER BY tsum DESC, reflink'; + } $allpages=api_sql_query($sql,__FILE__,__LINE__); - echo ''; + $table = new SortableTableFromArrayConfig($rows,4,10,'MostVisitedPages_table','','','DESC'); + $table->set_additional_parameters(array('cidReq' =>$_GET['cidReq'],'action'=>$_GET['action'],'group_id'=>Security::remove_XSS($_GET['group_id']))); + $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); + $table->set_header(1,get_lang('Title'), true); + $table->set_header(2,get_lang('Author'), true); + $table->set_header(3,get_lang('Date'), true); + $table->set_header(4,get_lang('Visits'), true); + $table->display(); + } } /////////////////////// Wanted pages /////////////////////// Juan Carlos RaƱa Trabado @@ -1051,7 +1079,7 @@ if ($_GET['action']=='edit') //Only teachers and platform admin can edit the index page. Only teachers and platform admin can edit an assignment teacher - if(($row['reflink']=='index' || $row['reflink']=='' || $row['assignment']==1) && (!api_is_allowed_to_edit() || !api_is_platform_admin())) + if(($row['reflink']=='index' || $row['reflink']=='' || $row['assignment']==1) && (!api_is_allowed_to_edit())) { Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'));