Ejemplo n.º 1
0
 /**
  * Displays definition summaries
  *
  * @param array $definitions
  * @return string HTML
  */
 public function definition_summaries(array $definitions, context $context)
 {
     $table = new html_table();
     $table->head = array(get_string('definition', 'cache'), get_string('mode', 'cache'), get_string('component', 'cache'), get_string('area', 'cache'), get_string('mappings', 'cache'), get_string('sharing', 'cache'), get_string('actions', 'cache'));
     $table->colclasses = array('definition', 'mode', 'component', 'area', 'mappings', 'sharing', 'actions');
     $table->data = array();
     $none = new lang_string('none', 'cache');
     foreach ($definitions as $id => $definition) {
         $actions = cache_administration_helper::get_definition_actions($context, $definition);
         $htmlactions = array();
         foreach ($actions as $action) {
             $action['url']->param('definition', $id);
             $htmlactions[] = $this->output->action_link($action['url'], $action['text']);
         }
         if (!empty($definition['mappings'])) {
             $mapping = join(', ', $definition['mappings']);
         } else {
             $mapping = '<em>' . $none . '</em>';
         }
         $row = new html_table_row(array($definition['name'], get_string('mode_' . $definition['mode'], 'cache'), $definition['component'], $definition['area'], $mapping, join(', ', $definition['selectedsharingoption']), join(', ', $htmlactions)));
         $row->attributes['class'] = 'definition-' . $definition['component'] . '-' . $definition['area'];
         $table->data[] = $row;
     }
     $html = html_writer::start_tag('div', array('id' => 'core-cache-definition-summaries'));
     $html .= $this->output->heading(get_string('definitionsummaries', 'cache'), 3);
     $html .= html_writer::table($table);
     $url = new moodle_url('/cache/admin.php', array('action' => 'rescandefinitions', 'sesskey' => sesskey()));
     $link = html_writer::link($url, get_string('rescandefinitions', 'cache'));
     $html .= html_writer::tag('div', $link, array('id' => 'core-cache-rescan-definitions'));
     $html .= html_writer::end_tag('div');
     return $html;
 }
Ejemplo n.º 2
0
            break;
        case 'purge':
            // Purge a store cache.
            $store = required_param('store', PARAM_TEXT);
            cache_helper::purge_store($store);
            redirect($PAGE->url, get_string('purgestoresuccess', 'cache'), 5);
            break;
    }
}
$PAGE->set_title($title);
$PAGE->set_heading($SITE->fullname);
$renderer = $PAGE->get_renderer('core_cache');
echo $renderer->header();
echo $renderer->heading($title);
if (!is_null($notification)) {
    echo $renderer->notification($notification, $notifysuccess ? 'notifysuccess' : 'notifyproblem');
}
if ($mform instanceof moodleform) {
    $mform->display();
} else {
    echo $renderer->store_plugin_summaries($plugins);
    echo $renderer->store_instance_summariers($stores, $plugins);
    echo $renderer->definition_summaries($definitions, cache_administration_helper::get_definition_actions($context));
    echo $renderer->lock_summaries($locks);
    $applicationstore = join(', ', $defaultmodestores[cache_store::MODE_APPLICATION]);
    $sessionstore = join(', ', $defaultmodestores[cache_store::MODE_SESSION]);
    $requeststore = join(', ', $defaultmodestores[cache_store::MODE_REQUEST]);
    $editurl = new moodle_url('/cache/admin.php', array('action' => 'editmodemappings', 'sesskey' => sesskey()));
    echo $renderer->mode_mappings($applicationstore, $sessionstore, $requeststore, $editurl);
}
echo $renderer->footer();