Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
pull/2487/head
Scrutinizer Auto-Fixer 9 years ago
parent a444e67791
commit 465d16f644
  1. 2
      custompages/language.php
  2. 20
      main/admin/career_dashboard.php
  3. 22
      main/admin/course_export.php
  4. 20
      main/admin/user_edit.php
  5. 18
      main/course_home/activity.php
  6. 76
      main/coursecopy/copy_course_session_selected.php
  7. 2
      main/exercise/hotspot.inc.php
  8. 6
      main/exercise/hotspot_updatescore.inc.php
  9. 8
      main/exercise/qti2.php
  10. 16
      main/inc/lib/formvalidator/Element/DatePicker.php
  11. 26
      main/inc/lib/online.inc.php
  12. 40
      main/inc/lib/pdf.lib.php
  13. 30
      main/inc/lib/sortable_table.class.php
  14. 20
      main/ticket/assign_tickets.php
  15. 86
      main/webservices/lp.php
  16. 16
      plugin/buycourses/src/paymentsetup.php
  17. 4
      plugin/ims_lti/start.php
  18. 136
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
  19. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyQuestion.php

@ -6,7 +6,7 @@
* @package chamilo.custompages * @package chamilo.custompages
*/ */
// Get helper functions // Get helper functions
require_once __DIR__ . '/language.inc.php'; require_once __DIR__.'/language.inc.php';
// Define the languages you want to make available for auto-detection here // Define the languages you want to make available for auto-detection here
$available_langs = array('en', 'fr', 'es', 'gl', 'eu'); $available_langs = array('en', 'fr', 'es', 'gl', 'eu');

