Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-areas-table';
     $this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'), get_string('showstandard', 'tag') . $OUTPUT->help_icon('showstandard', 'tag'));
     $this->data = array();
     $this->rowclasses = array();
     $tagareas = core_tag_area::get_areas();
     $tagcollections = core_tag_collection::get_collections_menu(true);
     $tagcollectionsall = core_tag_collection::get_collections_menu();
     $standardchoices = array(core_tag_tag::BOTH_STANDARD_AND_NOT => get_string('standardsuggest', 'tag'), core_tag_tag::STANDARD_ONLY => get_string('standardforce', 'tag'), core_tag_tag::HIDE_STANDARD => get_string('standardhide', 'tag'));
     foreach ($tagareas as $itemtype => $it) {
         foreach ($it as $component => $record) {
             $areaname = core_tag_area::display_name($record->component, $record->itemtype);
             $tmpl = new \core_tag\output\tagareaenabled($record);
             $enabled = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $tmpl = new \core_tag\output\tagareacollection($record);
             $collectionselect = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $tmpl = new \core_tag\output\tagareashowstandard($record);
             $showstandardselect = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect, $showstandardselect);
             $this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-areas-table';
     $this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'));
     $this->data = array();
     $this->rowclasses = array();
     $tagareas = core_tag_area::get_areas();
     $tagcollections = core_tag_collection::get_collections_menu(true);
     $tagcollectionsall = core_tag_collection::get_collections_menu();
     foreach ($tagareas as $itemtype => $it) {
         foreach ($it as $component => $record) {
             $areaname = core_tag_area::display_name($record->component, $record->itemtype);
             $baseurl = new moodle_url($pageurl, array('ta' => $record->id, 'sesskey' => sesskey()));
             if ($record->enabled) {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areadisable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/hide', get_string('disable')));
             } else {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areaenable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/show', get_string('enable')));
             }
             if ($record->enabled && empty($record->locked) && count($tagcollections) > 1) {
                 $changecollurl = new moodle_url($baseurl, array('action' => 'areasetcoll'));
                 $select = new single_select($changecollurl, 'areacollid', $tagcollections, $record->tagcollid, null);
                 $select->set_label(get_string('changetagcoll', 'core_tag', $areaname), array('class' => 'accesshide'));
                 $collectionselect = $OUTPUT->render($select);
             } else {
                 $collectionselect = $tagcollectionsall[$record->tagcollid];
             }
             $this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect);
             $this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
         }
     }
 }
 /**
  * Call parent construct and then build table
  * @param tool_mergeusers_renderer $renderer
  */
 public function __construct($renderer)
 {
     global $SESSION;
     $this->renderer = $renderer;
     // Call parent constructor
     parent::__construct();
     if (!empty($SESSION->mut)) {
         if (!empty($SESSION->mut->olduser)) {
             $this->olduser = $SESSION->mut->olduser;
         }
         if (!empty($SESSION->mut->newuser)) {
             $this->newuser = $SESSION->mut->newuser;
         }
     }
     $this->buildtable();
 }
