public function get_last_timefetched()
 {
     if ($this->fakerecentfetch == -1) {
         return parent::get_last_timefetched();
     } else {
         return $this->fakerecentfetch;
     }
 }
Exemplo n.º 2
0
 /**
  * Renders a button to fetch for available updates.
  *
  * @param \core\update\checker $checker
  * @param moodle_url $reloadurl
  * @return string HTML
  */
 public function check_for_updates_button(\core\update\checker $checker, $reloadurl)
 {
     $output = '';
     if ($checker->enabled()) {
         $output .= $this->container_start('checkforupdates');
         $output .= $this->single_button(new moodle_url($reloadurl, array('fetchupdates' => 1)), get_string('checkforupdates', 'core_plugin'));
         if ($timefetched = $checker->get_last_timefetched()) {
             $timefetched = userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'));
             $output .= $this->container(get_string('checkforupdateslast', 'core_plugin', $timefetched), 'lasttimefetched');
         }
         $output .= $this->container_end();
     }
     return $output;
 }
Exemplo n.º 3
0
 /**
  * Display the plugin management page (admin/plugins.php).
  *
  * The filtering options array may contain following items:
  *  bool contribonly - show only contributed extensions
  *  bool updatesonly - show only plugins with an available update
  *
  * @param core_plugin_manager $pluginman
  * @param \core\update\checker $checker
  * @param array $options filtering options
  * @return string HTML to output.
  */
 public function plugin_management_page(core_plugin_manager $pluginman, \core\update\checker $checker, array $options = array())
 {
     global $CFG;
     $output = '';
     $output .= $this->header();
     $output .= $this->heading(get_string('pluginsoverview', 'core_admin'));
     $output .= $this->plugins_overview_panel($pluginman, $options);
     if (empty($CFG->disableupdatenotifications)) {
         $output .= $this->container_start('checkforupdates');
         $output .= $this->single_button(new moodle_url($this->page->url, array_merge($options, array('fetchremote' => 1))), get_string('checkforupdates', 'core_plugin'));
         if ($timefetched = $checker->get_last_timefetched()) {
             $output .= $this->container(get_string('checkforupdateslast', 'core_plugin', userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'))));
         }
         $output .= $this->container_end();
     }
     $output .= $this->box($this->plugins_control_panel($pluginman, $options), 'generalbox');
     $output .= $this->footer();
     return $output;
 }