Skip to content

Commit

Permalink
Fix php UNIT
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Sep 25, 2023
1 parent 39db571 commit 3e5f7f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public static function update_emailvars($templatetext, $subject, $course, $user,
if (stripos($templatetext, $replacement) !== false) {
$val = $vars->$funcname;
// Placeholder found on the text, then replace with data.
$templatetext = str_replace($replacement, $val, $templatetext);
$templatetext = str_ireplace($replacement, $val, $templatetext);
}
// Replace message subject placeholder.
if (stripos($subject, $replacement) !== false) {
$val = $vars->$funcname;
$subject = str_replace($replacement, $val, $subject);
$subject = str_ireplace($replacement, $val, $subject);
}
}
return [$subject, $templatetext];
Expand All @@ -107,16 +107,16 @@ public static function convert_varstime_format(&$var) {
}
// Update the timestamp to user readable time.
array_walk($var, function(&$value, $key) {
if (in_array($key, ['timecreated', 'timemodified', 'startdate', 'enddate', 'firstaccess',
if (in_array(strtolower($key), ['timecreated', 'timemodified', 'startdate', 'enddate', 'firstaccess',
'lastaccess', 'lastlogin', 'currentlogin', 'timecreated', 'starttime', 'endtime'])) {
$value = userdate($value);
}
// Update the status to user readable strings.
if (in_array($key, ['visible', 'groupmode', 'groupmodeforce', 'defaultgroupingid', 'enablecompletion'])) {
if (in_array(strtolower($key), ['visible', 'groupmode', 'groupmodeforce', 'defaultgroupingid', 'enablecompletion'])) {
$value = $value == 1 ? get_string('enabled', 'pulse') : get_string('disabled', 'pulse');
}

if ($key == 'lang') {
if (strtolower($key) == 'lang') {
// Get the list of translations.
$translations = get_string_manager()->get_list_of_translations();
$value = $translations[$value] ?? '';
Expand Down
4 changes: 2 additions & 2 deletions lib/vars.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public static function user_profile_fields() {
$fields = array_merge(array_keys($userfields), array_values($profilefields));

array_walk($fields, function(&$value) {
$value = 'User_'.$value;
$value = 'User_'.ucwords($value);
});

$fields = array_values($fields);
Expand Down Expand Up @@ -403,7 +403,7 @@ public static function course_fields() {
$fields = array_merge($coursefields, array_values($customfields));

array_walk($fields, function(&$value) {
$value = 'Course_'.$value;
$value = 'Course_'.ucwords($value);
});

$fields = array_values($fields);
Expand Down

0 comments on commit 3e5f7f3

Please sign in to comment.