skala
Julio Montoya 14 years ago
commit 27b9a8ad7a
  1. 23
      documentation/changelog.html
  2. 2
      main/admin/user_import.php
  3. 35
      main/cron/user_import/get_data_from_mail.php
  4. 59
      main/cron/user_import/resend_email_with_new_password.php
  5. 6
      main/css/dokeos_classic/default.css
  6. 25
      main/exercice/upload_exercise.php
  7. 2
      main/inc/ajax/document.ajax.php
  8. 34
      main/inc/lib/course.lib.php
  9. 62
      main/inc/lib/document.lib.php
  10. 5
      main/install/update-db-1.8.5-1.8.6.inc.php
  11. 71
      main/install/update-db-1.8.6.2-1.8.7.inc.php
  12. 102
      main/work/work.lib.php
  13. 4
      main/work/work.php
  14. 4
      user_portal.php

@ -35,7 +35,8 @@ This version of Chamilo only includes a few minor new features:
<li>Added tokens to announcements (changeset 66d9c5e10b42)</li>
<li>Students can download learning paths as PDF (changeset 3bd77279faee)</li>
<li>Added tokens to certificates generation (changeset c2201eee3558)</li>
<li>Attendances session support </li>
<li>Attendances session support</li>
<li>Added quick browsing of directories' documents - requires manual activation for now: in user_portal.php, find $load_dirs and set to $load_dirs = true;. Will be setable through admin page in next version (changeset 7f84869233c2)</li>
</ul>
<h3>Debugging</h3>
<ul>
@ -52,7 +53,13 @@ This version of Chamilo only includes a few minor new features:
<ul>
<li>Fixing announcements listing BT#2751 </li>
</ul>
</li>
</li>
<li>
Assignments
<ul>
<li>Made assignments editable/removable by students only until they have been reviewed and scored (>0) by the teacher (changeset bc1b8e1e603d)</li>
</ul>
</li>
<li>
Attendances
<ul>
@ -73,6 +80,7 @@ This version of Chamilo only includes a few minor new features:
<ul>
<li>Fixed question matching when using french/spanish accents </li>
<li>Exercise results: Fixing and improving export to CSV using jquery BT#2722</li>
<li>Fixed bug with feedback in XLS import #3763</li>
</ul>
</li>
<li>Gradebook
@ -88,7 +96,12 @@ This version of Chamilo only includes a few minor new features:
<li>Fixed mp3 previews </li>
</ul>
</li>
<li>
<ul>
<li>Fixed fatal error in upgrade from 1.8.5 by requiring image.lib.php - BT#2777</li>
<li>Fixed fatal error in upgrade from 1.8.6.2 by checking the availability of the DateTimeZone library in PHP - BT#2777</li>
</ul>
</li>
<li>Learning path
<ul>
<li>Drag and drop to order LP items! #3741</li>
@ -145,7 +158,7 @@ This version of Chamilo only includes a few minor new features:
<li>All CSS were reduced and improved in order to use the base.css and base_chamilo.css styles</li>
<li>Chosen library (select tag improved)added #3740</li>
</ul>
</li>
</li>
</ul>
<h3>Security</h3>
<ul>
@ -154,7 +167,7 @@ This version of Chamilo only includes a few minor new features:
<li>Fixed several potential SQL injections #3601</li>
</ul>
<h3>Known issues</h3>
<ul>
<ul>
<li>Watermark portal images are now saved in the main/default_course_document/images/ folder. If you used portal-wide watermarks before, you might need to upload the watermark image again.</li>
<li>A style-specific switch had been added in 1.8.8.2, which improved the appearance of older style but went against MVC's principles and broke copies of Chamilo-based styles. This switch has been removed, which may lead to the breadcrumb in non-chamilo-based styles to appear as less attractive, but keeps the MVC model safe so anyone can modify the appearance safely from the CSS. This might require very little cosmetic changes from you (in your style's default.css file), but we believe it's for the best.</li>
</ul>