@ -29,7 +29,7 @@ $interbreadcrumb[] = array(
Display :: display_header(null); Display :: display_header(null);
$form = new FormValidator('filter_form','GET', api_get_self()); $form = new FormValidator('filter_form', 'GET', api_get_self());
$career = new Career(); $career = new Career();
@ -60,11 +60,11 @@ $form->addButtonSearch(get_lang('Filter'));
// action links // action links
echo '<div class="actions" style="margin-bottom:20px">'; echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="../admin/index.php">'. echo '<a href="../admin/index.php">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="careers.php">'. echo '<a href="careers.php">'.
Display::return_icon('career.png',get_lang('Careers'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="promotions.php">'. echo '<a href="promotions.php">'.
Display::return_icon('promotion.png',get_lang('Promotions'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';
$form->display(); $form->display();
@ -124,22 +124,22 @@ if (!empty($career_array)) {
foreach ($career_array as $career_id => $data) { foreach ($career_array as $career_id => $data) {
$career = $data['name']; $career = $data['name'];
$promotions = $data['promotions']; $promotions = $data['promotions'];
$career = Display::url($career, 'careers.php?action=edit&id=' . $career_id); $career = Display::url($career, 'careers.php?action=edit&id='.$career_id);
$career = Display::tag('h4', $career); $career = Display::tag('h4', $career);
echo '<tr><td style="background-color:#ECF0F1" colspan="3">' . $career . '</td></tr>'; echo '<tr><td style="background-color:#ECF0F1" colspan="3">'.$career.'</td></tr>';
if (!empty($promotions)) { if (!empty($promotions)) {
foreach ($promotions as $promotion_id => $promotion) { foreach ($promotions as $promotion_id => $promotion) {
$promotion_name = $promotion['name']; $promotion_name = $promotion['name'];
$promotion_url = Display::url($promotion_name, 'promotions.php?action=edit&id=' . $promotion_id); $promotion_url = Display::url($promotion_name, 'promotions.php?action=edit&id='.$promotion_id);
$sessions = $promotion['sessions']; $sessions = $promotion['sessions'];
$count = count($promotion['sessions']); $count = count($promotion['sessions']);
$rowspan = ''; $rowspan = '';
if (!empty($count)) { if (!empty($count)) {
$rowspan = 'rowspan="' . $count . '"'; $rowspan = 'rowspan="'.$count.'"';
} }
echo '<tr style="border-bottom:1px solid #ccc;">'. echo '<tr style="border-bottom:1px solid #ccc;">'.
'<td ' . $rowspan . ' style="border-right:1px solid #aaa;">'. '<td '.$rowspan.' style="border-right:1px solid #aaa;">'.
Display::tag('h5', $promotion_url). Display::tag('h5', $promotion_url).
'</td>'; '</td>';
@ -167,7 +167,7 @@ if (!empty($career_array)) {
echo '<li>'; echo '<li>';
$url = Display::url( $url = Display::url(
$course['title'], $course['title'],
api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . $session['data']['id'] api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.$session['data']['id']
); );
echo $url; echo $url;
echo '</li>'; echo '</li>';

@ -14,7 +14,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(); api_protect_admin_script();
$tool_name = get_lang('ExportCourses'); $tool_name = get_lang('ExportCourses');
$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
set_time_limit(0); set_time_limit(0);
@ -59,17 +59,17 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$dataToExport = []; $dataToExport = [];
foreach ($courses as $course) { foreach ($courses as $course) {
$dataToExport['code'] = str_replace(';',',',$course['code']); $dataToExport['code'] = str_replace(';', ',', $course['code']);
$dataToExport['title'] = str_replace(';',',',$course['title']); $dataToExport['title'] = str_replace(';', ',', $course['title']);
$dataToExport['category_code'] = str_replace(';',',',$course['category_code']); $dataToExport['category_code'] = str_replace(';', ',', $course['category_code']);
$categoryInfo = CourseCategory::getCategory($course['category_code']); $categoryInfo = CourseCategory::getCategory($course['category_code']);
if ($categoryInfo) { if ($categoryInfo) {
$dataToExport['category_name'] = str_replace(';',',',$categoryInfo['name']); $dataToExport['category_name'] = str_replace(';', ',', $categoryInfo['name']);
} else { } else {
$dataToExport['category_name'] = ''; $dataToExport['category_name'] = '';
} }
$dataToExport['tutor_name'] = str_replace(';',',',$course['tutor_name']); $dataToExport['tutor_name'] = str_replace(';', ',', $course['tutor_name']);
$dataToExport['course_language'] = str_replace(';',',',$course['course_language']); $dataToExport['course_language'] = str_replace(';', ',', $course['course_language']);
$dataToExport['students'] = ''; $dataToExport['students'] = '';
$dataToExport['teachers'] = ''; $dataToExport['teachers'] = '';
@ -79,9 +79,9 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
if (is_array($usersInCourse) && !empty($usersInCourse)) { if (is_array($usersInCourse) && !empty($usersInCourse)) {
foreach ($usersInCourse as $user) { foreach ($usersInCourse as $user) {
if ($user['status_rel'] == COURSEMANAGER) { if ($user['status_rel'] == COURSEMANAGER) {
$dataToExport['teachers'] .= $user['username'] . '|'; $dataToExport['teachers'] .= $user['username'].'|';
} else { } else {
$dataToExport['students'] .= $user['username'] . '|'; $dataToExport['students'] .= $user['username'].'|';
} }
} }
} }
@ -153,8 +153,8 @@ if (!empty($course_list)) {
$form->addHtml('</div>'); $form->addHtml('</div>');
} }
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV' , 'csv', null); $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
$form->addElement('radio', 'file_type', '' , 'XLS' , 'xls', null); $form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml')); $form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
$form->setDefaults(['select_type' => '1', 'file_type' => 'csv']); $form->setDefaults(['select_type' => '1', 'file_type' => 'csv']);

@ -73,7 +73,7 @@ $geolocalization = $gMapsPlugin->get('enable_api') === 'true';
if ($geolocalization) { if ($geolocalization) {
$gmapsApiKey = $gMapsPlugin->get('api_key'); $gmapsApiKey = $gMapsPlugin->get('api_key');
$htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true&key='. $gmapsApiKey . '" ></script>'; $htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true&key='.$gmapsApiKey.'" ></script>';
} }
$htmlHeadXtra[] = api_get_css_asset('cropper/dist/cropper.min.css'); $htmlHeadXtra[] = api_get_css_asset('cropper/dist/cropper.min.css');
@ -153,7 +153,7 @@ if (api_get_setting('registration', 'email') == 'true') {
} }
if (api_get_setting('login_is_email') == 'true') { if (api_get_setting('login_is_email') == 'true') {
$form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']); $form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']);
} }
@ -187,7 +187,7 @@ if (strlen($user_data['picture_uri']) > 0) {
if (api_get_setting('login_is_email') != 'true') { if (api_get_setting('login_is_email') != 'true') {
$form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
$form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
$form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
$form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']); $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
} }
@ -224,7 +224,7 @@ if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0
} }
$form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1); $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
$group = array(); $group = array();
$group[] =$form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2); $group[] = $form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2);
$group[] = $form->createElement( $group[] = $form->createElement(
'password', 'password',
'password', 'password',
@ -260,10 +260,10 @@ $display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (i
// Platform admin // Platform admin
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$group = array(); $group = array();
$group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
$group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
$user_data['status'] == 1 ? $display = 'block':$display = 'none'; $user_data['status'] == 1 ? $display = 'block' : $display = 'none';
$form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
$form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false);
@ -287,7 +287,7 @@ $form->addElement('label', get_lang('RegistrationDate'), $date);
if (!$user_data['platform_admin']) { if (!$user_data['platform_admin']) {
// Expiration Date // Expiration Date
$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
$group = array (); $group = array();
$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
$group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
$form->addGroup($group, 'max_member_group', null, null, false); $form->addGroup($group, 'max_member_group', null, null, false);
@ -305,7 +305,7 @@ $studentBossToSelect = [];
if ($studentBoss) { if ($studentBoss) {
foreach ($studentBoss as $bossId => $userData) { foreach ($studentBoss as $bossId => $userData) {
$bossInfo = api_get_user_info($userData['user_id']); $bossInfo = api_get_user_info($userData['user_id']);
$studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username']; $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username'];
} }
} }
@ -331,7 +331,7 @@ $returnParams = $extraField->addElements(
$jquery_ready_content = $returnParams['jquery_ready_content']; $jquery_ready_content = $returnParams['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
$htmlHeadXtra[] ='<script> $htmlHeadXtra[] = '<script>
$(document).ready(function(){ $(document).ready(function(){
'.$jquery_ready_content.' '.$jquery_ready_content.'
}); });

@ -22,7 +22,7 @@ if (api_is_platform_admin()) {
// Show message to confirm that a tool it to be hidden from available tools // Show message to confirm that a tool it to be hidden from available tools
// visibility 0,1->2 // visibility 0,1->2
if (!empty($_GET['askDelete'])) { if (!empty($_GET['askDelete'])) {
$content .='<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp; $content .= '<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
<a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp; <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
<a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a> <a href="'.api_get_self().'?delete=yes&id='.$id.'">'.get_lang('Yes').'</a>
</div>'; </div>';
@ -49,11 +49,11 @@ if ($enabled === 'true') {
// Start of tools for CourseAdmins (teachers/tutors) // Start of tools for CourseAdmins (teachers/tutors)
if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) { if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
$content .= '<div class="alert alert-success" style="border:0px; margin-top: 0px;padding:0px;"> $content .= '<div class="alert alert-success" style="border:0px; margin-top: 0px;padding:0px;">
<div class="normal-message" id="id_normal_message" style="display:none">'; <div class="normal-message" id="id_normal_message" style="display:none">';
$content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;'; $content .= '<img src="'.api_get_path(WEB_PATH).'main/inc/lib/javascript/indicator.gif"/>&nbsp;&nbsp;';
$content .= get_lang('PleaseStandBy'); $content .= get_lang('PleaseStandBy');
$content .= '</div> $content .= '</div>
<div class="alert alert-success" id="id_confirmation_message" style="display:none"></div> <div class="alert alert-success" id="id_confirmation_message" style="display:none"></div>
</div>'; </div>';
@ -79,7 +79,7 @@ if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, t
$list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN); $list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN);
$my_list = array_merge($my_list, $list2); $my_list = array_merge($my_list, $list2);
$items = CourseHome::show_tools_category($my_list); $items = CourseHome::show_tools_category($my_list);
$content .= return_block(get_lang('Interaction'), $items, 'course-tools-interaction'); $content .= return_block(get_lang('Interaction'), $items, 'course-tools-interaction');
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM); $my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
@ -94,10 +94,10 @@ if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, t
<span class="viewcaption">'.get_lang('SessionData').'</span> <span class="viewcaption">'.get_lang('SessionData').'</span>
<table class="course_activity_home">'; <table class="course_activity_home">';
$content .= CourseHome::show_session_data($session_id); $content .= CourseHome::show_session_data($session_id);
$content .= '</table></div></div>'; $content .= '</table></div></div>';
} }
$content .= '<div class="row">'; $content .= '<div class="row">';
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); $my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
$content .= CourseHome::show_tools_category($my_list); $content .= CourseHome::show_tools_category($my_list);
$content .= '</div>'; $content .= '</div>';
@ -179,7 +179,7 @@ function return_block($title, $content, $class = null)
{ {
$html = '<div class="row"> $html = '<div class="row">
<div class="col-xs-12 col-md-12"> <div class="col-xs-12 col-md-12">
<div class="title-tools">' . $title . '</div> <div class="title-tools">' . $title.'</div>
</div> </div>
</div> </div>
<div class="row '.$class.'">'.$content.'</div>'; <div class="row '.$class.'">'.$content.'</div>';

@ -47,7 +47,7 @@ if (function_exists('ini_set')) {
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
$nameTools = get_lang('CopyCourse'); $nameTools = get_lang('CopyCourse');
$returnLink = api_get_path(WEB_CODE_PATH) . 'course_info/maintenance_coach.php?' . api_get_cidreq(); $returnLink = api_get_path(WEB_CODE_PATH).'course_info/maintenance_coach.php?'.api_get_cidreq();
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => $returnLink, 'url' => $returnLink,
'name' => get_lang('Maintenance') 'name' => get_lang('Maintenance')
@ -73,29 +73,29 @@ function make_select_session_list($name, $sessions, $attr = array())
$attrs = ''; $attrs = '';
if (count($attr) > 0) { if (count($attr) > 0) {
foreach ($attr as $key => $value) { foreach ($attr as $key => $value) {
$attrs .= ' ' . $key . '="' . $value . '"'; $attrs .= ' '.$key.'="'.$value.'"';
} }
} }
$output = '<select name="' . $name . '" ' . $attrs . '>'; $output = '<select name="'.$name.'" '.$attrs.'>';
if (count($sessions) == 0) { if (count($sessions) == 0) {
$output .= '<option value = "0">' . get_lang( $output .= '<option value = "0">'.get_lang(
'ThereIsNotStillASession' 'ThereIsNotStillASession'
) . '</option>'; ).'</option>';
} else { } else {
$output .= '<option value = "0">' . get_lang( $output .= '<option value = "0">'.get_lang(
'SelectASession' 'SelectASession'
) . '</option>'; ).'</option>';
} }
if (is_array($sessions)) { if (is_array($sessions)) {
foreach ($sessions as $session) { foreach ($sessions as $session) {
$category_name = ''; $category_name = '';
if (!empty($session['category_name'])) { if (!empty($session['category_name'])) {
$category_name = ' (' . $session['category_name'] . ')'; $category_name = ' ('.$session['category_name'].')';
} }
$output .= '<option value="' . $session['id'] . '">' . $session['name'] . ' ' . $category_name . '</option>'; $output .= '<option value="'.$session['id'].'">'.$session['name'].' '.$category_name.'</option>';
} }
} }
$output .= '</select>'; $output .= '</select>';
@ -120,43 +120,43 @@ function displayForm()
// Actions // Actions
$html .= '<div class="actions">'; $html .= '<div class="actions">';
// Link back to the documents overview // Link back to the documents overview
$html .= '<a href="' . $returnLink . '">' . Display::return_icon( $html .= '<a href="'.$returnLink.'">'.Display::return_icon(
'back.png', get_lang('BackTo') . ' ' . get_lang('Maintenance'), '', ICON_SIZE_MEDIUM 'back.png', get_lang('BackTo').' '.get_lang('Maintenance'), '', ICON_SIZE_MEDIUM
) . '</a>'; ).'</a>';
$html .= '</div>'; $html .= '</div>';
$html .= Display::return_message( $html .= Display::return_message(
get_lang('CopyCourseFromSessionToSessionExplanation') get_lang('CopyCourseFromSessionToSessionExplanation')
); );
$html .= '<form name="formulaire" method="post" action="' . api_get_self( $html .= '<form name="formulaire" method="post" action="'.api_get_self(
) . '?' . api_get_cidreq() . '" >'; ).'?'.api_get_cidreq().'" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">'; $html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// Source // Source
$html .= '<tr><td width="15%"><b>' . get_lang( $html .= '<tr><td width="15%"><b>'.get_lang(
'OriginCoursesFromSession' 'OriginCoursesFromSession'
) . ':</b></td>'; ).':</b></td>';
$html .= '<td width="10%" align="left">' . api_get_session_name( $html .= '<td width="10%" align="left">'.api_get_session_name(
$sessionId $sessionId
) . '</td>'; ).'</td>';
$html .= '<td width="50%">'; $html .= '<td width="50%">';
$html .= "{$courseInfo['title']} ({$courseInfo['code']})" . '</td></tr>'; $html .= "{$courseInfo['title']} ({$courseInfo['code']})".'</td></tr>';
// Destination // Destination
$html .= '<tr><td width="15%"><b>' . get_lang( $html .= '<tr><td width="15%"><b>'.get_lang(
'DestinationCoursesFromSession' 'DestinationCoursesFromSession'
) . ':</b></td>'; ).':</b></td>';
$html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">'; $html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_searchCourses(this.value,\'destination\');">'; $html .= '<select name="sessions_list_destination" onchange="javascript: xajax_searchCourses(this.value,\'destination\');">';
if (empty($sessions)) { if (empty($sessions)) {
$html .= '<option value = "0">' . get_lang( $html .= '<option value = "0">'.get_lang(
'ThereIsNotStillASession' 'ThereIsNotStillASession'
) . '</option>'; ).'</option>';
} else { } else {
$html .= '<option value = "0">' . get_lang( $html .= '<option value = "0">'.get_lang(
'SelectASession' 'SelectASession'
) . '</option>'; ).'</option>';
foreach ($sessions as $session) { foreach ($sessions as $session) {
if ($session['id'] == $sessionId) { if ($session['id'] == $sessionId) {
continue; continue;
@ -166,7 +166,7 @@ function displayForm()
continue; continue;
} }
$html .= '<option value="' . $session['id'] . '">' . $session['name'] . '</option>'; $html .= '<option value="'.$session['id'].'">'.$session['name'].'</option>';
} }
} }
@ -178,17 +178,17 @@ function displayForm()
$html .= '</tr></table>'; $html .= '</tr></table>';
$html .= "<fieldset>"; $html .= "<fieldset>";
$html .= '<legend>' . get_lang('TypeOfCopy') . ' <small>(' . get_lang('CopyOnlySessionItems') . ')</small></legend>'; $html .= '<legend>'.get_lang('TypeOfCopy').' <small>('.get_lang('CopyOnlySessionItems').')</small></legend>';
$html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>'; $html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$html .= get_lang('FullCopy') . '</label>'; $html .= get_lang('FullCopy').'</label>';
$html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items"/>'; $html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items"/>';
$html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>'; $html .= ' '.get_lang('LetMeSelectItems').'</label><br/>';
$html .= "</fieldset>"; $html .= "</fieldset>";
$html .= '<button class="save" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes( $html .= '<button class="save" type="submit" onclick="javascript:if(!confirm('."'".addslashes(
api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES) api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)
) . "'" . ')) return false;">' . get_lang('CopyCourse') . '</button>'; )."'".')) return false;">'.get_lang('CopyCourse').'</button>';
$html .= '</form>'; $html .= '</form>';
echo $html; echo $html;
} }
@ -214,10 +214,10 @@ function searchCourses($idSession, $type)
$courseTitle = str_replace("'", "\'", $course['title']); $courseTitle = str_replace("'", "\'", $course['title']);
$return .= '<option value="' . $course['code'] . '" title="' . @htmlspecialchars( $return .= '<option value="'.$course['code'].'" title="'.@htmlspecialchars(
$course['title'] . ' (' . $course['visual_code'] . ')', ENT_QUOTES, api_get_system_encoding() $course['title'].' ('.$course['visual_code'].')', ENT_QUOTES, api_get_system_encoding()
) . '">' . ).'">'.
$course['title'] . ' (' . $course['visual_code'] . ')</option>'; $course['title'].' ('.$course['visual_code'].')</option>';
} }
$return .= '</select>'; $return .= '</select>';
$_SESSION['course_list_destination'] = $course_list_destination; $_SESSION['course_list_destination'] = $course_list_destination;
@ -235,7 +235,7 @@ $xajax->processRequests();
/* HTML head extra */ /* HTML head extra */
$htmlHeadXtra[] = $xajax->getJavascript( $htmlHeadXtra[] = $xajax->getJavascript(
api_get_path(WEB_LIBRARY_PATH) . 'xajax/' api_get_path(WEB_LIBRARY_PATH).'xajax/'
); );
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
function checkSelected(id_select,id_radio,id_title,id_destination) { function checkSelected(id_select,id_radio,id_title,id_destination) {
@ -380,7 +380,7 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
CourseSelectForm :: display_form($course, $hiddenFields, true); CourseSelectForm :: display_form($course, $hiddenFields, true);
echo '<div style="float:right"><a href="javascript:window.history.go(-1);">' . echo '<div style="float:right"><a href="javascript:window.history.go(-1);">'.
Display::return_icon( Display::return_icon(
'back.png', 'back.png',
get_lang('Back').' '.get_lang('To').' '.get_lang( get_lang('Back').' '.get_lang('To').' '.get_lang(
@ -388,7 +388,7 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
), ),
array('style' => 'vertical-align:middle') array('style' => 'vertical-align:middle')
). ).
get_lang('Back') . '</a></div>'; get_lang('Back').'</a></div>';
} else { } else {
Display::display_error_message( Display::display_error_message(
get_lang('You must select a course from original session and select a destination session') get_lang('You must select a course from original session and select a destination session')

@ -18,7 +18,7 @@ header('Content-Type: text/html; charset=UTF-8');
$file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php'); $file = file(api_get_path(SYS_LANG_PATH).'english/hotspot.inc.php');
foreach ($file as &$value) { foreach ($file as &$value) {
$variable = explode('=', $value , 2); $variable = explode('=', $value, 2);
if (count($variable) > 1) { if (count($variable) > 1) {
$variable = substr(trim($variable[0]), 1); $variable = substr(trim($variable[0]), 1);
$variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' '; $variable = '&'.$variable.'='.api_utf8_encode(get_lang($variable)).' ';

@ -33,13 +33,13 @@ if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
} }
//round-up the coordinates //round-up the coordinates
$coords = explode('/',$coordinates); $coords = explode('/', $coordinates);
$coordinates = ''; $coordinates = '';
foreach ($coords as $coord) { foreach ($coords as $coord) {
list($x,$y) = explode(';',$coord); list($x, $y) = explode(';', $coord);
$coordinates .= round($x).';'.round($y).'/'; $coordinates .= round($x).';'.round($y).'/';
} }
$coordinates = substr($coordinates,0,-1); $coordinates = substr($coordinates, 0, -1);
$TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT); $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);

@ -19,8 +19,8 @@ if (!api_is_allowed_to_edit(null, true)) {
} }
// the breadcrumbs // the breadcrumbs
$interbreadcrumb[]= array ( $interbreadcrumb[] = array(
"url" => api_get_path(WEB_CODE_PATH) . "exercise/exercise.php?".api_get_cidreq(), "url" => api_get_path(WEB_CODE_PATH)."exercise/exercise.php?".api_get_cidreq(),
"name" => get_lang('Exercises') "name" => get_lang('Exercises')
); );
$is_allowedToEdit = api_is_allowed_to_edit(null, true); $is_allowedToEdit = api_is_allowed_to_edit(null, true);
@ -32,7 +32,7 @@ function ch_qti2_display_form()
{ {
$name_tools = get_lang('ImportQtiQuiz'); $name_tools = get_lang('ImportQtiQuiz');
$form = '<div class="actions">'; $form = '<div class="actions">';
$form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercise/exercise.php?show=test&'.api_get_cidreq().'">'. $form .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?show=test&'.api_get_cidreq().'">'.
Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
$form .= '</div>'; $form .= '</div>';
$formValidator = new FormValidator( $formValidator = new FormValidator(
@ -83,7 +83,7 @@ if ((api_is_allowed_to_edit(null, true))) {
$imported = ch_qti2_import_file($_FILES['userFile']); $imported = ch_qti2_import_file($_FILES['userFile']);
if (is_numeric($imported) && !empty($imported)) { if (is_numeric($imported) && !empty($imported)) {
header('Location: '.api_get_path(WEB_CODE_PATH) . 'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported); header('Location: '.api_get_path(WEB_CODE_PATH).'exercise/admin.php?'.api_get_cidreq().'&exerciseId='.$imported);
exit; exit;
} else { } else {
$message = Display::return_message(get_lang($imported)); $message = Display::return_message(get_lang($imported));

@ -46,14 +46,14 @@ class DatePicker extends HTML_QuickForm_text
return ' return '
<div class="input-group"> <div class="input-group">
<span class="input-group-addon cursor-pointer"> <span class="input-group-addon cursor-pointer">
<input ' . $this->_getAttrString($this->_attributes) . '> <input ' . $this->_getAttrString($this->_attributes).'>
</span> </span>
<p class="form-control disabled" id="' . $id . '_alt_text">' . $value . '</p> <p class="form-control disabled" id="' . $id.'_alt_text">'.$value.'</p>
<input class="form-control" type="hidden" id="' . $id . '_alt" value="' . $value . '"> <input class="form-control" type="hidden" id="' . $id.'_alt" value="'.$value.'">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" type="button"> <button class="btn btn-default" type="button">
<span class="fa fa-times text-danger" aria-hidden="true"></span> <span class="fa fa-times text-danger" aria-hidden="true"></span>
<span class="sr-only">' . get_lang('Reset') . '</span> <span class="sr-only">' . get_lang('Reset').'</span>
</button> </button>
</span> </span>
</div> </div>
@ -92,14 +92,14 @@ class DatePicker extends HTML_QuickForm_text
txtDate txtDate
.hide() .hide()
.datepicker({ .datepicker({
defaultDate: '" . $this->getValue() . "', defaultDate: '".$this->getValue()."',
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
altField: '#{$id}_alt', altField: '#{$id}_alt',
altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
showOn: 'both', showOn: 'both',
buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
buttonImageOnly: true, buttonImageOnly: true,
buttonText: '" . get_lang('SelectDate') . "', buttonText: '" . get_lang('SelectDate')."',
changeMonth: true, changeMonth: true,
changeYear: true, changeYear: true,
yearRange: 'c-60y:c+5y' yearRange: 'c-60y:c+5y'

@ -33,17 +33,17 @@ function LoginCheck($uid)
$login_date = api_get_utc_datetime(); $login_date = api_get_utc_datetime();
$access_url_id = 1; $access_url_id = 1;
if (api_get_multiple_access_url() && api_get_current_access_url_id()!=-1) { if (api_get_multiple_access_url() && api_get_current_access_url_id() != -1) {
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
} }
$session_id = api_get_session_id(); $session_id = api_get_session_id();
// if the $_course array exists this means we are in a course and we have to store this in the who's online table also // if the $_course array exists this means we are in a course and we have to store this in the who's online table also
// to have the x users in this course feature working // to have the x users in this course feature working
if (is_array($_course) && count($_course)>0 && !empty($_course['id'])) { if (is_array($_course) && count($_course) > 0 && !empty($_course['id'])) {
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id) $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )"; VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )";
} else { } else {
$query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id) $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
VALUES ($uid,$uid,'$login_date','$user_ip', 0, '$session_id', '$access_url_id')"; VALUES ($uid,$uid,'$login_date','$user_ip', 0, '$session_id', '$access_url_id')";
} }
Database::query($query); Database::query($query);
@ -117,7 +117,7 @@ function online_logout($user_id = null, $logout_redirect = false)
ORDER BY login_date DESC ORDER BY login_date DESC
LIMIT 0,1"; LIMIT 0,1";
$q_last_connection = Database::query($sql); $q_last_connection = Database::query($sql);
if (Database::num_rows($q_last_connection)>0) { if (Database::num_rows($q_last_connection) > 0) {
$i_id_last_connection = Database::result($q_last_connection, 0, "login_id"); $i_id_last_connection = Database::result($q_last_connection, 0, "login_id");
} }
@ -167,7 +167,7 @@ function LoginDelete($user_id)
{ {
$online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$user_id = intval($user_id); $user_id = intval($user_id);
$query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id"; $query = "DELETE FROM ".$online_table." WHERE login_user_id = $user_id";
Database::query($query); Database::query($query);
} }
@ -248,7 +248,7 @@ function who_is_online($from, $number_of_items, $column = null, $direction = nul
$current_date = api_get_utc_datetime($online_time); $current_date = api_get_utc_datetime($online_time);
$track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE); $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER); $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
if ($friends) { if ($friends) {
// who friends from social network is online // who friends from social network is online
@ -264,8 +264,8 @@ function who_is_online($from, $number_of_items, $column = null, $direction = nul
LIMIT $from, $number_of_items"; LIMIT $from, $number_of_items";
} else { } else {
$query = "SELECT DISTINCT login_user_id, login_date $query = "SELECT DISTINCT login_user_id, login_date
FROM ".$track_online_table ." e FROM ".$track_online_table." e
INNER JOIN ".$table_user ." u ON (u.id = e.login_user_id) INNER JOIN ".$table_user." u ON (u.id = e.login_user_id)
WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."' WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."'
ORDER BY $column $direction ORDER BY $column $direction
LIMIT $from, $number_of_items"; LIMIT $from, $number_of_items";
@ -288,8 +288,8 @@ function who_is_online($from, $number_of_items, $column = null, $direction = nul
} else { } else {
// all users online // all users online
$query = "SELECT login_user_id, login_date $query = "SELECT login_user_id, login_date
FROM ".$track_online_table ." track FROM ".$track_online_table." track
INNER JOIN ".$table_user ." u INNER JOIN ".$table_user." u
ON (u.id=track.login_user_id) ON (u.id=track.login_user_id)
WHERE u.status != ".ANONYMOUS." AND track.access_url_id = $access_url_id AND WHERE u.status != ".ANONYMOUS." AND track.access_url_id = $access_url_id AND
login_date >= '".$current_date."' login_date >= '".$current_date."'
@ -427,7 +427,7 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit
if ($result) { if ($result) {
$users_online = array(); $users_online = array();
while(list($login_user_id, $login_date) = Database::fetch_row($result)) { while (list($login_user_id, $login_date) = Database::fetch_row($result)) {
$users_online[] = $login_user_id; $users_online[] = $login_user_id;
} }
return $users_online; return $users_online;
@ -436,7 +436,7 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit
} }
} }
function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null) function who_is_online_in_this_course_count($uid, $time_limit, $coursecode = null)
{ {
if (empty($coursecode)) { if (empty($coursecode)) {
return false; return false;

@ -33,7 +33,7 @@ class PDF
/* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
* mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]]) * mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
*/ */
if (!in_array($orientation, array('P','L'))) { if (!in_array($orientation, array('P', 'L'))) {
$orientation = 'P'; $orientation = 'P';
} }
//left, right, top, bottom, margin_header, margin footer //left, right, top, bottom, margin_header, margin footer
@ -105,7 +105,7 @@ class PDF
$visualTheme = api_get_visual_theme(); $visualTheme = api_get_visual_theme();
$img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png'; $img = api_get_path(SYS_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
if (file_exists($img)) { if (file_exists($img)) {
$img = api_get_path(WEB_CSS_PATH) . 'themes/' . $visualTheme . '/images/pdf_logo_header.png'; $img = api_get_path(WEB_CSS_PATH).'themes/'.$visualTheme.'/images/pdf_logo_header.png';
$organization = "<img src='$img'>"; $organization = "<img src='$img'>";
} }
} }
@ -242,7 +242,7 @@ class PDF
// then print the title in the PDF // then print the title in the PDF
if (is_array($file) && isset($file['title'])) { if (is_array($file) && isset($file['title'])) {
$html_title = $file['title']; $html_title = $file['title'];
$file = $file['path']; $file = $file['path'];
} else { } else {
//we suppose we've only been sent a file path //we suppose we've only been sent a file path
$html_title = basename($file); $html_title = basename($file);
@ -272,7 +272,7 @@ class PDF
//it's not a chapter but the file exists, print its title //it's not a chapter but the file exists, print its title
if ($print_title) { if ($print_title) {
$this->pdf->WriteHTML( $this->pdf->WriteHTML(
'<html><body><h3>' . $html_title . '</h3></body></html>' '<html><body><h3>'.$html_title.'</h3></body></html>'
); );
} }
@ -298,7 +298,7 @@ class PDF
$document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html); $document_html = str_replace('href="./css/frames.css"', $absolute_css_path, $document_html);
if (!empty($course_data['path'])) { if (!empty($course_data['path'])) {
$document_html= str_replace('../', '', $document_html); $document_html = str_replace('../', '', $document_html);
$document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/'; $document_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document/';
$doc = new DOMDocument(); $doc = new DOMDocument();
@ -375,7 +375,7 @@ class PDF
if (!empty($document_html)) { if (!empty($document_html)) {
$this->pdf->WriteHTML($document_html.$page_break); $this->pdf->WriteHTML($document_html.$page_break);
} }
} elseif (in_array($extension, array('jpg','jpeg','png','gif'))) { } elseif (in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) {
//Images //Images
$image = Display::img($file); $image = Display::img($file);
$this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break); $this->pdf->WriteHTML('<html><body>'.$image.'</body></html>'.$page_break);
@ -438,7 +438,7 @@ class PDF
//absolute path for frames.css //TODO: necessary? //absolute path for frames.css //TODO: necessary?
$absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css'; $absolute_css_path = api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/frames.css';
$document_html = str_replace('href="./css/frames.css"','href="'.$absolute_css_path.'"', $document_html); $document_html = str_replace('href="./css/frames.css"', 'href="'.$absolute_css_path.'"', $document_html);
$document_html = str_replace('../../', '', $document_html); $document_html = str_replace('../../', '', $document_html);
$document_html = str_replace('../', '', $document_html); $document_html = str_replace('../', '', $document_html);
@ -466,7 +466,7 @@ class PDF
$old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src); $old_src_fixed = str_replace(api_get_path(REL_COURSE_PATH).$course_data['path'].'/document/', '', $old_src);
$old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed); $old_src_fixed = str_replace('courses/'.$course_data['path'].'/document/', '', $old_src_fixed);
$new_path = $document_path.$old_src_fixed; $new_path = $document_path.$old_src_fixed;
$document_html= str_replace($old_src, $new_path, $document_html); $document_html = str_replace($old_src, $new_path, $document_html);
} }
} }
@ -485,7 +485,7 @@ class PDF
//$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates //$document_html= str_replace('temp_template_path', 'src="/main/default_course_document/', $document_html);// restore src templates
api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data. api_set_encoding_html($document_html, 'UTF-8'); // The library mPDF expects UTF-8 encoded input data.
$title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through $title = api_get_title_html($document_html, 'UTF-8', 'UTF-8'); // TODO: Maybe it is better idea the title to be passed through
// $_GET[] too, as it is done with file name. // $_GET[] too, as it is done with file name.
// At the moment the title is retrieved from the html document itself. // At the moment the title is retrieved from the html document itself.
@ -507,7 +507,7 @@ class PDF
//$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file //$this->pdf->Output($output_file, $outputMode); // F to save the pdf in a file
if ($outputMode == 'F') { if ($outputMode == 'F') {
$output_file = api_get_path(SYS_ARCHIVE_PATH) . $output_file; $output_file = api_get_path(SYS_ARCHIVE_PATH).$output_file;
} }
if ($saveInFile) { if ($saveInFile) {
@ -540,12 +540,12 @@ class PDF
$web_path = false; $web_path = false;
if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path
if (file_exists($store_path)) { if (file_exists($store_path)) {
$web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png'; $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/'.api_get_current_access_url_id().'_pdf_watermark.png';
} }
} else { } else {
$store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; // course path
if (file_exists($store_path)) if (file_exists($store_path))
$web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
} }
@ -586,10 +586,10 @@ class PDF
{ {
if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') { if (!empty($course_code) && api_get_setting('pdf_export_watermark_by_course') == 'true') {
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; // course path
$web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png'; $web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/pdf_watermark.png';
} else { } else {
$store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path $store_path = api_get_path(SYS_CODE_PATH).'default_course_document/images'; // course path
$web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png'; $web_path = api_get_path(WEB_CODE_PATH).'default_course_document/images/'.api_get_current_access_url_id().'_pdf_watermark.png';
} }
$course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png'; $course_image = $store_path.'/'.api_get_current_access_url_id().'_pdf_watermark.png';
@ -640,9 +640,9 @@ class PDF
*/ */
public function set_header($course_data) public function set_header($course_data)
{ {
$this->pdf->defaultheaderfontsize = 10; // in pts $this->pdf->defaultheaderfontsize = 10; // in pts
$this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI $this->pdf->defaultheaderfontstyle = 'BI'; // blank, B, I, or BI
$this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer $this->pdf->defaultheaderline = 1; // 1 to include line below header/above footer
if (!empty($course_data['code'])) { if (!empty($course_data['code'])) {
$teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']); $teacher_list = CourseManager::get_teacher_list_from_course_code($course_data['code']);
@ -650,7 +650,7 @@ class PDF
$teachers = ''; $teachers = '';
if (!empty($teacher_list)) { if (!empty($teacher_list)) {
foreach ($teacher_list as $teacher) { foreach ($teacher_list as $teacher) {
$teachers[]= $teacher['firstname'].' '.$teacher['lastname']; $teachers[] = $teacher['firstname'].' '.$teacher['lastname'];
} }
if (count($teachers) > 1) { if (count($teachers) > 1) {
$teachers = get_lang('Teachers').': '.implode(', ', $teachers); $teachers = get_lang('Teachers').': '.implode(', ', $teachers);
@ -717,7 +717,7 @@ class PDF
'line' => 1, 'line' => 1,
), ),
); );
$this->pdf->SetHeader($header);// ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title); $this->pdf->SetHeader($header); // ('{DATE j-m-Y}|{PAGENO}/{nb}|'.$title);
} }
} }
@ -762,7 +762,7 @@ class PDF
$this->pdf->directionality = api_get_text_direction(); $this->pdf->directionality = api_get_text_direction();
$this->pdf->useOnlyCoreFonts = true; $this->pdf->useOnlyCoreFonts = true;
// Use different Odd/Even headers and footers and mirror margins // Use different Odd/Even headers and footers and mirror margins
$this->pdf->mirrorMargins = 1; $this->pdf->mirrorMargins = 1;
// Add decoration only if not stated otherwise // Add decoration only if not stated otherwise
if ($complete) { if ($complete) {

@ -217,7 +217,7 @@ class SortableTable extends HTML_Table
$params['spacesBeforeSeparator'] = ''; $params['spacesBeforeSeparator'] = '';
$params['spacesAfterSeparator'] = ''; $params['spacesAfterSeparator'] = '';
$query_vars = array_keys($_GET); $query_vars = array_keys($_GET);
$query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
if (count($this->additional_parameters) > 0) { if (count($this->additional_parameters) > 0) {
$query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters)); $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters));
} }
@ -287,7 +287,7 @@ class SortableTable extends HTML_Table
if (!$empty_table) { if (!$empty_table) {
if (!empty($this->additional_parameters)) { if (!empty($this->additional_parameters)) {
foreach($this->additional_parameters as $key => $value) { foreach ($this->additional_parameters as $key => $value) {
$html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />'; $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />';
} }
} }
@ -312,7 +312,7 @@ class SortableTable extends HTML_Table
$html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>'; $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
} }
$html .= '</ul>'; $html .= '</ul>';
$html .= '</div>';//btn-group $html .= '</div>'; //btn-group
$html .= '</div>'; //toolbar $html .= '</div>'; //toolbar
} else { } else {
$html .= $form; $html .= $form;
@ -336,7 +336,7 @@ class SortableTable extends HTML_Table
} }
} }
return '<div class="table-responsive">' . $html . '</div>'; return '<div class="table-responsive">'.$html.'</div>';
} }
/** /**
@ -390,7 +390,7 @@ class SortableTable extends HTML_Table
$html .= '<div class="clear"></div>'; $html .= '<div class="clear"></div>';
if (count($this->form_actions) > 0) { if (count($this->form_actions) > 0) {
$script= '<script> $script = '<script>
/*<![CDATA[*/ /*<![CDATA[*/
function setCheckbox(value) { function setCheckbox(value) {
d = document.form_'.$this->table_name.'; d = document.form_'.$this->table_name.';
@ -412,7 +412,7 @@ class SortableTable extends HTML_Table
} }
} }
// Getting the items of the table // Getting the items of the table
$items = $this->get_clean_html(false); //no sort $items = $this->get_clean_html(false); //no sort
// Generation of style classes must be improved. Maybe we need a a table name to create style on the fly: // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly:
// i.e: .whoisonline_table_grid_container instead of .grid_container // i.e: .whoisonline_table_grid_container instead of .grid_container
@ -480,7 +480,7 @@ class SortableTable extends HTML_Table
$html .= '<div class="clear"></div>'; $html .= '<div class="clear"></div>';
if (count($this->form_actions) > 0) { if (count($this->form_actions) > 0) {
$script= '<script> $script = '<script>
/*<![CDATA[*/ /*<![CDATA[*/
function setCheckbox(value) { function setCheckbox(value) {
d = document.form_'.$this->table_name.'; d = document.form_'.$this->table_name.';
@ -588,7 +588,7 @@ class SortableTable extends HTML_Table
$counter = 0; $counter = 0;
foreach ($row as $index => $rowInfo) { foreach ($row as $index => $rowInfo) {
if (!isset($this->columnsToHide[$index])) { if (!isset($this->columnsToHide[$index])) {
$newRow[$counter] = $rowInfo ; $newRow[$counter] = $rowInfo;
$counter++; $counter++;
} }
} }
@ -603,7 +603,7 @@ class SortableTable extends HTML_Table
} }
if ($this->odd_even_rows_enabled == true) { if ($this->odd_even_rows_enabled == true) {
$this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true); $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true);
} }
foreach ($this->th_attributes as $column => $attributes) { foreach ($this->th_attributes as $column => $attributes) {
@ -665,11 +665,11 @@ class SortableTable extends HTML_Table
} }
$result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">'; $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">';
for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) { for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) {
$result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>'; $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
} }
// @todo no limits // @todo no limits
//if ($total_number_of_items < 500) { //if ($total_number_of_items < 500) {
$result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>'; $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
//} //}
$result[] = '</select>'; $result[] = '</select>';
$result[] = '<noscript>'; $result[] = '<noscript>';
@ -787,7 +787,7 @@ class SortableTable extends HTML_Table
*/ */
public function get_additional_url_paramstring() public function get_additional_url_paramstring()
{ {
$param_string_parts = array (); $param_string_parts = array();
if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) { if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) {
foreach ($this->additional_parameters as $key => & $value) { foreach ($this->additional_parameters as $key => & $value) {
$param_string_parts[] = urlencode($key).'='.urlencode($value); $param_string_parts[] = urlencode($key).'='.urlencode($value);
@ -800,7 +800,7 @@ class SortableTable extends HTML_Table
//$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
$my_get_direction = $_GET[$tablename.'_direction']; $my_get_direction = $_GET[$tablename.'_direction'];
if (!in_array($my_get_direction, array('ASC', 'DESC'))) { if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
$param[$tablename.'_direction'] = 'ASC'; $param[$tablename.'_direction'] = 'ASC';
} else { } else {
$param[$tablename.'_direction'] = $my_get_direction; $param[$tablename.'_direction'] = $my_get_direction;
} }
@ -814,7 +814,7 @@ class SortableTable extends HTML_Table
if (isset($_GET[$tablename.'_column'])) { if (isset($_GET[$tablename.'_column'])) {
$param[$tablename.'_column'] = intval($_GET[$tablename.'_column']); $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']);
} }
$param_string_parts = array (); $param_string_parts = array();
foreach ($param as $key => & $value) { foreach ($param as $key => & $value) {
$param_string_parts[] = urlencode($key).'='.urlencode($value); $param_string_parts[] = urlencode($key).'='.urlencode($value);
} }
@ -835,7 +835,7 @@ class SortableTable extends HTML_Table
$param[$this->param_prefix.'page_nr'] = $this->page_nr; $param[$this->param_prefix.'page_nr'] = $this->page_nr;
$param[$this->param_prefix.'per_page'] = $this->per_page; $param[$this->param_prefix.'per_page'] = $this->per_page;
$param[$this->param_prefix.'column'] = $this->column; $param[$this->param_prefix.'column'] = $this->column;
$param_string_parts = array (); $param_string_parts = array();
foreach ($param as $key => & $value) { foreach ($param as $key => & $value) {
$param_string_parts[] = urlencode($key).'='.urlencode($value); $param_string_parts[] = urlencode($key).'='.urlencode($value);
} }

@ -19,7 +19,7 @@ echo '<form action="tutor.php" name="assign" id ="assign">';
echo '<div id="confirmation"></div>'; echo '<div id="confirmation"></div>';
$id = intval($_GET['id']); $id = intval($_GET['id']);
$tblWeeklyReport = Database::get_main_table('rp_reporte_semanas'); $tblWeeklyReport = Database::get_main_table('rp_reporte_semanas');
$sql ="SELECT * FROM $tblWeeklyReport WHERE id = '$id'"; $sql = "SELECT * FROM $tblWeeklyReport WHERE id = '$id'";
$sql_tasks = "SELECT id AS colid, title as coltitle $sql_tasks = "SELECT id AS colid, title as coltitle
FROM ".Database::get_course_table(TABLE_STUDENT_PUBLICATION)." FROM ".Database::get_course_table(TABLE_STUDENT_PUBLICATION)."
WHERE parent_id = 0 WHERE parent_id = 0
@ -44,28 +44,28 @@ $result_tareas = Database::query($sql_tasks);
$result_forum = Database::query($sql_forum); $result_forum = Database::query($sql_forum);
echo '<div class="row"> echo '<div class="row">
<input type="hidden" id="rs_id" name ="rs_id" value="' . $id . '"> <input type="hidden" id="rs_id" name ="rs_id" value="' . $id.'">
<div class="formw">' . get_lang('PleaseSelectTasks') . '</div> <div class="formw">' . get_lang('PleaseSelectTasks').'</div>
</div>'; </div>';
echo '<div class="row"><div class="formw"><select name ="work_id" id="work_id">'; echo '<div class="row"><div class="formw"><select name ="work_id" id="work_id">';
echo '<option value="0"' . (($row['colid'] == $rs->work_id) ? "selected" : "") . '>' . get_lang('PleaseSelect') . '</option>'; echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.get_lang('PleaseSelect').'</option>';
while ($row = Database::fetch_assoc($result_tasks)) { while ($row = Database::fetch_assoc($result_tasks)) {
echo '<option value="' . $row['colid'] . '"' . (($row['colid'] == $rs->work_id) ? "selected" : "") . '>' . $row['coltitle'] . '</option>'; echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.$row['coltitle'].'</option>';
} }
echo '</select></div><div>'; echo '</select></div><div>';
echo '<div class="row"> echo '<div class="row">
<div class="formw">' . get_lang('PleaseSelectThread') . '</div> <div class="formw">' . get_lang('PleaseSelectThread').'</div>
</div>'; </div>';
echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">'; echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">';
echo '<option value="0"' . (($row['colid'] == $rs->work_id) ? "forum_id" : "") . '>' . get_lang('PleaseSelect') . '</option>'; echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "forum_id" : "").'>'.get_lang('PleaseSelect').'</option>';
while ($row = Database::fetch_assoc($result_forum)) { while ($row = Database::fetch_assoc($result_forum)) {
echo '<option value="' . $row['colid'] . '"' . (($row['colid'] == $rs->forum_id) ? "selected" : "") . '>' . $row['coltitle'] . '</option>'; echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->forum_id) ? "selected" : "").'>'.$row['coltitle'].'</option>';
} }
echo '</select></div><div>'; echo '</select></div><div>';
echo '<div class="row"> echo '<div class="row">
<div class="formw"> <div class="formw">
<button class="save" name="edit" type="button" value="' . get_lang('Edit') . '" onClick="save(' . "$id" . ');">' . <button class="save" name="edit" type="button" value="' . get_lang('Edit').'" onClick="save('."$id".');">'.
get_lang('Edit') . '</button> get_lang('Edit').'</button>
</div> </div>
</div>'; </div>';
echo '</form>'; echo '</form>';

@ -65,7 +65,7 @@ function WSHelperVerifyKey($params)
} }
if ($debug) { if ($debug) {
error_log("checkip " . intval($check_ip)); error_log("checkip ".intval($check_ip));
} }
if ($check_ip) { if ($check_ip) {
@ -120,13 +120,13 @@ $server->wsdl->addComplexType(
); );
// Register the method to expose // Register the method to expose
$server->register('WSImportLP', // method name $server->register('WSImportLP', // method name
array('params' => 'tns:params'), // input parameters array('params' => 'tns:params'), // input parameters
array('return' => 'xsd:string'), // output parameters array('return' => 'xsd:string'), // output parameters
'urn:WSLP', // namespace 'urn:WSLP', // namespace
'urn:WSLP#WSImportLP', // soapaction 'urn:WSLP#WSImportLP', // soapaction
'rpc', // style 'rpc', // style
'encoded', // use 'encoded', // use
'This service adds users' // documentation 'This service adds users' // documentation
); );
@ -183,7 +183,7 @@ function WSImportLP($params)
$uniqueFile = uniqid(); $uniqueFile = uniqid();
$userId = 1; // admin $userId = 1; // admin
$filePath = api_get_path(SYS_ARCHIVE_PATH) . $uniqueFile; $filePath = api_get_path(SYS_ARCHIVE_PATH).$uniqueFile;
file_put_contents($filePath, $fileData); file_put_contents($filePath, $fileData);
$fileName = $params['filename']; $fileName = $params['filename'];
@ -256,8 +256,8 @@ $server->wsdl->addComplexType(
'all', 'all',
'', '',
array( array(
'id' => array('name' => 'id', 'type' => 'xsd:string'), 'id' => array('name' => 'id', 'type' => 'xsd:string'),
'name' => array('name' => 'name', 'type' => 'xsd:string'), 'name' => array('name' => 'name', 'type' => 'xsd:string'),
) )
); );
@ -273,13 +273,13 @@ $server->wsdl->addComplexType(
); );
// Register the method to expose // Register the method to expose
$server->register('WSGetLpList', // method name $server->register('WSGetLpList', // method name
array('params' => 'tns:paramsGetLpList'), // input parameters array('params' => 'tns:paramsGetLpList'), // input parameters
array('return' => 'tns:lpList'), // output parameters array('return' => 'tns:lpList'), // output parameters
'urn:WSLP', // namespace 'urn:WSLP', // namespace
'urn:WSLP#WSGetLpList', // soapaction 'urn:WSLP#WSGetLpList', // soapaction
'rpc', // style 'rpc', // style
'encoded', // use 'encoded', // use
'This service adds users' // documentation 'This service adds users' // documentation
); );
@ -294,9 +294,9 @@ function WSGetLpList($params)
return return_error(WS_ERROR_SECRET_KEY); return return_error(WS_ERROR_SECRET_KEY);
} }
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php';
$courseIdName = $params['course_id_name']; $courseIdName = $params['course_id_name'];
$courseIdValue = $params['course_id_value']; $courseIdValue = $params['course_id_value'];
@ -368,13 +368,13 @@ $server->wsdl->addComplexType(
); );
// Register the method to expose // Register the method to expose
$server->register('WSDeleteLp', // method name $server->register('WSDeleteLp', // method name
array('params' => 'tns:paramsDeleteLp'), // input parameters array('params' => 'tns:paramsDeleteLp'), // input parameters
array('return' => 'xsd:string'), // output parameters array('return' => 'xsd:string'), // output parameters
'urn:WSLP', // namespace 'urn:WSLP', // namespace
'urn:WSLP#WSDeleteLp', // soapaction 'urn:WSLP#WSDeleteLp', // soapaction
'rpc', // style 'rpc', // style
'encoded', // use 'encoded', // use
'This service deletes a LP' // documentation 'This service deletes a LP' // documentation
); );
@ -389,9 +389,9 @@ function WSDeleteLp($params)
return return_error(WS_ERROR_SECRET_KEY); return return_error(WS_ERROR_SECRET_KEY);
} }
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php';
$courseIdName = $params['course_id_name']; $courseIdName = $params['course_id_name'];
$courseIdValue = $params['course_id_value']; $courseIdValue = $params['course_id_value'];
@ -433,9 +433,9 @@ function WSDeleteLp($params)
if ($lp) { if ($lp) {
if ($debug) error_log("LP deleted $lpId"); if ($debug) error_log("LP deleted $lpId");
$course_dir = $courseInfo['directory'] . '/document'; $course_dir = $courseInfo['directory'].'/document';
$sys_course_path = api_get_path(SYS_COURSE_PATH); $sys_course_path = api_get_path(SYS_COURSE_PATH);
$base_work_dir = $sys_course_path . $course_dir; $base_work_dir = $sys_course_path.$course_dir;
$items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId); $items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId);
@ -494,9 +494,9 @@ $server->wsdl->addComplexType(
'all', 'all',
'', '',
array( array(
'data' => array('name' => 'data', 'type' => 'xsd:string'), 'data' => array('name' => 'data', 'type' => 'xsd:string'),
'title' => array('name' => 'title', 'type' => 'xsd:string'), 'title' => array('name' => 'title', 'type' => 'xsd:string'),
'filename' => array('name' => 'filename', 'type' => 'xsd:string'), 'filename' => array('name' => 'filename', 'type' => 'xsd:string'),
) )
); );
@ -547,13 +547,13 @@ $server->wsdl->addComplexType(
); );
// Register the method to expose // Register the method to expose
$server->register('WSCreateLp', // method name $server->register('WSCreateLp', // method name
array('params' => 'tns:paramsCreateLp'), // input parameters array('params' => 'tns:paramsCreateLp'), // input parameters
array('return' => 'xsd:string'), // output parameters array('return' => 'xsd:string'), // output parameters
'urn:WSLP', // namespace 'urn:WSLP', // namespace
'urn:WSLP#WSCreateLp', // soapaction 'urn:WSLP#WSCreateLp', // soapaction
'rpc', // style 'rpc', // style
'encoded', // use 'encoded', // use
'This service creates a LP' // documentation 'This service creates a LP' // documentation
); );

