'; echo ''.get_lang('DeletePageHistory').''; echo '
'; $message = get_lang('ConfirmDeletePage').""."
"."".get_lang("No").""." | "."".get_lang("Yes").""."
"; if (!isset ($_GET['delete'])) { Display::display_warning_message($message,false); } if ($_GET['delete'] == 'yes') { $sql='DELETE FROM '.$tbl_wiki.' WHERE reflink="'.html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$groupfilter.' ORDER BY id DESC'; api_sql_query($sql,__FILE__,__LINE__); //// //here to do: delete discussion and mailcue too /// check_emailcue(0, 'E'); Display::display_confirmation_message(get_lang('WikiPageDeleted')); } } else { Display::display_normal_message(get_lang("OnlyAdminDeletePageWiki")); } } /////////////////////// delete all wiki /////////////////////// Juan Carlos Raña Trabado if ($_GET['action']=='deletewiki') { echo ''; echo ''.get_lang('DeleteWiki').''; echo '
'; } /////////////////////// search pages /////////////////////// Juan Carlos Raña Trabado if ($_GET['action']=='searchpages') { echo '
'; echo ''.$SearchPages.''; echo '
'; if (!$_POST['Skeyword']) { echo ''; } else { if($_POST['Scontent']=="1") { $sql="SELECT * FROM ".$tbl_wiki." WHERE ".$groupfilter." AND title LIKE '%".$_POST['Skeyword']."%' OR content LIKE '%".$_POST['Skeyword']."%' GROUP BY reflink ORDER BY title ASC"; } else { $sql="SELECT * FROM ".$tbl_wiki." WHERE ".$groupfilter." AND title LIKE '%".$_POST['Skeyword']."%' GROUP BY reflink ORDER BY title ASC"; } //show result $_clean['group_id']=(int)$_SESSION['_gid']; $result=api_sql_query($sql,__LINE__,__FILE__); echo '
- ';
while ($row=Database::fetch_array($result))
{
$userinfo=Database::get_user_info_from_id($row['user_id']);
//Show page to students if not is hidden. Show page to all teachers if is hidden. Mode assignments: show pages to student only if student it 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'])))
{
$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);
//show teacher assignment
if($row['assignment']==1)
{
//teachers assigment pages only list for teachers
if(api_is_allowed_to_edit() || api_is_platform_admin())
{
$ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } //show student assignment if ($row['assignment']==2) { //student assignment pages only list for each student author and for teachers if ($row['user_id']==(int)api_get_user_id() || api_is_allowed_to_edit() || api_is_platform_admin()) { $ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } //show wiki pages standard if ($row['assignment']==0) { $ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; if ($row['user_id']<>0) { echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; } else { echo get_lang('Anonymous').' ('.$row[user_ip].')'; } echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } } echo '



'; echo ''.$LinksPages.''; echo '
'; if (!$_GET['title']) { Display::display_normal_message(get_lang("MustSelectPage")); } else { $sql='SELECT * FROM '.$tbl_wiki.' WHERE reflink="'.html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$groupfilter.''; $result=api_sql_query($sql,__FILE__,__LINE__); //necessary for pages with compound name $row=Database::fetch_array($result); echo $LinksPagesFrom.': '.$row['title'].''; if ($page==get_lang('DefaultTitle')) { $page='index'; } $sql="SELECT * FROM ".$tbl_wiki." WHERE ".$groupfilter." AND linksto LIKE '%".html_entity_decode(Database::escape_string(stripslashes(urldecode($page))))."%' GROUP BY reflink ORDER BY title ASC"; $result=api_sql_query($sql,__LINE__,__FILE__); //show result echo '
- ';
while ($row=Database::fetch_array($result))
{
$userinfo=Database::get_user_info_from_id($row['user_id']);
//Show page to students if not is hidden, but the author can see. Show page to all teachers if is hidden. Mode assignments: 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'])))
{
$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);
//Description assignments visible for all teachers
if($row['assignment']==1)
{
if(api_is_allowed_to_edit() || api_is_platform_admin())
{
$ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } //Work on the assignments visible for each student if ($row['assignment']==2) { if ($row['user_id']==(int)api_get_user_id() || api_is_allowed_to_edit() || api_is_platform_admin()) { $ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } //show wiki pages standard if ($row['assignment']==0) { $ShowAssignment='
- '; echo ''.$ShowAssignment.$row['title'].''; if ($row['user_id']<>0) { echo '...'.$userinfo['lastname'].', '.$userinfo['firstname']; } else { echo get_lang('Anonymous').' ('.$row[user_ip].')'; } echo '...'.$day.' '.$MonthsLong[$month-1].' '.$year.' '.$hours.":".$minutes.":".$seconds.' '; } } } echo '



'; echo ''.get_lang('AddNew').''; echo '
'; display_new_wiki_form(); } else { Display::display_normal_message(get_lang('OnlyAddPagesGroupMembers')); } } else { echo '
'; echo ''.get_lang('AddNew').''; echo '
'; display_new_wiki_form(); } } } /////////////////////// show home page /////////////////////// if (!$_GET['action'] OR $_GET['action']=='show' AND !$_POST['SaveWikiNew']) { display_wiki_entry(); } /////////////////////// show current page /////////////////////// if ($_GET['action']=='showpage' AND !$_POST['SaveWikiNew']) { display_wiki_entry(); } /////////////////////// edit current page /////////////////////// if ($_GET['action']=='edit') { $_clean['group_id']=(int)$_SESSION['_gid']; $sql='SELECT * FROM '.$tbl_wiki.'WHERE reflink="'.html_entity_decode(Database::escape_string(stripslashes(urldecode($page)))).'" AND '.$groupfilter.' ORDER BY id DESC'; $result=api_sql_query($sql,__LINE__,__FILE__); $row=Database::fetch_array($result); // we do not need a while loop since we are always displaying the last version //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['assignment']==1) && (!api_is_allowed_to_edit() || !api_is_platform_admin())) { Display::display_normal_message(get_lang('OnlyEditPagesCourseManager')); } else { $PassEdit=false; if(stripslashes($row['assignment'])==1) { Display::display_normal_message(get_lang('EditAssignmentWarning')); $icon_assignment='




'; if($_POST['HistoryDifferences']) { echo '