Exemplo n.º 4
0
 /**
  * Constructor
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-collections-table';
     $this->head = array(get_string('name'), get_string('component', 'tag'), get_string('tagareas', 'tag'), get_string('searchable', 'tag') . $OUTPUT->help_icon('searchable', 'tag'), '');
     $this->data = array();
     $tagcolls = core_tag_collection::get_collections();
     $idx = 0;
     foreach ($tagcolls as $tagcoll) {
         $actions = '';
         $name = core_tag_collection::display_name($tagcoll);
         $url = new moodle_url($pageurl, array('sesskey' => sesskey(), 'tc' => $tagcoll->id));
         if (!$tagcoll->isdefault) {
             // Move up.
             if ($idx > 1) {
                 $url->param('action', 'collmoveup');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')), null, array('class' => 'action-icon action_moveup'));
             }
             // Move down.
             if ($idx < count($tagcolls) - 1) {
                 $url->param('action', 'collmovedown');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')), null, array('class' => 'action-icon action_movedown'));
             }
         }
         if (!$tagcoll->isdefault && empty($tagcoll->component)) {
             // Delete.
             $url->param('action', 'colldelete');
             $actions .= $OUTPUT->action_icon('#', new pix_icon('t/delete', get_string('delete')), null, array('data-url' => $url->out(false), 'data-collname' => $name, 'class' => 'action-icon action_delete'));
         }
         $component = '';
         if ($tagcoll->component) {
             $component = $tagcoll->component === 'core' || preg_match('/^core_/', $tagcoll->component) ? get_string('coresystem') : get_string('pluginname', $tagcoll->component);
         }
         $allareas = core_tag_collection::get_areas_names(null, false);
         $validareas = core_tag_collection::get_areas_names($tagcoll->id);
         $areaslist = array_map(function ($key) use($allareas, $validareas) {
             return "<li data-areaid=\"{$key}\" " . (array_key_exists($key, $validareas) ? "" : "style=\"display:none;\"") . ">{$allareas[$key]}</li>";
         }, array_keys($allareas));
         $displayname = new \core_tag\output\tagcollname($tagcoll);
         $searchable = new \core_tag\output\tagcollsearchable($tagcoll);
         $this->data[] = array($displayname->render($OUTPUT), $component, "<ul data-collectionid=\"{$tagcoll->id}\">" . join('', $areaslist) . '</ul>', $searchable->render($OUTPUT), $actions);
         $idx++;
     }
 }
Exemplo n.º 5
0
 /**
  * Constructor
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-collections-table';
     $this->head = array(get_string('name'), get_string('component', 'tag'), get_string('tagareas', 'tag'), get_string('searchable', 'tag') . $OUTPUT->help_icon('searchable', 'tag'), '');
     $this->data = array();
     $tagcolls = core_tag_collection::get_collections();
     $idx = 0;
     foreach ($tagcolls as $tagcoll) {
         $actions = '';
         $name = core_tag_collection::display_name($tagcoll);
         $url = new moodle_url($pageurl, array('sesskey' => sesskey(), 'tc' => $tagcoll->id));
         if (!$tagcoll->isdefault) {
             // Move up.
             if ($idx > 1) {
                 $url->param('action', 'collmoveup');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')));
             }
             // Move down.
             if ($idx < count($tagcolls) - 1) {
                 $url->param('action', 'collmovedown');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')));
             }
         }
         if (empty($tagcoll->component)) {
             // Edit.
             $url->param('action', 'colledit');
             $actions .= $OUTPUT->action_icon($url, new pix_icon('t/edit', get_string('edittagcoll', 'tag', $name)));
         }
         if (!$tagcoll->isdefault && empty($tagcoll->component)) {
             // Delete.
             $url->param('action', 'colldelete');
             $actions .= $OUTPUT->action_icon($url, new pix_icon('t/delete', get_string('delete')));
         }
         $manageurl = new moodle_url('/tag/manage.php', array('tc' => $tagcoll->id));
         $component = '';
         if ($tagcoll->component) {
             $component = $tagcoll->component === 'core' || preg_match('/^core_/', $tagcoll->component) ? get_string('coresystem') : get_string('pluginname', $tagcoll->component);
         }
         $this->data[] = array(html_writer::link($manageurl, $name), $component, join(', ', core_tag_collection::get_areas_names($tagcoll->id)), $tagcoll->searchable ? get_string('yes') : '-', $actions);
         $idx++;
     }
 }
 /**
  * Call parent construct
  *
  * @param array $users
  * @param tool_mergeusers_renderer $renderer
  *
  */
 public function __construct($users, $renderer)
 {
     parent::__construct();
     $this->renderer = $renderer;
     $this->buildtable($users);
 }