public static function get_title()
 {
     $identifier = self::get_name();
     return qtype_matrix::get_string($identifier);
 }
 public static function get_title()
 {
     return qtype_matrix::get_string(self::TYPE);
 }
 public function validation($data)
 {
     $multiple = $data['multiple'];
     if (empty($multiple)) {
         return array('multiple' => qtype_matrix::get_string('weightednomultiple'));
     }
     // each row must have a total weight of 100%
     $rows_count = $this->row_count($data);
     $cols_count = $this->col_count($data);
     for ($row = 0; $row < $rows_count; $row++) {
         $row_grade = 0;
         for ($col = 0; $col < $cols_count; $col++) {
             $cell_name = $this->cell_name($row, $col, $multiple);
             $row_grade += (double) $data[$cell_name];
         }
         if (abs(abs($row_grade) - 1) > 0.0001) {
             return array("matrix" => qtype_matrix::get_string('mustaddupto100'));
         }
     }
     return array();
 }
 protected function add_submit($name, $label = '')
 {
     if ($label === '') {
         $short_name = explode('[', $name);
         $short_name = reset($short_name);
         $label = qtype_matrix::get_string($short_name);
     }
     return $this->_form->addElement('submit', $name, $label);
 }
 protected function add_submit($name, $label = '')
 {
     if ($label === '') {
         $label = qtype_matrix::get_string($name);
     }
     return $this->_form->addElement('submit', $name, $label);
 }
 /**
  * In situations where is_gradable_response() returns false, this method
  * should generate a description of what the problem is.
  * @return string the message.
  */
 public function get_validation_error(array $response)
 {
     $is_gradable = $this->is_gradable_response($response);
     if ($is_gradable) {
         return '';
     }
     return qtype_matrix::get_string('oneanswerperrow');
 }