Skip to content

Commit

Permalink
Added availability message improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
santoshndev committed Jan 2, 2025
1 parent 53c81d1 commit 4c3d043
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
16 changes: 14 additions & 2 deletions classes/condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,23 @@ protected function seconds_to_hours_minutes($seconds) {
public function get_description($full, $not, info $info) {
$dseconds = $this->get_dedication_time();
$dtime = $this->seconds_to_hours_minutes($dseconds);

$minutesstr = '<strong>' . $dtime['minutes'] . '</strong>' . get_string('minutes', 'availability_dedicationtime');
$hoursstr = '<strong>' . $dtime['hours'] . '</strong>' . get_string('hours', 'availability_dedicationtime');
$andstr = get_string('and', 'availability_dedicationtime');
$msg = $hoursstr . $andstr . $minutesstr;

if ($dtime['hours'] == 0) {
$msg = $minutesstr;
} elseif ($dtime['minutes'] == 0) {
$msg = $hoursstr;
}

if ($not) {
return get_string('requires_notfinish', 'availability_dedicationtime', $dtime);
return get_string('requires_notfinish', 'availability_dedicationtime', $msg);
}

return get_string('requires_finish', 'availability_dedicationtime', $dtime);
return get_string('requires_finish', 'availability_dedicationtime', $msg);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions lang/en/availability_dedicationtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['and'] = ' and ';
$string['description'] = 'Restrict access to a specific course dedication time.';
$string['error_invalidnumber'] = 'Please enter a valid value.';
$string['hours'] = 'hours';
$string['minutes'] = 'minutes';
$string['hours'] = ' hours';
$string['minutes'] = ' minutes';
$string['pluginname'] = 'Restriction by dedication time';
$string['privacy:metadata'] = 'The Restriction by dedication time plugin does not store any personal data.';
$string['requires_finish'] = 'you must spent at least <strong>{$a->hours}</strong> hours and <strong>{$a->minutes}</strong> minutes time in the course';
$string['requires_notfinish'] = 'you must not spent <strong>{$a->hours}</strong> hours and <strong>{$a->minutes}</strong> minutes time in the course';
$string['requires_finish'] = 'you have spent at least {$a} time in the course';
$string['requires_notfinish'] = 'you have not spent {$a} time in the course';
$string['title'] = 'Dedication time';
$string['unit'] = 'Dedication time unit';
9 changes: 5 additions & 4 deletions lang/hi/availability_dedicationtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['and'] = ' और ';
$string['description'] = 'विशिष्ट पाठ्यक्रम समर्पण समय तक पहुंच को प्रतिबंधित करें।';
$string['error_invalidnumber'] = 'कृपया एक मान्य मान दर्ज करें।';
$string['hours'] = 'घंटे';
$string['minutes'] = 'मिनट';
$string['hours'] = ' घंटे';
$string['minutes'] = ' मिनट';
$string['pluginname'] = 'समर्पण समय के अनुसार प्रतिबंध';
$string['privacy:metadata'] = 'समर्पण समय के अनुसार प्रतिबंध प्लगइन कोई व्यक्तिगत डेटा संग्रहीत नहीं करता है।';
$string['requires_finish'] = 'आपको पाठ्यक्रम में कम से कम <strong>{$a->hours}</strong> घंटे और <strong>{$a->minutes}</strong> मिनट बिताने होंगे।';
$string['requires_notfinish'] = 'आपको पाठ्यक्रम में <strong>{$a->hours}</strong> घंटे और <strong>{$a->minutes}</strong> मिनट नहीं बिताने चाहिए।';
$string['requires_finish'] = 'आपको पाठ्यक्रम में कम से कम {$a} बिताने होंगे।';
$string['requires_notfinish'] = 'आपको पाठ्यक्रम में {$a} नहीं बिताने चाहिए।';
$string['title'] = 'समर्पण समय';
$string['unit'] = 'समर्पण समय इकाई';
9 changes: 5 additions & 4 deletions lang/mr/availability_dedicationtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$string['and'] = ' आणि ';
$string['description'] = 'विशिष्ट कोर्स समर्पित वेळेसाठी प्रवेश मर्यादित करा.';
$string['error_invalidnumber'] = 'कृपया एक वैध मूल्य प्रविष्ट करा.';
$string['hours'] = 'तास';
$string['minutes'] = 'मिनिटे';
$string['hours'] = ' तास';
$string['minutes'] = ' मिनिटे';
$string['pluginname'] = 'समर्पित वेळेने मर्यादा';
$string['privacy:metadata'] = 'समर्पित वेळेने मर्यादा प्लगइन कोणतीही वैयक्तिक माहिती संग्रहित करत नाही.';
$string['requires_finish'] = 'तुम्हाला कोर्समध्ये किमान <strong>{$a->hours}</strong> तास आणि <strong>{$a->minutes}</strong> मिनिटे वेळ समर्पित करणे आवश्यक आहे.';
$string['requires_notfinish'] = 'तुम्हाला कोर्समध्ये <strong>{$a->hours}</strong> तास आणि <strong>{$a->minutes}</strong> मिनिटे वेळ समर्पित करणे आवश्यक नाही.';
$string['requires_finish'] = 'तुम्हाला कोर्समध्ये किमान {$a} वेळ समर्पित करणे आवश्यक आहे.';
$string['requires_notfinish'] = 'तुम्हाला कोर्समध्ये {$a} वेळ समर्पित करणे आवश्यक नाही.';
$string['title'] = 'समर्पित वेळ';
$string['unit'] = 'समर्पण वेळ एकक';

0 comments on commit 4c3d043

Please sign in to comment.