Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 137... Línea 137...
137
 
137
 
138
    // Recursively uninstall all subplugins first.
138
    // Recursively uninstall all subplugins first.
139
    $subplugintypes = core_component::get_plugin_types_with_subplugins();
139
    $subplugintypes = core_component::get_plugin_types_with_subplugins();
140
    if (isset($subplugintypes[$type])) {
140
    if (isset($subplugintypes[$type])) {
141
        $base = core_component::get_plugin_directory($type, $name);
-
 
142
 
141
        $base = core_component::get_plugin_directory($type, $name);
143
        $subpluginsfile = "{$base}/db/subplugins.json";
-
 
144
        if (file_exists($subpluginsfile)) {
-
 
145
            $subplugins = (array) json_decode(file_get_contents($subpluginsfile))->plugintypes;
-
 
146
        } else if (file_exists("{$base}/db/subplugins.php")) {
-
 
147
            debugging('Use of subplugins.php has been deprecated. ' .
-
 
148
                    'Please update your plugin to provide a subplugins.json file instead.',
-
 
149
                    DEBUG_DEVELOPER);
-
 
150
            $subplugins = [];
-
 
151
            include("{$base}/db/subplugins.php");
-
 
Línea 152... Línea 142...
152
        }
142
        $subplugins = \core\component::get_subplugins("{$type}_{$name}");
153
 
143
 
154
        if (!empty($subplugins)) {
144
        if (!empty($subplugins)) {
155
            foreach (array_keys($subplugins) as $subplugintype) {
145
            foreach (array_keys($subplugins) as $subplugintype) {
Línea 8716... Línea 8706...
8716
 *      page (e.g. admin/roles/allow.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
8706
 *      page (e.g. admin/roles/allow.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
8717
 * @param array $options Additional options that can be specified for page setup.
8707
 * @param array $options Additional options that can be specified for page setup.
8718
 *      pagelayout - This option can be used to set a specific pagelyaout, admin is default.
8708
 *      pagelayout - This option can be used to set a specific pagelyaout, admin is default.
8719
 *      nosearch - Do not display search bar
8709
 *      nosearch - Do not display search bar
8720
 */
8710
 */
8721
function admin_externalpage_setup($section, $extrabutton = '', array $extraurlparams = null, $actualurl = '', array $options = array()) {
8711
function admin_externalpage_setup($section, $extrabutton = '', ?array $extraurlparams = null, $actualurl = '', array $options = array()) {
8722
    global $CFG, $PAGE, $USER, $SITE, $OUTPUT;
8712
    global $CFG, $PAGE, $USER, $SITE, $OUTPUT;
Línea 8723... Línea 8713...
8723
 
8713
 
Línea 8724... Línea 8714...
8724
    $PAGE->set_context(null); // hack - set context to something, by default to system context
8714
    $PAGE->set_context(null); // hack - set context to something, by default to system context
Línea 10449... Línea 10439...
10449
     * @param string $visiblename
10439
     * @param string $visiblename
10450
     * @param string $description
10440
     * @param string $description
10451
     * @param string $defaultsetting
10441
     * @param string $defaultsetting
10452
     * @param array $previewconfig Array('selector'=>'.some .css .selector','style'=>'backgroundColor');
10442
     * @param array $previewconfig Array('selector'=>'.some .css .selector','style'=>'backgroundColor');
10453
     */
10443
     */
10454
    public function __construct($name, $visiblename, $description, $defaultsetting, array $previewconfig = null,
10444
    public function __construct($name, $visiblename, $description, $defaultsetting, ?array $previewconfig = null,
10455
            $usedefaultwhenempty = true) {
10445
            $usedefaultwhenempty = true) {
10456
        $this->previewconfig = $previewconfig;
10446
        $this->previewconfig = $previewconfig;
10457
        $this->usedefaultwhenempty = $usedefaultwhenempty;
10447
        $this->usedefaultwhenempty = $usedefaultwhenempty;
10458
        parent::__construct($name, $visiblename, $description, $defaultsetting);
10448
        parent::__construct($name, $visiblename, $description, $defaultsetting);
10459
        $this->set_force_ltr(true);
10449
        $this->set_force_ltr(true);
Línea 10616... Línea 10606...
10616
     * @param string $description description of setting
10606
     * @param string $description description of setting
10617
     * @param mixed $filearea file area for file storage
10607
     * @param mixed $filearea file area for file storage
10618
     * @param int $itemid itemid for file storage
10608
     * @param int $itemid itemid for file storage
10619
     * @param array $options file area options
10609
     * @param array $options file area options
10620
     */
10610
     */
10621
    public function __construct($name, $visiblename, $description, $filearea, $itemid = 0, array $options = null) {
10611
    public function __construct($name, $visiblename, $description, $filearea, $itemid = 0, ?array $options = null) {
10622
        parent::__construct($name, $visiblename, $description, '');
10612
        parent::__construct($name, $visiblename, $description, '');
10623
        $this->filearea = $filearea;
10613
        $this->filearea = $filearea;
10624
        $this->itemid   = $itemid;
10614
        $this->itemid   = $itemid;
10625
        $this->options  = (array)$options;
10615
        $this->options  = (array)$options;
10626
        $this->customcontrol = true;
10616
        $this->customcontrol = true;
Línea 11808... Línea 11798...
11808
 
11798
 
11809
        // Wrap it in a notification so we reduce style changes when loading is finished.
11799
        // Wrap it in a notification so we reduce style changes when loading is finished.
Línea 11810... Línea 11800...
11810
        $output = $OUTPUT->notification($loadingicon . $loadingstr, \core\output\notification::NOTIFY_INFO, false);
11800
        $output = $OUTPUT->notification($loadingicon . $loadingstr, \core\output\notification::NOTIFY_INFO, false);
-
 
11801
 
11811
 
11802
        // Add the action link.
-
 
11803
        if ($actionlink = $this->check->get_action_link()) {
Línea 11812... Línea 11804...
11812
        // Add the action link.
11804
            $output .= $OUTPUT->render($actionlink);
11813
        $output .= $OUTPUT->render($this->check->get_action_link());
11805
        }
Línea 11814... Línea 11806...
11814
 
11806
 
11815
        // Wrap in a div with a reference. The JS getAndRender will replace this with the response from the webservice.
11807
        // Wrap in a div with a reference. The JS getAndRender will replace this with the response from the webservice.
11816
        $statusdiv = \html_writer::div($output, '', ['data-check-reference' => $domref]);
11808
        $statusdiv = \html_writer::div($output, '', ['data-check-reference' => $domref]);
Línea -... Línea 11809...
-
 
11809
 
-
 
11810
        return format_admin_setting($this, $this->visiblename, '', $statusdiv);
-
 
11811
    }
-
 
11812
}
-
 
11813
 
-
 
11814
 
-
 
11815
/**
-
 
11816
 * Show the save changes button.
-
 
11817
 */
-
 
11818
class admin_setting_savebutton extends admin_setting {
-
 
11819
    /**
-
 
11820
     * Constructor.
-
 
11821
     *
-
 
11822
     * @param string $name unique ascii name.
-
 
11823
     * @param string $visiblename localised name.
-
 
11824
     * @param string $description localised long description.
-
 
11825
     * @param mixed $defaultsetting string or array depending on implementation.
-
 
11826
     */
-
 
11827
    public function __construct(string $name, string $visiblename = "", string $description = "", $defaultsetting = "") {
-
 
11828
        $this->nosave = true;
-
 
11829
        parent::__construct($name, $visiblename, $description, $defaultsetting);
-
 
11830
    }
-
 
11831
 
-
 
11832
    /**
-
 
11833
     * Always returns true, does nothing.
-
 
11834
     *
-
 
11835
     * @return bool Always return true.
-
 
11836
     */
-
 
11837
    public function get_setting(): bool {
-
 
11838
        return true;
-
 
11839
    }
-
 
11840
 
-
 
11841
    /**
-
 
11842
     * Always returns '', does not write anything.
-
 
11843
     *
-
 
11844
     * @param mixed $data string or array, must not be NULL.
-
 
11845
     * @return string Always returns ''.
-
 
11846
     */
-
 
11847
    public function write_setting($data): string {
-
 
11848
        return '';
-
 
11849
    }
-
 
11850
 
-
 
11851
    /**
-
 
11852
     * Return part of form with setting.
-
 
11853
     *
-
 
11854
     * This function should always be overwritten.
-
 
11855
     *
-
 
11856
     * @param mixed $data array or string depending on setting.
-
 
11857
     * @param string $query
-
 
11858
     * @return string
-
 
11859
     */