@ -26,7 +26,7 @@ if (isset($_GET['action'], $_GET['id'])) {
Display::return_message(get_lang('ItemRemoved'), 'success') Display::return_message(get_lang('ItemRemoved'), 'success')
); );
header('Location: ' . api_get_self()); header('Location: '.api_get_self());
exit; exit;
} }
} }
@ -44,7 +44,7 @@ if ($currencyForm->validate()) {
Display::return_message(get_lang('Saved'), 'success') Display::return_message(get_lang('Saved'), 'success')
); );
header('Location:' . api_get_self()); header('Location:'.api_get_self());
exit; exit;
} }
@ -76,7 +76,7 @@ foreach ($currencies as $currency) {
} }
} }
$currencyForm->addTextarea('terms_and_conditions', [ get_lang('TermsAndConditions'), $plugin->get_lang('WriteHereTheTermsAndConditionsOfYourECommerce') ], ''); $currencyForm->addTextarea('terms_and_conditions', [get_lang('TermsAndConditions'), $plugin->get_lang('WriteHereTheTermsAndConditionsOfYourECommerce')], '');
$currencyForm->addButtonSave(get_lang('Save')); $currencyForm->addButtonSave(get_lang('Save'));
$currencyForm->setDefaults($plugin->getGlobalParameters()); $currencyForm->setDefaults($plugin->getGlobalParameters());
@ -93,7 +93,7 @@ if ($paypalForm->validate()) {
Display::return_message(get_lang('Saved'), 'success') Display::return_message(get_lang('Saved'), 'success')
); );
header('Location:' . api_get_self()); header('Location:'.api_get_self());
exit; exit;
} }
@ -132,7 +132,7 @@ if ($commissionForm->validate()) {
Display::return_message(get_lang('Saved'), 'success') Display::return_message(get_lang('Saved'), 'success')
); );
header('Location:' . api_get_self()); header('Location:'.api_get_self());
exit; exit;
} }
@ -158,7 +158,7 @@ if ($transferForm->validate()) {
Display::return_message(get_lang('Saved'), 'success') Display::return_message(get_lang('Saved'), 'success')
); );
header('Location:' . api_get_self()); header('Location:'.api_get_self());
exit; exit;
} }
@ -197,7 +197,7 @@ if ($culqiForm->validate()) {
Display::return_message(get_lang('Saved'), 'success') Display::return_message(get_lang('Saved'), 'success')
); );
header('Location:' . api_get_self()); header('Location:'.api_get_self());
exit; exit;
} }
@ -219,7 +219,7 @@ $culqiForm->setDefaults($plugin->getCulqiParams());
// breadcrumbs // breadcrumbs
$interbreadcrumb[] = [ $interbreadcrumb[] = [
'url' => api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php', 'url' => api_get_path(WEB_PLUGIN_PATH).'buycourses/index.php',
'name' => $plugin->get_lang('plugin_title') 'name' => $plugin->get_lang('plugin_title')
]; ];

