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();

        core_collator::asort_array_of_arrays_by_key($definitions, 'name');

        $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;
    }
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();

        core_collator::asort_array_of_arrays_by_key($definitions, 'name');

        $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;
    }
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 ( ) ; core_collator :: asort_array_of_arrays_by_key ( $ definitions , 'name' ) ; $ 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 ; }
Displays definition summaries

@param array $definitions
@return string HTML
Displays definition summaries