Minor: Format code

pull/4722/head
Angel Fernando Quiroz Campos 2 years ago
parent 8be357f593
commit 7508b66e67
  1. 2
      main/course_info/infocours.php
  2. 162
      main/inc/lib/course.lib.php
  3. 1
      main/inc/lib/exercise.lib.php
  4. 1
      main/inc/lib/template.lib.php
  5. 6
      main/inc/lib/webservices/Rest.php
  6. 1
      main/wiki/wiki.inc.php

@ -174,7 +174,6 @@ $form->addRule(
); );
$form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture')); $form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture'));
// Email Picture // Email Picture
$form->addFile( $form->addFile(
'email_picture', 'email_picture',
@ -191,7 +190,6 @@ $form->addRule(
); );
$form->addElement('checkbox', 'delete_email_picture', null, get_lang('DeleteEmailPicture')); $form->addElement('checkbox', 'delete_email_picture', null, get_lang('DeleteEmailPicture'));
if (api_get_setting('pdf_export_watermark_by_course') === 'true') { if (api_get_setting('pdf_export_watermark_by_course') === 'true') {
$url = PDF::get_watermark($course_code); $url = PDF::get_watermark($course_code);
$form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, ['size' => '60']); $form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, ['size' => '60']);

@ -7325,88 +7325,9 @@ class CourseManager
return $coursesCode; return $coursesCode;
} }
/**
* Check if a specific access-url-related setting is a problem or not.
*
* @param array $_configuration The $_configuration array
* @param int $accessUrlId The access URL ID
* @param string $param
* @param string $msgLabel
*
* @return bool|string
*/
private static function checkCreateCourseAccessUrlParam($_configuration, $accessUrlId, $param, $msgLabel)
{
if (isset($_configuration[$accessUrlId][$param]) && $_configuration[$accessUrlId][$param] > 0) {
$num = null;
switch ($param) {
case 'hosting_limit_courses':
$num = self::count_courses($accessUrlId);
break;
case 'hosting_limit_active_courses':
$num = self::countActiveCourses($accessUrlId);
break;
}
if ($num && $num >= $_configuration[$accessUrlId][$param]) {
api_warn_hosting_contact($param);
Display::addFlash(
Display::return_message($msgLabel)
);
return true;
}
}
return false;
}
/**
* Fill course with all necessary items.
*
* @param array $courseInfo Course info array
* @param array $params Parameters from the course creation form
* @param int $authorId
*/
private static function fillCourse($courseInfo, $params, $authorId = 0)
{
$authorId = empty($authorId) ? api_get_user_id() : (int) $authorId;
AddCourse::prepare_course_repository($courseInfo['directory']);
AddCourse::fill_db_course(
$courseInfo['real_id'],
$courseInfo['directory'],
$courseInfo['course_language'],
$params['exemplary_content'],
$authorId
);
if (isset($params['gradebook_model_id'])) {
self::createDefaultGradebook(
$params['gradebook_model_id'],
$courseInfo['code']
);
}
// If parameter defined, copy the contents from a specific
// template course into this new course
if (isset($params['course_template'])) {
self::useTemplateAsBasisIfRequired(
$courseInfo['id'],
$params['course_template']
);
}
$params['course_code'] = $courseInfo['code'];
$params['item_id'] = $courseInfo['real_id'];
$courseFieldValue = new ExtraFieldValue('course');
$courseFieldValue->saveFieldValues($params);
}
/** /**
* Update course email picture. * Update course email picture.
* *
* @param array $courseInfo
* @param string $sourceFile the full system name of the image from which course picture will be created * @param string $sourceFile the full system name of the image from which course picture will be created
* @param string $cropParameters Optional string that contents "x,y,width,height" of a cropped image format * @param string $cropParameters Optional string that contents "x,y,width,height" of a cropped image format
* *
@ -7451,8 +7372,6 @@ class CourseManager
/** /**
* Deletes the course email picture. * Deletes the course email picture.
*
* @param string $courseCode
*/ */
public static function deleteCourseEmailPicture(string $courseCode): void public static function deleteCourseEmailPicture(string $courseCode): void
{ {
@ -7472,7 +7391,7 @@ class CourseManager
} }
/** /**
* Get the course logo * Get the course logo.
* *
* @param array $course array containing course info, @see api_get_course_info() * @param array $course array containing course info, @see api_get_course_info()
* @param array $attributes Array containing extra attributes for the image tag * @param array $attributes Array containing extra attributes for the image tag
@ -7507,4 +7426,83 @@ class CourseManager
return $logo; return $logo;
} }
/**
* Check if a specific access-url-related setting is a problem or not.
*
* @param array $_configuration The $_configuration array
* @param int $accessUrlId The access URL ID
* @param string $param
* @param string $msgLabel
*
* @return bool|string
*/
private static function checkCreateCourseAccessUrlParam($_configuration, $accessUrlId, $param, $msgLabel)
{
if (isset($_configuration[$accessUrlId][$param]) && $_configuration[$accessUrlId][$param] > 0) {
$num = null;
switch ($param) {
case 'hosting_limit_courses':
$num = self::count_courses($accessUrlId);
break;
case 'hosting_limit_active_courses':
$num = self::countActiveCourses($accessUrlId);
break;
}
if ($num && $num >= $_configuration[$accessUrlId][$param]) {
api_warn_hosting_contact($param);
Display::addFlash(
Display::return_message($msgLabel)
);
return true;
}
}
return false;
}
/**
* Fill course with all necessary items.
*
* @param array $courseInfo Course info array
* @param array $params Parameters from the course creation form
* @param int $authorId
*/
private static function fillCourse($courseInfo, $params, $authorId = 0)
{
$authorId = empty($authorId) ? api_get_user_id() : (int) $authorId;
AddCourse::prepare_course_repository($courseInfo['directory']);
AddCourse::fill_db_course(
$courseInfo['real_id'],
$courseInfo['directory'],
$courseInfo['course_language'],
$params['exemplary_content'],
$authorId
);
if (isset($params['gradebook_model_id'])) {
self::createDefaultGradebook(
$params['gradebook_model_id'],
$courseInfo['code']
);
}
// If parameter defined, copy the contents from a specific
// template course into this new course
if (isset($params['course_template'])) {
self::useTemplateAsBasisIfRequired(
$courseInfo['id'],
$params['course_template']
);
}
$params['course_code'] = $courseInfo['code'];
$params['item_id'] = $courseInfo['real_id'];
$courseFieldValue = new ExtraFieldValue('course');
$courseFieldValue->saveFieldValues($params);
}
} }

