Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 62... Línea 62...
62
    public function init(): void {
62
    public function init(): void {
63
        parent::init();
63
        parent::init();
64
        $this->strdelete = get_string('delete');
64
        $this->strdelete = get_string('delete');
65
        $this->strrestore = get_string('restore');
65
        $this->strrestore = get_string('restore');
66
        $this->deletequestionurl = new \moodle_url('/question/bank/deletequestion/delete.php');
66
        $this->deletequestionurl = new \moodle_url('/question/bank/deletequestion/delete.php');
67
        if (!empty($this->qbank->cm->id)) {
-
 
68
            $this->returnparams['cmid'] = $this->qbank->cm->id;
67
        $this->returnparams['cmid'] = $this->qbank->cm->id;
69
        }
-
 
70
        if (!empty($this->qbank->course->id)) {
-
 
71
            $this->returnparams['courseid'] = $this->qbank->course->id;
-
 
72
        }
68
 
73
        if (!empty($this->qbank->returnurl)) {
69
        if (!empty($this->qbank->returnurl)) {
74
            $this->returnparams['returnurl'] = $this->qbank->returnurl;
70
            $this->returnparams['returnurl'] = $this->qbank->returnurl;
75
        }
71
        }
76
    }
72
    }
Línea 77... Línea 73...
77
 
73
 
78
    public function get_menu_position(): int {
74
    public function get_menu_position(): int {
79
        return 400;
75
        return 2000;
Línea 80... Línea 76...
80
    }
76
    }
81
 
77
 
82
    protected function get_url_icon_and_label(\stdClass $question): array {
78
    protected function get_url_icon_and_label(\stdClass $question): array {
Línea 94... Línea 90...
94
            $deleteparams = array(
90
            $deleteparams = array(
95
                    'deleteselected' => $question->id,
91
                    'deleteselected' => $question->id,
96
                    'q' . $question->id => 1,
92
                    'q' . $question->id => 1,
97
                    'sesskey' => sesskey());
93
                    'sesskey' => sesskey());
98
            $deleteparams = array_merge($deleteparams, $this->returnparams);
94
            $deleteparams = array_merge($deleteparams, $this->returnparams);
99
            if ($this->qbank->base_url()->get_param('deleteall')) {
95
            if (!$this->qbank->is_listing_specific_versions()) {
100
                $deleteparams['deleteall'] = 1;
96
                $deleteparams['deleteall'] = 1;
101
            }
97
            }
102
            $url = new \moodle_url($this->deletequestionurl, $deleteparams);
98
            $url = new \moodle_url($this->deletequestionurl, $deleteparams);
103
            return [$url, 't/delete', $this->strdelete];
99
            return [$url, 't/delete', $this->strdelete];
104
        }
100
        }
105
    }
101
    }
-
 
102
 
-
 
103
    /**
-
 
104
     * Override method to get url and label for delete action to add the text-danger class.
-
 
105
     *
-
 
106
     * @param \stdClass $question
-
 
107
     * @return \action_menu_link|null
-
 
108
     */
-
 
109
    public function get_action_menu_link(\stdClass $question): ?\action_menu_link {
-
 
110
        $deletelink = parent::get_action_menu_link($question);
-
 
111
        if ($deletelink !== null) {
-
 
112
            $deletelink->add_class('text-danger');
-
 
113
        }
-
 
114
        return $deletelink;
-
 
115
    }
106
}
116
}