Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 34... Línea 34...
34
 * @copyright 2021 Shamim Rezaie <shamim@moodle.com>
34
 * @copyright 2021 Shamim Rezaie <shamim@moodle.com>
35
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
36
 */
37
class dates extends activity_dates {
37
class dates extends activity_dates {
Línea -... Línea 38...
-
 
38
 
-
 
39
    /** @var int|null $timedue the activity due date */
-
 
40
    private ?int $timedue;
38
 
41
 
39
    /**
42
    /**
40
     * Returns a list of important dates in mod_assign
43
     * Returns a list of important dates in mod_assign
41
     *
44
     *
42
     * @return array
45
     * @return array
43
     */
46
     */
44
    protected function get_dates(): array {
47
    protected function get_dates(): array {
Línea 45... Línea 48...
45
        global $CFG;
48
        global $CFG;
Línea -... Línea 49...
-
 
49
 
-
 
50
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
46
 
51
 
47
        require_once($CFG->dirroot . '/mod/assign/locallib.php');
52
        $this->timedue = null;
48
 
53
 
Línea 49... Línea 54...
49
        $course = get_course($this->cm->course);
54
        $course = get_course($this->cm->course);
Línea 81... Línea 86...
81
            }
86
            }
82
            $dates[] = $date;
87
            $dates[] = $date;
83
        }
88
        }
Línea 84... Línea 89...
84
 
89
 
-
 
90
        if ($timedue) {
85
        if ($timedue) {
91
            $this->timedue = (int) $timedue;
86
            $date = [
92
            $date = [
87
                'dataid' => 'duedate',
93
                'dataid' => 'duedate',
88
                'label' => get_string('activitydate:submissionsdue', 'mod_assign'),
94
                'label' => get_string('activitydate:submissionsdue', 'mod_assign'),
89
                'timestamp' => (int) $timedue,
95
                'timestamp' => $this->timedue,
90
            ];
96
            ];
91
            if ($course->relativedatesmode && $assign->can_view_grades()) {
97
            if ($course->relativedatesmode && $assign->can_view_grades()) {
92
                $date['relativeto'] = $course->startdate;
98
                $date['relativeto'] = $course->startdate;
93
            }
99
            }
94
            $dates[] = $date;
100
            $dates[] = $date;
Línea 95... Línea 101...
95
        }
101
        }
96
 
102
 
-
 
103
        return $dates;
-
 
104
    }
-
 
105
 
-
 
106
    /**
-
 
107
     * Returns the dues date data, if any.
-
 
108
     * @return int|null the due date timestamp or null if not set.
-
 
109
     */
-
 
110
    public function get_due_date(): ?int {
-
 
111
        if (!isset($this->timedue)) {
-
 
112
            $this->get_dates();
-
 
113
        }
97
        return $dates;
114
        return $this->timedue;