Minor: Format code

pull/4964/head
Angel Fernando Quiroz Campos 2 years ago
parent 2a8e94266d
commit ddd8a6837e
  1. 2
      main/admin/export_exercise_results.php
  2. 4
      main/auth/justification.php
  3. 4
      main/auth/profile.php
  4. 3
      main/exercise/export/export_exercise_results.php
  5. 2
      main/exercise/overview.php
  6. 2
      main/inc/lib/api.lib.php
  7. 14
      main/inc/lib/exercise.lib.php
  8. 2
      main/inc/lib/link.lib.php
  9. 21
      main/inc/lib/statistics.lib.php
  10. 19
      main/inc/lib/usergroup.lib.php
  11. 5
      main/inc/lib/webservices/Rest.php
  12. 1
      main/survey/ch_multiplechoiceother.php
  13. 12
      main/survey/surveyUtil.class.php
  14. 1
      plugin/buycourses/lang/english.php
  15. 1
      plugin/buycourses/lang/french.php
  16. 2
      plugin/buycourses/src/buy_course_plugin.class.php
  17. 1
      plugin/buycourses/src/stripe_success.php

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script exports the PDF reports from a test for several students at once. * This script exports the PDF reports from a test for several students at once.
* This script has a teacher-focused version at main/exercise/export/export_exercise_result.php * This script has a teacher-focused version at main/exercise/export/export_exercise_result.php.
*/ */
$cidReset = true; $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';

