diff --git a/main/wiki/index.php b/main/wiki/index.php
index e9ff41ffad..5fee16fa0f 100644
--- a/main/wiki/index.php
+++ b/main/wiki/index.php
@@ -1,4 +1,5 @@
-'.get_lang('NotifyChanges').'';
}
- echo '
';
+ echo '
';
echo ''.get_lang('RecentChanges').' '.$notify_all.'
';
- echo '
';
- echo '';
-
- $group_id=Security::remove_XSS($_GET['group_id']);
- while ($row=Database::fetch_array($result))
- {
- $userinfo=Database::get_user_info_from_id($row['user_id']);
-
- $year = substr($row['timestamp'], 0, 4);
- $month = substr($row['timestamp'], 5, 2);
- $day = substr($row['timestamp'], 8, 2);
- $hours=substr($row['timestamp'], 11,2);
- $minutes=substr($row['timestamp'], 14,2);
- $seconds=substr($row['timestamp'], 17,2);
-
- $url_enc=urlencode($row['reflink']);
+ echo '
';
+ echo '';
- //Show page to students if isn't hidden. Show page to all teachers if is hidden. Mode assignments: If is hidden, show pages to student only if student is the author
- if($row['visibility']==1 || api_is_allowed_to_edit() || api_is_platform_admin() || ($row['assignment']==2 && $row['visibility']==0 && (api_get_user_id()==$row['user_id'])))
- {
- if($row['assignment']==1)
- {
- if(api_is_allowed_to_edit() || api_is_platform_admin()) //Mode assignments: show pages assignment (task) only for teachers
- {
- $ShowAssignment='
';
-
- if ($row['version']==1) $flag=get_lang('AddedBy');
- if ($row['version']>1) $flag=get_lang('EditedBy');
-
- echo '- ';
- echo $day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds;
- echo ' ... '.$ShowAssignment.''.$row['title'].' ...'.$flag.' '.$userinfo['lastname'].', '.$userinfo['firstname'].'
';
- }
- }
+ if(api_is_allowed_to_edit() || api_is_platform_admin()) //only by professors if page is hidden
+ {
+ $sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.' ORDER BY timestamp DESC';
+ }
+ else
+ {
+ $sql='SELECT * FROM '.$tbl_wiki.' WHERE '.$groupfilter.' AND visibility=1 ORDER BY timestamp DESC';
+ }
- if($row['assignment']==2)
- {
- if ($row['user_id']==(int)api_get_user_id() || api_is_allowed_to_edit() || api_is_platform_admin()) //Mode assignments: show pages assignment (works) only for teachers. Also show pages to student only if student is the author.
- {
- $ShowAssignment='
';
-
- if ($row['version']==1) $flag=get_lang('AddedBy');
- if ($row['version']>1) $flag=get_lang('EditedBy');
-
- echo '- ';
- echo $day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds;
- echo ' ... '.$ShowAssignment.''.$row['title'].' ...'.$flag.' '.$userinfo['lastname'].', '.$userinfo['firstname'].'
';
- }
- }
+ $allpages=api_sql_query($sql,__LINE__,__FILE__);
- if($row['assignment']==0)
+ //show table
+ if (mysql_num_rows($allpages) > 0)
+ {
+ $row = array ();
+ while ($obj = mysql_fetch_object($allpages))
+ {
+ //get author
+ $userinfo=Database::get_user_info_from_id($obj->user_id);
+
+ //get time
+ $year = substr($obj->timestamp, 0, 4);
+ $month = substr($obj->timestamp, 5, 2);
+ $day = substr($obj->timestamp, 8, 2);
+ $hours = substr($obj->timestamp, 11,2);
+ $minutes = substr($obj->timestamp, 14,2);
+ $seconds = substr($obj->timestamp, 17,2);
+
+ //get type assignment icon
+ if($obj->assignment==1)
{
-
- $ShowAssignment='
';
-
- if ($row['version']==1) $flag=get_lang('AddedBy');
- if ($row['version']>1) $flag=get_lang('EditedBy');
-
- echo '- ';
- echo $day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds;
- if ($row['user_id']<>0)
- {
- echo ' ... '.$ShowAssignment.''.$row['title'].' ...'.$flag.' '.$userinfo['lastname'].', '.$userinfo['firstname'].'
';
- }
- else
- {
- echo ' ... '.$row['title'].' ... '.$flag.' '.get_lang('Anonymous').' ('.$row['user_ip'].')';
- }
- }
+ $ShowAssignment='
';
+ }
+ elseif ($obj->assignment==2)
+ {
+ $ShowAssignment='
';
+ }
+ elseif ($obj->assignment==0)
+ {
+ $ShowAssignment='
';
+ }
+
+ $row = array ();
+ $row[] = $day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.':'.$minutes.":".$seconds;
+ $row[] =$ShowAssignment;
+ $row[] = ''.$obj->title.'';
+ $row[] =$obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy');
+ $row[] = $obj->user_id <>0 ? ''.$userinfo['lastname'].', '.$userinfo['firstname'].'' : get_lang('Anonymous').' ('.$obj->user_ip.')';
+ $rows[] = $row;
}
-
- //print_r($userinfo);
+
+ $table = new SortableTableFromArrayConfig($rows,0,10,'RecentPages_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('Date'), true, array ('style' => 'width:175px;'));
+ $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
+ $table->set_header(2,get_lang('Title'), true);
+ $table->set_header(3,get_lang('Actions'), true, array ('style' => 'width:80px;'));
+ $table->set_header(4,get_lang('Author'), true);
+
+ $table->display();
}
- echo '
';
}
-
/////////////////////// all pages ///////////////////////