Feature #1744 - Cleaning logical conditions (2).

skala
Ivan Tcholakov 15 years ago
parent f0c4747bf3
commit 7515a2354b
  1. 4
      main/admin/calendar.lib.php
  2. 4
      main/admin/configure_inscription.php
  3. 2
      main/admin/course_edit.php
  4. 4
      main/admin/course_export.php
  5. 4
      main/admin/course_virtual.php
  6. 18
      main/admin/index.php
  7. 2
      main/admin/ldap_import_students_to_session.php
  8. 4
      main/admin/legal_add.php
  9. 8
      main/admin/settings.lib.php
  10. 2
      main/admin/special_exports.php
  11. 2
      main/admin/user_list.php
  12. 86
      main/announcements/announcements.php
  13. 4
      main/app_share/appshare.php
  14. 4
      main/app_share/index.php
  15. 10
      main/attendance/attendance_add.php
  16. 30
      main/attendance/attendance_calendar.php
  17. 12
      main/attendance/attendance_edit.php
  18. 4
      main/auth/profile.php
  19. 10
      main/calendar/agenda.inc.php
  20. 2
      main/course_info/download.php
  21. 62
      main/course_progress/index.php
  22. 130
      main/coursecopy/classes/CourseRestorer.class.php
  23. 22
      main/coursecopy/classes/CourseSelectForm.class.php
  24. 2
      main/document/create_document.php
  25. 26
      main/document/document.inc.php
  26. 2
      main/document/upload.php
  27. 2
      main/dropbox/dropbox_class.inc.php
  28. 4
      main/dropbox/dropbox_functions.inc.php
  29. 84
      main/exercice/exercice.php
  30. 22
      main/exercice/exercice_submit.php
  31. 60
      main/exercice/exercise.class.php
  32. 8
      main/exercice/exercise.lib.php
  33. 12
      main/exercice/exercise_result.class.php
  34. 16
      main/exercice/exercise_result.php
  35. 28
      main/exercice/exercise_show.php
  36. 4
      main/exercice/exercise_submit_modal.php
  37. 4
      main/exercice/hotpotatoes.php
  38. 4
      main/exercice/qti2.php
  39. 10
      main/exercice/question_admin.inc.php
  40. 2
      main/forum/editpost.php
  41. 44
      main/forum/forumfunction.inc.php
  42. 2
      main/forum/viewforum.php
  43. 22
      main/gradebook/lib/fe/displaygradebook.php
  44. 4
      main/gradebook/lib/flatview_data_generator.class.php

