Minor - Fixing comments, fixing PHP warnings.

1.9.x
Julio Montoya 12 years ago
parent ea9f20b0c9
commit 20ecb6d390
  1. 2
      main/exercice/tests_category.php
  2. 10
      main/forum/forumfunction.inc.php
  3. 4
      main/glossary/index.php
  4. 4
      main/gradebook/lib/scoredisplay.class.php
  5. 2
      main/inc/lib/gradebook.lib.php
  6. 2
      main/inc/lib/promotion.lib.php
  7. 2
      main/inc/lib/timeline.lib.php
  8. 4
      main/notebook/index.php
  9. 2
      main/survey/create_new_survey.php
  10. 174
      main/wiki/diff.inc.php
  11. 731
      main/wiki/index.php
  12. 117
      main/wiki/wiki.inc.php

@ -138,7 +138,7 @@ function add_category_form($in_action) {
$in_action = Security::remove_XSS($in_action);
// initiate the object
$form = new FormValidator('note', 'post', api_get_self() . '?action=' . $in_action);
// settting the form elements
// Setting the form elements
$form->addElement('header', get_lang('AddACategory'));
$form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95'));
$form->add_html_editor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Width' => '90%', 'Height' => '200'));

@ -149,7 +149,7 @@ function show_add_forumcategory_form($inputvalues = array(), $lp_id)
// hidden field if from learning path
$form->addElement('hidden', 'lp_id', $lp_id);
// Settting the form elements.
// Setting the form elements.
$form->addElement('header', '', get_lang('AddForumCategory'));
$form->addElement('text', 'forum_category_title', get_lang('Title'), 'class="input_titles" id="category_title"');
@ -404,7 +404,7 @@ function show_edit_forumcategory_form($inputvalues = array())
$gradebook = Security::remove_XSS($_GET['gradebook']);
$form = new FormValidator('forumcategory', 'post', 'index.php?&gradebook='.$gradebook.'');
// Settting the form elements.
// Setting the form elements.
$form->addElement('header', '', get_lang('EditForumCategory'));
$form->addElement('hidden', 'forum_category_id');
$form->addElement('text', 'forum_category_title', get_lang('Title'), 'class="input_titles"');
@ -2154,7 +2154,7 @@ function show_add_post_form($action = '', $id = '', $form_values = '')
$form->addElement('header', $text);
// Settting the form elements.
// Setting the form elements.
$form->addElement('hidden', 'forum_id', intval($my_forum));
$form->addElement('hidden', 'thread_id', intval($my_thread));
$form->addElement('hidden', 'gradebook', $my_gradebook);
@ -2602,7 +2602,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
// Initialize the object.
$form = new FormValidator('edit_post', 'post', api_get_self().'?forum='.Security::remove_XSS($_GET['forum']).'&gradebook='.$gradebook.'&origin='.$origin.'&thread='.Security::remove_XSS($_GET['thread']).'&post='.Security::remove_XSS($_GET['post']));
$form->addElement('header', get_lang('EditPost'));
// Settting the form elements.
// Setting the form elements.
$form->addElement('hidden', 'post_id', $current_post['post_id']);
$form->addElement('hidden', 'thread_id', $current_thread['thread_id']);
$form->addElement('hidden', 'id_attach', $id_attach);
@ -3554,7 +3554,7 @@ function forum_search()
// Initialize the object.
$form = new FormValidator('forumsearch', 'post', 'forumsearch.php?origin='.$origin.'');
// Settting the form elements.
// Setting the form elements.
$form->addElement('header', '', get_lang('ForumSearch'));
$form->addElement('text', 'search_term', get_lang('SearchTerm'), 'class="input_titles" id="search_title"');
$form->applyFilter('search_term', 'html_filter');

@ -104,7 +104,7 @@ if (api_is_allowed_to_edit(null, true)) {
switch ($action) {
case 'addglossary':
$form = new FormValidator('glossary','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']));
// settting the form elements
// Setting the form elements
$form->addElement('header', '', get_lang('TermAddNew'));
$form->addElement('text', 'glossary_title', get_lang('TermName'), array('size'=>'80', 'id'=>'glossary_title'));
//$form->applyFilter('glossary_title', 'html_filter');
@ -132,7 +132,7 @@ if (api_is_allowed_to_edit(null, true)) {
if (is_numeric($_GET['glossary_id'])) {
// initiate the object
$form = new FormValidator('glossary','post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&glossary_id='.Security::remove_XSS($_GET['glossary_id']));
// settting the form elements
// Setting the form elements
$form->addElement('header', '', get_lang('TermEdit'));
$form->addElement('hidden', 'glossary_id');
$form->addElement('text', 'glossary_title', get_lang('TermName'),array('size'=>'80'));

@ -91,12 +91,12 @@ class ScoreDisplay
$this->category_id = $category_id;
}
//Loading portal settings + using standard functions
// Loading portal settings + using standard functions.
$value = api_get_setting('gradebook_score_display_coloring');
$value = $value['my_display_coloring'];
//Settting coloring
// Setting coloring.
$this->coloring_enabled = $value == 'true' ? true : false;
if ($this->coloring_enabled) {

@ -113,7 +113,7 @@ class Gradebook extends Model {
public function show_skill_form($gradebook_id, $url, $header = null) {
$form = new FormValidator('gradebook_add_skill', 'POST', $url);
// Settting the form elements
// Setting the form elements
if (!isset($header)) {
$header = get_lang('Add');
}

@ -171,7 +171,7 @@ class Promotion extends Model
$oFCKeditor->CreateHtml();
$form = new FormValidator('promotion', 'post', $url);
// Settting the form elements
// Setting the form elements
$header = get_lang('Add');
if ($action == 'edit') {
$header = get_lang('Modify');

@ -123,7 +123,7 @@ class Timeline extends Model
{
$form = new FormValidator('item_form', 'post', $url);
// Settting the form elements
// Setting the form elements
$header = get_lang('Add');
if ($action == 'edit') {
$header = get_lang('Modify');

@ -72,7 +72,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
// Initiate the object
$form = new FormValidator('note', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']));
// Settting the form elements
// Setting the form elements
$form->addElement('header', '', get_lang('NoteAddNew'));
$form->addElement('text', 'note_title', get_lang('NoteTitle'), array('size' => '95', 'id' => 'note_title'));
//$form->applyFilter('note_title', 'html_filter');
@ -118,7 +118,7 @@ elseif (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_
// Initialize the object
$form = new FormValidator('note', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&notebook_id='.Security::remove_XSS($_GET['notebook_id']));
// Settting the form elements
// Setting the form elements
$form->addElement('header', '', get_lang('ModifyNote'));
$form->addElement('hidden', 'notebook_id');
$form->addElement('text', 'note_title', get_lang('NoteTitle'), array('size' => '100'));

@ -118,7 +118,7 @@ $form = new FormValidator('survey', 'post', api_get_self().'?action='.Security::
$form->addElement('header', '', $tool_name);
// Settting the form elements
// Setting the form elements
if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) {
$form->addElement('hidden', 'survey_id');
}

@ -18,10 +18,10 @@
/**
* Code
*/
define( "DIFF_EQUAL", "=" );
define( "DIFF_ADDED", "+" );
define( "DIFF_DELETED", "-" );
define( "DIFF_MOVED", "M" );
define("DIFF_EQUAL", "=");
define("DIFF_ADDED", "+");
define("DIFF_DELETED", "-");
define("DIFF_MOVED", "M");
/**
* Get difference between two strings
@ -33,32 +33,33 @@ define( "DIFF_MOVED", "M" );
* (default 'format_line')
* @return string formated diff output
*/
function diff( $old, $new, $show_equals = false, $format_line_function = 'format_line' )
{
$oldArr = str_split_on_new_line( $old );
$newArr = str_split_on_new_line( $new );
function diff(
$old,
$new,
$show_equals = false,
$format_line_function = 'format_line'
) {
$oldArr = str_split_on_new_line($old);
$newArr = str_split_on_new_line($new);
$oldCount = count ( $oldArr );
$newCount = count ( $newArr );
$oldCount = count($oldArr);
$newCount = count($newArr);
$max = max( $oldCount, $newCount );
$max = max($oldCount, $newCount);
//get added and deleted lines
$deleted = array_diff_assoc( $oldArr, $newArr );
$added = array_diff_assoc( $newArr, $oldArr );
$deleted = array_diff_assoc($oldArr, $newArr);
$added = array_diff_assoc($newArr, $oldArr);
$moved = array();
foreach ( $added as $key => $candidate )
{
foreach ( $deleted as $index => $content )
{
if ( $candidate == $content )
{
foreach ($added as $key => $candidate) {
foreach ($deleted as $index => $content) {
if ($candidate == $content) {
$moved[$key] = $candidate;
unset( $added[$key] );
unset( $deleted[$index] );
unset($added[$key]);
unset($deleted[$index]);
break;
}
}
@ -66,41 +67,29 @@ function diff( $old, $new, $show_equals = false, $format_line_function = 'format
$output = '';
for ( $i = 0; $i < $max; $i++ )
{
for ($i = 0; $i < $max; $i++) {
// line changed
if ( isset ( $deleted[$i] ) && isset( $added[$i] ) )
{
$output .= $format_line_function( $i, DIFF_DELETED, $deleted[$i] );
$output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );
if (isset ($deleted[$i]) && isset($added[$i])) {
$output .= $format_line_function($i, DIFF_DELETED, $deleted[$i]);
$output .= $format_line_function($i, DIFF_ADDED, $added[$i]);
}
// line deleted
elseif ( isset ( $deleted[$i] ) && ! isset ( $added[$i] ) )
{
$output .= $format_line_function( $i, DIFF_DELETED, $deleted[$i] );
} // line deleted
elseif (isset ($deleted[$i]) && !isset ($added[$i])) {
$output .= $format_line_function($i, DIFF_DELETED, $deleted[$i]);
}
// line added
elseif ( isset ( $added[$i] ) && ! isset ( $deleted[$i] ) )
{
$output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );
} // line added
elseif (isset ($added[$i]) && !isset ($deleted[$i])) {
$output .= $format_line_function($i, DIFF_ADDED, $added[$i]);
}
// line moved
elseif ( isset ( $moved[$i] ) )
{
$output .= $format_line_function( $i, DIFF_MOVED, $newArr[$i] );
} // line moved
elseif (isset ($moved[$i])) {
$output .= $format_line_function($i, DIFF_MOVED, $newArr[$i]);
}
// line unchanged
elseif ( $show_equals )
{
$output .= $format_line_function( $i, DIFF_EQUAL, $newArr[$i] );
} // line unchanged
elseif ($show_equals) {
$output .= $format_line_function($i, DIFF_EQUAL, $newArr[$i]);
}
else
{
} else {
// skip
}
}
@ -111,24 +100,17 @@ function diff( $old, $new, $show_equals = false, $format_line_function = 'format
/**
* Split strings on new line
*/
function str_split_on_new_line( $str )
function str_split_on_new_line($str)
{
$content = array();
if ( api_strpos( $str, "\r\n" ) !== false )
{
$content = explode("\r\n", $str );
}
elseif ( api_strpos( $str, "\n" ) !== false )
{
$content = explode( "\n", $str );
}
elseif ( api_strpos( $str, "\r" ) !== false )
{
$content = explode( "\r", $str );
}
else
{
if (api_strpos($str, "\r\n") !== false) {
$content = explode("\r\n", $str);
} elseif (api_strpos($str, "\n") !== false) {
$content = explode("\n", $str);
} elseif (api_strpos($str, "\r") !== false) {
$content = explode("\r", $str);
} else {
$content[] = $str;
}
@ -144,92 +126,62 @@ function str_split_on_new_line( $str )
* @param boolean skip_empty skip empty lines (default false)
* @return string formated diff line
*/
function format_line( $line, $type, $value, $skip_empty = false )
function format_line($line, $type, $value, $skip_empty = false)
{
if ( trim( $value ) == "" && $skip_empty )
{
if (trim($value) == "" && $skip_empty) {
return "";
}
elseif ( trim( $value ) == "" )
{
} elseif (trim($value) == "") {
$value = '&nbsp;';
}
switch ( $type )
{
switch ($type) {
case DIFF_EQUAL:
{
// return $line. ' : ' . ' = <span class="diffEqual" >' . $value . '</span><br />' . "\n" ;
return '<span class="diffEqual" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
return '<span class="diffEqual" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
break;
}
case DIFF_MOVED:
{
//return $line. ' : ' . ' M <span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos ra<EFBFBD>a la sustitye la inverior
return '<span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
return '<span class="diffMoved" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
break;
}
case DIFF_ADDED:
{
//return $line . ' : ' . ' + <span class="diffAdded" >' . $value . '</span><br />' . "\n" ;
return '<span class="diffAdded" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
return '<span class="diffAdded" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
break;
}
case DIFF_DELETED:
{
//return $line . ' : ' . ' - <span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos ra<EFBFBD>a la sustitye la inverior
return '<span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
return '<span class="diffDeleted" >' . $value . '</span><br />' . "\n"; //juan carlos muestra solo color
break;
}
}
}
/**
* Table format line function
* @see format_line
*/
function format_table_line( $line, $type, $value, $skip_empty = false )
function format_table_line($line, $type, $value, $skip_empty = false)
{
if ( trim( $value ) == "" && $skip_empty )
{
if (trim($value) == "" && $skip_empty) {
return "";
}
elseif ( trim( $value ) == "" )
{
} elseif (trim($value) == "") {
$value = '&nbsp;';
}
switch ( $type )
{
switch ($type) {
case DIFF_EQUAL:
{
//return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;=</td><td><span class="diffEqual" >' . $value . '</span></td></tr>' . "\n"; //juan carlos comentado
return '<tr><td></td><td bgcolor="#FFFFFF">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#FFFFFF">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
break;
}
case DIFF_MOVED:
{
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;M</td><td><span class="diffMoved" >' . $value . '</span></td></tr>' . "\n" //juan carlos comenta
;
return '<tr><td></td><td bgcolor="#FFFFAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#FFFFAA">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
break;
}
case DIFF_ADDED:
{
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;+</td><td><span class="diffAdded" >' . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
return '<tr><td></td><td bgcolor="#CCFFCC">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#CCFFCC">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
break;
}
case DIFF_DELETED:
{
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;-</td><td><span class="diffDeleted" >' . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
return '<tr><td></td><td bgcolor="#FFAAAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
}
return '<tr><td></td><td bgcolor="#FFAAAA">' . $value . '</td></tr>' . "\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
}
}

@ -11,16 +11,15 @@
*/
// name of the language file that needs to be included
$language_file = 'wiki';
$newtitle = null;
// including the global initialization file
require_once '../inc/global.inc.php';
//error_reporting(-1);
// section (for the tabs)
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_WIKI;
require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
// Database table definition
@ -35,7 +34,7 @@ $course_id = api_get_course_int_id();
$htmlHeadXtra[] ='<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'wiki/css/default.css"/>';
// javascript for advanced parameters menu
$htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
$htmlHeadXtra[] = '<script>
function advanced_parameters() {
if (document.getElementById(\'options\').style.display == \'none\') {
document.getElementById(\'options\').style.display = \'block\';
@ -57,7 +56,6 @@ $(document).ready(function () {
/* Constants and variables */
$tool_name = get_lang('ToolWiki');
$MonthsLong = array(
get_lang("JanuaryLong"),
get_lang("FebruaryLong"),
@ -93,14 +91,14 @@ $groupId = api_get_group_id();
if ($groupId) {
$group_properties = GroupManager::get_group_properties($groupId);
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$groupId, "name"=> get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array("url"=>"../group/group_space.php?gidReq=".$groupId, "name"=> get_lang('GroupSpace').' '.$group_properties['name']);
$add_group_to_title = ' '.$group_properties['name'];
$groupfilter='group_id="'.$groupId.'"';
//ensure this tool in groups whe it's private or deactivated
if ($group_properties['wiki_state']==0) {
if ($group_properties['wiki_state'] == 0) {
api_not_allowed();
} elseif ($group_properties['wiki_state']==2) {
if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid'])) {
@ -117,10 +115,8 @@ if (isset($_POST['action']) && $_POST['action']=='export_to_pdf' && isset($_POST
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
Display::display_header($tool_name, 'Wiki');
$is_allowed_to_edit = api_is_allowed_to_edit(false,true);
$is_allowed_to_edit = api_is_allowed_to_edit(false, true);
/* INITIALISATION */
//the page we are dealing with
@ -139,7 +135,8 @@ Display::display_introduction_section(TOOL_WIKI);
// Release of blocked pages to prevent concurrent editions
echo '<div style="overflow:hidden">';
$sql = "SELECT * FROM $tbl_wiki WHERE c_id = $course_id AND is_editing != '0' ".$condition_session;
$sql = "SELECT * FROM $tbl_wiki
WHERE c_id = $course_id AND is_editing != '0' ".$condition_session;
$result = Database::query($sql);
while ($is_editing_block=Database::fetch_array($result)) {
$max_edit_time = 1200; // 20 minutes
@ -186,18 +183,23 @@ if (isset($_POST['SaveWikiNew'])) {
} elseif(!double_post($_POST['wpost_id'])) {
//double post
} else {
$_clean['assignment']=Database::escape_string($_POST['assignment']); // for mode assignment
if ($_clean['assignment']==1) {
$_clean['assignment'] = null;
if (isset($_POST['assignment'])) {
// for mode assignment
$_clean['assignment'] = Database::escape_string($_POST['assignment']);
}
if ($_clean['assignment'] == 1) {
auto_add_page_users($_clean['assignment']);
} else {
$return_message=save_new_wiki();
if ($return_message==false) {
}
$return_message = save_new_wiki();
if ($return_message == false) {
Display::display_error_message(get_lang('NoWikiPageTitle'), false);
} else {
Display::display_confirmation_message($return_message, false);
}
}
}
}
echo '</div>';
@ -274,7 +276,21 @@ if (isset($_GET['view']) && $_GET['view']) {
get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes');
Display::display_normal_message($is_being_edited, false);
} else {
Display::display_confirmation_message(restore_wikipage($current_row['page_id'], $current_row['reflink'], api_htmlentities($current_row['title']), api_htmlentities($current_row['content']), $current_row['group_id'], $current_row['assignment'], $current_row['progress'], $current_row['version'], $last_row['version'], $current_row['linksto']).': <a href="index.php?cidReq='.$_course['id'].'&action=showpage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&session_id='.$last_row['session_id'].'&group_id='.$last_row['group_id'].'">'.api_htmlentities($last_row['title']).'</a>',false);
Display::display_confirmation_message(
restore_wikipage(
$current_row['page_id'],
$current_row['reflink'],
api_htmlentities($current_row['title']),
api_htmlentities($current_row['content']),
$current_row['group_id'],
$current_row['assignment'],
$current_row['progress'],
$current_row['version'],
$last_row['version'],
$current_row['linksto']
).': <a href="index.php?cidReq='.$_course['id'].'&action=showpage&amp;title='.api_htmlentities(urlencode($last_row['reflink'])).'&session_id='.$last_row['session_id'].'&group_id='.$last_row['group_id'].'">'.api_htmlentities($last_row['title']).'</a>',
false
);
}
}
}
@ -505,7 +521,9 @@ if ($action =='statistics' && (api_is_allowed_to_edit(false,true) || api_is_plat
$total_multimedia = 0;
$total_tables = 0;
$sql="SELECT *, COUNT(*) AS TOTAL_VERS, SUM(hits) AS TOTAL_VISITS FROM ".$tbl_wiki." WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
$sql = "SELECT *, COUNT(*) AS TOTAL_VERS, SUM(hits) AS TOTAL_VISITS
FROM ".$tbl_wiki."
WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
@ -564,8 +582,11 @@ if ($action =='statistics' && (api_is_allowed_to_edit(false,true) || api_is_plat
$total_multimedia_lv = 0;
$total_tables_lv = 0;
$sql='SELECT * FROM '.$tbl_wiki.' s1 WHERE s1.c_id = '.$course_id.' AND id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND id=(
SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.'
)';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
@ -588,373 +609,398 @@ if ($action =='statistics' && (api_is_allowed_to_edit(false,true) || api_is_plat
$total_tables_lv = $total_tables_lv+substr_count($row['content'], "<table");
}
//Total pages edited at this time
$total_editing_now=0;
$sql='SELECT *, COUNT(*) AS TOTAL_EDITING_NOW FROM '.$tbl_wiki.' s1
//Total pages edited at this time
$total_editing_now=0;
$sql = 'SELECT *, COUNT(*) AS TOTAL_EDITING_NOW
FROM '.$tbl_wiki.' s1
WHERE is_editing!=0 AND s1.c_id = '.$course_id.' AND
id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//Can not use group by because the mark is set in the latest version
id=(
SELECT MAX(s2.id)
FROM '.$tbl_wiki.' s2
WHERE
s2.c_id = '.$course_id.' AND
s1.reflink = s2.reflink AND
'.$groupfilter.' AND
session_id='.$session_id.'
)';
//Can not use group by because the mark is set in the latest version
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
while ($row=Database::fetch_array($allpages)) {
$total_editing_now = $row['TOTAL_EDITING_NOW'];
}
//Total hidden pages
$total_hidden=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.' GROUP BY reflink';// or group by page_id. As the mark of hidden places it in all versions of the page, I can use group by to see the first
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
//Total hidden pages
$total_hidden=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.' GROUP BY reflink';
// or group by page_id. As the mark of hidden places it in all versions of the page, I can use group by to see the first
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_hidden = $total_hidden+1;
}
}
//Total protect pages
$total_protected=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.' GROUP BY reflink';// or group by page_id. As the mark of protected page is the first version of the page, I can use group by
//Total protect pages
$total_protected=0;
$sql='SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.' GROUP BY reflink';
// or group by page_id. As the mark of protected page is the first version of the page, I can use group by
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_protected = $total_protected+1;
}
//Total empty versions
}
$total_empty_content=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND content="" AND '.$groupfilter.$condition_session.'';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
// Total empty versions.
$total_empty_content=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND content="" AND '.$groupfilter.$condition_session.'';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_empty_content = $total_empty_content+1;
}
}
//Total empty pages (last version)
//Total empty pages (last version)
$total_empty_content_lv=0;
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
$total_empty_content_lv=0;
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND content="" AND id=(
SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_empty_content_lv = $total_empty_content_lv+1;
}
}
//Total locked discuss pages
//Total locked discuss pages
$total_lock_disc=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.' GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_lock_disc=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.'
GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_lock_disc = $total_lock_disc+1;
}
}
//Total hidden discuss pages
//Total hidden discuss pages
$total_hidden_disc=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND visibility_disc=0 AND '.$groupfilter.$condition_session.' GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_hidden_disc=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND visibility_disc=0 AND '.$groupfilter.$condition_session.'
GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_hidden_disc = $total_hidden_disc+1;
}
}
//Total versions with any short comment by user or system
//Total versions with any short comment by user or system
$total_comment_version=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.'';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_comment_version=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.'';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_comment_version = $total_comment_version+1;
}
}
//Total pages that can only be scored by teachers
//Total pages that can only be scored by teachers
$total_only_teachers_rating=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND ratinglock_disc=0 AND '.$groupfilter.$condition_session.' GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_only_teachers_rating=0;
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND ratinglock_disc=0 AND '.$groupfilter.$condition_session.'
GROUP BY reflink';//group by because mark lock in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_only_teachers_rating = $total_only_teachers_rating+1;
}
}
//Total pages scored by peers
$total_rating_by_peers=0;
$total_rating_by_peers=$total_pages-$total_only_teachers_rating;//put always this line alfter check num all pages and num pages rated by teachers
//Total pages scored by peers
$total_rating_by_peers=0;
$total_rating_by_peers=$total_pages-$total_only_teachers_rating;//put always this line alfter check num all pages and num pages rated by teachers
//Total pages identified as standard task
//Total pages identified as standard task
$total_task=0;
$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND '.$tbl_wiki_conf.'.task!="" AND '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.'.$groupfilter.$condition_session;
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_task=0;
$sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.'
WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND '.$tbl_wiki_conf.'.task!="" AND '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND '.$tbl_wiki.'.'.$groupfilter.$condition_session;
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_task=$total_task+1;
}
}
//Total pages identified as teacher page (wiki portfolio mode - individual assignment)
//Total pages identified as teacher page (wiki portfolio mode - individual assignment)
$total_teacher_assignment=0;
$sql='SELECT * FROM '.$tbl_wiki.' s1 WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//mark all versions, but do not use group by reflink because y want the pages not versions
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_teacher_assignment=0;
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//mark all versions, but do not use group by reflink because y want the pages not versions
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_teacher_assignment=$total_teacher_assignment+1;
}
}
//Total pages identifies as student page (wiki portfolio mode - individual assignment)
//Total pages identifies as student page (wiki portfolio mode - individual assignment)
$total_student_assignment=0;
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
$total_student_assignment=0;
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND assignment=2 AND
id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//mark all versions, but do not use group by reflink because y want the pages not versions
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_student_assignment=$total_student_assignment+1;
}
//Current Wiki status add new pages
}
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY addlock';//group by because mark 0 in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
//Current Wiki status add new pages
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY addlock';//group by because mark 0 in all vers, then always is ok
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$wiki_add_lock=$row['addlock'];
}
}
if ($wiki_add_lock==1) {
if ($wiki_add_lock==1) {
$status_add_new_pag=get_lang('Yes');
} else {
} else {
$status_add_new_pag=get_lang('No');
}
}
//Creation date of the oldest wiki page and version
//Creation date of the oldest wiki page and version
$first_wiki_date='0000-00-00 00:00:00';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY dtime ASC LIMIT 1';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$first_wiki_date='0000-00-00 00:00:00';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY dtime ASC LIMIT 1';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$first_wiki_date=$row['dtime'];
}
}
//Date of publication of the latest wiki version
//Date of publication of the latest wiki version
$last_wiki_date='0000-00-00 00:00:00';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY dtime DESC LIMIT 1';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$last_wiki_date='0000-00-00 00:00:00';
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' ORDER BY dtime DESC LIMIT 1';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$last_wiki_date=$row['dtime'];
}
}
//Average score of all wiki pages. (If a page has not scored zero rated)
//Average score of all wiki pages. (If a page has not scored zero rated)
$media_score =0;
$sql="SELECT *, SUM(score) AS TOTAL_SCORE FROM ".$tbl_wiki." WHERE c_id = $course_id AND ".$groupfilter.$condition_session." GROUP BY reflink ";//group by because mark in all versions, then always is ok. Do not use "count" because using "group by", would give a wrong value
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$media_score =0;
$sql="SELECT *, SUM(score) AS TOTAL_SCORE FROM ".$tbl_wiki."
WHERE c_id = $course_id AND ".$groupfilter.$condition_session." GROUP BY reflink ";//group by because mark in all versions, then always is ok. Do not use "count" because using "group by", would give a wrong value
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_score=$total_score+$row['TOTAL_SCORE'];
}
}
if (!empty($total_pages)) {
if (!empty($total_pages)) {
$media_score = $total_score/$total_pages;//put always this line alfter check num all pages
}
}
//Average user progress in his pages
//Average user progress in his pages
$media_progress=0;
$sql='SELECT *, SUM(progress) AS TOTAL_PROGRESS FROM '.$tbl_wiki.' s1 WHERE s1.c_id = '.$course_id.' AND id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//As the value is only the latest version I can not use group by
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$media_progress=0;
$sql='SELECT *, SUM(progress) AS TOTAL_PROGRESS FROM '.$tbl_wiki.' s1
WHERE s1.c_id = '.$course_id.' AND id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')';//As the value is only the latest version I can not use group by
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_progress = $row['TOTAL_PROGRESS'];
}
}
if (!empty($total_pages)) {
if (!empty($total_pages)) {
$media_progress=$total_progress/$total_pages;//put always this line alfter check num all pages
}
}
//Total users that have participated in the Wiki
//Total users that have participated in the Wiki
$total_users=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY user_id';//as the mark of user it in all versions of the page, I can use group by to see the first
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_users=0;
$sql='SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY user_id';//as the mark of user it in all versions of the page, I can use group by to see the first
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_users = $total_users+1;
}
}
//Total of different IP addresses that have participated in the wiki
$total_ip=0;
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY user_ip';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
// Total of different IP addresses that have participated in the wiki
$total_ip=0;
$sql='SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' GROUP BY user_ip';
$allpages=Database::query($sql);
while ($row=Database::fetch_array($allpages)) {
$total_ip = $total_ip+1;
}
?>
<style>
thead {background:#E2E2E2}
tbody tr:hover {
}
?>
<style>
thead {background:#E2E2E2}
tbody tr:hover {
background: #F9F9F9;
cursor:default;
}
</style>
<?php
}
</style>
<?php
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="2">'.get_lang('General').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('StudentAddNewPages').'</td>';
echo '<td>'.$status_add_new_pag.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('DateCreateOldestWikiPage').'</td>';
echo '<td>'.$first_wiki_date.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('DateEditLatestWikiVersion').'</td>';
echo '<td>'.$last_wiki_date.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('AverageScoreAllPages').'</td>';
echo '<td>'.$media_score.' %</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('AverageMediaUserProgress').'</td>';
echo '<td>'.$media_progress.' %</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalWikiUsers').'</td>';
echo '<td>'.$total_users.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalIpAdress').'</td>';
echo '<td>'.$total_ip.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="2">'.get_lang('General').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('StudentAddNewPages').'</td>';
echo '<td>'.$status_add_new_pag.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('DateCreateOldestWikiPage').'</td>';
echo '<td>'.$first_wiki_date.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('DateEditLatestWikiVersion').'</td>';
echo '<td>'.$last_wiki_date.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('AverageScoreAllPages').'</td>';
echo '<td>'.$media_score.' %</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('AverageMediaUserProgress').'</td>';
echo '<td>'.$media_progress.' %</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalWikiUsers').'</td>';
echo '<td>'.$total_users.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalIpAdress').'</td>';
echo '<td>'.$total_ip.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="2">'.get_lang('Pages').' '.get_lang('And').' '.get_lang('Versions').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('Pages').' - '.get_lang('NumContributions').'</td>';
echo '<td>'.$total_pages.' ('.get_lang('Versions').': '.$total_versions.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('EmptyPages').'</td>';
echo '<td>'.$total_empty_content_lv.' ('.get_lang('Versions').': '.$total_empty_content.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumAccess').'</td>';
echo '<td>'.$total_visits_lv.' ('.get_lang('Versions').': '.$total_visits.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalPagesEditedAtThisTime').'</td>';
echo '<td>'.$total_editing_now.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalHiddenPages').'</td>';
echo '<td>'.$total_hidden.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumProtectedPages').'</td>';
echo '<td>'.$total_protected.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('LockedDiscussPages').'</td>';
echo '<td>'.$total_lock_disc.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('HiddenDiscussPages').'</td>';
echo '<td>'.$total_hidden_disc.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalComments').'</td>';
echo '<td>'.$total_comment_version.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalOnlyRatingByTeacher').'</td>';
echo '<td>'.$total_only_teachers_rating.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalRatingPeers').'</td>';
echo '<td>'.$total_rating_by_peers.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalTeacherAssignments').' - '.get_lang('PortfolioMode').'</td>';
echo '<td>'.$total_teacher_assignment.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalStudentAssignments').' - '.get_lang('PortfolioMode').'</td>';
echo '<td>'.$total_student_assignment.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalTask').' - '.get_lang('StandardMode').'</td>';
echo '<td>'.$total_task.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="3">'.get_lang('ContentPagesInfo').'</td>';
echo '</tr>';
echo '<tr>';
echo '<td></td>';
echo '<td>'.get_lang('InTheLastVersion').'</td>';
echo '<td>'.get_lang('InAllVersions').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('NumWords').'</td>';
echo '<td>'.$total_words_lv.'</td>';
echo '<td>'.$total_words.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumlinksHtmlImagMedia').'</td>';
echo '<td>'.$total_links_lv.' ('.get_lang('Anchors').':'.$total_links_anchors_lv.', Mail:'.$total_links_mail_lv.', FTP:'.$total_links_ftp_lv.' IRC:'.$total_links_irc_lv.', News:'.$total_links_news_lv.', ... ) </td>';
echo '<td>'.$total_links.' ('.get_lang('Anchors').':'.$total_links_anchors.', Mail:'.$total_links_mail.', FTP:'.$total_links_ftp.', IRC:'.$total_links_irc.', News:'.$total_links_news.', ... ) </td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumWikilinks').'</td>';
echo '<td>'.$total_wlinks_lv.'</td>';
echo '<td>'.$total_wlinks.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumImages').'</td>';
echo '<td>'.$total_images_lv.'</td>';
echo '<td>'.$total_images.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumFlash').'</td>';
echo '<td>'.$total_flash_lv.'</td>';
echo '<td>'.$total_flash.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumMp3').'</td>';
echo '<td>'.$total_mp3_lv.'</td>';
echo '<td>'.$total_mp3.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumFlvVideo').'</td>';
echo '<td>'.$total_flv_lv.'</td>';
echo '<td>'.$total_flv.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumYoutubeVideo').'</td>';
echo '<td>'.$total_youtube_lv.'</td>';
echo '<td>'.$total_youtube.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumOtherAudioVideo').'</td>';
echo '<td>'.$total_multimedia_lv.'</td>';
echo '<td>'.$total_multimedia.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumTables').'</td>';
echo '<td>'.$total_tables_lv.'</td>';
echo '<td>'.$total_tables.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="2">'.get_lang('Pages').' '.get_lang('And').' '.get_lang('Versions').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('Pages').' - '.get_lang('NumContributions').'</td>';
echo '<td>'.$total_pages.' ('.get_lang('Versions').': '.$total_versions.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('EmptyPages').'</td>';
echo '<td>'.$total_empty_content_lv.' ('.get_lang('Versions').': '.$total_empty_content.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumAccess').'</td>';
echo '<td>'.$total_visits_lv.' ('.get_lang('Versions').': '.$total_visits.')</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalPagesEditedAtThisTime').'</td>';
echo '<td>'.$total_editing_now.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalHiddenPages').'</td>';
echo '<td>'.$total_hidden.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumProtectedPages').'</td>';
echo '<td>'.$total_protected.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('LockedDiscussPages').'</td>';
echo '<td>'.$total_lock_disc.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('HiddenDiscussPages').'</td>';
echo '<td>'.$total_hidden_disc.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalComments').'</td>';
echo '<td>'.$total_comment_version.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalOnlyRatingByTeacher').'</td>';
echo '<td>'.$total_only_teachers_rating.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalRatingPeers').'</td>';
echo '<td>'.$total_rating_by_peers.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalTeacherAssignments').' - '.get_lang('PortfolioMode').'</td>';
echo '<td>'.$total_teacher_assignment.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalStudentAssignments').' - '.get_lang('PortfolioMode').'</td>';
echo '<td>'.$total_student_assignment.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('TotalTask').' - '.get_lang('StandardMode').'</td>';
echo '<td>'.$total_task.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
echo '<table width="100%" border="1">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="3">'.get_lang('ContentPagesInfo').'</td>';
echo '</tr>';
echo '<tr>';
echo '<td></td>';
echo '<td>'.get_lang('InTheLastVersion').'</td>';
echo '<td>'.get_lang('InAllVersions').'</td>';
echo '</tr>';
echo '</thead>';
echo '<tr>';
echo '<td>'.get_lang('NumWords').'</td>';
echo '<td>'.$total_words_lv.'</td>';
echo '<td>'.$total_words.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumlinksHtmlImagMedia').'</td>';
echo '<td>'.$total_links_lv.' ('.get_lang('Anchors').':'.$total_links_anchors_lv.', Mail:'.$total_links_mail_lv.', FTP:'.$total_links_ftp_lv.' IRC:'.$total_links_irc_lv.', News:'.$total_links_news_lv.', ... ) </td>';
echo '<td>'.$total_links.' ('.get_lang('Anchors').':'.$total_links_anchors.', Mail:'.$total_links_mail.', FTP:'.$total_links_ftp.', IRC:'.$total_links_irc.', News:'.$total_links_news.', ... ) </td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumWikilinks').'</td>';
echo '<td>'.$total_wlinks_lv.'</td>';
echo '<td>'.$total_wlinks.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumImages').'</td>';
echo '<td>'.$total_images_lv.'</td>';
echo '<td>'.$total_images.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumFlash').'</td>';
echo '<td>'.$total_flash_lv.'</td>';
echo '<td>'.$total_flash.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumMp3').'</td>';
echo '<td>'.$total_mp3_lv.'</td>';
echo '<td>'.$total_mp3.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumFlvVideo').'</td>';
echo '<td>'.$total_flv_lv.'</td>';
echo '<td>'.$total_flv.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumYoutubeVideo').'</td>';
echo '<td>'.$total_youtube_lv.'</td>';
echo '<td>'.$total_youtube.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumOtherAudioVideo').'</td>';
echo '<td>'.$total_multimedia_lv.'</td>';
echo '<td>'.$total_multimedia.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>'.get_lang('NumTables').'</td>';
echo '<td>'.$total_tables_lv.'</td>';
echo '<td>'.$total_tables.'</td>';
echo '</tr>';
echo '</table>';
echo '<br/>';
}
// Most active users Juan Carlos Raña Trabado
@ -1036,7 +1082,6 @@ if ($action =='usercontrib') {
$row = array ();
$row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds;
$row[] =$ShowAssignment;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities(urlencode($_GET['$session_id'])).'&group_id='.api_htmlentities(urlencode($_GET['group_id'])).'">'.api_htmlentities($obj->title).'</a>';
$row[] =Security::remove_XSS($obj->version);
$row[] =Security::remove_XSS($obj->comment);
@ -1047,8 +1092,9 @@ if ($action =='usercontrib') {
}
$table = new SortableTableFromArrayConfig($rows,2,10,'UsersContributions_table','','','ASC');
$table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action ),'user_id'=>Security::remove_XSS($_GET['user_id']),'session_id'=>Security::remove_XSS($_GET['session_id']),'group_id'=>Security::remove_XSS($_GET['group_id'])));
$table->set_additional_parameters(
array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action ),'user_id'=>Security::remove_XSS($_GET['user_id']),'session_id'=>Security::remove_XSS($_GET['session_id']),'group_id'=>Security::remove_XSS($_GET['group_id']))
);
$table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;'));
$table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;'));
$table->set_header(2,get_lang('Title'), true, array ('style' => 'width:200px;'));
@ -1087,7 +1133,7 @@ if ($action =='mostchanged') {
}
$row = array ();
$row[] =$ShowAssignment;
$row[] = $ShowAssignment;
$row[] = '<a href="'.api_get_self().'?cidReq='.$_course['id'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.api_htmlentities($obj->title).'</a>';
$row[] = $obj->MAX;
$rows[] = $row;
@ -1183,7 +1229,7 @@ if ($action =='wanted') {
}
}
$wanted=array_unique($wanted);//make a unique list
$wanted = array_unique($wanted);//make a unique list
//show table
foreach ($wanted as $wanted_show) {
@ -1191,7 +1237,6 @@ if ($action =='wanted') {
$row = array ();
$wanted_show=Security::remove_XSS($wanted_show);
$row[] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?cidReq=&action=addnew&title='.str_replace('_',' ',$wanted_show).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" class="new_wiki_link">'.str_replace('_',' ',$wanted_show).'</a>';//meter un remove xss en lugar de htmlentities
$rows[] = $row;
}
@ -1405,9 +1450,12 @@ if ($action =='searchpages') {
} else {
// initiate the object
$form = new FormValidator('wiki_search','post', api_get_self().'?cidReq='.api_htmlentities($_GET['cidReq']).'&action='.api_htmlentities($action ).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'&mode_table=yes1&search_term='.api_htmlentities($_GET['search_term']).'&search_content='.api_htmlentities($_GET['search_content']).'&all_vers='.api_htmlentities($_GET['all_vers']));
$form = new FormValidator('wiki_search',
'post',
api_get_self().'?cidReq='.api_htmlentities($_GET['cidReq']).'&action='.api_htmlentities($action).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'&mode_table=yes1&search_term='.api_htmlentities($_GET['search_term']).'&search_content='.api_htmlentities($_GET['search_content']).'&all_vers='.api_htmlentities($_GET['all_vers'])
);
// settting the form elements
// Setting the form elements
$form->addElement('text', 'search_term', get_lang('SearchTerm'),'class="input_titles" id="search_title"');
$form->addElement('checkbox', 'search_content', null, get_lang('AlsoSearchContent'));
@ -1431,11 +1479,9 @@ if ($action =='searchpages') {
/* What links here. Show pages that have linked this page */
if ($action =='links') {
if (!$_GET['title']) {
Display::display_error_message(get_lang("MustSelectPage"));
} else {
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.'';
$result=Database::query($sql);
$row=Database::fetch_array($result);
@ -1569,7 +1615,7 @@ if ($action =='showpage' AND !isset($_POST['SaveWikiNew'])) {
// Edit current page
if (isset($action ) && $action =='edit') {
if (isset($action) && $action =='edit') {
if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
api_not_allowed();
@ -1621,7 +1667,7 @@ if (isset($action ) && $action =='edit') {
} else {
$PassEdit=true;
}
$icon_assignment = null;
// check if is a assignment
if ($row['assignment']==1) {
Display::display_normal_message(get_lang('EditAssignmentWarning'));
@ -1771,7 +1817,6 @@ if (isset($action ) && $action =='edit') {
echo '<div>&nbsp;</div><input type="checkbox" value="1" name="checktask" onclick="javascript: if(this.checked){document.getElementById(\'option4\').style.display=\'block\';}else{document.getElementById(\'option4\').style.display=\'none\';}"/>&nbsp;'.Display::return_icon('wiki_task.png', get_lang('DefineTask'),'',ICON_SIZE_SMALL).' '.get_lang('DescriptionOfTheTask').'';
echo '&nbsp;&nbsp;&nbsp;<span id="msg_error4" style="display:none;color:red"></span>';
echo '<div id="option4" style="padding:4px; margin:5px; border:1px dotted; display:none;">';
echo '<table border="0" style="font-weight:normal">';
echo '<tr>';
echo '<td>'.get_lang('DescriptionOfTheTask').'</td>';
@ -1931,7 +1976,8 @@ if (isset($action ) && $action =='edit') {
</select> %';
echo '<br/><br/>';
echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">';//prevent double post
echo '<button class="save" type="submit" name="SaveWikiChange">'.get_lang('Save').'</button>';//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js
//for save button Don't change name (see fckeditor/editor/plugins/customizations/fckplugin_compressed.js and fckplugin.js
echo '<button class="save" type="submit" name="SaveWikiChange">'.get_lang('Save').'</button>';
echo '</div>';
echo '</form>';
}
@ -1941,7 +1987,7 @@ if (isset($action ) && $action =='edit') {
// Page history
if ($action =='history' or isset($_POST['HistoryDifferences'])) {
if ($action == 'history' or isset($_POST['HistoryDifferences'])) {
if (!$_GET['title']) {
Display::display_error_message(get_lang("MustSelectPage"));
exit;
@ -1950,7 +1996,9 @@ if ($action =='history' or isset($_POST['HistoryDifferences'])) {
//First, see the property visibility that is at the last register and therefore we should select descending order. But to give ownership to each record, this is no longer necessary except for the title. TODO: check this
$sql='SELECT * FROM '.$tbl_wiki.'WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.' ORDER BY id DESC';
$sql = 'SELECT * FROM '.$tbl_wiki.'
WHERE c_id = '.$course_id.' AND reflink="'.Database::escape_string($page).'" AND '.$groupfilter.$condition_session.'
ORDER BY id DESC';
$result=Database::query($sql);
while ($row=Database::fetch_array($result)) {
@ -1966,10 +2014,10 @@ if ($action =='history' or isset($_POST['HistoryDifferences'])) {
$icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL);
}
//Second, show
// Second, show
//if the page is hidden and is a job only sees its author and professor
if($KeyVisibility==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin() || ($KeyAssignment==2 && $KeyVisibility==0 && (api_get_user_id()==$KeyUserId))) {
if ($KeyVisibility==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin() || ($KeyAssignment==2 && $KeyVisibility==0 && (api_get_user_id()==$KeyUserId))) {
// We show the complete history
if (!$_POST['HistoryDifferences'] && !$_POST['HistoryDifferences2']) {
@ -2202,7 +2250,8 @@ if ($action == 'allpages') {
} else {
$sql = 'SELECT * FROM '.$tbl_wiki.' s1
WHERE visibility=1 AND s1.c_id = '.$course_id.' AND id=(
SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')'; // warning don't use group by reflink because does not return the last version
SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2
WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')'; // warning don't use group by reflink because does not return the last version
}
$allpages=Database::query($sql);

@ -36,7 +36,8 @@ function createreflink($testvalue)
* @return bool False if title is already taken
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
**/
function checktitle($paramwk) {
function checktitle($paramwk)
{
global $tbl_wiki;
global $groupfilter;
global $condition_session;
@ -53,9 +54,8 @@ function checktitle($paramwk) {
// the value has not been found and is this available
if ($numberofresults==0) {
return true;
}
else // the value has been found
{
} else {
// the value has been found
return false;
}
}
@ -66,12 +66,13 @@ function checktitle($paramwk) {
**/
function links_to($input)
{
$input_array=preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
$input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
$all_links = array();
foreach ($input_array as $key=>$value) {
if ($input_array[$key-1]=='[[' AND $input_array[$key+1]==']]') {
if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' &&
isset($input_array[$key+1]) && $input_array[$key+1] == ']]'
) {
if (api_strpos($value, "|") !== false) {
$full_link_array=explode("|", $value);
$link=trim($full_link_array[0]);
@ -82,10 +83,11 @@ function links_to($input)
}
unset($input_array[$key-1]);
unset($input_array[$key+1]);
$all_links[]= Database::escape_string(str_replace(' ','_',$link)).' '; //replace blank spaces by _ within the links. But to remove links at the end add a blank space
//replace blank spaces by _ within the links. But to remove links at the end add a blank space
$all_links[]= Database::escape_string(str_replace(' ','_',$link)).' ';
}
}
$output=implode($all_links);
$output = implode($all_links);
return $output;
}
@ -168,35 +170,15 @@ function detect_irc_link($input) {
function make_wiki_link_clickable($input)
{
$groupId = api_get_group_id();
$input_array=preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE); //now doubles brackets
foreach ($input_array as $key=>$value) {
//now doubles brackets
if ($input_array[$key-1] == '[[' AND $input_array[$key+1]==']]') {
/////////// TODO: metawiki
/*
if ($session_id==0)
{
if ($groupId==0)
{
$titleg_ex='';
}
else
{
$group_properties = GroupManager :: get_group_properties($groupId);
$group_name= $group_properties['name'];
$titleg_ex='<sup><img src="css/wgroup.gif" alt="('.$group_name.')" title="Link to Wikigroup:'.$group_name.'"/></sup>';
}
}
else
{
TODO:logic for sessions
}
*/
/////////
$input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE);
//now full wikilink
foreach ($input_array as $key => $value) {
//now doubles brackets
if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' AND
$input_array[$key+1] == ']]'
) {
// now full wikilink
if (api_strpos($value, "|") !== false){
$full_link_array=explode("|", $value);
$link=trim(strip_tags($full_link_array[0]));
@ -275,19 +257,21 @@ function save_wiki()
$_clean['fprogress3']=Database::escape_string($_POST['fprogress3']);
}
if (Security::remove_XSS($_POST['initstartdate']==1)) {
if (isset($_POST['initstartdate']) && $_POST['initstartdate'] == 1) {
$_clean['startdate_assig']=Database::escape_string(get_date_from_select('startdate_assig'));
} else {
$_clean['startdate_assig']=Database::escape_string($_POST['startdate_assig']);
}
if (Security::remove_XSS($_POST['initenddate']==1)) {
$_clean['enddate_assig']=Database::escape_string(get_date_from_select('enddate_assig'));
if (isset($_POST['initenddate']) && $_POST['initenddate']==1) {
$_clean['enddate_assig'] = Database::escape_string(get_date_from_select('enddate_assig'));
} else {
$_clean['enddate_assig']=Database::escape_string($_POST['enddate_assig']);
$_clean['enddate_assig'] = Database::escape_string($_POST['enddate_assig']);
}
if (isset($_POST['delayedsubmit'])) {
$_clean['delayedsubmit']=Database::escape_string($_POST['delayedsubmit']);
}
if (!empty($_POST['max_text']) || !empty($_POST['max_version'])) {
$_clean['max_text'] =Database::escape_string($_POST['max_text']);
@ -389,8 +373,13 @@ function save_new_wiki() {
global $tbl_wiki_conf;
global $page;
$_clean = array();
// cleaning the variables
$_clean['assignment']=Database::escape_string($_POST['assignment']);
$_clean['assignment'] = null;
if (isset($_POST['assignment'])) {
$_clean['assignment'] = Database::escape_string($_POST['assignment']);
}
// session_id
$session_id = api_get_session_id();
@ -414,7 +403,7 @@ function save_new_wiki() {
return false;
}
if($_clean['assignment']==2) {//config by default for individual assignment (students)
if ($_clean['assignment']==2) {//config by default for individual assignment (students)
//Identifies the user as a creator, not the teacher who created
$_clean['user_id']=(int)Database::escape_string($assig_user_id);
$_clean['visibility']=0;
@ -506,26 +495,27 @@ function display_new_wiki_form() {
<script>
function CheckSend()
{
if(document.form1.title.value == "")
{
if (document.form1.title.value == "") {
alert("<?php echo get_lang('NoWikiPageTitle');?>");
document.form1.title.focus();
return false;
}
return true;
return true;
}
function setFocus(){
function setFocus(){
$("#wiki_title").focus();
}
$(document).ready(function () {
}
$(document).ready(function () {
setFocus();
});
});
</script>
<?php
$title = isset($_GET['title']) ? Security::remove_XSS($_GET['title']) : null;
//form
echo '<form name="form1" method="post" onsubmit="return CheckSend()" action="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&amp;title='.api_htmlentities(urlencode(strtolower(str_replace(' ','_',$page)))).'&group_id='.api_htmlentities($_GET['group_id']).'">';
echo '<div id="wikititle" style="min-height:30px;">';
echo '<div style="width:70%;float:left;"><span class="form_required">*</span> '.get_lang('Title').': <input type="text" id="wiki_title" name="title" value="'.api_htmlentities($_GET['title']).'" size="40"></div>';
echo '<div style="width:70%;float:left;">
<span class="form_required">*</span> '.get_lang('Title').': <input type="text" id="wiki_title" name="title" value="'.$title.'" size="40"></div>';
if(api_is_allowed_to_edit(false,true) || api_is_platform_admin()) {
echo'<a href="javascript://" onclick="advanced_parameters()" ><span id="plus_minus" style="float:right">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>';
@ -685,7 +675,8 @@ return true;
* @author Juan Carlos Raña Trabado
* @return html code
**/
function display_wiki_entry($newtitle) {
function display_wiki_entry($newtitle)
{
global $tbl_wiki, $tbl_wiki_conf, $groupfilter, $condition_session, $page;
$course_id = api_get_course_int_id();
if ($newtitle) {
@ -694,12 +685,11 @@ function display_wiki_entry($newtitle) {
$pageMIX=$page;//display current page
}
$session_id=api_get_session_id();
if ($_GET['view']) {
$session_id = api_get_session_id();
$filter = null;
if (isset($_GET['view']) && $_GET['view']) {
$_clean['view']=(int)Database::escape_string($_GET['view']);
$filter=' AND w.id="'.$_clean['view'].'"';
$filter =' AND w.id="'.$_clean['view'].'"';
}
//first, check page visibility in the first page version
@ -713,8 +703,9 @@ function display_wiki_entry($newtitle) {
$KeyVisibility=$row['visibility'];
// second, show the last version
$sql='SELECT * FROM '.$tbl_wiki.' w , '.$tbl_wiki_conf.' wc
WHERE wc.c_id = '.$course_id.' AND
$sql = 'SELECT * FROM '.$tbl_wiki.' w , '.$tbl_wiki_conf.' wc
WHERE
wc.c_id = '.$course_id.' AND
w.c_id = '.$course_id.' AND
wc.page_id = w.page_id AND
w.reflink = "'.Database::escape_string($pageMIX).'" AND
@ -726,8 +717,7 @@ function display_wiki_entry($newtitle) {
$row = Database::fetch_array($result); // we do not need a while loop since we are always displaying the last version
//log users access to wiki (page_id)
if (!empty($row['page_id']))
{
if (!empty($row['page_id'])) {
event_system(LOG_WIKI_ACCESS, LOG_WIKI_PAGE_ID, $row['page_id']);
}
//update visits
@ -754,14 +744,15 @@ function display_wiki_entry($newtitle) {
}
//assignment mode: identify page type
$icon_assignment = null;
if ($row['assignment']==1) {
$icon_assignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
$icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL);
} elseif($row['assignment']==2) {
$icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
$icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL);
}
//task mode
$icon_task = null;
if (!empty($row['task'])) {
$icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL);
}

Loading…
Cancel
Save