Minor - format code

pull/2472/head
jmontoyaa 8 years ago
parent 8a465b29dd
commit 05debb857e
  1. 6
      main/coursecopy/create_backup.php
  2. 5
      src/Chamilo/CourseBundle/Component/CourseCopy/Course.php
  3. 5
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseArchiver.php
  4. 17
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php

@ -46,8 +46,6 @@ Display::display_header($nameTools);
// Display the tool title // Display the tool title
echo Display::page_header($nameTools); echo Display::page_header($nameTools);
/* MAIN CODE */
if (Security::check_token('post') && ( if (Security::check_token('post') && (
( (
isset($_POST['action']) && isset($_POST['action']) &&
@ -70,7 +68,9 @@ if (Security::check_token('post') && (
$zip_file = CourseArchiver::createBackup($course); $zip_file = CourseArchiver::createBackup($course);
echo Display::return_message(get_lang('BackupCreated'), 'confirm'); echo Display::return_message(get_lang('BackupCreated'), 'confirm');
echo '<br /><a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.$zip_file.'&'.api_get_cidreq().'"> echo '<br />
<a class="btn btn-primary btn-large"
href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.$zip_file.'&'.api_get_cidreq().'">
'.get_lang('Download').'</a>'; '.get_lang('Download').'</a>';
} elseif (Security::check_token('post') && ( } elseif (Security::check_token('post') && (
isset($_POST['backup_option']) && isset($_POST['backup_option']) &&

@ -92,7 +92,8 @@ class Course
/** /**
* Returns sample text based on the imported course content. * Returns sample text based on the imported course content.
* This sample text is to be used for course language or encoding detection if there is missing (meta)data in the archive. * This sample text is to be used for course language or encoding
* detection if there is missing (meta)data in the archive.
* *
* @return string the resulting sample text extracted from some common resources' data fields * @return string the resulting sample text extracted from some common resources' data fields
*/ */
@ -283,7 +284,7 @@ class Course
$resource->question = api_to_system_encoding($resource->question, $this->encoding); $resource->question = api_to_system_encoding($resource->question, $this->encoding);
$resource->description = api_to_system_encoding($resource->description, $this->encoding); $resource->description = api_to_system_encoding($resource->description, $this->encoding);
if (is_array($resource->answers) && count($resource->answers) > 0) { if (is_array($resource->answers) && count($resource->answers) > 0) {
foreach ($resource->answers as $index => &$answer) { foreach ($resource->answers as &$answer) {
$answer['answer'] = api_to_system_encoding($answer['answer'], $this->encoding); $answer['answer'] = api_to_system_encoding($answer['answer'], $this->encoding);
$answer['comment'] = api_to_system_encoding($answer['comment'], $this->encoding); $answer['comment'] = api_to_system_encoding($answer['comment'], $this->encoding);
} }

@ -210,7 +210,10 @@ class CourseArchiver
$date = $file_parts[0]; $date = $file_parts[0];
$ext = isset($file_parts[1]) ? $file_parts[1] : null; $ext = isset($file_parts[1]) ? $file_parts[1] : null;
if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) { if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) {
$date = substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.substr($date, 6, 2).' '.substr($date, 9, 2).':'.substr($date, 11, 2).':'.substr($date, 13, 2); $date =
substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.
substr($date, 6, 2).' '.substr($date, 9, 2).':'.
substr($date, 11, 2).':'.substr($date, 13, 2);
$backup_files[] = [ $backup_files[] = [
'file' => $file, 'file' => $file,
'date' => $date, 'date' => $date,

@ -370,7 +370,10 @@ class CourseSelectForm
switch ($type) { switch ($type) {
case RESOURCE_QUIZQUESTION: case RESOURCE_QUIZQUESTION:
foreach ($resources as $id => $resource) { foreach ($resources as $id => $resource) {
echo '<input type="hidden" name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />'; echo '<input
type="hidden"
name="resource['.RESOURCE_QUIZQUESTION.']['.$id.']"
id="resource['.RESOURCE_QUIZQUESTION.']['.$id.']" value="On" />';
} }
break; break;
} }
@ -390,7 +393,10 @@ class CourseSelectForm
switch ($type) { switch ($type) {
case RESOURCE_SCORM: case RESOURCE_SCORM:
foreach ($resources as $id => $resource) { foreach ($resources as $id => $resource) {
echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; echo '<input
type="hidden"
name="resource['.RESOURCE_SCORM.']['.$id.']"
id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />';
} }
break; break;
} }
@ -702,7 +708,8 @@ class CourseSelectForm
} }
} }
if ($avoid_serialize) { if ($avoid_serialize) {
//Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files) // Documents are avoided due the huge amount of memory that the serialize php
// function "eats" (when there are directories with hundred/thousand of files)
// this is a known issue of serialize // this is a known issue of serialize
$course->resources['document'] = null; $course->resources['document'] = null;
} }
@ -713,7 +720,9 @@ class CourseSelectForm
echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>'; echo '<input type="hidden" name="'.$key.'" value="'.$value.'"/>';
} }
} }
echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.get_lang('Ok').'</button>'; echo '<br /><button class="save" type="submit"
onclick="checkLearnPath(\''.addslashes(get_lang('DocumentsWillBeAddedToo')).'\')">'.
get_lang('Ok').'</button>';
self::display_hidden_quiz_questions($course); self::display_hidden_quiz_questions($course);
self::display_hidden_scorm_directories($course); self::display_hidden_scorm_directories($course);
echo '</form>'; echo '</form>';

Loading…
Cancel
Save