@ -7,7 +7,7 @@ $toolId = isset($_GET['id']) ? intval($_GET['id']) : 0;
if (empty($toolId)) { if (empty($toolId)) {
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'ims_lti/list.php'); header('Location: '.api_get_path(WEB_PLUGIN_PATH).'ims_lti/list.php');
exit; exit;
} }
@ -26,7 +26,7 @@ $htmlHeadXtra[] = '<link rel="stylesheet" href="../assets/css/style.css" type="t
$template = new Template($imsLtiPlugin->get_title()); $template = new Template($imsLtiPlugin->get_title());
$template->assign( $template->assign(
'launch_url', 'launch_url',
api_get_path(WEB_PLUGIN_PATH) . 'ims_lti/form.php?' . http_build_query(['id' => $tool->getId()]) api_get_path(WEB_PLUGIN_PATH).'ims_lti/form.php?'.http_build_query(['id' => $tool->getId()])
); );
$content = $template->fetch('ims_lti/view/start.tpl'); $content = $template->fetch('ims_lti/view/start.tpl');

@ -219,7 +219,7 @@ class CourseRestorer
$params['lastedit_date'] = self::DBUTF8($property['lastedit_date']); $params['lastedit_date'] = self::DBUTF8($property['lastedit_date']);
$params['ref'] = $resource->destination_id; $params['ref'] = $resource->destination_id;
$params['lastedit_type'] = self::DBUTF8($property['lastedit_type']); $params['lastedit_type'] = self::DBUTF8($property['lastedit_type']);
$params['lastedit_user_id'] = $this->checkUserId($property['lastedit_user_id']); $params['lastedit_user_id'] = $this->checkUserId($property['lastedit_user_id']);
$params['visibility'] = self::DBUTF8($property['visibility']); $params['visibility'] = self::DBUTF8($property['visibility']);
$params['start_visible'] = self::DBUTF8($property['start_visible']); $params['start_visible'] = self::DBUTF8($property['start_visible']);
$params['end_visible'] = self::DBUTF8($property['end_visible']); $params['end_visible'] = self::DBUTF8($property['end_visible']);
@ -587,7 +587,7 @@ class CourseRestorer
$new_file_name = $file_name_no_ext.'_'.$i.$ext; $new_file_name = $file_name_no_ext.'_'.$i.$ext;
$file_exists = file_exists($path.$new_file_name); $file_exists = file_exists($path.$new_file_name);
while ($file_exists) { while ($file_exists) {
$i ++; $i++;
$new_file_name = $file_name_no_ext.'_'.$i.$ext; $new_file_name = $file_name_no_ext.'_'.$i.$ext;
$file_exists = file_exists($path.$new_file_name); $file_exists = file_exists($path.$new_file_name);
} }
@ -631,9 +631,9 @@ class CourseRestorer
$new_base_path = $_SESSION['new_base_path']; $new_base_path = $_SESSION['new_base_path'];
} }
$dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png" $dest_document_path = $new_base_path.'/'.$document_path[2]; // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1/collaborative.png"
$basedir_dest_path = dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1" $basedir_dest_path = dirname($dest_document_path); // e.g: "/var/www/wiener/courses/CURSO4/document/carpeta1_1/subcarpeta1"
$base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document" $base_path_document = $course_path.$document_path[0]; // e.g: "/var/www/wiener/courses/CURSO4/document"
$path_title = '/'.$new_base_foldername.'/'.$document_path[2]; $path_title = '/'.$new_base_foldername.'/'.$document_path[2];
copy_folder_course_session( copy_folder_course_session(
@ -652,7 +652,7 @@ class CourseRestorer
// Replace old course code with the new destination code see BT#1985 // Replace old course code with the new destination code see BT#1985
if (file_exists($dest_document_path)) { if (file_exists($dest_document_path)) {
$file_info = pathinfo($dest_document_path); $file_info = pathinfo($dest_document_path);
if (in_array($file_info['extension'], array('html','htm'))) { if (in_array($file_info['extension'], array('html', 'htm'))) {
$content = file_get_contents($dest_document_path); $content = file_get_contents($dest_document_path);
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
@ -714,8 +714,8 @@ class CourseRestorer
//Replace old course code with the new destination code see BT#1985 //Replace old course code with the new destination code see BT#1985
if (file_exists($path.$new_file_name)) { if (file_exists($path.$new_file_name)) {
$file_info = pathinfo($path.$new_file_name); $file_info = pathinfo($path.$new_file_name);
if (in_array($file_info['extension'], array('html','htm'))) { if (in_array($file_info['extension'], array('html', 'htm'))) {
$content = file_get_contents($path.$new_file_name); $content = file_get_contents($path.$new_file_name);
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
@ -779,7 +779,7 @@ class CourseRestorer
// Replace old course code with the new destination code see BT#1985 // Replace old course code with the new destination code see BT#1985
if (file_exists($path.$new_file_name)) { if (file_exists($path.$new_file_name)) {
$file_info = pathinfo($path.$new_file_name); $file_info = pathinfo($path.$new_file_name);
if (in_array($file_info['extension'], array('html','htm'))) { if (in_array($file_info['extension'], array('html', 'htm'))) {
$content = file_get_contents($path.$new_file_name); $content = file_get_contents($path.$new_file_name);
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
@ -854,7 +854,7 @@ class CourseRestorer
// Replace old course code with the new destination code see BT#1985 // Replace old course code with the new destination code see BT#1985
if (file_exists($path.$document->path)) { if (file_exists($path.$document->path)) {
$file_info = pathinfo($path.$document->path); $file_info = pathinfo($path.$document->path);
if (isset($file_info['extension']) && in_array($file_info['extension'], array('html','htm'))) { if (isset($file_info['extension']) && in_array($file_info['extension'], array('html', 'htm'))) {
$content = file_get_contents($path.$document->path); $content = file_get_contents($path.$document->path);
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
@ -971,8 +971,8 @@ class CourseRestorer
case FILE_OVERWRITE: case FILE_OVERWRITE:
rmdirr($path.$document->path); rmdirr($path.$document->path);
copyDirTo( copyDirTo(
$this->course->backup_path . '/' . $document->path, $this->course->backup_path.'/'.$document->path,
$path . dirname($document->path), $path.dirname($document->path),
false false
); );
break; break;
@ -994,23 +994,23 @@ class CourseRestorer
$file_exists = file_exists($path.$new_file_name); $file_exists = file_exists($path.$new_file_name);
while ($file_exists) { while ($file_exists) {
$i ++; $i++;
$new_file_name = $file_name_no_ext.'_'.$i.$ext; $new_file_name = $file_name_no_ext.'_'.$i.$ext;
$file_exists = file_exists($path.$new_file_name); $file_exists = file_exists($path.$new_file_name);
} }
rename( rename(
$this->course->backup_path . '/' . $document->path, $this->course->backup_path.'/'.$document->path,
$this->course->backup_path . '/' . $new_file_name $this->course->backup_path.'/'.$new_file_name
); );
copyDirTo( copyDirTo(
$this->course->backup_path . '/' . $new_file_name, $this->course->backup_path.'/'.$new_file_name,
$path . dirname($new_file_name), $path.dirname($new_file_name),
false false
); );
rename( rename(
$this->course->backup_path . '/' . $new_file_name, $this->course->backup_path.'/'.$new_file_name,
$this->course->backup_path . '/' . $document->path $this->course->backup_path.'/'.$document->path
); );
break; break;
@ -1018,8 +1018,8 @@ class CourseRestorer
} else { } else {
// end if file exists // end if file exists
copyDirTo( copyDirTo(
$this->course->backup_path . '/' . $document->path, $this->course->backup_path.'/'.$document->path,
$path . dirname($document->path), $path.dirname($document->path),
false false
); );
} }
@ -1039,7 +1039,7 @@ class CourseRestorer
$table_forum = Database::get_course_table(TABLE_FORUM); $table_forum = Database::get_course_table(TABLE_FORUM);
$resources = $this->course->resources; $resources = $this->course->resources;
foreach ($resources[RESOURCE_FORUM] as $id => $forum) { foreach ($resources[RESOURCE_FORUM] as $id => $forum) {
$params = (array)$forum->obj; $params = (array) $forum->obj;
$cat_id = ''; $cat_id = '';
if (isset($this->course->resources[RESOURCE_FORUMCATEGORY]) && if (isset($this->course->resources[RESOURCE_FORUMCATEGORY]) &&
isset($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']])) { isset($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']])) {
@ -1092,13 +1092,13 @@ class CourseRestorer
foreach ($this->course->resources[RESOURCE_FORUMTOPIC] as $topic_id => $topic) { foreach ($this->course->resources[RESOURCE_FORUMTOPIC] as $topic_id => $topic) {
if ($topic->obj->forum_id == $id) { if ($topic->obj->forum_id == $id) {
$this->restore_topic($topic_id, $new_id, $sessionId); $this->restore_topic($topic_id, $new_id, $sessionId);
$forum_topics ++; $forum_topics++;
} }
} }
} }
if ($forum_topics > 0) { if ($forum_topics > 0) {
$sql = "UPDATE ".$table_forum." SET forum_threads = ".$forum_topics." $sql = "UPDATE ".$table_forum." SET forum_threads = ".$forum_topics."
WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int)$new_id; WHERE c_id = {$this->destination_course_id} AND forum_id = ".(int) $new_id;
Database::query($sql); Database::query($sql);
} }
} }
@ -1160,7 +1160,7 @@ class CourseRestorer
$table = Database::get_course_table(TABLE_FORUM_THREAD); $table = Database::get_course_table(TABLE_FORUM_THREAD);
$topic = $this->course->resources[RESOURCE_FORUMTOPIC][$thread_id]; $topic = $this->course->resources[RESOURCE_FORUMTOPIC][$thread_id];
$params = (array)$topic->obj; $params = (array) $topic->obj;
$params = self::DBUTF8_array($params); $params = self::DBUTF8_array($params);
$params['c_id'] = $this->destination_course_id; $params['c_id'] = $this->destination_course_id;
$params['forum_id'] = $forum_id; $params['forum_id'] = $forum_id;
@ -1274,7 +1274,7 @@ class CourseRestorer
FROM $link_table FROM $link_table
WHERE WHERE
c_id = ".$this->destination_course_id." AND c_id = ".$this->destination_course_id." AND
category_id='" . intval($cat_id). "'"; category_id='" . intval($cat_id)."'";
$result = Database::query($sql); $result = Database::query($sql);
list($max_order) = Database::fetch_array($result); list($max_order) = Database::fetch_array($result);
@ -1289,7 +1289,7 @@ class CourseRestorer
$params['description'] = self::DBUTF8($link->description); $params['description'] = self::DBUTF8($link->description);
$params['category_id'] = $cat_id; $params['category_id'] = $cat_id;
$params['on_homepage'] = $link->on_homepage; $params['on_homepage'] = $link->on_homepage;
$params['display_order'] = $max_order+1; $params['display_order'] = $max_order + 1;
$id = Database::insert($link_table, $params); $id = Database::insert($link_table, $params);
@ -1712,7 +1712,7 @@ class CourseRestorer
$this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]->is_restored()) { $this->course->resources[RESOURCE_DOCUMENT][$quiz->sound]->is_restored()) {
$sql = "SELECT path FROM $table_doc $sql = "SELECT path FROM $table_doc
WHERE WHERE
c_id = " . $this->destination_course_id . " AND c_id = ".$this->destination_course_id." AND
id = " . $resources[RESOURCE_DOCUMENT][$quiz->sound]->destination_id; id = " . $resources[RESOURCE_DOCUMENT][$quiz->sound]->destination_id;
$doc = Database::query($sql); $doc = Database::query($sql);
$doc = Database::fetch_object($doc); $doc = Database::fetch_object($doc);
@ -1749,17 +1749,17 @@ class CourseRestorer
'random' => $quiz->random, 'random' => $quiz->random,
'active' => $quiz->active, 'active' => $quiz->active,
'sound' => self::DBUTF8($doc), 'sound' => self::DBUTF8($doc),
'max_attempt' => (int)$quiz->max_attempt, 'max_attempt' => (int) $quiz->max_attempt,
'results_disabled' => (int)$quiz->results_disabled, 'results_disabled' => (int) $quiz->results_disabled,
'access_condition' => $quiz->access_condition, 'access_condition' => $quiz->access_condition,
'pass_percentage' => $quiz->pass_percentage, 'pass_percentage' => $quiz->pass_percentage,
'feedback_type' => (int)$quiz->feedback_type, 'feedback_type' => (int) $quiz->feedback_type,
'random_answers' => (int)$quiz->random_answers, 'random_answers' => (int) $quiz->random_answers,
'random_by_category' => $quiz->random_by_category, 'random_by_category' => $quiz->random_by_category,
'review_answers' => $quiz->review_answers, 'review_answers' => $quiz->review_answers,
'propagate_neg' => $quiz->propagate_neg, 'propagate_neg' => $quiz->propagate_neg,
'text_when_finished' => $quiz->text_when_finished, 'text_when_finished' => $quiz->text_when_finished,
'expired_time' => (int)$quiz->expired_time, 'expired_time' => (int) $quiz->expired_time,
'start_time' => $quiz->start_time, 'start_time' => $quiz->start_time,
'end_time' => $quiz->end_time, 'end_time' => $quiz->end_time,
'save_correct_answers' => 0, 'save_correct_answers' => 0,
@ -1800,10 +1800,10 @@ class CourseRestorer
$qid = $this->restore_quiz_question($question_id); $qid = $this->restore_quiz_question($question_id);
$question_order = $quiz->question_orders[$index] ? $quiz->question_orders[$index] : ++$order; $question_order = $quiz->question_orders[$index] ? $quiz->question_orders[$index] : ++$order;
$sql = "INSERT IGNORE INTO $table_rel SET $sql = "INSERT IGNORE INTO $table_rel SET
c_id = " . $this->destination_course_id . ", c_id = ".$this->destination_course_id.",
question_id = $qid , question_id = $qid ,
exercice_id = $new_id , exercice_id = $new_id ,
question_order = " . $question_order; question_order = ".$question_order;
Database::query($sql); Database::query($sql);
} }
} }
@ -2267,7 +2267,7 @@ class CourseRestorer
break; break;
case FILE_RENAME: case FILE_RENAME:
$survey_code = $survey->code.'_'; $survey_code = $survey->code.'_';
$i=1; $i = 1;
$temp_survey_code = $survey_code.$i; $temp_survey_code = $survey_code.$i;
while (!$this->is_survey_code_available($temp_survey_code)) { while (!$this->is_survey_code_available($temp_survey_code)) {
$temp_survey_code = $survey_code.++$i; $temp_survey_code = $survey_code.++$i;
@ -2299,15 +2299,15 @@ class CourseRestorer
$sql = "SELECT * FROM $table_sur $sql = "SELECT * FROM $table_sur
WHERE WHERE
c_id = ".$this->destination_course_id." AND c_id = ".$this->destination_course_id." AND
survey_id='".self::DBUTF8escapestring(Database::result($result_check,0,0))."'"; survey_id='".self::DBUTF8escapestring(Database::result($result_check, 0, 0))."'";
$result = Database::query($sql); $result = Database::query($sql);
$survey_data = Database::fetch_array($result,'ASSOC'); $survey_data = Database::fetch_array($result, 'ASSOC');
// if the survey is shared => also delete the shared content // if the survey is shared => also delete the shared content
if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) { if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) {
SurveyManager::delete_survey($survey_data['survey_share'], true,$this->destination_course_id); SurveyManager::delete_survey($survey_data['survey_share'], true, $this->destination_course_id);
} }
SurveyManager::delete_survey($survey_data['survey_id'],false,$this->destination_course_id); SurveyManager::delete_survey($survey_data['survey_id'], false, $this->destination_course_id);
// Insert the new source survey // Insert the new source survey
$new_id = Database::insert($table_sur, $params); $new_id = Database::insert($table_sur, $params);
@ -2492,10 +2492,10 @@ class CourseRestorer
// Adding the author's image // Adding the author's image
if (!empty($lp->preview_image)) { if (!empty($lp->preview_image)) {
$new_filename = uniqid('') . substr($lp->preview_image, strlen($lp->preview_image) - 7, $new_filename = uniqid('').substr($lp->preview_image, strlen($lp->preview_image) - 7,
strlen($lp->preview_image)); strlen($lp->preview_image));
if (file_exists($origin_path . $lp->preview_image) && !is_dir($origin_path . $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 = copy($origin_path.$lp->preview_image, $destination_path.$new_filename);
if ($copy_result) { if ($copy_result) {
$lp->preview_image = $new_filename; $lp->preview_image = $new_filename;
} else { } else {
@ -2505,7 +2505,7 @@ class CourseRestorer
} }
if ($this->add_text_in_items) { if ($this->add_text_in_items) {
$lp->name = $lp->name . ' ' . get_lang('CopyLabelSuffix'); $lp->name = $lp->name.' '.get_lang('CopyLabelSuffix');
} }
if (isset($this->tool_copy_settings['learnpaths'])) { if (isset($this->tool_copy_settings['learnpaths'])) {
@ -2573,7 +2573,7 @@ class CourseRestorer
$params = [ $params = [
'c_id' => $this->destination_course_id, 'c_id' => $this->destination_course_id,
'name' => self::DBUTF8($lp->name), 'name' => self::DBUTF8($lp->name),
'link' => 'lp/lp_controller.php?action=view&lp_id=$new_lp_id&id_session=' . $session_id, 'link' => 'lp/lp_controller.php?action=view&lp_id=$new_lp_id&id_session='.$session_id,
'image' => 'scormbuilder.gif', 'image' => 'scormbuilder.gif',
'visibility' => '0', 'visibility' => '0',
'admin' => '0', 'admin' => '0',
@ -2697,8 +2697,8 @@ class CourseRestorer
// Updating prerequisites // Updating prerequisites
foreach ($old_prerequisite as $key => $my_old_prerequisite) { foreach ($old_prerequisite as $key => $my_old_prerequisite) {
if ($my_old_prerequisite != '') { if ($my_old_prerequisite != '') {
$sql = "UPDATE " . $table_item . " SET prerequisite = '" . $my_old_prerequisite . "' $sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $key . "' "; WHERE c_id = " . $this->destination_course_id." AND id = '".$key."' ";
Database::query($sql); Database::query($sql);
} }
} }
@ -2706,8 +2706,8 @@ class CourseRestorer
// Updating refs // Updating refs
foreach ($old_refs as $key => $my_old_ref) { foreach ($old_refs as $key => $my_old_ref) {
if ($my_old_ref != '') { if ($my_old_ref != '') {
$sql = "UPDATE " . $table_item . " SET ref = '" . $my_old_ref . "' $sql = "UPDATE ".$table_item." SET ref = '".$my_old_ref."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $key . "' "; WHERE c_id = " . $this->destination_course_id." AND id = '".$key."' ";
Database::query($sql); Database::query($sql);
} }
} }
@ -2717,8 +2717,8 @@ class CourseRestorer
if ($parent_item_old_id != 0) { if ($parent_item_old_id != 0) {
$parent_new_id = $new_item_ids[$parent_item_old_id]; $parent_new_id = $new_item_ids[$parent_item_old_id];
} }
$sql = "UPDATE " . $table_item . " SET parent_item_id = '" . $parent_new_id . "' $sql = "UPDATE ".$table_item." SET parent_item_id = '".$parent_new_id."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $new_item_id . "'"; WHERE c_id = " . $this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql); Database::query($sql);
} }
foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) { foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) {
@ -2726,8 +2726,8 @@ class CourseRestorer
if ($previous_item_old_id != 0) { if ($previous_item_old_id != 0) {
$previous_new_id = $new_item_ids[$previous_item_old_id]; $previous_new_id = $new_item_ids[$previous_item_old_id];
} }
$sql = "UPDATE " . $table_item . " SET previous_item_id = '" . $previous_new_id . "' $sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $new_item_id . "'"; WHERE c_id = " . $this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql); Database::query($sql);
} }
@ -2736,8 +2736,8 @@ class CourseRestorer
if ($next_item_old_id != 0) { if ($next_item_old_id != 0) {
$next_new_id = $new_item_ids[$next_item_old_id]; $next_new_id = $new_item_ids[$next_item_old_id];
} }
$sql = "UPDATE " . $table_item . " SET next_item_id = '" . $next_new_id . "' $sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $new_item_id . "'"; WHERE c_id = " . $this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql); Database::query($sql);
} }
@ -2746,8 +2746,8 @@ class CourseRestorer
if ($prerequisite_old_id != 0) { if ($prerequisite_old_id != 0) {
$prerequisite_new_id = $new_item_ids[$prerequisite_old_id]; $prerequisite_new_id = $new_item_ids[$prerequisite_old_id];
} }
$sql = "UPDATE " . $table_item . " SET prerequisite = '" . $prerequisite_new_id . "' $sql = "UPDATE ".$table_item." SET prerequisite = '".$prerequisite_new_id."'
WHERE c_id = " . $this->destination_course_id . " AND id = '" . $new_item_id . "'"; WHERE c_id = " . $this->destination_course_id." AND id = '".$new_item_id."'";
Database::query($sql); Database::query($sql);
} }
$this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id; $this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id;
@ -2867,17 +2867,17 @@ class CourseRestorer
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
// as long as storing the next file to $file is successful, continue // as long as storing the next file to $file is successful, continue
if ($file != '.' && $file != '..') { if ($file != '.' && $file != '..') {
$path = $source . '/' . $file; $path = $source.'/'.$file;
if (is_file($path)) { if (is_file($path)) {
/* if (!is_file($dest . '/' . $file) || $overwrite) /* if (!is_file($dest . '/' . $file) || $overwrite)
if (!@copy($path, $dest . '/' . $file)) { if (!@copy($path, $dest . '/' . $file)) {
echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>'; echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>';
}*/ }*/
} elseif(is_dir($path)) { } elseif (is_dir($path)) {
if (!is_dir($dest . '/' . $file)) { if (!is_dir($dest.'/'.$file)) {
mkdir($dest . '/' . $file); mkdir($dest.'/'.$file);
} }
self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite); self:: allow_create_all_directory($path, $dest.'/'.$file, $overwrite);
} }
} }
} }
@ -3075,7 +3075,7 @@ class CourseRestorer
$this->course->backup_path, $this->course->backup_path,
$this->course->info['path'] $this->course->info['path']
); );
$thematic->params['c_id'] = $this->destination_course_id; $thematic->params['c_id'] = $this->destination_course_id;
unset($thematic->params['id']); unset($thematic->params['id']);
unset($thematic->params['iid']); unset($thematic->params['iid']);
@ -3099,7 +3099,7 @@ class CourseRestorer
unset($thematic_advance['iid']); unset($thematic_advance['iid']);
$thematic_advance['attendance_id'] = 0; $thematic_advance['attendance_id'] = 0;
$thematic_advance['thematic_id'] = $last_id; $thematic_advance['thematic_id'] = $last_id;
$thematic_advance['c_id'] = $this->destination_course_id; $thematic_advance['c_id'] = $this->destination_course_id;
$my_id = Database::insert( $my_id = Database::insert(
$table_thematic_advance, $table_thematic_advance,
@ -3122,7 +3122,7 @@ class CourseRestorer
} }
} }
foreach($thematic->thematic_plan_list as $thematic_plan) { foreach ($thematic->thematic_plan_list as $thematic_plan) {
unset($thematic_plan['id']); unset($thematic_plan['id']);
unset($thematic_plan['iid']); unset($thematic_plan['iid']);
$thematic_plan['thematic_id'] = $last_id; $thematic_plan['thematic_id'] = $last_id;
@ -3238,7 +3238,7 @@ class CourseRestorer
// re-create dir // re-create dir
// @todo check security against injection of dir in crafted course backup here! // @todo check security against injection of dir in crafted course backup here!
$path = $obj->params['url']; $path = $obj->params['url'];
$path = '/'.str_replace('/','',substr($path,1)); $path = '/'.str_replace('/', '', substr($path, 1));
$workData = array(); $workData = array();
switch ($this->file_option) { switch ($this->file_option) {
@ -3262,9 +3262,9 @@ class CourseRestorer
$obj->params['new_dir'] = $obj->params['title']; $obj->params['new_dir'] = $obj->params['title'];
if (!empty($this->course_origin_id)) { if (!empty($this->course_origin_id)) {
$sql = 'SELECT * FROM ' . $table_work_assignment . ' $sql = 'SELECT * FROM '.$table_work_assignment.'
WHERE WHERE
c_id = ' . $this->course_origin_id . ' AND c_id = ' . $this->course_origin_id.' AND
publication_id = ' . $id_work; publication_id = ' . $id_work;
$result = Database::query($sql); $result = Database::query($sql);

@ -85,7 +85,7 @@ class SurveyQuestion extends Resource
* @param string $option_text * @param string $option_text
* @param int $sort * @param int $sort
*/ */
public function add_answer($option_text,$sort) public function add_answer($option_text, $sort)
{ {
$answer = array(); $answer = array();
$answer['option_text'] = $option_text; $answer['option_text'] = $option_text;

Loading…
Cancel
Save