@ -7055,7 +7055,6 @@ EOT;
continue; continue;
} }
api_mail_html( api_mail_html(
null, null,
$email, $email,

@ -2075,7 +2075,6 @@ class Template
$portalImageMeta .= '<meta property="twitter:image:alt" content="'.$imageAlt.'" />'."\n"; $portalImageMeta .= '<meta property="twitter:image:alt" content="'.$imageAlt.'" />'."\n";
} }
} else { } else {
if (api_get_configuration_value('mail_header_from_custom_course_logo') == true) { if (api_get_configuration_value('mail_header_from_custom_course_logo') == true) {
// check if current page is a course page // check if current page is a course page
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();

@ -1156,9 +1156,11 @@ class Rest extends WebService
/** /**
* Get the list of users from extra field. * Get the list of users from extra field.
*
* @param string $fieldName The name of the extra_field (as in extra_field.variable) we want to filter on. * @param string $fieldName The name of the extra_field (as in extra_field.variable) we want to filter on.
* @param string $fieldValue The value of the extra_field we want to filter on. If a user doesn't have the given extra_field set to that value, it will not be returned. * @param string $fieldValue The value of the extra_field we want to filter on. If a user doesn't have the given extra_field set to that value, it will not be returned.
* @param int $active Additional filter. If 1, only return active users. Otherwise, return them all. * @param int $active Additional filter. If 1, only return active users. Otherwise, return them all.
*
* @throws Exception * @throws Exception
*/ */
public function getUsersProfilesByExtraField(string $fieldName, string $fieldValue, int $active = 0): array public function getUsersProfilesByExtraField(string $fieldName, string $fieldValue, int $active = 0): array
@ -1585,8 +1587,10 @@ class Rest extends WebService
} }
/** /**
* Returns an array of users with id, firstname, lastname, email and username * Returns an array of users with id, firstname, lastname, email and username.
*
* @param array $params An array of parameters to filter the results (currently only supports 'status' and 'id_campus') * @param array $params An array of parameters to filter the results (currently only supports 'status' and 'id_campus')
*
* @throws Exception * @throws Exception
*/ */
public function getUsersCampus(array $params): array public function getUsersCampus(array $params): array

@ -2253,7 +2253,6 @@ class Wiki
} }
///make and send email ///make and send email
if ($allow_send_mail) { if ($allow_send_mail) {
$extraParameters = []; $extraParameters = [];
if (api_get_configuration_value('mail_header_from_custom_course_logo') == true) { if (api_get_configuration_value('mail_header_from_custom_course_logo') == true) {
$extraParameters = ['logo' => CourseManager::getCourseEmailPicture($_course)]; $extraParameters = ['logo' => CourseManager::getCourseEmailPicture($_course)];

Loading…
Cancel
Save