/** * Constructor. * * @param stdClass $cohort */ public function __construct($cohort) { $cohortcontext = \context::instance_by_id($cohort->contextid); $editable = has_capability('moodle/cohort:manage', $cohortcontext); $displayvalue = format_string($cohort->name, true, array('context' => $cohortcontext)); parent::__construct('core_cohort', 'cohortname', $cohort->id, $editable, $displayvalue, $cohort->name, new lang_string('editcohortname', 'cohort'), new lang_string('newnamefor', 'cohort', $displayvalue)); }
/** * Constructor. * * @param \stdClass|core_tag_tag $tag */ public function __construct($tag) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $value = (int) $tag->flag; parent::__construct('core_tag', 'tagflag', $tag->id, $editable, $value, $value); $this->set_type_toggle(array(0, $value ? $value : 1)); }
/** * Constructor. * * @param \stdClass|core_tag_tag $tag */ public function __construct($tag) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $value = (int) (bool) $tag->isstandard; parent::__construct('core_tag', 'tagisstandard', $tag->id, $editable, $value, $value); $this->set_type_toggle(); }
/** * Constructor. * * @param \stdClass $tagarea */ public function __construct($tagarea) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $value = $tagarea->enabled ? 1 : 0; parent::__construct('core_tag', 'tagareaenable', $tagarea->id, $editable, '', $value); $this->set_type_toggle(); }
/** * Constructor. * * @param stdClass $cohort */ public function __construct($cohort) { $cohortcontext = \context::instance_by_id($cohort->contextid); $editable = has_capability('moodle/cohort:manage', $cohortcontext); $displayvalue = s($cohort->idnumber); // All idnumbers are plain text. parent::__construct('core_cohort', 'cohortidnumber', $cohort->id, $editable, $displayvalue, $cohort->idnumber, new lang_string('editcohortidnumber', 'cohort'), new lang_string('newidnumberfor', 'cohort', $displayvalue)); }
/** * Constructor. * * @param \stdClass $tagcoll */ public function __construct($tagcoll) { $defaultid = core_tag_collection::get_default(); $editable = $tagcoll->id != $defaultid && has_capability('moodle/tag:manage', context_system::instance()); $edithint = new lang_string('editsearchable', 'core_tag'); $value = $tagcoll->searchable ? 1 : 0; parent::__construct('core_tag', 'tagcollsearchable', $tagcoll->id, $editable, $value, $value, $edithint); $this->set_type_toggle(); }
/** * Constructor. * * @param stdClass|core_tag $tag */ public function __construct($tag) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $edithint = new lang_string('editname', 'core_tag'); $editlabel = new lang_string('newnamefor', 'core_tag', $tag->rawname); $value = $tag->rawname; $displayvalue = html_writer::link(core_tag_tag::make_url($tag->tagcollid, $tag->rawname), core_tag_tag::make_display_name($tag)); parent::__construct('core_tag', 'tagname', $tag->id, $editable, $displayvalue, $value, $edithint, $editlabel); }
/** * Constructor. * * @param cm_info $cm * @param bool $editable * @param array $displayoptions */ public function __construct(cm_info $cm, $editable, $displayoptions = array()) { $this->cm = $cm; $this->displayoptions = $displayoptions; $value = $cm->name; $edithint = new lang_string('edittitle'); $editlabel = new lang_string('newactivityname', '', $cm->get_formatted_name()); $editable = $editable && has_capability('moodle/course:manageactivities', context_module::instance($cm->id)); parent::__construct('core_course', 'activityname', $cm->id, $editable, $value, $value, $edithint, $editlabel); }
/** * Constructor. * * @param \stdClass $tagarea */ public function __construct($tagarea) { $tagcollections = \core_tag_collection::get_collections_menu(true); $editable = count($tagcollections) > 1 && empty($tagarea->locked) && has_capability('moodle/tag:manage', context_system::instance()); $areaname = core_tag_area::display_name($tagarea->component, $tagarea->itemtype); $edithint = new lang_string('edittagcollection', 'core_tag'); $editlabel = new lang_string('changetagcoll', 'core_tag', $areaname); $value = $tagarea->tagcollid; parent::__construct('core_tag', 'tagareacollection', $tagarea->id, $editable, null, $value, $edithint, $editlabel); $this->set_type_select($tagcollections); }
/** * Constructor. * * @param \stdClass $tagcoll */ public function __construct($tagcoll) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $edithint = new lang_string('editcollname', 'core_tag'); $value = $tagcoll->name; $name = \core_tag_collection::display_name($tagcoll); $editlabel = new lang_string('newcollnamefor', 'core_tag', $name); $manageurl = new moodle_url('/tag/manage.php', array('tc' => $tagcoll->id)); $displayvalue = html_writer::link($manageurl, $name); parent::__construct('core_tag', 'tagcollname', $tagcoll->id, $editable, $displayvalue, $value, $edithint, $editlabel); }
/** * Constructor. * * @param \stdClass $tagarea */ public function __construct($tagarea) { $editable = has_capability('moodle/tag:manage', context_system::instance()); $edithint = new lang_string('editisstandard', 'core_tag'); $value = $tagarea->showstandard; $areaname = core_tag_area::display_name($tagarea->component, $tagarea->itemtype); $editlabel = new lang_string('changeshowstandard', 'core_tag', $areaname); parent::__construct('core_tag', 'tagareashowstandard', $tagarea->id, $editable, null, $value, $edithint, $editlabel); $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')); $this->set_type_select($standardchoices); }
/** * Constructor. * * @param \stdClass $tagarea */ public function __construct($tagarea) { if (!empty($tagarea->locked)) { // If the tag collection for the current tag area is locked, display the // name of the collection without possibility to edit it. $tagcoll = \core_tag_collection::get_by_id($tagarea->tagcollid); parent::__construct('core_tag', 'tagareacollection', $tagarea->id, false, \core_tag_collection::display_name($tagcoll), $tagarea->tagcollid); return; } $tagcollections = \core_tag_collection::get_collections_menu(true); $editable = count($tagcollections) > 1 && has_capability('moodle/tag:manage', context_system::instance()); $areaname = core_tag_area::display_name($tagarea->component, $tagarea->itemtype); $edithint = new lang_string('edittagcollection', 'core_tag'); $editlabel = new lang_string('changetagcoll', 'core_tag', $areaname); $value = $tagarea->tagcollid; parent::__construct('core_tag', 'tagareacollection', $tagarea->id, $editable, null, $value, $edithint, $editlabel); $this->set_type_select($tagcollections); }