Beispiel #1
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->displayvalue = $output->pix_icon('i/checked', get_string('yes'));
     } else {
         $this->displayvalue = $output->pix_icon('i/unchecked', get_string('no'));
     }
     return parent::export_for_template($output);
 }
Beispiel #2
0
 /**
  * Export this data so it can be used as the context for a mustache template (core/inplace_editable).
  *
  * @param renderer_base $output typically, the renderer that's calling this function
  * @return array data context for a mustache template
  */
 public function export_for_template(\renderer_base $output)
 {
     global $PAGE;
     $courserenderer = $PAGE->get_renderer('core', 'course');
     $this->displayvalue = $courserenderer->course_section_cm_name_title($this->cm, $this->displayoptions);
     if (strval($this->displayvalue) === '') {
         $this->editable = false;
     }
     return parent::export_for_template($output);
 }
Beispiel #3
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('resetflag', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/flagged', $this->edithint) . " ({$this->value})";
     } else {
         $this->edithint = get_string('flagasinappropriate', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/unflagged', $this->edithint);
     }
     return parent::export_for_template($output);
 }
Beispiel #4
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('settypedefault', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/checked', $this->edithint);
     } else {
         $this->edithint = get_string('settypestandard', 'core_tag');
         $this->displayvalue = $output->pix_icon('i/unchecked', $this->edithint);
     }
     return parent::export_for_template($output);
 }
Beispiel #5
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @param \renderer_base $output
  * @return \stdClass
  */
 public function export_for_template(\renderer_base $output)
 {
     if ($this->value) {
         $this->edithint = get_string('disable');
         $this->displayvalue = $output->pix_icon('i/hide', get_string('disable'));
     } else {
         $this->edithint = get_string('enable');
         $this->displayvalue = $output->pix_icon('i/show', get_string('enable'));
     }
     return parent::export_for_template($output);
 }
Beispiel #6
0
 /**
  * Renders element for inline editing of any value
  *
  * @param \core\output\inplace_editable $element
  * @return string
  */
 public function render_inplace_editable(\core\output\inplace_editable $element)
 {
     return $this->render_from_template('core/inplace_editable', $element->export_for_template($this));
 }