Minor - format code.

pull/2487/head
Julio 8 years ago
parent 8c73f57ec2
commit 6107c6b3de
  1. 30
      main/inc/lib/course.lib.php
  2. 13
      main/lp/learnpathItem.class.php
  3. 47
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@ -5076,7 +5076,10 @@ class CourseManager
$my_course['price'] = $isThisCourseInSale['html'];
// set the Buy button instead register.
if ($isThisCourseInSale['verificator'] && !empty($my_course['register_button'])) {
$my_course['register_button'] = $plugin->returnBuyCourseButton($course_info['real_id'], BuyCoursesPlugin::PRODUCT_TYPE_COURSE);
$my_course['register_button'] = $plugin->returnBuyCourseButton(
$course_info['real_id'],
BuyCoursesPlugin::PRODUCT_TYPE_COURSE
);
}
}
// end buycourse validation
@ -5822,7 +5825,8 @@ class CourseManager
/**
* Generates a course code from a course title
* @todo Such a function might be useful in other places too. It might be moved in the CourseManager class.
* @todo the function might be upgraded for avoiding code duplications (currently, it might suggest a code that is already in use)
* @todo the function might be upgraded for avoiding code duplications (currently,
* it might suggest a code that is already in use)
* @param string $title A course title
* @return string A proposed course code
* +
@ -6324,7 +6328,13 @@ class CourseManager
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
$params['right_actions'] .= Display::div(
'',
array(
'id' => 'document_result_'.$course_info['real_id'].'_0',
'class' => 'document_preview_container',
)
);
} else {
$params['right_actions'] .= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>';
}
@ -6336,7 +6346,13 @@ class CourseManager
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) {
if ($loadDirs) {
$params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>';
$params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container'));
$params['right_actions'] .= Display::div(
'',
array(
'id' => 'document_result_'.$course_info['real_id'].'_0',
'class' => 'document_preview_container',
)
);
} else {
if ($course_info['status'] == COURSEMANAGER) {
$params['right_actions'] .= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>';
@ -6350,7 +6366,11 @@ class CourseManager
$course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title'].' '.Display::tag('span', get_lang('CourseClosed'), array('class'=>'item_closed'));
$course_title = $course_info['title'].' '.Display::tag(
'span',
get_lang('CourseClosed'),
array('class' => 'item_closed')
);
}
// Start displaying the course block itself

@ -1208,7 +1208,8 @@ class learnpathItem
}
} elseif (strpos($second_part, '=') > 0) {
if (substr($second_part,0,1) === '/') {
// Link starts with a /, making it absolute (relative to DocumentRoot).
// Link starts with a /,
// making it absolute (relative to DocumentRoot).
$files_list[] = array(
$second_part,
'local',
@ -3875,16 +3876,10 @@ class learnpathItem
}
} else {
// Multiple attempts are allowed.
if (in_array(
$this->get_status(false),
$case_completed
) && $my_type_lp == 2
) {
if (in_array($this->get_status(false), $case_completed) && $my_type_lp == 2) {
// Reset zero new attempt ?
$my_status = " status = '".$this->get_status(false)."' ,";
} elseif (!in_array($this->get_status(false), $case_completed) &&
$my_type_lp == 2
) {
} elseif (!in_array($this->get_status(false), $case_completed) && $my_type_lp == 2) {
$total_time = " total_time = ".$this->get_total_time().", ";
$my_status = " status = '".$this->get_status(false)."' ,";
} else {

@ -2178,7 +2178,10 @@ class CourseRestorer
break;
case FILE_OVERWRITE:
// get category from source
$destinationCategoryId = TestCategory::get_category_id_for_title($title, $destinationCourseId);
$destinationCategoryId = TestCategory::get_category_id_for_title(
$title,
$destinationCourseId
);
if ($destinationCategoryId) {
$my_cat = new TestCategory();
$my_cat = $my_cat->getCategory($destinationCategoryId, $destinationCourseId);
@ -2335,7 +2338,8 @@ class CourseRestorer
}
break;
case FILE_OVERWRITE:
// Delete the existing survey with the same code and language and import the one of the source course
// Delete the existing survey with the same code and language and
// import the one of the source course
// getting the information of the survey (used for when the survey is shared)
$sql = "SELECT * FROM $table_sur
@ -2347,9 +2351,17 @@ class CourseRestorer
// if the survey is shared => also delete the shared content
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
$new_id = Database::insert($table_sur, $params);
@ -2542,10 +2554,18 @@ class CourseRestorer
// Adding the author's image
if (!empty($lp->preview_image)) {
$new_filename = uniqid('').substr($lp->preview_image, strlen($lp->preview_image) - 7,
strlen($lp->preview_image));
if (file_exists($origin_path.$lp->preview_image) && !is_dir($origin_path.$lp->preview_image)) {
$copy_result = copy($origin_path.$lp->preview_image, $destination_path.$new_filename);
$new_filename = uniqid('').substr(
$lp->preview_image,
strlen($lp->preview_image) - 7,
strlen($lp->preview_image)
);
if (file_exists($origin_path.$lp->preview_image) &&
!is_dir($origin_path.$lp->preview_image)
) {
$copy_result = copy(
$origin_path.$lp->preview_image,
$destination_path.$new_filename
);
if ($copy_result) {
$lp->preview_image = $new_filename;
} else {
@ -2869,9 +2889,16 @@ class CourseRestorer
}
}
$sql = 'SELECT sa.id, sa.expires_on,sa.ends_on,sa.add_to_calendar, sa.enable_qualification, sa.publication_id
$sql = 'SELECT
sa.id,
sa.expires_on,
sa.ends_on,
sa.add_to_calendar,
sa.enable_qualification,
sa.publication_id
FROM '.$work_assignment_table.' sa
INNER JOIN '.$work_table.' sp ON sa.publication_id=sp.id
INNER JOIN '.$work_table.' sp
ON sa.publication_id=sp.id
WHERE
sp.c_id = '.$this->course_origin_id.' AND
sa.c_id = '.$this->course_origin_id.' AND

Loading…
Cancel
Save