Merge branch '1.9.x' into 1.10.x

1.10.x
Julio Montoya 10 years ago
commit 19ee4c0d4d
  1. 22
      main/inc/lib/fckeditor/editor/plugins/Abbr/lang/nl.js
  2. 146
      main/inc/lib/fileUpload.lib.php
  3. 54
      main/tracking/question_course_report.php
  4. 13
      main/wiki/index.php
  5. 62
      main/wiki/wiki.inc.php

@ -0,0 +1,22 @@
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: en.js
* Abbr English language file.
* Changes for Chamilo corrections
*
*/
FCKLang.Abbr = 'Corrections' ;
FCKLang.AbbrBtn = 'Insert/Remove corrections' ;
FCKLang.AbbrDlgTitle = 'Insert/Remove corrections' ;
FCKLang.AbbrDlgName = 'Please insert a comment:' ;
FCKLang.AbbrDlgTxt = 'Correction gets visible while mouseover with cursor [<abbr title="This word is a mispelling">This is the correction appearance</abbr>]';
FCKLang.AbbrDlgRemove = 'Remove correction';
FCKLang.AbbrDlgSelectFirst = 'You have to select text first!';

@ -1518,100 +1518,102 @@ function create_unexisting_directory(
}
if (!is_dir($base_work_dir.$systemFolderName)) {
mkdir(
$result = mkdir(
$base_work_dir.$systemFolderName,
api_get_permissions_for_new_directories(),
true
);
// Check if pathname already exists inside document table
$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT id, path FROM $tbl_document
WHERE
c_id = $course_id AND
(
path = '".$systemFolderName."'
)
";
if ($result) {
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
// Check if pathname already exists inside document table
$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT id, path FROM $tbl_document
WHERE
c_id = $course_id AND
(
path = '" . $systemFolderName . "'
)
";
$document_id = add_document(
$_course,
$systemFolderName,
'folder',
0,
$title,
null,
0,
true,
$to_group_id
);
$rs = Database::query($sql);
if (Database::num_rows($rs) == 0) {
if ($document_id) {
// Update document item_property
if (!empty($visibility)) {
$document_id = add_document(
$_course,
$systemFolderName,
'folder',
0,
$title,
null,
0,
true,
$to_group_id
);
$visibilities = array(
0 => 'invisible',
1 => 'visible',
2 => 'delete'
);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
$visibilities[$visibility],
$user_id,
$to_group_id,
$to_user_id,
null,
null,
$session_id
);
} else {
api_item_property_update(
$_course,
TOOL_DOCUMENT,
if ($document_id) {
// Update document item_property
if (!empty($visibility)) {
$visibilities = array(
0 => 'invisible',
1 => 'visible',
2 => 'delete'
);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
$visibilities[$visibility],
$user_id,
$to_group_id,
$to_user_id,
null,
null,
$session_id
);
} else {
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$document_id,
'FolderCreated',
$user_id,
$to_group_id,
$to_user_id,
null,
null,
$session_id
);
}
$documentData = DocumentManager::get_document_data_by_id(
$document_id,
'FolderCreated',
$user_id,
$to_group_id,
$to_user_id,
null,
null,
$_course['code'],
false,
$session_id
);
return $documentData;
}
} else {
$document = Database::fetch_array($rs);
$documentData = DocumentManager::get_document_data_by_id(
$document_id,
$document['id'],
$_course['code'],
false,
$session_id
);
return $documentData;
} else {
return false;
}
} else {
$document = Database::fetch_array($rs);
$documentData = DocumentManager::get_document_data_by_id(
$document['id'],
$_course['code'],
false,
$session_id
);
/* This means the folder NOT exist in the filesystem
(now this was created) but there is a record in the Database*/
/* This means the folder NOT exist in the filesystem
(now this was created) but there is a record in the Database*/
return $documentData;
return $documentData;
}
}
} else {
return false;
}
return false;
}
/**

@ -1,18 +1,17 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Report
* @package chamilo.tracking
*/
/**
* Code
*/
$language_file = array ('registration', 'index', 'tracking', 'exercice','survey');
$language_file = array('registration', 'index', 'tracking', 'exercice','survey');
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php';
require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php';
require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
@ -59,9 +58,14 @@ if (empty($session_id)) {
$temp_course_list = SessionManager::get_course_list_by_session_id($session_id);
}
foreach($temp_course_list as $temp_course_item) {
foreach ($temp_course_list as $temp_course_item) {
$course_item = CourseManager ::get_course_information($temp_course_item['code']);
$course_list[]= array('db_name' =>$course_item['db_name'],'code'=>$course_item['code'], 'title'=>$course_item['title'], 'visual_code'=>$course_item['visual_code']);
$course_list[] = array(
'db_name' => $course_item['db_name'],
'code' => $course_item['code'],
'title' => $course_item['title'],
'visual_code' => $course_item['visual_code']
);
$course_select_list[$temp_course_item['code']] = $course_item['title'];
}
@ -94,41 +98,35 @@ if (!empty($course_info)) {
$main_question_list = array();
foreach ($lp_list as $lp_id =>$lp) {
$exercise_list = get_all_exercises_from_lp($lp_id, $course_info['real_id']);
//var_dump($exercise_list);
foreach ($exercise_list as $exercise) {
$my_exercise = new Exercise();
//$my_exercise->read($exercise['ref']);
$my_exercise->read($exercise['path']);
$question_list = $my_exercise->selectQuestionList();
$exercise_stats = get_all_exercise_event_from_lp($exercise['path'],$course_info['id'], $session_id);
//echo '<pre>'; print_r($exercise_stats);
$exercise_stats = get_all_exercise_event_from_lp(
$exercise['path'],
$course_info['id'],
$session_id
);
foreach($question_list as $question_id) {
foreach ($question_list as $question_id) {
$question_data = Question::read($question_id);
///var_dump($question_data);
$main_question_list[$question_id] = $question_data;
$quantity_exercises = 0;
$question_result = 0;
//echo '<pre>';
//print_r($exercise_stats);
foreach($exercise_stats as $stats) {
if (!empty($stats['question_list'])) {
foreach($stats['question_list'] as $my_question_stat) {
// var_dump($my_question_stat);
if ($question_id == $my_question_stat['question_id']) {
//var_dump($my_question_stat);
$question_result = $question_result + $my_question_stat['marks'];
// var_dump($my_question_stat['marks']);
$quantity_exercises++;
}
}
}
}
//echo $question_id;
//var_dump($question_result.' - '.$quantity_exercises.$main_question_list[$question_id]->weighting);
if(!empty($quantity_exercises)) {
$main_question_list[$question_id]->results =(($question_result / ($quantity_exercises)) ) ; // Score % average
if (!empty($quantity_exercises)) {
// Score % average
$main_question_list[$question_id]->results =(($question_result / ($quantity_exercises)) ) ;
} else {
$main_question_list[$question_id]->results = 0;
}
@ -139,11 +137,6 @@ if (!empty($course_info)) {
}
}
//var_dump($main_question_list);
//var_dump($main_question_list);
//$course_list = SessionManager::get_course_list_by_session_id($session_id);
if (!$export_to_xls) {
Display :: display_header(get_lang("MySpace"));
@ -173,7 +166,6 @@ if (!$export_to_xls) {
}
$course_average = array();
$counter = 0;
if (!empty($main_question_list) && is_array($main_question_list)) {
@ -228,7 +220,8 @@ if ($export_to_xls) {
exit;
}
function sort_user($a, $b) {
function sort_user($a, $b)
{
if (is_numeric($a['score']) && is_numeric($b['score'])) {
echo $a['score'].' : '.$b['score'];
echo '<br />';
@ -240,7 +233,8 @@ function sort_user($a, $b) {
return 1;
}
function export_complete_report_xls($filename, $array) {
function export_complete_report_xls($filename, $array)
{
global $charset;
$workbook = new Spreadsheet_Excel_Writer();
$workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH));

@ -74,10 +74,13 @@ event_access_tool(TOOL_WIKI);
if ($groupId) {
$group_properties = GroupManager::get_group_properties($groupId);
$interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH)."group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array(
"url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?gidReq=".$groupId,
"name" => get_lang('GroupSpace').' '.$group_properties['name']
"url" => api_get_path(WEB_CODE_PATH)."group/group.php?".api_get_cidreq(),
"name" => get_lang('Groups')
);
$interbreadcrumb[] = array(
"url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(),
"name" => get_lang('GroupSpace').' '.Security::remove_XSS($group_properties['name'])
);
//ensure this tool in groups whe it's private or deactivated
if ($group_properties['wiki_state'] == 0) {
@ -95,8 +98,8 @@ $is_allowed_to_edit = api_is_allowed_to_edit(false, true);
// The page we are dealing with
$page = isset($_GET['title']) ? $_GET['title']: 'index';
$action = isset($_GET['action']) ? $_GET['action'] : 'showpage';
$view = isset($_GET['view']) ? $_GET['view'] : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'showpage';
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$wiki->page = $page;
$wiki->action = $action;

@ -36,17 +36,16 @@ class Wiki
public function __construct()
{
// Database table definition
$this->tbl_wiki = Database::get_course_table(TABLE_WIKI);
$this->tbl_wiki_discuss = Database::get_course_table(TABLE_WIKI_DISCUSS);
$this->tbl_wiki_mailcue = Database::get_course_table(TABLE_WIKI_MAILCUE);
$this->tbl_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
$this->tbl_wiki = Database::get_course_table(TABLE_WIKI);
$this->tbl_wiki_discuss = Database::get_course_table(TABLE_WIKI_DISCUSS);
$this->tbl_wiki_mailcue = Database::get_course_table(TABLE_WIKI_MAILCUE);
$this->tbl_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
$this->session_id = api_get_session_id();
$this->condition_session = api_get_session_condition($this->session_id);
$this->course_id = api_get_course_int_id();
$this->group_id = api_get_group_id();
if (!empty($this->group_id)) {
$this->groupfilter = ' group_id="'.$this->group_id.'"';
}
@ -186,8 +185,10 @@ class Wiki
$irclink='href="irc';
$irclinkStyle='class="wiki_irc_link" href="irc';
$output=str_replace($irclink, $irclinkStyle, $input);
return $output;
}
/**
* This function allows users to have [link to a title]-style links like in most regular wikis.
* It is true that the adding of links is probably the most anoying part of Wiki for the people
@ -277,8 +278,8 @@ class Wiki
$_clean['title'] = Database::escape_string(trim($values['title']));
$_clean['content'] = Database::escape_string($values['content']);
if (api_get_setting('htmlpurifier_wiki') == 'true'){
$purifier = new HTMLPurifier();
$_clean['content'] = $purifier->purify($_clean['content']);
//$purifier = new HTMLPurifier();
$_clean['content'] = Security::remove_XSS($_clean['content']);
}
$_clean['user_id'] = api_get_user_id();
$_clean['assignment']= Database::escape_string($values['assignment']);
@ -704,7 +705,7 @@ class Wiki
}
$wikiData = self::getWikiData();
$redirectUrl = $this->url.'&action=showpage&title='.$wikiData['reflink'];
$redirectUrl = $this->url.'&action=showpage&title='.$wikiData['reflink'].'&'.api_get_cidreq();
header('Location: '.$redirectUrl);
exit;
}
@ -4320,17 +4321,18 @@ class Wiki
$page = $this->page;
echo '<div class="actions">';
/* echo '&nbsp;<a href="index.php?cidReq='.$_course['id'].'&action=show&amp;title=index&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('show').'>'.
Display::return_icon('wiki.png',get_lang('HomeWiki'),'',ICON_SIZE_MEDIUM).'</a>&nbsp;';*/
echo '<ul class="nav" style="margin-bottom:0px">
<li class="dropdown">
<a class="dropdown-toggle" href="javascript:void(0)">'.Display::return_icon('menu.png', get_lang('Menu'), '', ICON_SIZE_MEDIUM).'</a>';
<a class="dropdown-toggle" href="javascript:void(0)">'.
Display::return_icon('menu.png', get_lang('Menu'), '', ICON_SIZE_MEDIUM).'</a>';
// menu home
echo '<ul class="dropdown-menu">';
echo '<li><a href="index.php?action=showpage&title=index&cidReq='.$_course['id'].'&session_id='.$session_id.'&group_id='.$groupId.'">'.get_lang('Home').'</a></li>';
echo '<li><a href="index.php?action=showpage&title=index&cidReq='.$_course['id'].'&session_id='.$session_id.'&group_id='.$groupId.'">'.
get_lang('Home').'</a></li>';
if (api_is_allowed_to_session_edit(false, true) && api_is_allowed_to_edit()) {
// menu add page
echo '<li><a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>' . get_lang('AddNew') . '</a>';
echo '<li><a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>'
. get_lang('AddNew') . '</a>';
}
$lock_unlock_addnew = null;
@ -4347,16 +4349,21 @@ class Wiki
}
}
echo '<a href="index.php?action=show&amp;actionpage='.$lock_unlock_addnew.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$protect_addnewpage.'</a></li>';
echo '<a href="index.php?action=show&amp;actionpage='.$lock_unlock_addnew.'&amp;title='.api_htmlentities(urlencode($page)).'">'.
$protect_addnewpage.'</a></li>';
// menu find
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=searchpages&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('searchpages').'>'.get_lang('SearchPages').'</a></li>';
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=searchpages&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('searchpages').'>'.
get_lang('SearchPages').'</a></li>';
// menu all pages
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=allpages&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('allpages').'>'.get_lang('AllPages').'</a></li>';
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=allpages&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('allpages').'>'.
get_lang('AllPages').'</a></li>';
// menu recent changes
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=recentchanges&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('recentchanges').'>'.get_lang('RecentChanges').'</a></li>';
echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=recentchanges&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('recentchanges').'>'.
get_lang('RecentChanges').'</a></li>';
// menu delete all wiki
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
echo '<li><a href="index.php?action=deletewiki&amp;title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('deletewiki').'>'.get_lang('DeleteWiki').'</a></li>';
echo '<li><a href="index.php?action=deletewiki&amp;title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('deletewiki').'>'.
get_lang('DeleteWiki').'</a></li>';
}
///menu more
echo '<li><a href="index.php?action=more&amp;title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('more').'>'.get_lang('Statistics').'</a></li>';
@ -4395,7 +4402,7 @@ class Wiki
Display::return_icon('delete.png',get_lang('DeleteThisPage'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo '</ul>';
echo '</div>'; // End actions
echo '</div>';
}
/**
@ -4542,7 +4549,7 @@ class Wiki
$message=get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig'], null, date_default_timezone_get());
self::setMessage(Display::display_warning_message($message, false, true));
if (!api_is_allowed_to_edit(false,true)) {
return;
$this->redirectHome();
}
}
@ -4555,7 +4562,7 @@ class Wiki
$message = get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig'], null, date_default_timezone_get());
self::setMessage(Display::display_warning_message($message, false, true));
if (!api_is_allowed_to_edit(false,true)) {
return;
$this->redirectHome();
}
}
@ -4563,7 +4570,7 @@ class Wiki
$message=get_lang('HasReachedMaxiNumVersions');
self::setMessage(Display::display_warning_message($message, false, true));
if (!api_is_allowed_to_edit(false,true)) {
return;
$this->redirectHome();
}
}
@ -4571,7 +4578,7 @@ class Wiki
$message = get_lang('HasReachedMaxNumWords');
self::setMessage(Display::display_warning_message($message, false, true));
if (!api_is_allowed_to_edit(false,true)) {
return;
$this->redirectHome();
}
}
@ -4648,11 +4655,11 @@ class Wiki
Display::tag('span', api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])), array('title'=>$username)).
'</a>. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').'';
self::setMessage(Display::display_normal_message($is_being_edited, false, true));
return;
$this->redirectHome();
}
// Form.
$url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id();
$url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'&'.api_get_cidreq();
$form = new FormValidator('wiki', 'post', $url);
$form->addElement('header', $icon_assignment.str_repeat('&nbsp;',3).api_htmlentities($title));
self::setForm($form, $row);
@ -4682,7 +4689,7 @@ class Wiki
self::setMessage(Display::display_confirmation_message($return_message, false, true));
}
$wikiData = self::getWikiData();
$redirectUrl = $this->url.'&action=showpage&title='.$wikiData['reflink'];
$redirectUrl = $this->url.'&action=showpage&title='.$wikiData['reflink'].'&'.api_get_cidreq();
header('Location: '.$redirectUrl);
exit;
}
@ -5131,7 +5138,7 @@ class Wiki
public function redirectHome()
{
$redirectUrl = $this->url.'&action=showpage&title=index';
header('Location: '.$redirectUrl);
header('Location: '.$redirectUrl.'&'.api_get_cidreq());
exit;
}
@ -5155,4 +5162,3 @@ class Wiki
return false;
}
}

Loading…
Cancel
Save