@ -87,9 +87,9 @@ switch ($action) {
$userInfo = api_get_user_info(); $userInfo = api_get_user_info();
// get_all_administrators // get_all_administrators
$adminList = UserManager::get_all_administrators(); $adminList = UserManager::get_all_administrators();
$link = api_get_path(WEB_PATH) . 'plugin/justification/justification_by_user.php?user_id=' . api_get_user_id(); $link = api_get_path(WEB_PATH).'plugin/justification/justification_by_user.php?user_id='.api_get_user_id();
$emailToAdminSubject = $plugin->get_lang('JustificationsCompleted').': '.$userInfo['complete_name']; $emailToAdminSubject = $plugin->get_lang('JustificationsCompleted').': '.$userInfo['complete_name'];
$emailToAdminContent = $emailToAdminSubject . ' <br /><br />' . '<a href="'. $link . '">' . $link . '</a>'; $emailToAdminContent = $emailToAdminSubject.' <br /><br />'.'<a href="'.$link.'">'.$link.'</a>';
foreach ($adminList as $adminId => $data) { foreach ($adminList as $adminId => $data) {
MessageManager::send_message_simple( MessageManager::send_message_simple(
$adminId, $adminId,

@ -332,7 +332,7 @@ if (is_platform_authentication() &&
$allow_users_to_change_email_with_no_password = false; $allow_users_to_change_email_with_no_password = false;
} }
if (!$allow_users_to_change_email_with_no_password) { if (!$allow_users_to_change_email_with_no_password) {
$passwordExtraCommentForPasswordChange = get_lang('ToChangeYourEmailMustTypeYourPassword') . ". "; $passwordExtraCommentForPasswordChange = get_lang('ToChangeYourEmailMustTypeYourPassword').". ";
} }
if ($showPassword && if ($showPassword &&
@ -342,7 +342,7 @@ if ($showPassword &&
$form->addElement( $form->addElement(
'password', 'password',
'password0', 'password0',
[get_lang('Pass'), $passwordExtraCommentForPasswordChange . get_lang('TypeCurrentPassword')], [get_lang('Pass'), $passwordExtraCommentForPasswordChange.get_lang('TypeCurrentPassword')],
[ [
'size' => 40, 'size' => 40,
'show_hide' => true, 'show_hide' => true,

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* This script exports the PDF reports from a test for several students at once. * This script exports the PDF reports from a test for several students at once.
* This script is the teacher view of a similar script (for admins) at main/admin/export_exercise_results.php * This script is the teacher view of a similar script (for admins) at main/admin/export_exercise_results.php.
*/ */
require_once __DIR__.'/../../inc/global.inc.php'; require_once __DIR__.'/../../inc/global.inc.php';
@ -112,7 +112,6 @@ if ($form->validate()) {
Display::display_header(get_lang('ExportExerciseAllResults')); Display::display_header(get_lang('ExportExerciseAllResults'));
echo $form->display(); echo $form->display();
Display::display_footer(); Display::display_footer();

@ -66,7 +66,7 @@ $exerciseUrlParams = [
'exerciseId' => $objExercise->iid, 'exerciseId' => $objExercise->iid,
'learnpath_id' => $learnpath_id, 'learnpath_id' => $learnpath_id,
'learnpath_item_id' => $learnpath_item_id, 'learnpath_item_id' => $learnpath_item_id,
'learnpath_item_view_id' => $learnpathItemViewId 'learnpath_item_view_id' => $learnpathItemViewId,
]; ];
if (isset($_GET['preview'])) { if (isset($_GET['preview'])) {
$exerciseUrlParams['preview'] = 1; $exerciseUrlParams['preview'] = 1;

@ -10586,8 +10586,6 @@ function api_flush_settings_cache(int $url_id): bool
* in the variable $_configuration['ldap_admin_password_salt']. * in the variable $_configuration['ldap_admin_password_salt'].
* *
* @param $encryptedText The text to be decrypted * @param $encryptedText The text to be decrypted
*
* @return string
*/ */
function api_decrypt_ldap_password(string $encryptedText): string function api_decrypt_ldap_password(string $encryptedText): string
{ {

@ -7191,10 +7191,8 @@ EOT;
} }
/** /**
* Export all results of all exercises to a ZIP file (including one zip for each exercise) * Export all results of all exercises to a ZIP file (including one zip for each exercise).
* @param int $sessionId *
* @param int $courseId
* @param array $filterDates
* @return false|void * @return false|void
*/ */
public static function exportAllExercisesResultsZip( public static function exportAllExercisesResultsZip(
@ -7253,12 +7251,8 @@ EOT;
} }
/** /**
* Export all results of *one* exercise to a ZIP file containing individual PDFs * Export all results of *one* exercise to a ZIP file containing individual PDFs.
* @param int $sessionId *
* @param int $courseId
* @param int $exerciseId
* @param array $filterDates
* @param string $mainPath
* @return false|void * @return false|void
*/ */
public static function exportExerciseAllResultsZip( public static function exportExerciseAllResultsZip(

@ -1827,7 +1827,6 @@ class Link extends Model
if (200 === $responseIpv6->getStatusCode()) { if (200 === $responseIpv6->getStatusCode()) {
return true; return true;
} }
} catch (Exception $e) { } catch (Exception $e) {
try { try {
$responseIpv4 = $client->request('GET', $url, ['force_ip_resolve' => 'v4']); $responseIpv4 = $client->request('GET', $url, ['force_ip_resolve' => 'v4']);
@ -1839,6 +1838,7 @@ class Link extends Model
return false; return false;
} }
} }
return false; return false;
} }

@ -1646,11 +1646,10 @@ class Statistics
} }
/** /**
* Return a list of logins by date * Return a list of logins by date.
*
* @param string $startDate Start date in YYYY-MM-DD format * @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format * @param string $endDate End date in YYYY-MM-DD format
*
* @return array
*/ */
public static function getLoginsByDate($startDate, $endDate): array public static function getLoginsByDate($startDate, $endDate): array
{ {
@ -1787,14 +1786,14 @@ class Statistics
} }
/** /**
* Return duplicate users at a SortableTableFromArray object * Return duplicate users at a SortableTableFromArray object.
*
* @param string $type The type of duplication we are checking for ('name' or 'email') * @param string $type The type of duplication we are checking for ('name' or 'email')
*/ */
public static function returnDuplicatedUsersTable( public static function returnDuplicatedUsersTable(
string $type = 'name', string $type = 'name',
array $additionalExtraFieldsInfo array $additionalExtraFieldsInfo
): SortableTableFromArray ): SortableTableFromArray {
{
if ($type == 'email') { if ($type == 'email') {
$usersInfo = Statistics::getDuplicatedUserMails($additionalExtraFieldsInfo); $usersInfo = Statistics::getDuplicatedUserMails($additionalExtraFieldsInfo);
} else { } else {
@ -1893,8 +1892,6 @@ class Statistics
* *
* @param string $startDate Start date in YYYY-MM-DD format * @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format * @param string $endDate End date in YYYY-MM-DD format
*
* @return array
*/ */
private static function getLtiLearningPathByDate(string $startDate, string $endDate): array private static function getLtiLearningPathByDate(string $startDate, string $endDate): array
{ {
@ -1917,9 +1914,9 @@ class Statistics
} }
/** /**
* Get a list of users duplicated (firstname and lastname are both the same) * Get a list of users duplicated (firstname and lastname are both the same).
*
* @param array $additionalExtraFieldsInfo A list of extra fields we want to get in return, additional to the user details * @param array $additionalExtraFieldsInfo A list of extra fields we want to get in return, additional to the user details
* @return array
*/ */
private static function getDuplicatedUsers(array $additionalExtraFieldsInfo): array private static function getDuplicatedUsers(array $additionalExtraFieldsInfo): array
{ {
@ -1999,9 +1996,9 @@ class Statistics
} }
/** /**
* Get a list of duplicated user emails * Get a list of duplicated user emails.
*
* @param array $additionalExtraFieldsInfo A list of extra fields we want to get in return, additional to the user details * @param array $additionalExtraFieldsInfo A list of extra fields we want to get in return, additional to the user details
* @return array
*/ */
private static function getDuplicatedUserMails(array $additionalExtraFieldsInfo): array private static function getDuplicatedUserMails(array $additionalExtraFieldsInfo): array
{ {

@ -3397,12 +3397,13 @@ class UserGroup extends Model
} }
/** /**
* Check the given ID matches an existing group * Check the given ID matches an existing group.
* @param int $groupId *
* @return bool * @return bool
*/ */
public function groupExists(int $groupId) { public function groupExists(int $groupId)
$sql = "SELECT id FROM ".$this->table. " WHERE id = ".$groupId; {
$sql = "SELECT id FROM ".$this->table." WHERE id = ".$groupId;
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) === 1) { if (Database::num_rows($result) === 1) {
return true; return true;
@ -3410,13 +3411,15 @@ class UserGroup extends Model
return false; return false;
} }
/** /**
* Check the given ID matches an existing user * Check the given ID matches an existing user.
* @param int $userId *
* @return bool * @return bool
*/ */
public function userExists(int $userId) { public function userExists(int $userId)
$sql = "SELECT id FROM ".$this->table_user. " WHERE id = ".$userId; {
$sql = "SELECT id FROM ".$this->table_user." WHERE id = ".$userId;
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) === 1) { if (Database::num_rows($result) === 1) {
return true; return true;

@ -4077,8 +4077,6 @@ class Rest extends WebService
/** /**
* Add a new user to the given group/class. * Add a new user to the given group/class.
* *
* @param int $groupId
* @param int $userId
* @param int $relationType (1:admin, 2:reader, etc. See GROUP_USER_PERMISSION_ constants in api.lib.php) * @param int $relationType (1:admin, 2:reader, etc. See GROUP_USER_PERMISSION_ constants in api.lib.php)
* *
* @return array One item array containing true on success, false otherwise * @return array One item array containing true on success, false otherwise
@ -4097,8 +4095,6 @@ class Rest extends WebService
/** /**
* Get the list of group/class IDs to which the user belongs. * Get the list of group/class IDs to which the user belongs.
* *
* @param int $userId
*
* @return array Array containing the group IDs like ['groups' => [1, 2, 3]] * @return array Array containing the group IDs like ['groups' => [1, 2, 3]]
*/ */
public function getUserSubGroup(int $userId): array public function getUserSubGroup(int $userId): array
@ -4106,6 +4102,7 @@ class Rest extends WebService
$userGroup = new UserGroup(); $userGroup = new UserGroup();
$res = $userGroup->get_usergroup_by_user($userId); $res = $userGroup->get_usergroup_by_user($userId);
return ['groups' => $res]; return ['groups' => $res];
} }

@ -80,7 +80,6 @@ class ch_multiplechoiceother extends survey_question
if (!empty($answers)) { if (!empty($answers)) {
$answers = self::decodeOptionValue($answers); $answers = self::decodeOptionValue($answers);
if (isset($answers[1])) { if (isset($answers[1])) {
$display = ''; $display = '';
$defaultOtherData = $answers[1]; $defaultOtherData = $answers[1];
} }

@ -1745,7 +1745,9 @@ class SurveyUtil
.';'; .';';
} else { } else {
$numberOfOptions = $row['number_of_options']; $numberOfOptions = $row['number_of_options'];
if ($row['type'] == 'multiplechoiceother') $numberOfOptions++; if ($row['type'] == 'multiplechoiceother') {
$numberOfOptions++;
}
for ($ii = 0; $ii < $numberOfOptions; $ii++) { for ($ii = 0; $ii < $numberOfOptions; $ii++) {
$return .= str_replace( $return .= str_replace(
"\r\n", "\r\n",
@ -1828,8 +1830,6 @@ class SurveyUtil
if (!$compact) { if (!$compact) {
$return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';'; $return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id']; $possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
} else { } else {
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['option_text']; $possible_answers[$row['question_id']][$row['question_option_id']] = $row['option_text'];
@ -2028,7 +2028,7 @@ class SurveyUtil
if ($idAnswer == $option_id) { if ($idAnswer == $option_id) {
$return .= ( $return .= (
strlen($other) > 0 strlen($other) > 0
? 'v;"' . str_replace('"', '""', api_html_entity_decode(strip_tags($other), ENT_QUOTES)) . '";' ? 'v;"'.str_replace('"', '""', api_html_entity_decode(strip_tags($other), ENT_QUOTES)).'";'
: 'v;' : 'v;'
); );
} else { } else {
@ -2154,7 +2154,9 @@ class SurveyUtil
$column++; $column++;
} else { } else {
$numberOfOptions = $row['number_of_options']; $numberOfOptions = $row['number_of_options'];
if ($row['type'] == 'multiplechoiceother') $numberOfOptions++; if ($row['type'] == 'multiplechoiceother') {
$numberOfOptions++;
}
for ($ii = 0; $ii < $numberOfOptions; $ii++) { for ($ii = 0; $ii < $numberOfOptions; $ii++) {
$worksheet->setCellValueByColumnAndRow( $worksheet->setCellValueByColumnAndRow(
$column, $column,

@ -319,4 +319,3 @@ $strings['SubscriptionPeriodDuration'] = "Subscription duration (in days)";
$strings['Product'] = "Product name"; $strings['Product'] = "Product name";
$strings['YouProductIsActivatedYouCanNowAccessIt'] = "Your product is now activated and you can now have access to it."; $strings['YouProductIsActivatedYouCanNowAccessIt'] = "Your product is now activated and you can now have access to it.";
$strings['hide_shopping_cart_from_course_catalogue'] = "Hide shopping cart from the course catalogue and leave the subscribe button"; $strings['hide_shopping_cart_from_course_catalogue'] = "Hide shopping cart from the course catalogue and leave the subscribe button";

@ -248,4 +248,3 @@ $strings['Product'] = "Produit";
$strings['SalePrice'] = "Prix"; $strings['SalePrice'] = "Prix";
$strings['YouProductIsActivatedYouCanNowAccessIt'] = "Votre abonnement a été activé, vous avez maintenant accès au module choisi."; $strings['YouProductIsActivatedYouCanNowAccessIt'] = "Votre abonnement a été activé, vous avez maintenant accès au module choisi.";
$strings['hide_shopping_cart_from_course_catalogue'] = "Cacher le chariot de vente dans le catalogue de cours et laisse le bouton s'inscrire"; $strings['hide_shopping_cart_from_course_catalogue'] = "Cacher le chariot de vente dans le catalogue de cours et laisse le bouton s'inscrire";

@ -612,7 +612,7 @@ class BuyCoursesPlugin extends Plugin
$buyButton = Display::returnFontAwesomeIcon('check').PHP_EOL.get_lang('Subscribe'); $buyButton = Display::returnFontAwesomeIcon('check').PHP_EOL.get_lang('Subscribe');
} }
$html = '<a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'. $html = '<a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
$buyButton .'</a>'; $buyButton.'</a>';
return $html; return $html;
} }

@ -26,7 +26,6 @@ $currency = $plugin->getCurrency($sale['currency_id']);
$globalParameters = $plugin->getGlobalParameters(); $globalParameters = $plugin->getGlobalParameters();
if (!empty($globalParameters['sale_email'])) { if (!empty($globalParameters['sale_email'])) {
$messageConfirmBuyerTemplate = new Template(); $messageConfirmBuyerTemplate = new Template();
$messageConfirmBuyerTemplate->assign('user', $userInfo); $messageConfirmBuyerTemplate->assign('user', $userInfo);
$messageConfirmBuyerTemplate->assign( $messageConfirmBuyerTemplate->assign(

Loading…
Cancel
Save