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. 2
      main/attendance/attendance_sheet.php
  3. 12
      main/auth/justification.php
  4. 4
      main/auth/profile.php
  5. 3
      main/exercise/export/export_exercise_results.php
  6. 2
      main/exercise/overview.php
  7. 6
      main/inc/lib/api.lib.php
  8. 14
      main/inc/lib/exercise.lib.php
  9. 2
      main/inc/lib/link.lib.php
  10. 25
      main/inc/lib/statistics.lib.php
  11. 19
      main/inc/lib/usergroup.lib.php
  12. 5
      main/inc/lib/webservices/Rest.php
  13. 1
      main/survey/ch_multiplechoiceother.php
  14. 16
      main/survey/surveyUtil.class.php
  15. 1
      plugin/buycourses/lang/english.php
  16. 1
      plugin/buycourses/lang/french.php
  17. 4
      plugin/buycourses/src/buy_course_plugin.class.php
  18. 1
      plugin/buycourses/src/stripe_success.php

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* 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;
require_once __DIR__.'/../inc/global.inc.php';

@ -546,7 +546,7 @@ if (api_is_allowed_to_edit(null, true) ||
<em class="fa fa-search"></em> '.get_lang('SignView').'
</a>
</span>';
} else {
} else {
if ($presence['presence']) {
echo '<span class="list-data">
<a id="sign-'.$user_id.'-'.$presence['calendar_id'].'" class="btn btn-primary attendance-sign" href="javascript:void(0)">

@ -86,14 +86,14 @@ switch ($action) {
// notification to all admins action
$userInfo = api_get_user_info();
// 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();
$emailToAdminSubject = $plugin->get_lang('JustificationsCompleted').': '.$userInfo['complete_name'];
$emailToAdminContent = $emailToAdminSubject . ' <br /><br />' . '<a href="'. $link . '">' . $link . '</a>';
$adminList = UserManager::get_all_administrators();
$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'];
$emailToAdminContent = $emailToAdminSubject.' <br /><br />'.'<a href="'.$link.'">'.$link.'</a>';
foreach ($adminList as $adminId => $data) {
MessageManager::send_message_simple(
$adminId,
$emailToAdminSubject,
$adminId,
$emailToAdminSubject,
$emailToAdminContent,
api_get_user_id());
}

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

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* 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';
@ -112,7 +112,6 @@ if ($form->validate()) {
Display::display_header(get_lang('ExportExerciseAllResults'));
echo $form->display();
Display::display_footer();

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

@ -10586,8 +10586,6 @@ function api_flush_settings_cache(int $url_id): bool
* in the variable $_configuration['ldap_admin_password_salt'].
*
* @param $encryptedText The text to be decrypted
*
* @return string
*/
function api_decrypt_ldap_password(string $encryptedText): string
{
@ -10603,7 +10601,7 @@ function api_decrypt_ldap_password(string $encryptedText): string
$data = substr($data, 0, strlen($data) - 16);
try {
return openssl_decrypt(
return openssl_decrypt(
$data,
'aes-256-gcm',
$secret,
@ -10612,6 +10610,6 @@ function api_decrypt_ldap_password(string $encryptedText): string
$tag
);
} catch (\Exception $e) {
return false;
return false;
}
}

@ -7191,10 +7191,8 @@ EOT;
}
/**
* 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
* Export all results of all exercises to a ZIP file (including one zip for each exercise).
*
* @return false|void
*/
public static function exportAllExercisesResultsZip(
@ -7253,12 +7251,8 @@ EOT;
}
/**
* 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
* Export all results of *one* exercise to a ZIP file containing individual PDFs.
*
* @return false|void
*/
public static function exportExerciseAllResultsZip(

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

@ -1646,11 +1646,10 @@ class Statistics
}
/**
* Return a list of logins by date
* @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format
* Return a list of logins by date.
*
* @return array
* @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format
*/
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')
*/
public static function returnDuplicatedUsersTable(
string $type = 'name',
array $additionalExtraFieldsInfo
): SortableTableFromArray
{
): SortableTableFromArray {
if ($type == 'email') {
$usersInfo = Statistics::getDuplicatedUserMails($additionalExtraFieldsInfo);
} else {
@ -1892,9 +1891,7 @@ class Statistics
* It gets lti learnpath results by date.
*
* @param string $startDate Start date in YYYY-MM-DD format
* @param string $endDate End date in YYYY-MM-DD format
*
* @return array
* @param string $endDate End date in YYYY-MM-DD format
*/
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
* @return 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
* @return array
*/
private static function getDuplicatedUserMails(array $additionalExtraFieldsInfo): array
{

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

@ -4077,8 +4077,6 @@ class Rest extends WebService
/**
* 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)
*
* @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.
*
* @param int $userId
*
* @return array Array containing the group IDs like ['groups' => [1, 2, 3]]
*/
public function getUserSubGroup(int $userId): array
@ -4106,6 +4102,7 @@ class Rest extends WebService
$userGroup = new UserGroup();
$res = $userGroup->get_usergroup_by_user($userId);
return ['groups' => $res];
}

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

@ -1745,7 +1745,9 @@ class SurveyUtil
.';';
} else {
$numberOfOptions = $row['number_of_options'];
if ($row['type'] == 'multiplechoiceother') $numberOfOptions++;
if ($row['type'] == 'multiplechoiceother') {
$numberOfOptions++;
}
for ($ii = 0; $ii < $numberOfOptions; $ii++) {
$return .= str_replace(
"\r\n",
@ -1822,14 +1824,12 @@ class SurveyUtil
}
$current_question_type = $row['type'];
$current_question_id = $row['question_id'];
$current_question_id = $row['question_id'];
$row['option_text'] = str_replace(["\r", "\n"], ['', ''], $row['option_text']);
if (!$compact) {
$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'];
} else {
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['option_text'];
@ -2028,7 +2028,7 @@ class SurveyUtil
if ($idAnswer == $option_id) {
$return .= (
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;'
);
} else {
@ -2154,7 +2154,9 @@ class SurveyUtil
$column++;
} else {
$numberOfOptions = $row['number_of_options'];
if ($row['type'] == 'multiplechoiceother') $numberOfOptions++;
if ($row['type'] == 'multiplechoiceother') {
$numberOfOptions++;
}
for ($ii = 0; $ii < $numberOfOptions; $ii++) {
$worksheet->setCellValueByColumnAndRow(
$column,
@ -2235,7 +2237,7 @@ class SurveyUtil
}
$current_question_type = $row['type'];
$current_question_id = $row['question_id'];
$current_question_id = $row['question_id'];
$worksheet->setCellValueByColumnAndRow(
$column,

@ -319,4 +319,3 @@ $strings['SubscriptionPeriodDuration'] = "Subscription duration (in days)";
$strings['Product'] = "Product name";
$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";

@ -248,4 +248,3 @@ $strings['Product'] = "Produit";
$strings['SalePrice'] = "Prix";
$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";

@ -610,9 +610,9 @@ class BuyCoursesPlugin extends Plugin
$buyButton = Display::returnFontAwesomeIcon('shopping-cart');
if ($this->get('hide_shopping_cart_from_course_catalogue') === 'true') {
$buyButton = Display::returnFontAwesomeIcon('check').PHP_EOL.get_lang('Subscribe');
}
}
$html = '<a class="btn btn-success btn-sm" title="'.$this->get_lang('Buy').'" href="'.$url.'">'.
$buyButton .'</a>';
$buyButton.'</a>';
return $html;
}

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

Loading…
Cancel
Save