protected function available_updates($updates, $fetch) {

        $updateinfo = '';
        $someupdateavailable = false;
        if (is_array($updates)) {
            if (is_array($updates['core'])) {
                $someupdateavailable = true;
                $updateinfo .= $this->heading(get_string('updateavailable', 'core_admin'), 3);
                foreach ($updates['core'] as $update) {
                    $updateinfo .= $this->moodle_available_update_info($update);
                }
                $updateinfo .= html_writer::tag('p', get_string('updateavailablerecommendation', 'core_admin'),
                    array('class' => 'updateavailablerecommendation'));
            }
            unset($updates['core']);
            // If something has left in the $updates array now, it is updates for plugins.
            if (!empty($updates)) {
                $someupdateavailable = true;
                $updateinfo .= $this->heading(get_string('updateavailableforplugin', 'core_admin'), 3);
                $pluginsoverviewurl = new moodle_url('/admin/plugins.php', array('updatesonly' => 1));
                $updateinfo .= $this->container(get_string('pluginsoverviewsee', 'core_admin',
                    array('url' => $pluginsoverviewurl->out())));
            }
        }

        if (!$someupdateavailable) {
            $now = time();
            if ($fetch and ($fetch <= $now) and ($now - $fetch < HOURSECS)) {
                $updateinfo .= $this->heading(get_string('updateavailablenot', 'core_admin'), 3);
            }
        }

        $updateinfo .= $this->container_start('checkforupdates');
        $fetchurl = new moodle_url('/admin/index.php', array('fetchupdates' => 1, 'sesskey' => sesskey(), 'cache' => 0));
        $updateinfo .= $this->single_button($fetchurl, get_string('checkforupdates', 'core_plugin'));
        if ($fetch) {
            $updateinfo .= $this->container(get_string('checkforupdateslast', 'core_plugin',
                userdate($fetch, get_string('strftimedatetime', 'core_langconfig'))));
        }
        $updateinfo .= $this->container_end();

        return $this->warning($updateinfo);
    }
protected function available_updates($updates, $fetch) {

        $updateinfo = '';
        $someupdateavailable = false;
        if (is_array($updates)) {
            if (is_array($updates['core'])) {
                $someupdateavailable = true;
                $updateinfo .= $this->heading(get_string('updateavailable', 'core_admin'), 3);
                foreach ($updates['core'] as $update) {
                    $updateinfo .= $this->moodle_available_update_info($update);
                }
                $updateinfo .= html_writer::tag('p', get_string('updateavailablerecommendation', 'core_admin'),
                    array('class' => 'updateavailablerecommendation'));
            }
            unset($updates['core']);
            // If something has left in the $updates array now, it is updates for plugins.
            if (!empty($updates)) {
                $someupdateavailable = true;
                $updateinfo .= $this->heading(get_string('updateavailableforplugin', 'core_admin'), 3);
                $pluginsoverviewurl = new moodle_url('/admin/plugins.php', array('updatesonly' => 1));
                $updateinfo .= $this->container(get_string('pluginsoverviewsee', 'core_admin',
                    array('url' => $pluginsoverviewurl->out())));
            }
        }

        if (!$someupdateavailable) {
            $now = time();
            if ($fetch and ($fetch <= $now) and ($now - $fetch < HOURSECS)) {
                $updateinfo .= $this->heading(get_string('updateavailablenot', 'core_admin'), 3);
            }
        }

        $updateinfo .= $this->container_start('checkforupdates');
        $fetchurl = new moodle_url('/admin/index.php', array('fetchupdates' => 1, 'sesskey' => sesskey(), 'cache' => 0));
        $updateinfo .= $this->single_button($fetchurl, get_string('checkforupdates', 'core_plugin'));
        if ($fetch) {
            $updateinfo .= $this->container(get_string('checkforupdateslast', 'core_plugin',
                userdate($fetch, get_string('strftimedatetime', 'core_langconfig'))));
        }
        $updateinfo .= $this->container_end();

        return $this->warning($updateinfo);
    }
protected function available_updates ( $ updates , $ fetch ) { $ updateinfo = '' ; $ someupdateavailable = false ; if ( is_array ( $ updates ) ) { if ( is_array ( $ updates [ 'core' ] ) ) { $ someupdateavailable = true ; $ updateinfo .= $ this -> heading ( get_string ( 'updateavailable' , 'core_admin' ) , 3 ) ; foreach ( $ updates [ 'core' ] as $ update ) { $ updateinfo .= $ this -> moodle_available_update_info ( $ update ) ; } $ updateinfo .= html_writer :: tag ( 'p' , get_string ( 'updateavailablerecommendation' , 'core_admin' ) , array ( 'class' => 'updateavailablerecommendation' ) ) ; } unset ( $ updates [ 'core' ] ) ; // If something has left in the $updates array now, it is updates for plugins. if ( ! empty ( $ updates ) ) { $ someupdateavailable = true ; $ updateinfo .= $ this -> heading ( get_string ( 'updateavailableforplugin' , 'core_admin' ) , 3 ) ; $ pluginsoverviewurl = new moodle_url ( '/admin/plugins.php' , array ( 'updatesonly' => 1 ) ) ; $ updateinfo .= $ this -> container ( get_string ( 'pluginsoverviewsee' , 'core_admin' , array ( 'url' => $ pluginsoverviewurl -> out ( ) ) ) ) ; } } if ( ! $ someupdateavailable ) { $ now = time ( ) ; if ( $ fetch and ( $ fetch <= $ now ) and ( $ now - $ fetch < HOURSECS ) ) { $ updateinfo .= $ this -> heading ( get_string ( 'updateavailablenot' , 'core_admin' ) , 3 ) ; } } $ updateinfo .= $ this -> container_start ( 'checkforupdates' ) ; $ fetchurl = new moodle_url ( '/admin/index.php' , array ( 'fetchupdates' => 1 , 'sesskey' => sesskey ( ) , 'cache' => 0 ) ) ; $ updateinfo .= $ this -> single_button ( $ fetchurl , get_string ( 'checkforupdates' , 'core_plugin' ) ) ; if ( $ fetch ) { $ updateinfo .= $ this -> container ( get_string ( 'checkforupdateslast' , 'core_plugin' , userdate ( $ fetch , get_string ( 'strftimedatetime' , 'core_langconfig' ) ) ) ) ; } $ updateinfo .= $ this -> container_end ( ) ; return $ this -> warning ( $ updateinfo ) ; }
Displays the info about available Moodle core and plugin updates

The structure of the $updates param has changed since 2.4. It contains not only updates
for the core itself, but also for all other installed plugins.

@param array|null $updates array of (string)component => array of \core\update\info objects or null
@param int|null $fetch timestamp of the most recent updates fetch or null (unknown)
@return string
Displays the info about available Moodle core and plugin updates