/**
  * Add appropriate form elements to the criteria form
  *
  * @param stdClass $data details of overall criterion
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $prefix = 'criteria-' . $this->id;
     if (count($data->criteria) > 2) {
         echo $OUTPUT->box_start();
         if (!empty($this->description)) {
             $badge = new badge($this->badgeid);
             echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
         }
         echo $OUTPUT->heading($this->get_title(), 2);
         $agg = $data->get_aggregation_methods();
         if (!$data->is_locked() && !$data->is_active()) {
             $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
             $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
             echo $OUTPUT->box($editaction, array('criteria-header'));
             $url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
             echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null, null, array('aria-describedby' => 'overall'));
             echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
         }
         echo $OUTPUT->box_end();
     }
 }
 /**
  * Add appropriate form elements to the criteria form
  *
  * @param moodleform $mform  Moodle forms object
  * @param stdClass $data details of various modules
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
     $deleteurl = new moodle_url('/badges/criteria_action.php', array('badgeid' => $this->badgeid, 'delete' => true, 'type' => $this->criteriatype));
     $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
     $deleteaction = $OUTPUT->action_icon($deleteurl, new pix_icon('t/delete', get_string('delete')), null, array('class' => 'criteria-action'));
     echo $OUTPUT->box_start();
     if (!$data->is_locked() && !$data->is_active()) {
         echo $OUTPUT->box($deleteaction . $editaction, array('criteria-header'));
     }
     echo $OUTPUT->heading($this->get_title() . $OUTPUT->help_icon('criteria_' . $this->criteriatype, 'badges'), 3, 'main help');
     if (!empty($this->params)) {
         echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges') . $this->get_details(), array('clearfix'));
     }
     echo $OUTPUT->box_end();
 }
 /**
  * Add appropriate form elements to the criteria form
  *
  * @param stdClass $data details of overall criterion
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $prefix = 'criteria-' . $this->id;
     if (count($data->criteria) > 2) {
         echo $OUTPUT->box_start();
         echo $OUTPUT->heading($this->get_title(), 2);
         $agg = $data->get_aggregation_methods();
         if (!$data->is_locked() && !$data->is_active()) {
             $url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
             $table = new html_table();
             $table->attributes = array('class' => 'clearfix');
             $table->colclasses = array('', 'activatebadge');
             $table->data[] = array($OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null), get_string('overallcrit', 'badges'));
             echo html_writer::table($table);
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
         }
         echo $OUTPUT->box_end();
     }
 }
Example #4
0
 /**
  * Add appropriate criteria elements
  *
  * @param stdClass $data details of various criteria
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $agg = $data->get_aggregation_methods();
     $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
     $deleteurl = new moodle_url('/badges/criteria_action.php', array('badgeid' => $this->badgeid, 'delete' => true, 'type' => $this->criteriatype));
     $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
     $deleteaction = $OUTPUT->action_icon($deleteurl, new pix_icon('t/delete', get_string('delete')), null, array('class' => 'criteria-action'));
     echo $OUTPUT->box_start();
     if (!$data->is_locked() && !$data->is_active()) {
         echo $OUTPUT->box($deleteaction . $editaction, array('criteria-header'));
     }
     echo $OUTPUT->heading($this->get_title() . $OUTPUT->help_icon('criteria_' . $this->criteriatype, 'badges'), 3, 'main help');
     if (!empty($this->description)) {
         $badge = new badge($this->badgeid);
         echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
     }
     if (!empty($this->params)) {
         if (count($this->params) > 1) {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method($this->criteriatype)])), array('clearfix'));
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_single_' . $this->criteriatype, 'badges'), array('clearfix'));
         }
         echo $OUTPUT->box($this->get_details(), array('clearfix'));
     }
     echo $OUTPUT->box_end();
 }