@ -171,7 +171,7 @@ function save_data($users) {
if ($send_mail) {
$recipient_name = api_get_person_name($user['FirstName'], $user['LastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : $user[UserName]\n".get_lang('Pass')." : $user[Password]\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ".$user['UserName']."\n".get_lang('Pass')." : ".$user['Password']."\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
@api_mail($recipient_name, $user['Email'], $emailsubject, $emailbody, $sender_name, $email_admin);

@ -0,0 +1,35 @@
<?php
/**
* This script gets users details of a given list of users
* (given by e-mail) and prints the details in /tmp/list.txt
* To enable script, prefix the first die(); with //
* @package chamilo.cron.user_import
*/
/**
* Initialization
*/
/* Example of input file:
sam@example.com
Matthew@example.com
HERMAN@example.com
*/
die();
//change filename depending on file containing mails list
$list = file('input.txt');
require_once '../../inc/global.inc.php';
$users = Database::get_main_table(TABLE_MAIN_USER);
$string='';
foreach ($list as $mail) {
$mail = trim($mail);
$sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n";
$res = Database::query($sql);
if ($res === false) { die(mysql_error());}
if (Database::num_rows($res) == 0) {
$string .= 'No encontrado;'.$row['email'];
} else {
$row = Database::fetch_assoc($res);
$string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n";
}
}
echo $string;
file_put_contents('/tmp/list.txt',$string);

@ -0,0 +1,59 @@
<?php
/**
* This script updates the passwords of a given list of users
* (given by e-mail) and resends them their account creation
* confirmation e-mail.
* Note that the password generation has been simplified, which
* means the password below is not really "safe"
* To enable script, prefix the first die(); with //
* @package chamilo.cron.user_import
*/
/**
* Initialization
*/
/* Example of input file:
sam@example.com
Matthew@example.com
HERMAN@example.com
*/
die();
//change filename depending on file containing mails list, with one e-mail per line.
$list = file('input.txt');
$language_file = array ('admin', 'registration');
require_once '../../inc/global.inc.php';
$users = Database::get_main_table(TABLE_MAIN_USER);
/**
* E-mails list loop
*/
foreach ($list as $mail) {
$mail = trim($mail);
$sql = "SELECT user_id, official_code, firstname, lastname, email, username, language FROM $users WHERE email = '$mail'\n";
$res = Database::query($sql);
if ($res === false) { echo 'Error in database with email '.$mail."\n";}
if (Database::num_rows($res) == 0) {
echo '[Error] Email not found in database: '.$row['email']."\n";
} else {
$row = Database::fetch_assoc($res);
$pass = api_substr($row['username'], 0,4).rand(0,9).rand(0,9);
$crypass = api_get_encrypted_password($password);
$sqlu = "UPDATE $users SET password='$crypass' WHERE user_id = ".$row['user_id'];
$resu = Database::query($sqlu);
if ($resu === false ) {
echo "[Error] Error updating password. Skipping $mail\n";
continue;
}
$user = array('FirstName'=>$row['firstname'],'LastName'=>$row['lastname'],'UserName'=>$row['username'],'Password'=>$pass,'Email'=>$mail);
$l = api_get_interface_language();
if (!empty($row['language'])) {
$l = $row['language'];
}
//This comes from main/admin/user_import.php::save_data() slightly modified
$recipient_name = api_get_person_name($user['FirstName'], $user['LastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg',null,$l).' '.api_get_setting('siteName');
$emailbody = get_lang('Dear',null,$l).' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg',null,$l)." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings',null,$l)."\n\n".get_lang('Username',null,$l)." : ".$user['UserName']."\n".get_lang('Pass',null,$l)." : ".$user['Password']."\n\n".get_lang('Address',null,$l)." ".api_get_setting('siteName')." ".get_lang('Is',null,$l)." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem',null,$l)."\n\n".get_lang('Formula',null,$l).",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager',null,$l)." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email',null,$l)." : ".api_get_setting('emailAdministrator')."";
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
@api_mail($recipient_name, $user['Email'], $emailsubject, $emailbody, $sender_name, $email_admin);
echo "[OK] Sent to $mail with new password $pass (encrypted:$crypass)... w/ subject: $emailsubject\n";
}
}

@ -440,7 +440,7 @@ input[text] {
*****************************************************/
#header3 {
font-size: 1.0em;
padding: 0.8em 0.5em 0.4em 0.5em;
padding: 0.8em 0.5em 0em 0.5em;
background: #E5EDF9;
color: #006;
border-bottom: 1px solid #4171b5;
@ -548,7 +548,7 @@ input[text] {
#header4 {
background-color: #fff;
color: #009;
padding: 4px 0px 4px 21px;
padding: 0;
margin-bottom: 2px;
float:left;
width:98%;
@ -3058,4 +3058,4 @@ abbr {
border-bottom: 1px dotted rgb(102, 102, 102);
background-color:#F00;
cursor: help;
}
}

@ -141,7 +141,7 @@ function lp_upload_quiz_action_handling() {
$feedback_false_index = array();
$number_questions = 0;
// Reading all the first column items sequencially to create breakpoints
for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) {
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
if ($data->sheets[0]['cells'][$i][1] == 'Quiz' && $i == 1) {
$quiz_index = $i; // Quiz title position, only occurs once
} elseif ($data->sheets[0]['cells'][$i][1] == 'Question') {
@ -152,9 +152,9 @@ function lp_upload_quiz_action_handling() {
$question_name_index_end[] = $i - 1; // Question name position
$score_index[] = $i; // Question score position
} elseif ($data->sheets[0]['cells'][$i][1] == 'FeedbackTrue') {
$feedback_true_index[] = $i; // FeedbackTrue position
$feedback_true_index[] = $i; // FeedbackTrue position (line)
} elseif ($data->sheets[0]['cells'][$i][1] == 'FeedbackFalse') {
$feedback_false_index[] = $i; // FeedbackFalse position
$feedback_false_index[] = $i; // FeedbackFalse position (line)
}
}
// Variables
@ -170,7 +170,7 @@ function lp_upload_quiz_action_handling() {
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
if (is_array($data->sheets[0]['cells'][$i])) {
$column_data = $data->sheets[0]['cells'][$i];
// Fill all column with data
// Fill all column with data to have a full array
for ($x = 1; $x <= $data->sheets[0]['numCols']; $x++) {
if (empty($column_data[$x])) {
$data->sheets[0]['cells'][$i][$x] = '';
@ -185,16 +185,16 @@ function lp_upload_quiz_action_handling() {
if ($quiz_index == $i) { // The title always in the first position
$quiz = $column_data;
} elseif (in_array($i, $question_title_index)) {
$question[$k] = $column_data;
$question[$k] = $column_data; //a complete line where 1st column is 'Question'
$k++;
} elseif (in_array($i, $score_index)) {
$score_list[$z] = $column_data;
$score_list[$z] = $column_data; //a complete line where 1st column is 'Score'
$z++;
} elseif (in_array($i, $feedback_true_index)) {
$feedback_true_list[$q] = $column_data;
$feedback_true_list[$q] = $column_data;//a complete line where 1st column is 'FeedbackTrue'
$q++;
} elseif (in_array($i, $feedback_false_index)) {
$feedback_false_list[$l] = $column_data;
$feedback_false_list[$l] = $column_data;//a complete line where 1st column is 'FeedbackFalse' for wrong answers
$l++;
}
}
@ -222,7 +222,9 @@ function lp_upload_quiz_action_handling() {
// Variables
$type = 2;
$random = $active = $results = $max_attempt = $expired_time = 0;
$feedback = 3;
//make sure feedback is enabled (3 to disable), otherwise the fields
// added to the XLS are not shown, which is confusing
$feedback = 0;
// Quiz object
$quiz_object = new Exercise();
@ -248,12 +250,17 @@ function lp_upload_quiz_action_handling() {
if (strtolower($answer_data[3]) == 'x') {
$correct = 1;
$score = $score_list[$i][3];
$comment = $feedback_true_list[$i][2];
} else {
$comment = $feedback_false_list[$i][2];
}
/*
if ($id == 1) {
$comment = $feedback_true_list[$i][2];
} elseif ($id == 2) {
$comment = $feedback_false_list[$i][2];
}
*/
// Create answer
$unique_answer->create_answer($id, $question_id, ($answer), ($comment), $score, $correct);
$id++;

@ -45,7 +45,7 @@ switch($action) {
case 'document_preview':
$course_info = api_get_course_info_by_id($_REQUEST['course_id']);
if (!empty($course_info) && is_array($course_info)) {
echo DocumentManager::get_document_preview($course_info, false, '_blank', $_REQUEST['session_id']);
echo DocumentManager::get_document_preview($course_info, false, '_blank', $_REQUEST['sessid']);
}
break;
}

@ -2522,9 +2522,10 @@ class CourseManager {
* Special courses are courses that stick on top of the list and are "auto-registerable"
* in the sense that any user clicking them is registered as a student
* @param int User id
* @param bool Whether to show the document quick-loader or not
* @return void
*/
function display_special_courses ($user_id) {
function display_special_courses ($user_id, $load_dirs = false) {
$user_id = intval($user_id);
$user_info = api_get_user_info($user_id);
@ -2579,12 +2580,32 @@ class CourseManager {
echo '<div class="userportal-course-item">';
if (api_is_platform_admin()) {
echo '<div style="float: right;"><a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), 22).'</a>';
echo '<div style="float:right;">';
if ($load_dirs) {
echo '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="#">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),22).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
echo Display::div('', array('id' => 'document_result_'.$course['id'].'_0', 'class'=>'document_preview_container'));
} else {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
}
if ($course['status'] == COURSEMANAGER) {
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'),array('style'=>'width:11px; height:11px;'));
//echo Display::return_icon('teachers.gif', get_lang('Status').': '.get_lang('Teacher'), array('style'=>'width: 11px; height: 11px;'));
}
echo '</div>';
} else {
echo '<div style="float:right;">';
if ($load_dirs) {
echo '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="#">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),22).'</a>';
echo Display::div('', array('id' => 'document_result_'.$course['id'].'_0', 'class'=>'document_preview_container'));
}
echo '</div>';
}
$course_visibility = $course['visibility'];
if ($course_visibility != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title = '<a href="'.api_get_path(WEB_COURSE_PATH).$course['directory'].'/?id_session=0&amp;autoreg=1">'.$course['title'].'</a>';
@ -2619,6 +2640,7 @@ class CourseManager {
* of course categories, as class userportal-catalog-item.
* @uses display_courses_in_category() to display the courses themselves
* @param int user id
* @param bool Whether to show the document quick-loader or not
* @return void
*/
function display_courses($user_id, $load_dirs = false) {
@ -2657,6 +2679,7 @@ class CourseManager {
* Display courses inside a category (without special courses) as HTML dics of
* class userportal-course-item.
* @param int User category id
* @param bool Whether to show the document quick-loader or not
* @return void
*/
function display_courses_in_category($user_category_id, $load_dirs = false) {
@ -2719,8 +2742,10 @@ class CourseManager {
if ($load_dirs) {
echo '<a id="document_preview_'.$course['id'].'_0" class="document_preview" href="#">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),22).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
echo Display::div('', array('id' => 'document_result_'.$course['id'].'_0', 'class'=>'document_preview_container'));
} else {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),22).'</a>';
}
if ($course['status'] == COURSEMANAGER) {
@ -2844,6 +2869,7 @@ class CourseManager {
* @param integer Session ID
* @param string CSS class to apply to course entry
* @param boolean Whether the session is supposedly accessible now (not in the case it has passed and is in invisible/unaccessible mode)
* @param bool Whether to show the document quick-loader or not
* @return string The HTML to be printed for the course entry
*
* @version 1.0.3

@ -2497,25 +2497,25 @@ return 'application/octet-stream';
}
//condition for the session
if (isset($session_id) && !empty($session_id)) {
$current_session_id = 0;
if (!empty($session_id)) {
$current_session_id = intval($session_id);
} else {
$current_session_id = api_get_session_id();
}
if (!$user_in_course)
if (empty($current_session_id)) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$user_in_course = true;
}
} else {
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
$user_status = SessionManager::get_user_status_in_session($user_id, $course_info['code'], $current_session_id);
if (in_array($user_status, array('0', '6'))) { //user and coach
$user_in_course = true;
}
}
if (!$user_in_course) {
if (empty($current_session_id)) {
if (CourseManager::is_user_subscribed_in_course($user_id, $course_info['code'])) {
$user_in_course = true;
}
} else {
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
$user_status = SessionManager::get_user_status_in_session($user_id, $course_info['code'], $current_session_id);
if (in_array($user_status, array('0', '6'))) { //user and coach
$user_in_course = true;
}
}
}
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT, $course_info['dbName']);
$tbl_item_prop = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_info['dbName']);
@ -2528,18 +2528,16 @@ return 'application/octet-stream';
//$condition_session = " AND (id_session = '$current_session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $tbl_course WHERE code = '".$course_info['code']."' )))";
$condition_session = " AND (id_session = '$current_session_id' OR id_session = '0' )";
$sql_doc = "SELECT last.visibility, docs.*
FROM $tbl_item_prop AS last, $tbl_doc AS docs
WHERE docs.id = last.ref
AND docs.path LIKE '".$path.$added_slash."%'
AND docs.path NOT LIKE '%_DELETED_%'
AND last.tool = '".TOOL_DOCUMENT."' $condition_session
AND last.visibility = '1'
ORDER BY docs.path ASC";
$res_doc = Database::query($sql_doc);
$sql_doc = "SELECT last.visibility, docs.* ".
" FROM $tbl_item_prop AS last, $tbl_doc AS docs ".
" WHERE docs.id = last.ref ".
" AND docs.path LIKE '".$path.$added_slash."%' ".
" AND docs.path NOT LIKE '%_DELETED_%' ".
" AND last.tool = '".TOOL_DOCUMENT."' $condition_session ".
" AND last.visibility = '1' ".
"ORDER BY docs.path ASC";
$res_doc = Database::query($sql_doc);
$resources = Database::store_result($res_doc);
$return = '';
$resources_sorted = array();
@ -2550,13 +2548,14 @@ return 'application/octet-stream';
$return .= Display::url(get_lang('NewDocument'), api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&lp_id='.$_SESSION['oLP']->lp_id);
$return .= '</div>';
} else {
$return .= Display::div(Display::url(Display::return_icon('delete.png', get_lang('Close'), array(), 22), '#', array('id'=>'close_div_'.$course_info['real_id'].'_'.$session_id,'class' =>'close_div')), array('style' => 'position:absolute;right:10px'));
$txt_sessid = (empty($session_id)?'0':(string)$session_id);
$return .= Display::div(Display::url(Display::return_icon('delete.png', get_lang('Close'), array(), 22), '#', array('id'=>'close_div_'.$course_info['real_id'].'_'.$txt_sessid,'class' =>'close_div')), array('style' => 'position:absolute;right:10px'));
}
// If you want to debug it, I advise you to do "echo" on the eval statements.
if (!empty($resources) && $user_in_course) {
foreach ($resources as $resource) {
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $resource['id'], $session_id);
foreach ($resources as $resource) {
$item_info = api_get_item_property_info($course_info['real_id'], 'document', $resource['id'], $current_session_id);
if (empty($item_info)) {
continue;
@ -2569,7 +2568,7 @@ return 'application/octet-stream';
foreach ($resource_paths as $key => $resource_path) {
if (strpos($resource_path, '.') === false && $key != count($resource_paths) - 1) {
// It's a folder.
$path_to_eval .= '["' . $resource_path . '"]["files"]';
$path_to_eval .= "['$resource_path']['files']";
} else
if (strpos($resource_path, '.') !== false)
$is_file = true;
@ -2654,7 +2653,6 @@ return 'application/octet-stream';
$web_code_path = api_get_path(WEB_CODE_PATH);
$return = '';
if (count($resources_sorted) > 0) {
foreach ($resources_sorted as $key => $resource) {
if (isset($resource['id']) && is_int($resource['id'])) {

@ -100,6 +100,9 @@ if (defined('SYSTEM_INSTALLATION')) {
}
}
require_once '../inc/lib/image.lib.php'; //this library has been created
// in 1.8.8, which makes this inclusion retroactively necessary in
// updates from 1.8.5
// Filling the access_url_rel_user table with access_url_id by default = 1
$query = "SELECT user_id FROM $dbNameForm.user";
@ -126,7 +129,7 @@ if (defined('SYSTEM_INSTALLATION')) {
$picture_location = $dir.$user_id.'/'.$file;
$big_picture_location = $dir.$user_id.'/big_'.$file;
$temp = new image($image_repository);
$temp = new Image($image_repository);
$picture_infos = getimagesize($image_repository);

@ -116,42 +116,43 @@ if (defined('SYSTEM_INSTALLATION')) {
}
}
// Converting dates and times to UTC using the default timezone of PHP
// Converting gradebook dates and times
$timezone = date_default_timezone_get();
// Calculating the offset
$dateTimeZoneCurrent = new DateTimeZone($timezone);
$dateTimeUTC = new DateTime("now", new DateTimeZone('UTC'));
$timeOffsetSeconds = $dateTimeZoneCurrent->getOffset($dateTimeUTC);
$timeOffsetHours = $timeOffsetSeconds / 3600;
$timeOffsetString = "";
if($timeOffsetHours < 0) {
$timeOffsetString .= "-";
$timeOffsetHours = abs($timeOffsetHours);
} else {
$timeOffsetString .= "+";
}
if($timeOffsetHours < 10) {
$timeOffsetString .= "0";
if (DATE_TIME_INSTALLED) {
// Converting dates and times to UTC using the default timezone of PHP
// Converting gradebook dates and times
$timezone = date_default_timezone_get();
// Calculating the offset
$dateTimeZoneCurrent = new DateTimeZone($timezone);
$dateTimeUTC = new DateTime("now", new DateTimeZone('UTC'));
$timeOffsetSeconds = $dateTimeZoneCurrent->getOffset($dateTimeUTC);
$timeOffsetHours = $timeOffsetSeconds / 3600;
$timeOffsetString = "";
if($timeOffsetHours < 0) {
$timeOffsetString .= "-";
$timeOffsetHours = abs($timeOffsetHours);
} else {
$timeOffsetString .= "+";
}
if($timeOffsetHours < 10) {
$timeOffsetString .= "0";
}
$timeOffsetString .= "$timeOffsetHours";
$timeOffsetString .= ":00";
// Executing the queries to convert everything
$queries[] = "UPDATE gradebook_certificate SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_evaluation SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_link SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_linkeval_log SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_result SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_result_log SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
foreach ($queries as $query) {
Database::query($query);
}
}
$timeOffsetString .= "$timeOffsetHours";
$timeOffsetString .= ":00";
// Executing the queries to convert everything
$queries[] = "UPDATE gradebook_certificate SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_evaluation SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_link SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_linkeval_log SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_result SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
$queries[] = "UPDATE gradebook_result_log SET created_at = CONVERT_TZ(created_at, '".$timeOffsetString."', '+00:00');";
foreach ($queries as $query) {
Database::query($query);
}
// Moving user followed by a human resource manager from hr_dept_id field to user_rel_user table
$query = "SELECT user_id, hr_dept_id FROM $dbNameForm.user";
$result = Database::query($query);

@ -429,59 +429,27 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$row = Database::fetch_array($sql_result_num);
$count_files = $row[0];
$table_header = array();
$table_has_actions_column = false;
$table_header[] = array(get_lang('Type'), false, 'style="width:40px"');
$table_header[] = array(get_lang('Title'), true);
if ($count_files != 0) {
$table_header[] = array(get_lang('FirstName'), true);
$table_header[] = array(get_lang('LastName'), true);
if ($qualification_exists)
if ($qualification_exists) {
$table_header[] = array(get_lang('Qualification'), true);
}
}
$table_header[] = array(get_lang('Date'), true, 'style="width:160px"');
if ($is_allowed_to_edit) {
$table_header[] = array(get_lang('Actions'), false, 'style="width:90px"');
$table_has_actions_column = true;
}
$table_header[] = array('RealDate', true);
// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
$column_show = array();
$column_show[] = 1; // type
$column_show[] = 1; // title
if ($count_files != 0) {
$column_show[] = 1; // firstname
$column_show[] = 1; // lastname
if ($qualification_exists) {
$column_show[] = 1; // qualification
}
}
// the following column name seems both undefined and unused
//$table_header[] = array('RealDate', true);
$column_show[] = 1; //date
if ($is_allowed_to_edit) {
$column_show[] = 1; // modify
}
$column_show[] = 0; //real date in correct format
// Here we change the way how the colums are going to be sort
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
$column_order = array();
$i=0;
foreach($table_header as $item) {
$column_order[$i] = $i;
$i++;
}
if ($count_files != 0) {
$column_order[2] = 2;
} else {
$column_order[2] = 4;
}
$table_data = array();
$dirs_list = get_subdirs_list($work_dir);
@ -885,10 +853,7 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$qualification_string = '';
$add_string = '';
if ($qualification_exists) {
if ($work->qualification == '') {
$qualification_string = '<b style="color:orange"> - </b>';
@ -909,18 +874,18 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$row[] = $user_info['firstname']; // $work->author;
$row[] = $user_info['lastname'];
if ($qualification_exists)
if ($qualification_exists) {
$row[] = $qualification_string;
}
$work_sent_date_local = api_get_local_time($work->sent_date);
$row[] = date_to_str_ago($work_sent_date_local).$add_string.'<br /><span class="dropbox_date">'.api_format_date($work_sent_date_local).'</span>';
if ($is_allowed_to_edit) {
$action = '';
if ($qualification_exists)
if ($qualification_exists) {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;parent_id='.$work->parent_id.'" title="'.get_lang('Modify').'" >'.
Display::return_icon('rate_work.png', get_lang('CorrectAndRate'),array(), 22).'</a>';
}
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;move='.$work->id.'" title="'.get_lang('Move').'">'.Display::return_icon('move.png', get_lang('Move'),array(), 22).'</a>';
if ($work->accepted == '1') {
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_invisible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Invisible').'" >'.Display::return_icon('visible.png', get_lang('Invisible'),array(), 22).'</a>';
@ -930,7 +895,11 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'" >'.Display::return_icon('delete.png', get_lang('WorkDelete'),'',22).'</a>';
$row[] = $action;
// the user that is not course admin can only edit/delete own document
} elseif ($row2['insert_user_id'] == $_user['user_id']) {
} elseif ($is_author && empty($work->qualification)) {
if (!$table_has_actions_column) {
$table_header[] = array(get_lang('Actions'), false, 'style="width:90px"');
$table_has_actions_column = true;
}
$action = '';
$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_folder_data['id'].'&curdirpath='.urlencode($my_sub_dir).'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'" title="'.get_lang('Modify').'" >'.Display::return_icon('edit.png', get_lang('Modify'),array(), 22).'</a>';
if (api_get_course_setting('student_delete_own_publication') == 1) {
@ -948,6 +917,43 @@ function display_student_publications_list($id, $link_target_parameter, $dateFor
$sorting_options = array();
$sorting_options['column'] = 1;
// Here we change the way how the colums are going to be sorted
// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
$column_order = array();
$i=0;
foreach($table_header as $item) {
$column_order[$i] = $i;
$i++;
}
if ($count_files != 0) {
$column_order[2] = 2;
} else {
$column_order[2] = 4;
}
// An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide
$column_show = array();
$column_show[] = 1; // type
$column_show[] = 1; // title
if ($count_files != 0) {
$column_show[] = 1; // firstname
$column_show[] = 1; // lastname
if ($qualification_exists) {
$column_show[] = 1; // qualification
}
}
$column_show[] = 1; //date
if ($table_has_actions_column) {
$column_show[] = 1; // modify
}
$column_show[] = 0; //real date in correct format
$paging_options = array();
if (isset($_GET['curdirpath'])) {
$my_params = array ('curdirpath' => Security::remove_XSS($_GET['curdirpath']));

@ -282,7 +282,7 @@ if (!empty($_SESSION['toolgroup'])) {
}
if ($_GET['createdir'] == 1) {
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('CreateFolder'));
$interbreadcrumb[] = array ('url' => 'work.php','name' => get_lang('CreateAssignment'));
}
Display :: display_header(null);
} else {
@ -317,7 +317,7 @@ if (!empty($_SESSION['toolgroup'])) {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditToolOptions'));
}
if ($_GET['createdir'] == 1) {
$interbreadcrumb[] = array ('url' => '#','name' => get_lang('CreateDir'));
$interbreadcrumb[] = array ('url' => '#','name' => get_lang('CreateAssignment'));
}
Display :: display_header(null);

@ -91,7 +91,7 @@ define('CONFVAL_dateFormatForInfosFromCourses', get_lang('dateFormatLong'));
define("CONFVAL_limitPreviewTo", SCRIPTVAL_NewEntriesOfTheDayOfLastLogin);
//$load_dirs = api_get_setting('courses_list_document_dynamic_dropdown');
$load_dirs = true;
$load_dirs = false;
// This is the main function to get the course list.
@ -417,7 +417,7 @@ if (is_array($courses_tree)) {
// Sessions and courses that are not in a session category.
if (!isset($_GET['history'])) {
// If we're not in the history view...
CourseManager :: display_special_courses(api_get_user_id());
CourseManager :: display_special_courses(api_get_user_id(), $load_dirs);
CourseManager :: display_courses(api_get_user_id(), $load_dirs);
}
// Independent sessions.

Loading…
Cancel
Save