@ -259,11 +259,11 @@ function validate_date()
msg_err1.style.display =\"block\";
msg_err1.innerHTML=\"".get_lang('EndDateCannotBeBeforeTheStartDate')."\";
msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
} else if (checkDate(start_month,start_day,start_year) == false) {
} else if (!checkDate(start_month,start_day,start_year)) {
msg_err2.style.display =\"block\";
msg_err2.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err3.innerHTML=\"\";
} else if (checkDate(ends_month,ends_day,ends_year) == false) {
} else if (!checkDate(ends_month,ends_day,ends_year)) {
msg_err3.style.display =\"block\";
msg_err3.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";

@ -24,11 +24,11 @@ if (get_setting('allow_terms_conditions') == 'true') {
$language = api_get_interface_language();
$language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language);
if ($term_preview == false) {
if (!$term_preview) {
//look for the default language
$language = api_get_setting('platformLanguage');
$language = api_get_language_id($language);
$term_preview= LegalManager::get_last_condition($language);
$term_preview = LegalManager::get_last_condition($language);
}
$tool_name = get_lang('TermsAndConditions');
Display :: display_header('');

@ -294,7 +294,7 @@ if ($form->validate()) {
$forum_config_table = Database::get_course_table(TOOL_FORUM_CONFIG_TABLE,$course_db_name);
$sql = "UPDATE ".$forum_config_table." SET default_lang='".Database::escape_string($course_language)."'";
if ($visual_code_is_used == true) {
if ($visual_code_is_used) {
header('Location: course_list.php?action=show_msg&warn='.urlencode($warn));
} else {
header('Location: course_list.php');

@ -87,10 +87,10 @@ if (!empty($msg)) {
<br />
<?php if (!empty($course_list)) { ?>
<div>
<input id="all-courses" class="checkbox" type="radio" value="1" name="select_type" <?php if(!$formSent || ($formSent && $select_type == 1)) echo 'checked="checked"'; ?> onclick="if(this.checked==true){document.getElementById('div-course-list').style.display='none';}"/>
<input id="all-courses" class="checkbox" type="radio" value="1" name="select_type" <?php if(!$formSent || ($formSent && $select_type == 1)) echo 'checked="checked"'; ?> onclick="javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"/>
<label for="all-courses"><?php echo get_lang('ExportAllCoursesList')?></label>
<br/>
<input id="select-courses" class="checkbox" type="radio" value="2" name="select_type" <?php if($formSent && $select_type == 2) echo 'checked="checked"'; ?> onclick="if(this.checked==true){document.getElementById('div-course-list').style.display='block';}"/>
<input id="select-courses" class="checkbox" type="radio" value="2" name="select_type" <?php if($formSent && $select_type == 2) echo 'checked="checked"'; ?> onclick="javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"/>
<label for="select-courses"><?php echo get_lang('ExportSelectedCoursesFromCoursesList')?></label>
</div>
<br />

@ -355,7 +355,7 @@ function attempt_create_virtual_course($real_course_code, $course_title, $wanted
$creation_success = CourseManager::create_virtual_course( $real_course_code, $course_title, $wanted_course_code, $course_language, $course_category );
if ($creation_success == true)
if ($creation_success)
{
Display::display_normal_message( $course_title . " - " . get_lang('CourseCreationSucceeded') );
return true;
@ -393,7 +393,7 @@ if ( isset($attempt_create_virtual_course) && $attempt_create_virtual_course )
$creation_success = CourseManager::attempt_create_virtual_course($real_course_code, $course_title, $wanted_course_code, $course_language, $course_category);
if ($creation_success == true)
if ($creation_success)
{
Display::display_normal_message( $course_title . " - " . get_lang('CourseCreationSucceeded') );
}

@ -49,8 +49,8 @@ if(api_is_platform_admin()) {
Display :: display_confirmation_message(get_lang('VersionCheckEnabled'));
}
/*
MAIN SECTION
/*
MAIN SECTION
*/
$keyword_url = Security::remove_XSS((empty($_GET['keyword'])?'':$_GET['keyword']));
}
@ -115,7 +115,7 @@ if(api_is_platform_admin()) {
<button class="search" type="submit"> <?php echo get_lang('Search');?></button>
</form>
</div>
<ul>
<ul>
<li><a href="course_list.php"><?php echo get_lang('CourseList') ?></a></li>
<li><a href="course_add.php"><?php echo get_lang('AddCourse') ?></a></li>
<li><a href="course_export.php"><?php echo get_lang('ExportCourses'); ?></a></li>
@ -155,7 +155,7 @@ if(api_is_platform_admin()) {
<?php } ?>
<?php
if(!empty($_configuration['multiple_access_urls'])) {
if (api_is_global_platform_admin()) {
if (api_is_global_platform_admin()) {
echo '<li><a href="access_urls.php">'.get_lang('ConfigureMultipleAccessURLs').'</a></li>';
}
}
@ -167,7 +167,7 @@ if(api_is_platform_admin()) {
if (api_get_setting('allow_terms_conditions')=='true') {
echo '<li><a href="legal_add.php">'.get_lang('TermsAndConditions').'</a></li>';
}
//@todo Translations needed in order to see a better explanation of issues
echo '<li><a href="system_status.php">'.get_lang('SystemStatus').'</a></li>';
@ -288,7 +288,7 @@ if (api_is_platform_admin()) {
?>
</ul>
</div>
<?php
<?php
}
/**
@ -383,10 +383,10 @@ function check_system_version2()
$number_of_courses = statistics::count_courses();
// the number of users
$number_of_users = statistics::count_users();
$number_of_users = statistics::count_users();
$version_url= 'http://version.chamilo.org/version.php?url='.urlencode(api_get_path(WEB_PATH)).'&campus='.urlencode(api_get_setting('siteName')).'&contact='.urlencode(api_get_setting('emailAdministrator')).'&version='.urlencode($system_version).'&numberofcourses='.urlencode($number_of_courses).'&numberofusers='.urlencode($number_of_users).'&donotlistcampus='.api_get_setting('donotlistcampus').'&organisation='.urlencode(api_get_setting('Institution')).'&adminname='.urlencode(api_get_setting('administratorName').' '.api_get_setting('administratorSurname'));
$handle=@fopen($version_url,'r');
if ($handle !== false) {
$version_info=trim(@fread($handle, 1024));

@ -185,7 +185,7 @@ elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed']=='yes'))
id_user="'.intval($user_id).'",
id_session = "'.intval($id_session).'"';
$res_user = Database::query($sql);
if($res_user != false)
if ($res_user)
{
$num++;
}

@ -70,7 +70,7 @@ if( $form->validate()) {
$language = api_get_language_id($my_lang);
$term_preview = LegalManager::get_last_condition($language);
$defaults = $term_preview;
if ($term_preview==false) {
if (!$term_preview) {
// there are not terms and conditions
$term_preview['type']=-1;
$defaults['type']=0;
@ -87,7 +87,7 @@ if( $form->validate()) {
$language = api_get_language_id($language);
$term_preview = LegalManager::get_last_condition($language);
$defaults['type']=$term_preview['type'];
if ($term_preview==false) {
if (!$term_preview) {
// there are not terms and conditions
$term_preview['type']=-1;
$defaults['type']=0;

@ -377,7 +377,7 @@ function upload_stylesheet($values,$picture)
$single_directory = false;
}
}
if($valid == false) {
if (!$valid) {
$error_string = '<ul>';
foreach($invalid_files as $invalid_file) {
$error_string .= '<li>'.$invalid_file.'</li>';
@ -386,7 +386,7 @@ function upload_stylesheet($values,$picture)
Display::display_error_message(get_lang('ErrorStylesheetFilesExtensionsInsideZip').$error_string, false);
} else {
// If the zip does not contain a single directory, extract it
if($single_directory == false) {
if (!$single_directory) {
// Extract zip file
$zip->extractTo(api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/');
} else {
@ -396,7 +396,7 @@ function upload_stylesheet($values,$picture)
if ( substr($entry, -1) == '/') continue;
$pos_slash = strpos($entry, '/');
$entry_without_first_dir = substr($entry, $pos_slash + 1);
$entry_without_first_dir = substr($entry, $pos_slash + 1);
// If there is still a slash, we need to make sure the directories are created
if(strpos($entry_without_first_dir, '/') !== false) {
if(!is_dir($extraction_path.dirname($entry_without_first_dir))) {
@ -424,7 +424,7 @@ function upload_stylesheet($values,$picture)
}
} else {
// Simply move the file
move_uploaded_file($picture['tmp_name'], api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/'.$picture['name']);
move_uploaded_file($picture['tmp_name'], api_get_path(SYS_CODE_PATH).'css/'.$style_name.'/'.$picture['name']);
}
}

@ -123,7 +123,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
<?php
}
if($export == true && $name != false) {
if ($export && $name) {
Display::display_confirmation_message(get_lang('BackupCreated').'<br /><br /><a class="bottom-link" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.urlencode($name).'&session=true">'.$name.'</a>', false);
echo '<p><a class="bottom-link" href="'.api_get_path(WEB_CODE_PATH).'admin/index.php">&nbsp;'.get_lang('MainMenu').'</a></p>';
} else{

@ -601,7 +601,7 @@ function modify_filter($user_id,$url_params,$row)
$result .= Display::return_icon('edit_na.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
}
if ($row[0]<>$_user['user_id'] && $user_is_anonymous == false) {
if ($row[0] != $_user['user_id'] && !$user_is_anonymous) {
// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
$result .= '<a href="user_list.php?action=delete_user&amp;user_id='.$user_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';

@ -4,7 +4,7 @@
* @author Frederik Vermeire <frederik.vermeire@pandora.be>, UGent Internship
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: code cleaning
* @author Julio Montoya <gugli100@gmail.com>, MORE code cleaning
*
*
* @abstract The task of the internship was to integrate the 'send messages to specific users' with the
* Announcements tool and also add the resource linker here. The database also needed refactoring
* as there was no title field (the title was merged into the content field)
@ -75,11 +75,11 @@ require_once $lib.'fileUpload.lib.php';
require_once 'announcements.inc.php';
/*
Resource linker
Resource linker
$_SESSION['source_type']="Ad_Valvas";
require_once '../resourcelinker/resourcelinker.inc.php';
if (!empty($_POST['addresources'])) {
// When the "Add Resource" button is clicked we store all the form data into a session
// When the "Add Resource" button is clicked we store all the form data into a session
$form_elements= array ('emailTitle'=>Security::remove_XSS($emailTitle), 'newContent'=>Security::remove_XSS($newContent), 'id'=>$id, 'to'=>$selectedform, 'emailoption'=>$email_ann);
$_SESSION['formelements']=$form_elements;
if($id) {
@ -221,7 +221,7 @@ if(!empty($_REQUEST['publish_survey'])) {
$surveyid=intval($_REQUEST['publish_survey']);
}
//@todo fix those request values
//@todo fix those request values
$cidReq = Database::escape_string($_REQUEST['cidReq']);
if($surveyid) {
$db_name=Database::escape_string($_REQUEST['db_name']);
@ -310,7 +310,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $id)) {
// tooledit : visibility = 2 : only visibile for platform administrator
if ($ctok == $_GET['sec_token']) {
if ($ctok == $_GET['sec_token']) {
AnnouncementManager::delete_announcement($_course, $id);
//delete_added_resource("Ad_Valvas", $delete);
@ -326,7 +326,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
Delete all announcements
*/
if (!empty($_GET['action']) and $_GET['action']=='delete_all') {
if (api_is_allowed_to_edit()) {
if (api_is_allowed_to_edit()) {
AnnouncementManager::delete_all_announcements($_course);
$id = null;
$emailTitle = null;
@ -379,7 +379,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
/*
Move announcement up/down
*/
if ($ctok == $_GET['sec_token']) {
if (!empty($_GET['down'])) {
$thisAnnouncementId = intval($_GET['down']);
@ -409,7 +409,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
// STEP 2 : FOUND THE NEXT ANNOUNCEMENT ID AND ORDER.
// COMMIT ORDER SWAP ON THE DB
if (isset ($thisAnnouncementOrderFound) && $thisAnnouncementOrderFound == true) {
if ($thisAnnouncementOrderFound) {
$nextAnnouncementId = $announcementId;
$nextAnnouncementOrder = $announcementOrder;
Database::query("UPDATE $tbl_announcement " .
@ -478,7 +478,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
if (!empty($_SESSION['toolgroup'])) {
$insert_id = AnnouncementManager::add_group_announcement($safe_emailTitle,$safe_newContent,$order,array('GROUP:'.$_SESSION['toolgroup']),$_POST['selectedform'],$file,$file_comment);
} else {
$insert_id = AnnouncementManager::add_announcement($safe_emailTitle, $safe_newContent, $order, $_POST['selectedform'], $file, $file_comment);
}
//store_resources($_SESSION['source_type'],$insert_id);
@ -488,7 +488,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
/* MAIL WHEN USER COMES FROM SURVEY */
/*
if ($_POST['emailsAdd']) {
if ($_POST['emailsAdd']) {
$to_email_address =$_POST['emailsAdd'];
$to_email_to = explode(',', $to_email_address);
$to_email = array_unique($to_email_to);
@ -593,12 +593,12 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
if ($sqlmail != '') {
$rs_mail = Database::query($sqlmail);
/* Send email one by one to avoid antispam */
$db_name = Database::get_course_table(TABLE_MAIN_SURVEY);
while ($myrow = Database::fetch_array($rs_mail)) {
$emailSubject = "[" . $_course['official_code'] . "] " . $emailTitle;
/* if ($surveyid) {
@ -611,10 +611,10 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
$message=stripslashes($newContentsix);
$sender_name = api_get_person_name($_SESSION['_user']['lastName'], $_SESSION['_user']['firstName'], null, PERSON_NAME_EMAIL_ADDRESS);
$email = $_SESSION['_user']['mail'];
$headers="From:$sender_name\r\nReply-to: $email";
$headers="From:$sender_name\r\nReply-to: $email";
@api_mail('',$myrow["email"],stripslashes($emailTitle),$message,$sender_name,$email);
} else {*/
// intro of the email: receiver name and subject
$mail_body = api_get_person_name($myrow["lastname"], $myrow["firstname"], null, PERSON_NAME_EMAIL_ADDRESS)."<br />\n".stripslashes($emailTitle)."<br />";
@ -652,7 +652,7 @@ if (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_ed
$end_date=$obj_date->avail_till;
$table_reminder = Database :: get_main_table(TABLE_MAIN_SURVEY_REMINDER); // TODO: To be checked. TABLE_MAIN_SURVEY_REMINDER has not been defined.
*/
if ($_REQUEST['reminder']=="1") {
$time=getdate();
$time = $time['yday'];
@ -730,13 +730,13 @@ $condition_session = api_get_session_condition($session_id);
if(api_is_allowed_to_edit(false,true)) {
// check teacher status
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
if (api_get_group_id() == 0) {
$group_condition = "";
} else {
$group_condition = "AND (ip.to_group_id='".api_get_group_id()."' OR ip.to_group_id = 0)";
}
$sql="SELECT
announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
FROM $tbl_announcement announcement, $tbl_item_property ip
@ -756,12 +756,12 @@ if(api_is_allowed_to_edit(false,true)) {
$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
if (api_get_group_id() == 0) {
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ( ip.to_user_id='".$_user['user_id']."'" .
"OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))) ";
} else {
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
OR ip.to_group_id IN (0, ".api_get_group_id()."))";
}
} else {
@ -773,7 +773,7 @@ if(api_is_allowed_to_edit(false,true)) {
"OR ip.to_group_id IN (0, ".api_get_group_id().")) ";
}
}
// the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
if (is_array($group_memberships) && count($group_memberships)>0) {
$sql="SELECT
@ -854,7 +854,7 @@ $announcement_number = Database::num_rows($result);
if (api_get_group_id() == 0 ) {
if (!$show_actions)
echo '<div class="actions">';
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete_all\" onclick=\"javascript:if(!confirm('".get_lang("ConfirmYourChoice")."')) return false;\">".Display::return_icon('valvesdelete.gif',get_lang('AnnouncementDeleteAll')).get_lang('AnnouncementDeleteAll')."</a>\n"; } // if announcementNumber > 1
echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=delete_all\" onclick=\"javascript:if(!confirm('".get_lang("ConfirmYourChoice")."')) return false;\">".Display::return_icon('valvesdelete.gif',get_lang('AnnouncementDeleteAll')).get_lang('AnnouncementDeleteAll')."</a>\n"; } // if announcementNumber > 1
}
if ($show_actions)
echo '</div>';
@ -870,7 +870,7 @@ if (empty($_GET['origin']) OR $_GET['origin'] !== 'learnpath') {
ANNOUNCEMENTS LIST
*/
//if (!$surveyid) {
if ($display_title_list == true) {
if ($display_title_list) {
echo "<table>";
while ($myrow = Database::fetch_array($result)) {
$title = $myrow['title'];
@ -889,7 +889,7 @@ if (empty($_GET['origin']) OR $_GET['origin'] !== 'learnpath') {
echo "</td></tr>";
}
echo "</table>";
} // end $display_title_list == true
} // end $display_title_list
//}
if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
@ -903,7 +903,7 @@ if (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath') {
DISPLAY ACTION MESSAGE
*/
if (isset($message) && $message == true) {
if ($message) {
Display::display_confirmation_message($message);
$display_announcement_list = true;
$display_form = false;
@ -918,7 +918,7 @@ if (!empty($error_message)) {
DISPLAY FORM
*/
if ($display_form == true) {
if ($display_form) {
$content_to_modify = stripslashes($content_to_modify);
$title_to_modify = stripslashes($title_to_modify);
@ -968,7 +968,7 @@ if ($display_form == true) {
// when we want to remind the users who have never been active then we have a different subject and content for the announcement
if ($_GET['since'] == 'never') {
$title_to_modify = sprintf(get_lang('RemindInactiveLearnersMailSubject'), api_get_setting('siteName'));
$content_to_modify = get_lang('YourAccountIsActiveYouCanLoginAndCheckYourCourses');
$content_to_modify = get_lang('YourAccountIsActiveYouCanLoginAndCheckYourCourses');
}
} else {
echo get_lang('Everybody');
@ -1117,26 +1117,26 @@ if ($display_form == true) {
if ($display_announcement_list && !$surveyid) {
// by default we use the id of the current user. The course administrator can see the announcement of other users by using the user / group filter
//$user_id=$_user['user_id'];
//$user_id=$_user['user_id'];
if (isset($_SESSION['user'])) {
//$user_id=$_SESSION['user'];
}
$user_id = api_get_user_id();
if (isset($_SESSION['group'])) {
//$group_id=$_SESSION['group'];
}
$group_id = api_get_group_id();
//$group_memberships=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
$group_memberships = GroupManager::get_group_ids($_course['dbName'],api_get_user_id());
if (api_is_allowed_to_edit(false,true)) {
// A.1. you are a course admin with a USER filter
// => see only the messages of this specific user + the messages of the group (s)he is member of.
if (!empty($_SESSION['user'])) {
if (is_array($group_memberships) && count($group_memberships)>0) {
$sql="SELECT
announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
@ -1159,7 +1159,7 @@ if ($display_announcement_list && !$surveyid) {
ORDER BY display_order DESC";
}
} elseif (api_get_group_id() !=0 ) {
} elseif (api_get_group_id() !=0 ) {
// A.2. you are a course admin with a GROUP filter
// => see only the messages of this specific group
$sql="SELECT
@ -1204,25 +1204,25 @@ if ($display_announcement_list && !$surveyid) {
} else {
//STUDENT
if (is_array($group_memberships) && count($group_memberships)>0) {
if ((api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous())) {
if (api_get_group_id() == 0) {
//No group
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR ( ip.to_user_id='".$_user['user_id']."'" .
"OR ip.to_group_id IN (0, ".implode(", ", $group_memberships)."))) ";
} else {
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."'
OR ip.to_group_id IN (0, ".api_get_group_id()."))";
}
}
//$cond_user_id = " AND (ip.lastedit_user_id = '".api_get_user_id()."' OR (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )) ";
} else {
if (api_get_group_id() == 0) {
$cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ";
} else {
$cond_user_id = " AND (ip.to_user_id=$user_id OR ip.to_group_id IN (0, ".api_get_group_id()."))";
}
}
}
$sql="SELECT
@ -1234,7 +1234,7 @@ if ($display_announcement_list && !$surveyid) {
$condition_session
AND ip.visibility='1'
ORDER BY display_order DESC";
} else {
if ($_user['user_id']) {
@ -1276,7 +1276,7 @@ if ($display_announcement_list && !$surveyid) {
}
}
$result = Database::query($sql);
$num_rows = Database::num_rows($result);
@ -1342,10 +1342,10 @@ if ($display_announcement_list && !$surveyid) {
echo "<th>".Security::remove_XSS($title)."</th>";
echo "<th>" . get_lang("SentTo") . " : &nbsp; ";
$sent_to = AnnouncementManager::sent_to('announcement', $myrow['id']);
$sent_to = AnnouncementManager::sent_to('announcement', $myrow['id']);
$sent_to_form = AnnouncementManager::sent_to_form($sent_to);
$user_info = api_get_user_info($myrow['insert_user_id']);
echo '&nbsp;&nbsp;&nbsp;'.get_lang('By').' : &nbsp;'.str_replace(' ', '&nbsp;', api_get_person_name($user_info['firstName'], $user_info['lastName']));
echo "</th></tr>";
echo "<tr class='row_odd'><td class=\"announcements_datum\" colspan=\"3\">";

@ -22,12 +22,12 @@ $app_base_file = api_get_path(SYS_CODE_PATH).'app_share/DokeosAppShare.exe';
$app_share_app_file = $app_share_tmp_dir.'/DokeosAppShare.exe';
$specialCode='';
if (file_exists($app_share_app_file) == FALSE) {
if (!file_exists($app_share_app_file)) {
//mkdir ($app_share_tmp_dir, 0700);
mkdir ($app_share_tmp_dir, api_get_permissions_for_new_directories());
if (file_exists($app_base_file) == FALSE) {
if (!file_exists($app_base_file)) {
echo('FATAL ERROR: file <strong>'.$app_base_file.'</strong> not found.<br />');
} else {
$source = fopen($app_base_file, "r");

@ -22,12 +22,12 @@ $app_base_file = api_get_path(SYS_CODE_PATH).'app_share/DokeosAppShare.exe';
$app_share_app_file = $app_share_tmp_dir.'/DokeosAppShare.exe';
$specialCode='';
if (file_exists($app_share_app_file) == FALSE) {
if (!file_exists($app_share_app_file)) {
//mkdir ($app_share_tmp_dir, 0700);
mkdir ($app_share_tmp_dir, api_get_permissions_for_new_directories());
if (file_exists($app_base_file) == FALSE) {
if (!file_exists($app_base_file)) {
echo('FATAL ERROR: file <strong>'.$app_base_file.'</strong> not found.<br />');
} else {
$source = fopen($app_base_file, "r");

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for adding a attendance
* View (MVC patter) for adding a attendance
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.attendance
*/
@ -11,8 +11,8 @@
api_protect_course_script(true);
// error messages
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
}
$param_gradebook = '';
@ -38,11 +38,11 @@ $form->addElement('html', '<div class="formw"><br /><a href="javascript://" clas
$form->addElement('html','<div id="id_qualify" style="display:none">');
// Qualify Attendance for gradebook option
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form -> addElement('html','<div id="options_field" style="display:none">');
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('attendance_qualify_title', 'html_filter');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->applyFilter('attendance_weight', 'html_filter');
$form->addElement('html','</div>');

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for attendance calendar (list, edit, add)
* View (MVC patter) for attendance calendar (list, edit, add)
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.attendance
*/
@ -20,7 +20,7 @@ if ($action == 'calendar_add') {
echo '<a href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_up.gif',get_lang('AttendanceCalendarList')).' '.get_lang('GoToAttendanceCalendarList').'</a>';
} else {
echo '<a href="index.php?'.api_get_cidreq().'&action=calendar_add&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_add.png',get_lang('AddDateAndTime')).' '.get_lang('AddDateAndTime').'</a>';
echo '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDeleteAllDates').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=calendar_all_delete&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_delete.png',get_lang('CleanCalendar')).' '.get_lang('CleanCalendar').'</a>';
echo '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDeleteAllDates').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=calendar_all_delete&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('calendar_delete.png',get_lang('CleanCalendar')).' '.get_lang('CleanCalendar').'</a>';
}
echo '</div>';
@ -53,7 +53,7 @@ if (isset($action) && $action == 'calendar_add') {
$form->addElement('html','<br /><br />');
$form->addElement('html', '<div id="repeat_check">&nbsp;'. get_lang('RepeatDate').'<input type="checkbox" name="repeat" '.($repeat?'checked="checked"':'').' onclick="if(this.checked==true){document.getElementById(\'repeat-date-attendance\').style.display=\'block\';}else{document.getElementById(\'repeat-date-attendance\').style.display=\'none\';}"/>');
$form->addElement('html', '<div id="repeat_check">&nbsp;'. get_lang('RepeatDate').'<input type="checkbox" name="repeat" '.($repeat?'checked="checked"':'').' onclick="javascript: if(this.checked){document.getElementById(\'repeat-date-attendance\').style.display=\'block\';}else{document.getElementById(\'repeat-date-attendance\').style.display=\'none\';}"/>');
if ($repeat) {
$form->addElement('html', '<div id="repeat-date-attendance" style="display:block">');
} else {
@ -70,8 +70,8 @@ if (isset($action) && $action == 'calendar_add') {
$defaults['end_date_time'] = date('Y-m-d 12:00:00');
$form->addElement('html', '</td></tr>');
$form->addElement('html', '</table>');
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
$form->addElement('html','<br /><br />');
@ -85,32 +85,32 @@ if (isset($action) && $action == 'calendar_add') {
// calendar list
echo '<div class="attendance-calendar-list">';
echo '<h4>'.get_lang('CalendarList').'</h4>';
if (!empty($attendance_calendar)) {
foreach ($attendance_calendar as $calendar) {
echo '<div class="attendance-calendar-row">';
if (!empty($attendance_calendar)) {
foreach ($attendance_calendar as $calendar) {
echo '<div class="attendance-calendar-row">';
if ((isset($action) && $action == 'calendar_edit') && (isset($calendar_id) && $calendar_id == $calendar['id'])) {
// calendar edit form
echo '<div class="attendance-calendar-edit">';
$form = new FormValidator('attendance_calendar_edit','POST','index.php?action=calendar_edit&attendance_id='.$attendance_id.'&calendar_id='.$calendar_id.'&'.api_get_cidreq().$param_gradebook,'');
// calendar edit form
echo '<div class="attendance-calendar-edit">';
$form = new FormValidator('attendance_calendar_edit','POST','index.php?action=calendar_edit&attendance_id='.$attendance_id.'&calendar_id='.$calendar_id.'&'.api_get_cidreq().$param_gradebook,'');
$form->addElement('datepicker', 'date_time', '', array('form_name'=>'attendance_calendar_edit'));
$defaults['date_time'] = $calendar['date_time'];
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
$form->addElement('style_submit_button', 'cancel', get_lang('Cancel'), 'class="cancel"');
$form->setDefaults($defaults);
$form->display();
echo '</div>';
echo '</div>';
} else {
echo Display::return_icon('lp_calendar_event.png',get_lang('DateTime')).' '.$calendar['date_time'].'&nbsp;';
echo '<span style="margin-left:20px;">';
echo '<a href="index.php?'.api_get_cidreq().'&action=calendar_edit&calendar_id='.intval($calendar['id']).'&attendance_id='.$attendance_id.$param_gradebook.'">'.Display::return_icon('edit.gif', get_lang('Edit'), array('style'=>'vertical-align:middle')).'</a>&nbsp;';
echo '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().$param_gradebook.'&action=calendar_delete&calendar_id='.intval($calendar['id']).'&attendance_id='.$attendance_id.'">'.Display::return_icon('delete.gif', get_lang('Delete'), array('style'=>'vertical-align:middle')).'</a>';
echo '</span>';
}
echo '</span>';
}
echo '</div>';
}
} else {
echo '<div style="padding:5px;">'.get_lang('ThereAreNoRegisteredDatetimeYet').'</div>';
}
echo '</div>';
echo '</div>';
}
?>

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for editing an attendance
* View (MVC patter) for editing an attendance
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.attendance
*/
@ -12,8 +12,8 @@
api_protect_course_script(true);
// error messages
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
}
$param_gradebook = '';
@ -41,17 +41,17 @@ $form->addElement('html', '<div class="row"><div class="label"></div>');
if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
$form->addElement('html', '<div class="formw"><br /><a href="javascript://" class="advanced_parameters"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a></div></div>');
$form->addElement('html','<div id="id_qualify" style="display:block">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),array('checked'=>'true','onclick'=>'javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
$form -> addElement('html','<div id="options_field" style="display:block">');
} else {
$form->addElement('html', '<div class="formw"><br /><a href="javascript://" class="advanced_parameters"><span id="img_plus_and_minus">&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedParameters').'</span></a></div></div>');
$form->addElement('html','<div id="id_qualify" style="display:none">');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form -> addElement('html','<div id="options_field" style="display:none">');
}
$form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('attendance_qualify_title', 'html_filter');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"');
$form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->applyFilter('attendance_weight', 'html_filter');
$form->addElement('html','</div>');

@ -578,7 +578,7 @@ if (!empty($_SESSION['change_email'])) {
}
$form->removeElement('productions_list');
$file_deleted = true;
}
}
if ($form->validate()) {
@ -601,7 +601,7 @@ if ($form->validate()) {
$_SESSION['is_not_password'] = 'success';
}
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && ($wrong_current_password==false)) {
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) {
$changeemail = $user_data['email'];
}

@ -476,7 +476,7 @@ function display_monthcalendar($month, $year) {
}
}
//Do not show links with no content
if ($some_content == false) {
if (!$some_content) {
$dayheader = $curday;
}
@ -684,11 +684,11 @@ function selectAll(cbList,bSelect,showwarning)
msg_err1.style.display =\"block\";
msg_err1.innerHTML=\"".get_lang('EndDateCannotBeBeforeTheStartDate')."\";
msg_err2.innerHTML=\"\";msg_err3.innerHTML=\"\";
} else if (checkDate(start_month,start_day,start_year) == false) {
} else if (!checkDate(start_month,start_day,start_year)) {
msg_err2.style.display =\"block\";
msg_err2.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err3.innerHTML=\"\";
} else if (checkDate(ends_month,ends_day,ends_year) == false) {
} else if (!checkDate(ends_month,ends_day,ends_year)) {
msg_err3.style.display =\"block\";
msg_err3.innerHTML=\"".get_lang('InvalidDate')."\";
msg_err1.innerHTML=\"\";msg_err2.innerHTML=\"\";
@ -4629,12 +4629,12 @@ function agenda_import_ical($course_info,$file) {
$ts = $ve->getProperty('dtend');
if ($ts != false) {
if ($ts) {
$end_date_string = $ts['year'].'-'.$ts['month'].'-'.$ts['day'].' '.$ts['hour'].':'.$ts['min'].':'.$ts['sec'];
} else {
//Check duration if dtend does not exist
$duration = $ve->getProperty('duration');
if ($duration != false) {
if ($duration) {
$duration = $ve->getProperty('duration');
$duration_string = $duration['year'].'-'.$duration['month'].'-'.$duration['day'].' '.$duration['hour'].':'.$duration['min'].':'.$duration['sec'];
$start_date_tms = mktime(intval($start_date['hour']), intval($start_date['min']), intval($start_date['sec']), intval($start_date['month']), intval($start_date['day']), intval($start_date['year']));

@ -6,7 +6,7 @@ $this_section = SECTION_COURSES;
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
if (isset($_GET['session']) && $_GET['session'] == true) {
if ($_GET['session']) {
$archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
$_cid = true;
$is_courseAdmin = true;

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_progress
*/
@ -10,7 +10,7 @@
// name of the language file that needs to be included
$language_file = array ('course_description', 'pedaSuggest', 'userInfo', 'admin');
// including files
// including files
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
@ -34,8 +34,8 @@ api_protect_course_script(true);
define('ADD_THEMATIC_PLAN', 6);
// get actions
$actions = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_delete', 'moveup', 'movedown',
'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete',
$actions = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_delete', 'moveup', 'movedown',
'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete',
'thematic_advance_list', 'thematic_advance_add', 'thematic_advance_edit', 'thematic_advance_delete');
$action = 'thematic_details';
@ -83,7 +83,7 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jqu
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">';
$htmlHeadXtra[] = '<script language="javascript">
function datetime_by_attendance(selected_value) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
@ -96,7 +96,7 @@ $htmlHeadXtra[] = '<script language="javascript">
}
});
}
function update_done_thematic_advance(selected_value) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
@ -108,42 +108,42 @@ $htmlHeadXtra[] = '<script language="javascript">
$("#div_result").html(datos);
}
});
// clean all radios
for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;
$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});
var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;
$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});
}
// set background to previous radios
// set background to previous radios
for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;
var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;
$("#td_"+id_radio_thematic).css({"background-color":"#E5EDF9"});
if ($("input[@name=\'done_thematic\']").get(i).value == selected_value) {
break;
}
}
}
}
function check_per_attendance(obj) {
if (obj.checked == true) {
function check_per_attendance(obj) {
if (obj.checked) {
document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
document.getElementById(\'div_custom_datetime\').style.display=\'none\';
} else {
document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
document.getElementById(\'div_custom_datetime\').style.display=\'block\';
}
}
}
function check_per_custom_date(obj) {
if (obj.checked == true) {
if (obj.checked) {
document.getElementById(\'div_custom_datetime\').style.display=\'block\';
document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
} else {
document.getElementById(\'div_custom_datetime\').style.display=\'none\';
document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
}
}
}
</script>';
@ -159,26 +159,26 @@ if ($action == 'thematic_list') {
}
if ($action == 'thematic_add') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
}
if ($action == 'thematic_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
}
if ($action == 'thematic_details') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));
}
if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));
if ($description_type >= ADD_THEMATIC_PLAN) {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
} else {
$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);
}
}
if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') {
@ -192,10 +192,10 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
}
// distpacher actions to controller
switch ($action) {
switch ($action) {
case 'thematic_add' :
case 'thematic_edit' :
case 'thematic_delete' :
case 'thematic_delete' :
case 'thematic_delete_select' :
case 'thematic_details' :
case 'moveup' :
@ -204,7 +204,7 @@ switch ($action) {
break;
case 'thematic_plan_list' :
case 'thematic_plan_add' :
case 'thematic_plan_edit' :
case 'thematic_plan_edit' :
case 'thematic_plan_delete' : $thematic_controller->thematic_plan($action);
break;
case 'thematic_advance_list' :

@ -57,7 +57,7 @@ class CourseRestorer
{
$this->file_option = $option;
}
/**
* Restore a course.
* @param string $destination_course_code The code of the Dokeos-course in
@ -95,7 +95,7 @@ class CourseRestorer
$this->course->to_system_encoding();
if (!empty($session_id)) {
$this->restore_documents($session_id, $destination_course_code);
$this->restore_quizzes($session_id);
$this->restore_glossary($session_id);
@ -184,25 +184,25 @@ class CourseRestorer
* Restore documents
*/
function restore_documents($session_id = 0, $destination_course_code = '') {
$perm = api_get_permissions_for_new_directories();
if ($this->course->has_resources(RESOURCE_DOCUMENT)) {
$table = Database :: get_course_table(TABLE_DOCUMENT, $this->course->destination_db);
$resources = $this->course->resources;
$destination_course['dbName']= $this->course->destination_db;
foreach ($resources[RESOURCE_DOCUMENT] as $id => $document) {
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
$dirs = explode('/', dirname($document->path));
//if (count($dirs)==1) {
if ($document->file_type==FOLDER) {
$visibility = $document->item_properties[0]['visibility'];
$new = substr($document->path, 8);
if (!is_dir($path.'document/'.$new)) {
$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document',$new,basename($new),$visibility);
}
@ -237,10 +237,10 @@ class CourseRestorer
echo 'filetype:'.$document->file_type ;
echo '<br>';
*/
if ($document->file_type == DOCUMENT) {
if (file_exists($path.$document->path)) {
if ($document->file_type == DOCUMENT) {
if (file_exists($path.$document->path)) {
switch ($this->file_option) {
case FILE_OVERWRITE :
$origin_path = $this->course->backup_path.'/'.$document->path;
@ -261,7 +261,7 @@ class CourseRestorer
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
break;
case FILE_RENAME :
$i = 1;
$ext = explode('.', basename($document->path));
if (count($ext) > 1) {
@ -287,7 +287,7 @@ class CourseRestorer
$course_path = $path; // "/var/www/wiener/courses/"
$orig_base_folder = $document_path[1];
$orig_base_path = $course_path.$document_path[0].'/'.$document_path[1];
if (is_dir($orig_base_path)) {
$new_base_foldername = $orig_base_folder; // e.g: "carpeta1"
@ -350,10 +350,10 @@ class CourseRestorer
break;
} // end switch
} else { // end if file exists
} else { // end if file exists
//make sure the source file actually exists
if(is_file($this->course->backup_path.'/'.$document->path) && is_readable($this->course->backup_path.'/'.$document->path) && is_dir(dirname($path.$document->path)) && is_writeable(dirname($path.$document->path))) {
copy($this->course->backup_path.'/'.$document->path, $path.$document->path);
$sql = "INSERT INTO ".$table." SET path = '/".substr($document->path, 9)."', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."'";
Database::query($sql);
@ -371,7 +371,7 @@ class CourseRestorer
}
} // end file doesn't exist
} else {
/*$sql = "SELECT id FROM ".$table." WHERE path = '/".Database::escape_string(substr($document->path, 9))."'";
$res = Database::query($sql);
if( Database::num_rows($res)> 0)
@ -401,10 +401,10 @@ class CourseRestorer
function restore_scorm_documents()
{
$perm = api_get_permissions_for_new_directories();
if ($this->course->has_resources(RESOURCE_SCORM)) {
$resources = $this->course->resources;
foreach ($resources[RESOURCE_SCORM] as $id => $document) {
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
@ -712,42 +712,42 @@ class CourseRestorer
Database::query($sql);
$new_event_id = Database::insert_id();
$this->course->resources[RESOURCE_EVENT][$id]->destination_id = $new_event_id;
//copy event attachment
$origin_path = $this->course->backup_path.'/upload/calendar/';
$origin_path = $this->course->backup_path.'/upload/calendar/';
$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/calendar/';
if (!empty($this->course->orig)) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT, $this->course->orig);
$sql = 'SELECT path, comment, size, filename FROM '.$table_attachment.' WHERE agenda_id = '.$id;
$attachment_event = Database::query($sql);
$attachment_event = Database::fetch_object($attachment_event);
if (file_exists($origin_path.$attachment_event->path) && !is_dir($origin_path.$attachment_event->path) ) {
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$copy_result = copy($origin_path.$attachment_event->path, $destination_path.$new_filename);
//$copy_result = true;
if ($copy_result == true) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT, $this->course->destination_db);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT, $this->course->destination_db);
$sql = "INSERT INTO ".$table_attachment." SET path = '".Database::escape_string($new_filename)."', comment = '".Database::escape_string($attachment_event->comment)."', size = '".$attachment_event->size."', filename = '".$attachment_event->filename."' , agenda_id = '".$new_event_id."' ";
Database::query($sql);
}
}
} else {
// get the info of the file
}
}
} else {
// get the info of the file
if(!empty($event->attachment_path) && is_file($origin_path.$event->attachment_path) && is_readable($origin_path.$event->attachment_path)) {
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$copy_result = copy($origin_path.$event->attachment_path, $destination_path.$new_filename);
if ($copy_result == true) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT, $this->course->destination_db);
$copy_result = copy($origin_path.$event->attachment_path, $destination_path.$new_filename);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT, $this->course->destination_db);
$sql = "INSERT INTO ".$table_attachment." SET path = '".Database::escape_string($new_filename)."', comment = '".Database::escape_string($event->attachment_comment)."', size = '".$event->attachment_size."', filename = '".$event->attachment_filename."' , agenda_id = '".$new_event_id."' ";
Database::query($sql);
}
}
}
}
}
}
}
}
}
/**
@ -805,39 +805,39 @@ class CourseRestorer
Database::query($sql);
$new_announcement_id = Database::insert_id();
$this->course->resources[RESOURCE_ANNOUNCEMENT][$id]->destination_id = $new_announcement_id;
$origin_path = $this->course->backup_path.'/upload/announcements/';
$origin_path = $this->course->backup_path.'/upload/announcements/';
$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/announcements/';
//Copy announcement attachment file
//Copy announcement attachment file
if (!empty($this->course->orig)) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT, $this->course->orig);
$sql = 'SELECT path, comment, size, filename FROM '.$table_attachment.' WHERE announcement_id = '.$id;
$attachment_event = Database::query($sql);
$attachment_event = Database::fetch_object($attachment_event);
if (file_exists($origin_path.$attachment_event->path) && !is_dir($origin_path.$attachment_event->path) ) {
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$copy_result = copy($origin_path.$attachment_event->path, $destination_path.$new_filename);
//error_log($destination_path.$new_filename); error_log($copy_result);
//$copy_result = true;
if ($copy_result == true) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT, $this->course->destination_db);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT, $this->course->destination_db);
$sql = "INSERT INTO ".$table_attachment." SET path = '".Database::escape_string($new_filename)."', comment = '".Database::escape_string($attachment_event->comment)."', size = '".$attachment_event->size."', filename = '".$attachment_event->filename."' , announcement_id = '".$new_announcement_id."' ";
Database::query($sql);
}
}
}
} else {
} else {
// get the info of the file
if(!empty($announcement->attachment_path) && is_file($origin_path.$announcement->attachment_path) && is_readable($origin_path.$announcement->attachment_path)) {
$new_filename = uniqid(''); //ass seen in the add_agenda_attachment_file() function in agenda.inc.php
$copy_result = copy($origin_path.$announcement->attachment_path, $destination_path.$new_filename);
if ($copy_result == true) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT, $this->course->destination_db);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT, $this->course->destination_db);
$sql = "INSERT INTO ".$table_attachment." SET path = '".Database::escape_string($new_filename)."', comment = '".Database::escape_string($announcement->attachment_comment)."', size = '".$announcement->attachment_size."', filename = '".$announcement->attachment_filename."' , announcement_id = '".$new_announcement_id."' ";
Database::query($sql);
}
@ -1211,9 +1211,9 @@ class CourseRestorer
$table_tool = Database::get_course_table(TABLE_TOOL_LIST, $this->course->destination_db);
$resources = $this->course->resources;
$origin_path = $this->course->backup_path.'/upload/learning_path/images/';
$origin_path = $this->course->backup_path.'/upload/learning_path/images/';
$destination_path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/upload/learning_path/images/';
foreach ($resources[RESOURCE_LEARNPATH] as $id => $lp) {
@ -1223,19 +1223,19 @@ class CourseRestorer
$session_id = intval($session_id);
$condition_session = " , session_id = '$session_id' ";
}
//Adding the author's image
if (!empty($lp->preview_image)) {
$new_filename = uniqid('').$new_filename.substr($lp->preview_image,strlen($lp->preview_image)-7, strlen($lp->preview_image));
$new_filename = uniqid('').$new_filename.substr($lp->preview_image,strlen($lp->preview_image)-7, strlen($lp->preview_image));
if (file_exists($origin_path.$lp->preview_image) && !is_dir($origin_path.$lp->preview_image)) {
$copy_result = copy($origin_path.$lp->preview_image, $destination_path.$new_filename);
//$copy_result = true;
if ($copy_result === true) {
if ($copy_result) {
$lp->preview_image = $new_filename;
} else {
$lp->preview_image ='';
}
}
}
}
$sql = "INSERT INTO ".$table_main." SET " .
@ -1256,9 +1256,9 @@ class CourseRestorer
"author= '".Database::escape_string($lp->author)."', " .
"preview_image= '".Database::escape_string($lp->preview_image)."', " .
"debug= '".Database::escape_string($lp->debug)."' $condition_session ";
Database::query($sql);
Database::query($sql);
$new_lp_id = Database::insert_id();
if($lp->visibility) {

@ -16,7 +16,7 @@ class CourseSelectForm
* @param array $hidden_fiels Hidden fields to add to the form.
* @param boolean the document array will be serialize. This is used in the course_copy.php file
*/
function display_form($course, $hidden_fields = null, $avoid_serialize=false) {
function display_form($course, $hidden_fields = null, $avoid_serialize=false) {
$resource_titles[RESOURCE_EVENT] = get_lang('Events');
$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements');
$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents');
@ -61,7 +61,7 @@ class CourseSelectForm
if (d.elements[i].type == "checkbox") {
var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
if( name.indexOf('learnpath') > 0){
if(d.elements[i].checked == true){
if(d.elements[i].checked){
setCheckbox('document',true);
alert(message);
break;
@ -92,7 +92,7 @@ class CourseSelectForm
echo '<input type="hidden" name="action" value="course_select_form"/>';
if (!empty($hidden_fields['destination_course']) && !empty($hidden_fields['origin_course']) && !empty($hidden_fields['destination_session']) && !empty($hidden_fields['origin_session']) ) {
echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>';
echo '<input type="hidden" name="destination_course" value="'.$hidden_fields['destination_course'].'"/>';
echo '<input type="hidden" name="origin_course" value="'.$hidden_fields['origin_course'].'"/>';
echo '<input type="hidden" name="destination_session" value="'.$hidden_fields['destination_session'].'"/>';
echo '<input type="hidden" name="origin_session" value="'.$hidden_fields['origin_session'].'"/>';
@ -110,20 +110,20 @@ class CourseSelectForm
case RESOURCE_SURVEYINVITATION:
case RESOURCE_SCORM:
break;
default :
default :
echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript: exp('."'$type'".');" />';
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[$type].'</b><br />';
echo '<div id="div_'.$type.'">';
echo '<blockquote>';
echo "[<a href=\"javascript: void(0);\" onclick=\"javascript: setCheckbox('$type',true);\" >".get_lang('All')."</a> | <a href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('$type',false);\" >".get_lang('None')."</a>]";
echo '<br />';
foreach ($resources as $id => $resource) {
echo '<input type="checkbox" name="resource['.$type.']['.$id.']" id="resource['.$type.']['.$id.']" />';
echo ' <label for="resource['.$type.']['.$id.']">';
$resource->show();
echo '</label>';
echo '<br />';
echo '<br />';
}
echo '</blockquote>';
echo '</div>';
@ -131,7 +131,7 @@ class CourseSelectForm
}
}
}
if ($avoid_serialize) {
//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
// this is a known issue of serialize
@ -141,7 +141,7 @@ class CourseSelectForm
echo '<input type="hidden" name="course" value="'.base64_encode(serialize($course)).'"/>';
if (is_array($hidden_fields)) {
foreach ($hidden_fields as $key => $value) {
foreach ($hidden_fields as $key => $value) {
echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
}
}
@ -200,7 +200,7 @@ class CourseSelectForm
*/
function get_posted_course($from='', $session_id = 0, $course_code = '') {
$course = unserialize(base64_decode($_POST['course']));
//Create the resource DOCUMENT objects
//Loading the results from the checkboxes of the javascript
$resource = $_POST['resource'][RESOURCE_DOCUMENT];
@ -215,7 +215,7 @@ class CourseSelectForm
}
// Searching the documents resource that have been set to null because $avoid_serialize is true in the display_form() function
if ($from == 'copy_course') {
if (is_array($resource)) {
$resource = array_keys($resource);
@ -357,7 +357,7 @@ class CourseSelectForm
if (d.elements[i].type == "checkbox") {
var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
if( name.indexOf('learnpath') > 0){
if(d.elements[i].checked == true){
if(d.elements[i].checked){
setCheckbox('document',true);
alert(message);
break;

@ -75,7 +75,7 @@ function InnerDialogLoaded()
function check_for_title()
{
if(temp==true){
if(temp){
// This functions shows that you can interact directly with the editor area
// DOM. In this way you have the freedom to do anything you want with it.

@ -73,7 +73,7 @@ function build_directory_selector($folders, $curdirpath, $group_dir = '', $chang
$path_parts = explode('/', str_replace($group_dir, '', $folder));
$label = cut($label, 80);
$label = str_repeat('&nbsp;&nbsp;&nbsp;', count($path_parts) - 2).' &mdash; '.$label;
}
}
$parent_select -> addOption($label, $folder);
if ($selected != '') {
$parent_select->setSelected($folder);
@ -114,7 +114,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
// Folder download or file download?
$forcedownload_icon = ($filetype == 'folder') ? 'folder_zip.gif' : 'filesave.gif';
// Prevent multiple clicks on zipped folder download
$prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || clic_$dbl_click_id == false) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"":'';
$prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"":'';
}
$target = '_self';
@ -142,7 +142,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
//$tooltip_title = str_replace('?cidReq='.$_GET['cidReq'], '', basename($path));
$tooltip_title = explode('?', basename($path));
$tooltip_title = $tooltip_title[0];
$tooltip_title_alt = $tooltip_title;
if ($tooltip_title == 'shared_folder') {
$tooltip_title_alt = get_lang('SharedFolder');
@ -160,9 +160,9 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
//filter when I am into shared folder, I can show for donwload only my shared folder
$current_session_id=api_get_session_id();
if(is_shared_folder($_GET['curdirpath'],$current_session_id))
{
{
if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link))|| preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || api_is_allowed_to_edit() || api_is_platform_admin())
{
{
$force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.Display::return_icon($forcedownload_icon, get_lang('Download'), array('height'=>'16', 'width' => '16')).'</a>';
}
}
@ -180,7 +180,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $tooltip_title).Display::return_icon('shared.png', get_lang('ResourceShared'), array('hspace' => '5', 'align' => 'middle', 'height' => 22, 'width' => 22)).'</a>';
}
else
{
{
return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.build_document_icon_tag($filetype, $tooltip_title).'</a>';
}
}
@ -213,7 +213,7 @@ function build_document_icon_tag($type, $path) {
$basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpSharedFolder');
} else {
$basename = get_lang('SharedFolder').' ('.api_get_session_name($current_session_id).')';
}
}
$icon = 'shared_folder.gif';
}elseif(strstr($basename, 'sf_user_')) {
$userinfo = Database::get_user_info_from_id(substr($basename, 8));
@ -224,7 +224,7 @@ function build_document_icon_tag($type, $path) {
} else {
$icon = '../upload/users/'.substr($basename, 8).'/'.$image_path['file'];
}
$basename = get_lang('SharedFolder').' ('.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).')';
} else {
@ -497,7 +497,7 @@ function create_dir_form() {
*/
function is_shared_folder($curdirpath, $current_session_id) {
$clean_curdirpath = Security::remove_XSS($curdirpath);
if($clean_curdirpath== '/shared_folder'){
if($clean_curdirpath== '/shared_folder'){
return true;
}
elseif($clean_curdirpath== '/shared_folder_session_'.$current_session_id){
@ -513,17 +513,17 @@ function is_shared_folder($curdirpath, $current_session_id) {
* @return return bool Return true when user is in any user shared folder
*/
function is_any_user_shared_folder($path, $current_session_id) {
$clean_path = Security::remove_XSS($path);
$clean_path = Security::remove_XSS($path);
if(strpos($clean_path,'shared_folder/sf_user_')){
return true;
}
elseif(strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')){
return true;
}
else{
else{
return false;
}
}
}
}
/**
* Checks whether the user is into his shared folder

@ -51,7 +51,7 @@ $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/java
$htmlHeadXtra[] = '<script type="text/javascript">
function check_unzip() {
if(document.upload.unzip.checked==true){
if(document.upload.unzip.checked){
document.upload.if_exists[0].disabled=true;
document.upload.if_exists[1].checked=true;
document.upload.if_exists[2].disabled=true;

@ -113,7 +113,7 @@ class Dropbox_Work {
WHERE filename = '".Database::escape_string($this->filename)."'";
$result = Database::query($sql);
$res = Database::fetch_array($result);
if ($res != false) {
if ($res) {
$this->isOldWork = true;
}
// Insert or update the dropbox_file table and set the id property

@ -620,9 +620,9 @@ function getUserNameFromId($id) {
FROM " . $dropbox_cnf['tbl_user'] . "
WHERE user_id='$id'";
$result = Database::query($sql);
$res = Database::fetch_array( $result);
$res = Database::fetch_array($result);
if ( $res == false) return false;
if (!$res) return false;
return stripslashes($res['name']);
}

@ -155,12 +155,12 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
} else {
$array_content_id_exe=$post_content_id;
}
for ($i=0;$i<$loop_in_track;$i++) {
$my_marks=Database::escape_string($_POST['marks_'.$array_content_id_exe[$i]]);
$contain_comments=Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
if (isset($contain_comments)) {
@ -176,7 +176,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
$query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks',teacher_comment = '$my_comments'
WHERE question_id = '".$my_questionid."'
AND exe_id='".$id."'";
Database::query($query);
$qry = 'SELECT sum(marks) as tot
@ -339,7 +339,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
@api_mail_html($emailid, $emailid, $subject, $mess, $from_name, $from);
if (in_array($origin, array ('tracking_course','user_course'))) {
if (isset ($_POST['lp_item_id']) && isset ($_POST['lp_item_view_id']) && isset ($_POST['student_id']) && isset ($_POST['total_score']) && isset ($_POST['total_time']) && isset ($_POST['totalWeighting'])) {
$lp_item_id = $_POST['lp_item_id'];
$lp_item_view_id = $_POST['lp_item_view_id'];
@ -347,21 +347,21 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
$totalWeighting = $_POST['totalWeighting'];
if ($lp_item_id == strval(intval($lp_item_id)) && $lp_item_view_id == strval(intval($lp_item_view_id)) && $student_id == strval(intval($student_id))) {
$score = Database :: escape_string($_POST['total_score']); //This is the new note
$total_time = Database :: escape_string($_POST['total_time']);
//I need the lp_item_view_id in order to update the record
//@todo add the lp_item_view_id in the track_exercise table in order to have a real match between the lp_item_view and the track_exercise
//$my_real_lp_item_view_id = Database :: escape_string($_POST['real_lp_item_view_id']);
$lp_item_id = Database :: escape_string($lp_item_id);
$lp_item_view_id = Database :: escape_string($lp_item_view_id);
$student_id = Database :: escape_string($student_id);
$totalWeighting = Database :: escape_string($totalWeighting);
/*
$sql = "SELECT (view_count) FROM $TBL_LP_ITEM_VIEW
WHERE lp_item_id = '" . (int) $lp_item_view_id . "' AND lp_view_id = $my_real_lp_item_view_id ORDER BY id DESC LIMIT 1";
@ -369,30 +369,30 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
$res_view_count = Database :: fetch_row($res_view_count);
$my_view_count = intval($res_view_count[0]);
*/
//Checking if this is the lastest attempt
$sql = "SELECT exe_id FROM $TBL_TRACK_EXERCICES
WHERE exe_user_id = '" . Database :: escape_string($_POST['student_id']) . "' AND exe_cours_id = '" . api_get_course_id() . "' AND orig_lp_id = '$lp_item_id' AND orig_lp_item_id = '$lp_item_view_id' AND session_id = '" . api_get_session_id() . "' AND status = ''
ORDER BY exe_id DESC LIMIT 1 ";
$res_view_count = Database::query($sql);
$res_view_count = Database :: fetch_row($res_view_count);
$my_view_count = intval($res_view_count[0]);
//Update lp_item_view if this attempts is the latest
$my_view_count = intval($res_view_count[0]);
//Update lp_item_view if this attempts is the latest
$sql = "SELECT MAX(view_count) FROM $TBL_LP_ITEM_VIEW
WHERE lp_item_id = '" . (int) $lp_item_view_id . "' AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '" . (int) $student_id . "' and lp_id='" . (int) $lp_item_id . "')";
$res_max_view_count = Database::query($sql);
$row_max_view_count = Database :: fetch_row($res_max_view_count);
$max_view_count = intval($row_max_view_count[0]);
//Only update if is the last attempt
if ($my_view_count == $_GET['exeid']) {
//Only update if is the last attempt
if ($my_view_count == $_GET['exeid']) {
// update score and total_time from last attempt when you qualify the exercise in Learning path detail
$sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = '" . intval($tot) . "' WHERE lp_item_id = '" . (int) $lp_item_view_id . "'
AND lp_view_id = (SELECT id from $TBL_LP_VIEW WHERE user_id = '" . (int) $student_id . "' and lp_id='" . (int) $lp_item_id . "') AND view_count = '$max_view_count'";
Database::query($sql_update_score);
}
}
/*
/*
// update score and total_time from last attempt when you qualify the exercise in Learning path detail
@ -737,7 +737,7 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
echo '<a href="exercise_admin.php?' . api_get_cidreq() . '">' . Display :: return_icon('new_test.gif', get_lang('NewEx')) . get_lang('NewEx') . '</a>';
echo '<a href="question_create.php?' . api_get_cidreq() . '">' . Display :: return_icon('question_add.gif', get_lang('AddQuestionToExercise')) . get_lang('AddQuestionToExercise') . '</a>';
echo '<a href="hotpotatoes.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_db.png', get_lang('ImportHotPotatoesQuiz')) . get_lang('ImportHotPotatoesQuiz') . '</a>';
// link to import qti2 ...
// link to import qti2 ...
echo '<a href="qti2.php?' . api_get_cidreq() . '">' . Display :: return_icon('import_db.png', get_lang('ImportQtiQuiz')) . get_lang('ImportQtiQuiz') . '</a>';
echo '<a href="exercice.php?' . api_get_cidreq() . '&show=result">' . Display :: return_icon('show_test_results.gif', get_lang('Results')) . get_lang('Results') . '</a>';
}
@ -746,7 +746,7 @@ if (($is_allowedToEdit) and ($origin != 'learnpath')) {
if ($show == 'result') {
// the form
if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
if ($_SESSION['export_user_fields'] == true) {
if ($_SESSION['export_user_fields']) {
$alt = get_lang('ExportWithUserFields');
$extra_user_fields = '<input type="hidden" name="export_user_fields" value="export_user_fields">';
} else {
@ -892,21 +892,21 @@ if ($show == 'test') {
<?php
}
$i = 1;
/*
*
/*
*
* Listing exercises
*
*
*/
if ($origin != 'learnpath') {
//avoid sending empty parameters
$myorigin = (empty ($origin) ? '' : '&origin=' . $origin);
$mylpid = (empty ($learnpath_id) ? '' : '&learnpath_id=' . $learnpath_id);
$mylpitemid = (empty ($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id);
$token = Security::get_token();
$token = Security::get_token();
while ($row = Database :: fetch_array($result)) {
//validacion when belongs to a session
$session_img = api_get_session_image($row['session_id'], $_user['status']);
@ -921,10 +921,10 @@ if ($show == 'test') {
echo '<td width="30" align="left">'.Display::return_icon('quiz.gif', get_lang('Exercice')).'</td>';
echo '<td width="15" valign="left">'.($i+($page*$limitExPage)).'.'.'</td>';
//Showing exercise title
$row['title']=api_parse_tex($row['title']);
echo '<td>';
$class_invisible = '';
if (!$row['active']) {
@ -935,7 +935,7 @@ if ($show == 'test') {
echo '</a>';
echo $session_img;
echo '</td>';
echo '<td align="center">';
echo '<td align="center">';
$exid = $row['id'];
//count number exercice - teacher
@ -954,10 +954,10 @@ if ($show == 'test') {
}
?>
<td>
<a href="admin.php?<?php echo api_get_cidreq()?>&amp;exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=copy_exercise&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"><img width="16" src="../img/cd.gif" border="0" title="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" /></a>
<a href="admin.php?<?php echo api_get_cidreq()?>&amp;exerciseId=<?php echo $row['id']; ?>"><img src="../img/wizard_small.gif" border="0" title="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('Edit'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=copy_exercise&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;"><img width="16" src="../img/cd.gif" border="0" title="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CopyExercise'),ENT_QUOTES,$charset); ?>" /></a>
<a href="exercice.php?<?php echo api_get_cidreq()?>&amp;choice=clean_results&amp;sec_token=<?php echo $token; ?>&amp;exerciseId=<?php echo $row['id']; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('AreYouSureToDeleteResults'),ENT_QUOTES,$charset)); echo " ".addslashes($row['title']); echo "?"; ?>')) return false;" ><img width="16" src="../img/clean_group.gif" border="0" title="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" alt="<?php echo api_htmlentities(get_lang('CleanStudentResults'),ENT_QUOTES,$charset); ?>" /></a>
<?php
if ($row['results_disabled']) {
//echo '<a href="exercice.php?choice=enable_results&page='.$page.'&exerciseId='.$row['id'].'" title="'.get_lang('EnableResults').'" alt="'.get_lang('EnableResults').'"><img src="../img/lp_quiz_na.gif" border="0" alt="'.api_htmlentities(get_lang('EnableResults'),ENT_QUOTES,$charset).'" /></a>';
@ -989,13 +989,13 @@ if ($show == 'test') {
// else if not active
?>
<a href="exercice.php?<?php echo api_get_cidreq() ?>&choice=enable&sec_token=<?php echo$token; ?>&amp;page=<?php echo $page; ?>&exerciseId=<?php echo $row['id']; ?>"> <img src="../img/invisible.gif" border="0" title="<?php echo get_lang('Activate'); ?>" alt="<?php echo api_htmlentities(get_lang('Activate'),ENT_QUOTES,$charset); ?>" /></a>
<?php
}
}
// Export qti ...
echo '<a href="exercice.php?choice=exportqti2&exerciseId='.$row['id'].'"><img src="../img/export_db.png" border="0" title="IMS/QTI" /></a>';
echo "</td>";
echo "</tr>";
} else { // student only
@ -1260,10 +1260,10 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
if (Database :: num_rows($query) > 0) {
$revised = true;
}
if ($filter_by_not_revised && $revised == true) {
if ($filter_by_not_revised && $revised) {
continue;
}
if ($filter_by_revised && $revised == false) {
if ($filter_by_revised && !$revised) {
continue;
}
if ($from_gradebook && ($is_allowedToEdit || $is_tutor)) {
@ -1396,7 +1396,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
}
$parameters=array('cidReq'=>Security::remove_XSS($_GET['cidReq']),'show'=>Security::remove_XSS($_GET['show']),'filter' => Security::remove_XSS($_GET['filter']),'gradebook' =>Security::remove_XSS($_GET['gradebook']));
$table = new SortableTableFromArrayConfig($list_info, 1,20,'quiz_table');
$table->set_additional_parameters($parameters);
if ($is_allowedToEdit || $is_tutor) {

@ -326,7 +326,7 @@ if ($exercise_row['expired_time'] != 0 && $origin != 'learnpath') { //Sends the
</script>";
}
if ($_configuration['live_exercise_tracking'] == true && $exerciseType == ONE_PER_PAGE && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
if ($_configuration['live_exercise_tracking'] && $exerciseType == ONE_PER_PAGE && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
$query = 'SELECT * FROM ' . $stat_table . $condition;
$result_select = Database::query($query);
if (Database :: num_rows($result_select) > 0) {
@ -398,7 +398,7 @@ if ($formSent) {
$exerciseResult[$key] = $choice[$key];
//saving each question
if ($_configuration['live_exercise_tracking'] == true && $exerciseType == ONE_PER_PAGE && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
if ($_configuration['live_exercise_tracking'] && $exerciseType == ONE_PER_PAGE && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
$nro_question = $questionNum; // - 1;
@ -542,7 +542,7 @@ if ($formSent) {
$correct_tags = array ();
$real_text = array ();
// the loop will stop at the end of the text
while (1) {
while (1) {
// quits the loop if there are no more blanks (detect '[')
if (($pos = api_strpos($temp, '[')) === false) {
// adds the end of the text
@ -585,7 +585,7 @@ if ($formSent) {
if (!$switchable_answer_set) {
//needed to parse ' and " characters
$user_tags[$i] = stripslashes($user_tags[$i]);
$user_tags[$i] = stripslashes($user_tags[$i]);
if ($correct_tags[$i] == $user_tags[$i]) {
// gives the related weighting to the student
$questionScore += $answerWeighting[$i];
@ -1067,7 +1067,7 @@ if (isset($exerciseId) && !empty($exerciseId)) {
$sql="SELECT max_score FROM $TBL_LP_ITEM
WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
if (Database::num_rows($result) > 0) {
$show_quiz_edition = false;
}
}
@ -1075,14 +1075,14 @@ if (isset($exerciseId) && !empty($exerciseId)) {
// I'm in a preview mode
if (api_is_course_admin() && $origin != 'learnpath') {
echo '<div class="actions">';
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . '</a>';
if ($show_quiz_edition) {
echo Display :: return_icon('edit.gif', get_lang('ModifyExercise')) . '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . get_lang('ModifyExercise') . '</a>';
} else {
echo Display::return_icon('edit_na.gif', get_lang('ModifyExercise')).'<a href="#">'.get_lang('ModifyExercise').'</a>';
}
echo '</div>';
}
@ -1139,14 +1139,14 @@ if ($limit_time_exists) {
$permission_to_start = (($time_now - $exercise_start_time) > 0) ? true : false;
if ($_SERVER['REQUEST_METHOD'] != 'POST')
$exercise_timeover = (($time_now - $exercise_end_time) > 0) ? true : false;
if ($permission_to_start == false || $exercise_timeover == true) { //
if (!$permission_to_start || $exercise_timeover) { //
if (!api_is_allowed_to_edit(null,true)) {
$message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedYet') : get_lang('ReachedTimeLimit');
$message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts));
Display :: display_footer();
exit;
} else {
$message_warning = ($permission_to_start == false) ? get_lang('ExerciseNoStartedAdmin') : get_lang('ReachedTimeLimitAdmin');
$message_warning = $permission_to_start ? get_lang('ReachedTimeLimitAdmin') : get_lang('ExerciseNoStartedAdmin');
Display :: display_warning_message(sprintf($message_warning, $exerciseTitle, $exerciseAttempts));
}
}
@ -1294,7 +1294,7 @@ if (!empty ($error)) {
}
if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
if ($_configuration['live_exercise_tracking'] && $exerciseFeedbackType != EXERCISE_FEEDBACK_TYPE_DIRECT) {
if ($table_recorded_not_exist) { //$table_recorded_not_exist
if ($exercise_row['expired_time'] != 0) {

@ -118,7 +118,7 @@ class Exercise
//load questions only for exercises of type 'one question per page'
//this is needed only is there is no questions
//
if($this->type == 2 && $_configuration['live_exercise_tracking']==true && $_SERVER['REQUEST_METHOD']!='POST' && defined('QUESTION_LIST_ALREADY_LOGGED'))
if ($this->type == 2 && $_configuration['live_exercise_tracking'] && $_SERVER['REQUEST_METHOD'] != 'POST' && defined('QUESTION_LIST_ALREADY_LOGGED'))
{
//if(empty($_SESSION['questionList']))
$this->questionList = $questionList;
@ -568,7 +568,7 @@ class Exercise
}
$start_time = Database::escape_string($this->start_time);
$end_time = Database::escape_string($this->end_time);
// exercise already exists
if($id) {
@ -1365,84 +1365,84 @@ class Exercise
}
/**
* Cleans the student's results only for the Exercise tool.
* Cleans the student's results only for the Exercise tool.
* The LP results are NOT deleted
* Works with exercises in sessions
* @return int quantity of user's exercises deleted
* @return int quantity of user's exercises deleted
*/
function clean_results() {
$table_track_e_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_track_e_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_track_e_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$sql_select = "SELECT exe_id FROM $table_track_e_exercises
WHERE exe_cours_id = '".api_get_course_id()."' AND exe_exo_id = ".$this->id." AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = ".api_get_session_id()."";
$result = Database::query($sql_select);
$exe_list = Database::store_result($result);
//deleting TRACK_E_ATTEMPT table
$i = 0;
if (is_array($exe_list) && count($exe_list) > 0) {
foreach($exe_list as $item) {
$sql = "DELETE FROM $table_track_e_attempt WHERE exe_id = '".$item['exe_id']."'";
$sql = "DELETE FROM $table_track_e_attempt WHERE exe_id = '".$item['exe_id']."'";
Database::query($sql);
$i++;
$i++;
}
}
//delete TRACK_E_EXERCICES table
$sql = "DELETE FROM $table_track_e_exercises
WHERE exe_cours_id = '".api_get_course_id()."' AND exe_exo_id = ".$this->id." AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = ".api_get_session_id()."";
Database::query($sql);
return $i;
Database::query($sql);
return $i;
}
/**
* Copies an exercise (duplicate all questions and answers)
*/
public function copy_exercise() {
$exercise_obj= new Exercise();
$exercise_obj = $this;
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
// force the creation of a new exercise
$exercise_obj->updateTitle($exercise_obj->selectTitle().' - '.get_lang('Copy'));
//Hides the new exercise
$exercise_obj->updateStatus(false);
$exercise_obj->updateId(0);
$exercise_obj->save();
$new_exercise_id = $exercise_obj->selectId();
$new_exercise_id = $exercise_obj->selectId();
$question_list = $exercise_obj->selectQuestionList();
//Question creation
foreach ($question_list as $old_question_id) {
//Question creation
foreach ($question_list as $old_question_id) {
$old_question_obj = Question::read($old_question_id);
$new_id = $old_question_obj->duplicate();
$new_question_obj = Question::read($new_id);
$new_question_obj->addToList($new_exercise_id);
// This should be moved to the duplicate function
$new_question_obj->addToList($new_exercise_id);
// This should be moved to the duplicate function
$new_answer_obj = new Answer($old_question_id);
$new_answer_obj->read();
$new_answer_obj->duplicate($new_id);
$new_answer_obj->duplicate($new_id);
}
}
/**
* Changes the exercise id
*
* @param - in $id - exercise id
*/
private function updateId($id) {
private function updateId($id) {
$this->id = $id;
}
/**
* Changes the exercise status
*

@ -211,7 +211,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
// set $debug_mark_answer to true at function start to
// show the correct answer with a suffix '-x'
$help = $selected = '';
if ($debug_mark_answer==true) {
if ($debug_mark_answer) {
if ($answerCorrect) {
$help = 'x-';
$selected = 'checked="checked"';
@ -232,7 +232,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
// set $debug_mark_answer to true at function start to
// show the correct answer with a suffix '-x'
$help = $selected = '';
if ($debug_mark_answer==true) {
if ($debug_mark_answer) {
if ($answerCorrect) {
$help = 'x-';
$selected = 'checked="checked"';
@ -253,7 +253,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
// set $debug_mark_answer to true at function start to
// show the correct answer with a suffix '-x'
$help = $selected = '';
if ($debug_mark_answer==true) {
if ($debug_mark_answer) {
if ($answerCorrect) {
$help = 'x-';
$selected = 'checked="checked"';
@ -291,7 +291,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
// set $debug_mark_answer to true at function start to
// show the correct answer with a suffix '-x'
$help = $selected = '';
if ($debug_mark_answer==true) {
if ($debug_mark_answer) {
if ($val['id'] == $answerCorrect) {
$help = '-x';
$selected = 'selected="selected"';

@ -122,7 +122,7 @@ class ExerciseResult
ORDER BY tth.exe_cours_id ASC, tth.exe_date ASC";
} else {
} else {
// get only this user's results
$sql="SELECT '', ce.title, te.exe_result ,
te.exe_weighting, te.exe_date, te.exe_id
@ -137,7 +137,7 @@ class ExerciseResult
ORDER BY exe_cours_id ASC, exe_date DESC";
}
$results = getManyResultsXCol($sql,8);
$hpresults = getManyResultsXCol($hpsql,7);
@ -168,8 +168,8 @@ class ExerciseResult
$query = Database::query($sql_exe);
if (Database :: num_rows($query) > 0) $revised = true;
if ($filter_by_not_revised && $revised == true) continue;
if ($filter_by_revised && $revised == false) continue;
if ($filter_by_not_revised && $revised) continue;
if ($filter_by_revised && !$revised) continue;
$return[$i] = array();
$id = $results[$i][5];
@ -182,7 +182,7 @@ class ExerciseResult
$return[$i]['user'] = $user;
$return[$i]['user_id'] = $results[$i][7];
}
$return[$i]['title'] = $test;
$return[$i]['title'] = $test;
$return[$i]['time'] = api_convert_and_format_date($results[$i][4], null, date_default_timezone_get());
$return[$i]['result'] = $res;
$return[$i]['max'] = $results[$i][3];
@ -317,7 +317,7 @@ class ExerciseResult
require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php');
$workbook = new Spreadsheet_Excel_Writer();
$workbook ->setTempDir(api_get_path(SYS_ARCHIVE_PATH));
$workbook->send($filename);
$worksheet =& $workbook->addWorksheet('Report '.date('YmdGis'));
$line = 0;

@ -101,7 +101,7 @@ if ( empty ( $exerciseType ) ) {
$_configuration['live_exercise_tracking'] = false;
if($_configuration['live_exercise_tracking']) define('ENABLED_LIVE_EXERCISE_TRACKING',1);
if($_configuration['live_exercise_tracking'] == true && $exerciseType == 1){
if($_configuration['live_exercise_tracking'] && $exerciseType == 1){
$_configuration['live_exercise_tracking'] = false;
}
$arrques = array();
@ -1012,7 +1012,7 @@ foreach ($questionList as $questionId) {
<td>
<b>
<?php echo get_lang('YourTotalScore')." ";
if ($dsp_percent == true) {
if ($dsp_percent) {
echo number_format(($totalScore/$totalWeighting)*100,1,'.','')."%";
} else {
echo float_format($totalScore,1)."/".float_format($totalWeighting,1);
@ -1058,16 +1058,16 @@ if($objExercise->results_disabled) {
Display :: display_normal_message(get_lang('ExerciseFinished').'<br /><a href="exercice.php" />'.get_lang('Back').'</a>',false);
} else {
Display :: display_normal_message(get_lang('ExerciseFinished').'<br /><br />',false);
if ($origin == 'learnpath') {
if ($origin == 'learnpath') {
$lp_mode = $_SESSION['lp_mode'];
$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type;
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
echo '<script language="javascript" type="text/javascript">'.$href.'</script>'."\n";
//record the results in the learning path, using the SCORM interface (API)
echo '<script language="javascript" type="text/javascript">window.parent.API.void_save_asset('.$totalScore.','.$totalWeighting.');</script>'."\n";
echo '</body></html>';
echo '</body></html>';
}
}
} else {
@ -1078,12 +1078,12 @@ if($objExercise->results_disabled) {
$url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exeId.'&fb_type='.$feedback_type;
$href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" ';
echo '<script language="javascript" type="text/javascript">'.$href.'</script>'."\n";
//record the results in the learning path, using the SCORM interface (API)
echo '<script language="javascript" type="text/javascript">window.parent.API.void_save_asset('.$totalScore.','.$totalWeighting.');</script>'."\n";
echo '</body></html>';
}
}
if ($origin != 'learnpath') {

@ -287,7 +287,7 @@ if (Database::num_rows($result)>0 && isset($id)) {
}
}
}
if ($show_results == true) {
if ($show_results) {
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($_user['user_id'])." ";
$query = "SELECT attempts.question_id, answer from ".$TBL_TRACK_ATTEMPT." as attempts
INNER JOIN ".$TBL_TRACK_EXERCICES." as stats_exercices ON stats_exercices.exe_id=attempts.exe_id
@ -309,7 +309,7 @@ if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) {
$show_results = false;
}
if ($show_results == true ) {
if ($show_results) {
?>
<table width="100%">
<tr>
@ -387,7 +387,7 @@ if ($show_results) {
// destruction of the Question object
unset($objQuestionTmp);
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
$colspan=2;
}
@ -626,7 +626,7 @@ if ($show_results) {
$switchable_answer_set=true;
}
$answer = $pre_array[0];
$answer = $pre_array[0];
// splits weightings that are joined with a comma
$answerWeighting = explode(',',$is_set_switchable[0]);
@ -664,19 +664,19 @@ if ($show_results) {
if (($pos = api_strpos($temp,']')) === false) {
break;
}
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($id)."' AND question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str = Database::result($resfill,0,'answer');
preg_match_all('#\[([^[]*)\]#', $str, $arr);
$str = str_replace('\r\n', '', $str);
$choice = $arr[1];
$tmp=strrpos($choice[$j],' / ');
$choice[$j]=substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
//Needed to let characters ' and " to work as part of an answer
$choice[$j] = stripslashes($choice[$j]);
@ -694,7 +694,7 @@ if ($show_results) {
$temp=api_substr($temp,$pos+1);
$i=$i+1;
}
$answer = stripslashes($str);
$answer = stripslashes($str);
} else {
//multiple fill in blank
@ -774,7 +774,7 @@ if ($show_results) {
$resq = Database::query($query);
$choice = Database::result($resq,0,'answer');
$choice = str_replace('\r\n', '', $choice);
$choice = stripslashes($choice);
$choice = stripslashes($choice);
$questionScore = Database::result($resq,0,"marks");
if ($questionScore==-1) {
@ -803,10 +803,10 @@ if ($show_results) {
while ($real_answer = Database::fetch_array($res_answer)) {
$real_list[$real_answer['id']]= $real_answer['answer'];
}
$sql_select_answer = 'SELECT id, answer, correct, id_auto FROM '.$table_ans.'
WHERE question_id="'.Database::escape_string($questionId).'" AND correct <> 0 ORDER BY id_auto';
$res_answers = Database::query($sql_select_answer);
echo '<table width="100%" height="71" border="0" cellspacing="3" cellpadding="3" >';
@ -828,7 +828,7 @@ if ($show_results) {
$sql_user_answer = "SELECT answer FROM $TBL_TRACK_ATTEMPT
WHERE exe_id = '$id' AND question_id = '$questionId' AND position='$i_answer_id_auto'";
$res_user_answer = Database::query($sql_user_answer);
if (Database::num_rows($res_user_answer)>0 ) {
@ -1003,7 +1003,7 @@ if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type'])))
//Database::query($query);
if ($show_results) {
echo '<div id="question_score">'.get_lang('YourTotalScore')." ";
if($dsp_percent == true) {
if ($dsp_percent) {
$my_result = number_format(($totalScore/$totalWeighting)*100,1,'.','');
$my_result = float_format($my_result,1);
echo $my_result."%";

@ -14,7 +14,7 @@ $dbg_local = 0;
api_protect_course_script();
// answer types
// answer types
define('UNIQUE_ANSWER', 1);
define('MULTIPLE_ANSWER', 2);
define('FILL_IN_BLANKS', 3);
@ -349,7 +349,7 @@ if (!empty($choice_value))
$poly_answer_compiled = poly_compile($poly_answer,$max_coord);
$overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
if ($overlap == false) {
if (!$overlap) {
//all good, no overlap
$next = 1;
continue;

@ -103,7 +103,7 @@ if((api_is_allowed_to_edit(null,true)) && (($finish == 0) || ($finish == 2)))
else
{
/* deprecated code
if ($enableDocumentParsing==true)
if ($enableDocumentParsing)
{ $enableDocumentParsing=false;
$oke=1;}
else { $oke = 0; }
@ -204,7 +204,7 @@ if((api_is_allowed_to_edit(null,true)) && (($finish == 0) || ($finish == 2)))
}
Display::display_header($nameTools,get_lang('Exercise'));
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList')) . get_lang('GoBackToQuestionList') . '</a>';
echo '</div>';

@ -69,12 +69,12 @@ function ch_qti2_import_file($array_file) {
// if it's a zip, allow zip upload
$unzip = 1;
}
if ($process == true && $unzip == 1) {
if ($process && $unzip == 1) {
$main_path = api_get_path(SYS_CODE_PATH);
require_once $main_path.'exercice/export/exercise_import.inc.php';
require_once $main_path.'exercice/export/qti2/qti2_classes.php';
$imported = import_exercise($array_file['name']);
if ($imported == true) {
if ($imported) {
header('Location: exercice.php?' . Security::remove_XSS(api_get_cidreq()) .'');
} else {
Display::display_error_message(get_lang('The import was not performed'));

@ -96,15 +96,15 @@ if(is_object($objQuestion)) {
// question form elements
$objQuestion -> createForm ($form,array('Height'=>150));
// answer form elements
$objQuestion -> createAnswersForm ($form);
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications
if ($show_quiz_edition == false) {
if (!$show_quiz_edition) {
$form->freeze();
}
// submit button is implemented in every question type
//$form->addElement('style_submit_button','submitQuestion',$text, 'class="'.$class.'"');
@ -116,7 +116,7 @@ if(is_object($objQuestion)) {
* FORM VALIDATION
**********************/
if(isset($_POST['submitQuestion']) && $form->validate()) {
// question
$objQuestion -> processCreation($form,$objExercise);
// answers

@ -210,7 +210,7 @@ if (!empty($values) and isset($_POST['SubmitPost'])) {
$description="";
$session_id=api_get_session_id();
$link_id=is_resource_in_course_gradebook(api_get_course_id(),5,$id,$session_id);
if ($link_id==false) {
if (!$link_id) {
add_resource_to_course_gradebook(api_get_course_id(), 5, $id, $title_gradebook,$weight_calification,$value_calification,$description,time(),1,api_get_session_id());
} else {
Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');

@ -14,7 +14,7 @@
* - sticky messages
* - new view option: nested view
* - quoting a message
*
*
* @package chamilo.forum
*
* @todo several functions have to be moved to the itemmanager library
@ -522,7 +522,7 @@ function store_forum($values) {
$session_id = api_get_session_id();
$clean_title = Database::escape_string($values['forum_title']);
// forum images
$image_moved=false;
if (!empty($_FILES['picture']['name'])) {
@ -618,9 +618,9 @@ function store_forum($values) {
'".Database::escape_string(isset($values['public_private_group_forum_group']['public_private_group_forum'])?$values['public_private_group_forum_group']['public_private_group_forum']:null)."',
'".Database::escape_string(isset($new_max)?$new_max:null)."',
".intval($session_id).")";
Database::query($sql);
$last_id = Database::insert_id();
if ($last_id > 0) {
api_item_property_update($_course, TOOL_FORUM, $last_id, 'ForumAdded', api_get_user_id());
@ -738,7 +738,7 @@ function delete_post($post_id) {
api_sql_query($sql);
return 'PostDeleted';
}
if ($last_post_of_thread==false) {
if (!$last_post_of_thread) {
// we deleted the very single post of the thread so we need to delete the entry in the thread table also.
$sql="DELETE FROM $table_threads WHERE thread_id='".intval($_GET['thread'])."'";
api_sql_query($sql);
@ -1026,7 +1026,7 @@ function move_up_down($content, $direction, $id) {
$found=false;
while ($row=Database::fetch_array($result)) {
//echo $row[$id_column].'-';
if ($found==true) {
if ($found) {
$next_id=$row[$id_column];
$next_sort=$row[$sort_column];
$found=false;
@ -1359,7 +1359,7 @@ function get_last_post_information($forum_id, $show_invisibles=false, $course_db
ORDER BY post.post_id DESC";
$result=Database::query($sql);
if ($show_invisibles==true) {
if ($show_invisibles) {
$row=Database::fetch_array($result);
$return_array['last_post_id']=$row['post_id'];
$return_array['last_poster_id']=$row['poster_id'];
@ -1948,12 +1948,12 @@ function show_add_post_form($action='', $id='', $form_values='') {
// thread qualify
$form->addElement('static','Group', '<br /><strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form -> addElement('html','<div id="options_field" style="display:none">');
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'Style="width:40px"');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html','</div>');
}
@ -2376,7 +2376,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
if (!isset($_GET['edit'])) {
$form->addElement('static','Group','<strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$defaults['thread_qualify_gradebook']=is_resource_in_course_gradebook(api_get_course_id(),5,$_GET['thread'],api_get_session_id());
if (!empty($defaults['thread_qualify_gradebook'])) {
@ -2823,7 +2823,7 @@ function send_notification_mails($thread_id, $reply_info) {
}
// the forum category, the forum, the thread and the reply are visible to the user
if ($send_mails == true) {
if ($send_mails) {
send_notifications($current_thread['forum_id'],$thread_id);
/*
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
@ -2855,7 +2855,7 @@ function send_notification_mails($thread_id, $reply_info) {
/**
* This function is called whenever something is made visible because there might
* be new posts and the user might have indicated that (s)he wanted to be
* be new posts and the user might have indicated that (s)he wanted to be
* informed about the new posts by mail.
*
* @param string Content type (post, thread, forum, forum_category)
@ -2870,15 +2870,15 @@ function handle_mail_cue($content, $id) {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
// if the post is made visible we only have to send mails to the people who indicated that they wanted to be informed for that thread.
if ($content=='post') {
// getting the information about the post (need the thread_id)
$post_info = get_post_information($id);
$thread_id = Database::escape_string($post_info['thread_id']);
// sending the mail to all the users that wanted to be informed for replies on this thread.
$sql="SELECT users.firstname, users.lastname, users.user_id, users.email
$sql="SELECT users.firstname, users.lastname, users.user_id, users.email
FROM $table_mailcue mailcue, $table_posts posts, $table_users users
WHERE posts.thread_id='$thread_id'
AND posts.post_notification='1'
@ -2886,15 +2886,15 @@ function handle_mail_cue($content, $id) {
AND users.user_id=posts.poster_id
AND users.active=1
GROUP BY users.email";
$result=Database::query($sql);
while ($row=Database::fetch_array($result)) {
while ($row=Database::fetch_array($result)) {
send_mail($row, get_thread_information($post_info['thread_id']));
}
// deleting the relevant entries from the mailcue
$sql_delete_mailcue="DELETE FROM $table_mailcue
WHERE post_id='".Database::escape_string($id)."'
$sql_delete_mailcue="DELETE FROM $table_mailcue
WHERE post_id='".Database::escape_string($id)."'
AND thread_id='".Database::escape_string($post_info['thread_id'])."'";
//$result=Database::query($sql_delete_mailcue);
} elseif ($content=='thread') {
@ -3282,7 +3282,7 @@ function display_forum_search_results($search_term) {
$display_result = true;
}
if ($display_result == true) {
if ($display_result) {
$search_results_item = '<li><a href="viewforumcategory.php?forumcategory='.$forum_list[$row['forum_id']]['forum_category'].'&origin='.$origin.'&amp;search='.urlencode($search_term).'">'.$forum_categories_list[$row['forum_id']['forum_category']]['cat_title'].'</a> > ';
$search_results_item .= '<a href="viewforum.php?forum='.$row['forum_id'].'&amp;origin='.$origin.'&amp;search='.urlencode($search_term).'">'.$forum_list[$row['forum_id']]['forum_title'].'</a> > ';
//$search_results_item .= '<a href="">THREAD</a> > ';
@ -3890,7 +3890,7 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
* return String
* @author Christian Fasanando
*/
function get_name_user_by_id($user_id) {
function get_name_user_by_id($user_id) {
$t_users = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT firstname, lastname FROM ".$t_users." WHERE user_id = '".intval($user_id)."' ";
$result = Database::query($sql);
@ -3905,7 +3905,7 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
* @author Julio Montoya <gugli100@gmail.com> Adding security
**/
function get_name_thread_by_id($thread_id) {
$t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD,'');
$t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD,'');
$sql ="SELECT thread_title FROM ".$t_forum_thread." WHERE thread_id = '".intval($thread_id)."' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);

@ -74,7 +74,7 @@ $my_forum=isset($_GET['forum'])?$_GET['forum']:'';
$val=GroupManager::user_has_access($userid,$my_forum_group,GROUP_TOOL_FORUM);
if(!empty($my_forum_group)){
if (api_is_allowed_to_edit(false,true) || $val==true) {
if (api_is_allowed_to_edit(false, true) || $val) {
$current_forum=get_forum_information($my_forum); // note: this has to be validated that it is an existing forum.
$current_forum_category=get_forumcategory_information($current_forum['forum_category']);
}

@ -113,7 +113,7 @@ class DisplayGradebook
* @param $showlink
*/
function display_header_reduce_flatview($catobj, $showeval, $showlink,$simple_search_form) {
$header = '<div class="actions">';
$header = '<div class="actions">';
$header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?'.api_get_cidreq().'">'. Display::return_icon('back.png',get_lang('FolderView')) . get_lang('FolderView') . '</a>';
// $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?exportpdf=&offset='.Security::remove_XSS($_GET['offset']).'&search=' . Security::remove_XSS($_GET['search']).'&selectcat=' . $catobj->get_id() . '"><img src=../img/file_pdf.gif alt=' . get_lang('ExportPDF') . '/> ' . get_lang('ExportPDF') . '</a>';
@ -140,7 +140,7 @@ class DisplayGradebook
$header .= '<span><a " href="javascript: void(0);" onclick="javascript: document.form1b.submit();">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').'</a></span>';
$header .= '<a href="' . api_get_self() . '?print=&selectcat=' . $catobj->get_id() . '" target="_blank">'.Display::return_icon('printmgr.gif', get_lang('Print')).' ' . get_lang('Print') . '</a>';
$header .= '<a href="' . api_get_self() . '?exportpdf=&selectcat=' . $catobj->get_id() . '" >'.Display::return_icon('file_pdf.gif', get_lang('ExportToPDF')).' ' . get_lang('ExportToPDF') . '</a>';
//exportpdf
//<div class="clear">
$header .= '</div>';
@ -217,11 +217,11 @@ class DisplayGradebook
if (($showtree == '1') || (isset ($_GET['studentoverview']))) {
$header .= '<tr>';
if (!$selectcat == '0') {
$header .= '<td style=" "><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('RootCat')).get_lang('BackTo').' '.get_lang('RootCat').'</a></td>';
}
$header .= '<td style=" ">' . get_lang('CurrentCategory') . '</td>' .
'<td style=" "><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
$cats= Category :: load();
@ -273,7 +273,7 @@ class DisplayGradebook
if ($show_add_qualification === true) {
// $header .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat=0"><img src="../img/folder_new.gif" alt="' . get_lang('NewCategory') . '" /> ' . get_lang('NewCategory') . '</a></td>';
}
if ($show_add_link === true) {
if ($show_add_link) {
//$header .= '<td><a href="gradebook_add_eval.php?'.api_get_cidreq().'"><img src="../img/filenew.gif" alt="' . get_lang('NewEvaluation') . '" /> ' . get_lang('NewEvaluation') . '</a>';
}
} else {
@ -285,10 +285,10 @@ class DisplayGradebook
if ($my_api_cidreq=='') {
$my_api_cidreq='cidReq='.$my_category['course_code'];
}
if ($show_add_link === true && $message_resource==false) {
if ($show_add_link && !$message_resource) {
$header .= '<td><a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '" >'.Display::return_icon('filenew.gif', get_lang('NewEvaluation')).' ' . get_lang('NewEvaluation') . '</a>&nbsp;';
$cats= Category :: load($selectcat);
if ($cats[0]->get_course_code() != null && $message_resource===false) {
if ($cats[0]->get_course_code() != null && !$message_resource) {
//$header .= '<td><a href="gradebook_add_link.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() . '"><img src="../img/link.gif" alt="' . get_lang('MakeLink') . '" align="absmiddle" /> ' . get_lang('MakeLink') . '</a>';
$header .= '<td><a href="gradebook_add_link.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('link.gif', get_lang('MakeLink')).' ' . get_lang('MakeLink') . '</a>&nbsp;';
@ -297,7 +297,7 @@ class DisplayGradebook
}
}
if ($message_resource===false ) {
if (!$message_resource) {
$myname=$catobj->shows_all_information_an_category($catobj->get_id());
$header .= '<td><a href="gradebook_edit_all.php?id_session='.intval($_SESSION['id_session']).'&amp;'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('statistics.gif', get_lang('EditAllWeights')).' ' . get_lang('EditAllWeights') . '</a>';
$my_course_id=api_get_course_id();
@ -305,10 +305,10 @@ class DisplayGradebook
if (api_is_allowed_to_edit(null, true)) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() .'">'.Display::return_icon('acces_tool.gif', get_lang('ScoreEdit')).' ' . get_lang('ScoreEdit') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('stats_access.gif', get_lang('FlatView')).' ' . get_lang('FlatView') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('stats_access.gif', get_lang('FlatView')).' ' . get_lang('FlatView') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat=' . $catobj->get_id() . '">'.Display::return_icon('certificate.png', get_lang('AttachCertificate')).' ' . get_lang('AttachCertificate') . '</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int)$_GET['selectcat'].'">'.Display::return_icon('gradebook_eval_not_empty.gif', get_lang('GradebookSeeListOfStudentsCertificates')).' ' . get_lang('GradebookSeeListOfStudentsCertificates') . '</a>';
}
}
}
@ -335,7 +335,7 @@ class DisplayGradebook
$scoreinfo.= '<br />'.get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
$scoreinfo.= '<br />'.get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
Display :: display_normal_message($scoreinfo,false);
}
// show navigation tree and buttons?
$header = '<div class="actions">';

@ -156,7 +156,7 @@ class FlatViewDataGenerator
$divide=( ($score[1])==0 ) ? 1 : $score[1];
$item_value+=round($score[0]/$divide*$item->get_weight(),2);
$item_total+=$item->get_weight();
if ($show_all == false) {
if (!$show_all) {
$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
} else {
$row[] = $scoredisplay->display_score($score, SCORE_DECIMAL);
@ -165,7 +165,7 @@ class FlatViewDataGenerator
}
$total_score=array($item_value,$item_total);
if ($show_all == false) {
if (!$show_all) {
$row[] = $scoredisplay->display_score($total_score,SCORE_DIV_PERCENT);
} else {
$row[] = $scoredisplay->display_score($total_score,SCORE_DECIMAL);

Loading…
Cancel
Save