Exemplo n.º 1
0
 function get_analysed($item, $groupid = false, $courseid = false)
 {
     global $DB;
     $analysed = null;
     $analysed->data = array();
     $analysed->name = $item->name;
     //$values = $DB->get_records('feedback_value', array('item'=>$item->id));
     $values = feedback_get_group_values($item, $groupid, $courseid);
     $avg = 0.0;
     $counter = 0;
     if ($values) {
         $data = array();
         foreach ($values as $value) {
             if (is_numeric($value->value)) {
                 $data[] = $value->value;
                 $avg += $value->value;
                 $counter++;
             }
         }
         $avg = $counter > 0 ? $avg / $counter : 0;
         $analysed->data = $data;
         $analysed->avg = $avg;
     }
     return $analysed;
 }
Exemplo n.º 2
0
 function get_analysed($item, $groupid = false, $courseid = false)
 {
     $presentation = $item->presentation;
     $aVal = null;
     $aVal->data = null;
     $aVal->name = $item->name;
     //$values = get_records('feedback_value', 'item', $item->id);
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         $data = array();
         $datavalue = new object();
         foreach ($values as $value) {
             switch ($presentation) {
                 case 1:
                     $datavalue->value = $value->value;
                     $datavalue->show = UserDate($datavalue->value);
                     break;
                 case 2:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
                 case 3:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
             }
             $data[] = $datavalue;
         }
         $aVal->data = $data;
     }
     return $aVal;
 }
Exemplo n.º 3
0
 function get_analysed($item, $groupid = false, $courseid = false)
 {
     $info = $this->get_info($item);
     $analysedItem = array();
     $analysedItem[] = $item->typ;
     $analysedItem[] = $item->name;
     //die moeglichen Antworten extrahieren
     $answers = null;
     // $presentation = '';
     // @list($presentation) = explode(FEEDBACK_RADIO_ADJUST_SEP, $item->presentation); //remove the adjustment-info
     $answers = explode(FEEDBACK_MULTICHOICE_LINE_SEP, stripslashes_safe($info->presentation));
     if (!is_array($answers)) {
         return null;
     }
     //die Werte holen
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if (!$values) {
         return null;
     }
     //schleife ueber den Werten und ueber die Antwortmoeglichkeiten
     $analysedAnswer = array();
     if ($info->subtype == 'c') {
         for ($i = 1; $i <= sizeof($answers); $i++) {
             $ans = null;
             $ans->answertext = $answers[$i - 1];
             $ans->answercount = 0;
             foreach ($values as $value) {
                 //ist die Antwort gleich dem index der Antworten + 1?
                 $vallist = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value->value);
                 foreach ($vallist as $val) {
                     if ($val == $i) {
                         $ans->answercount++;
                     }
                 }
             }
             $ans->quotient = $ans->answercount / sizeof($values);
             $analysedAnswer[] = $ans;
         }
     } else {
         for ($i = 1; $i <= sizeof($answers); $i++) {
             $ans = null;
             $ans->answertext = $answers[$i - 1];
             $ans->answercount = 0;
             foreach ($values as $value) {
                 //ist die Antwort gleich dem index der Antworten + 1?
                 if ($value->value == $i) {
                     $ans->answercount++;
                 }
             }
             $ans->quotient = $ans->answercount / sizeof($values);
             $analysedAnswer[] = $ans;
         }
     }
     $analysedItem[] = $analysedAnswer;
     return $analysedItem;
 }
Exemplo n.º 4
0
 function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false)
 {
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         //echo '<table>';2
         // $itemnr++;
         echo '<tr><th colspan="2" align="left">' . $itemnr . '&nbsp;(' . $item->label . ') ' . $item->name . '</th></tr>';
         foreach ($values as $value) {
             echo '<tr><td valign="top" align="left">-&nbsp;&nbsp;</td><td align="left" valign="top">' . str_replace("\n", '<br />', $value->value) . '</td></tr>';
         }
         //echo '</table>';
     }
     // return $itemnr;
 }
Exemplo n.º 5
0
 function get_analysed($item, $groupid = false, $courseid = false)
 {
     $analysedItem = array();
     $analysedItem[] = $item->typ;
     $analysedItem[] = $item->name;
     //die moeglichen Antworten extrahieren
     $info = $this->get_info($item);
     $lines = null;
     $lines = explode(FEEDBACK_MULTICHOICERATED_LINE_SEP, stripslashes_safe($info->presentation));
     if (!is_array($lines)) {
         return null;
     }
     //die Werte holen
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if (!$values) {
         return null;
     }
     //schleife ueber den Werten und ueber die Antwortmoeglichkeiten
     $analysedAnswer = array();
     for ($i = 1; $i <= sizeof($lines); $i++) {
         $item_values = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $lines[$i - 1]);
         $ans = null;
         $ans->answertext = $item_values[1];
         $avg = 0.0;
         $anscount = 0;
         foreach ($values as $value) {
             //ist die Antwort gleich dem index der Antworten + 1?
             if ($value->value == $i) {
                 $avg += $item_values[0];
                 //erst alle Werte aufsummieren
                 $anscount++;
             }
         }
         $ans->answercount = $anscount;
         $ans->avg = doubleval($avg) / doubleval(sizeof($values));
         $ans->value = $item_values[0];
         $ans->quotient = $ans->answercount / sizeof($values);
         $analysedAnswer[] = $ans;
     }
     $analysedItem[] = $analysedAnswer;
     return $analysedItem;
 }
Exemplo n.º 6
0
 public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false)
 {
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         echo "<table class=\"analysis itemtype_{$item->typ}\">";
         echo '<tr><th colspan="2" align="left">';
         echo $itemnr . ' ';
         if (strval($item->label) !== '') {
             echo '(' . format_string($item->label) . ') ';
         }
         echo format_text($item->name, FORMAT_HTML, array('noclean' => true, 'para' => false));
         echo '</th></tr>';
         foreach ($values as $value) {
             $class = strlen(trim($value->value)) ? '' : ' class="isempty"';
             echo '<tr' . $class . '>';
             echo '<td colspan="2" class="singlevalue">';
             echo str_replace("\n", '<br />', $value->value);
             echo '</td>';
             echo '</tr>';
         }
         echo '</table>';
     }
 }
Exemplo n.º 7
0
 public function get_analysed($item, $groupid = false, $courseid = false)
 {
     $info = $this->get_info($item);
     $analysed_item = array();
     $analysed_item[] = $item->typ;
     $analysed_item[] = $item->name;
     //get the possible answers
     $answers = null;
     $answers = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
     if (!is_array($answers)) {
         return null;
     }
     //get the values
     $values = feedback_get_group_values($item, $groupid, $courseid, $this->ignoreempty($item));
     if (!$values) {
         return null;
     }
     //get answertext, answercount and quotient for each answer
     $analysed_answer = array();
     if ($info->subtype == 'c') {
         $sizeofanswers = count($answers);
         for ($i = 1; $i <= $sizeofanswers; $i++) {
             $ans = new stdClass();
             $ans->answertext = $answers[$i - 1];
             $ans->answercount = 0;
             foreach ($values as $value) {
                 //ist die Antwort gleich dem index der Antworten + 1?
                 $vallist = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value->value);
                 foreach ($vallist as $val) {
                     if ($val == $i) {
                         $ans->answercount++;
                     }
                 }
             }
             $ans->quotient = $ans->answercount / count($values);
             $analysed_answer[] = $ans;
         }
     } else {
         $sizeofanswers = count($answers);
         for ($i = 1; $i <= $sizeofanswers; $i++) {
             $ans = new stdClass();
             $ans->answertext = $answers[$i - 1];
             $ans->answercount = 0;
             foreach ($values as $value) {
                 //ist die Antwort gleich dem index der Antworten + 1?
                 if ($value->value == $i) {
                     $ans->answercount++;
                 }
             }
             $ans->quotient = $ans->answercount / count($values);
             $analysed_answer[] = $ans;
         }
     }
     $analysed_item[] = $analysed_answer;
     return $analysed_item;
 }
Exemplo n.º 8
0
 public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false)
 {
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         echo '<tr><th colspan="2" align="left">';
         echo $itemnr . '&nbsp;(' . $item->label . ') ' . $item->name;
         echo '</th></tr>';
         foreach ($values as $value) {
             echo '<tr>';
             echo '<td colspan="2" valign="top" align="left">';
             echo '-&nbsp;&nbsp;';
             echo str_replace("\n", '<br />', $value->value);
             echo '</td>';
             echo '</tr>';
         }
     }
 }
Exemplo n.º 9
0
 public function get_analysed($item, $groupid = false, $courseid = false)
 {
     $presentation = $item->presentation;
     $analysed_val = new stdClass();
     $analysed_val->data = null;
     $analysed_val->name = $item->name;
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         $data = array();
         foreach ($values as $value) {
             $datavalue = new stdClass();
             switch ($presentation) {
                 case 1:
                     $datavalue->value = $value->value;
                     $datavalue->show = userdate($datavalue->value);
                     break;
                 case 2:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
                 case 3:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
             }
             $data[] = $datavalue;
         }
         $analysed_val->data = $data;
     }
     return $analysed_val;
 }
Exemplo n.º 10
0
 public function get_analysed($item, $groupid = false, $courseid = false)
 {
     global $DB;
     $analysed = new stdClass();
     $analysed->data = array();
     $analysed->name = $item->name;
     $values = feedback_get_group_values($item, $groupid, $courseid);
     $avg = 0.0;
     $counter = 0;
     if ($values) {
         $data = array();
         foreach ($values as $value) {
             if (is_numeric($value->value)) {
                 $data[] = $value->value;
                 $avg += $value->value;
                 $counter++;
             }
         }
         $avg = $counter > 0 ? $avg / $counter : 0;
         $analysed->data = $data;
         $analysed->avg = $avg;
     }
     return $analysed;
 }
Exemplo n.º 11
0
 public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false)
 {
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         echo '<tr><th colspan="2" align="left">';
         echo $itemnr . ' ';
         if (strval($item->label) !== '') {
             echo '(' . format_string($item->label) . ') ';
         }
         echo $this->get_display_name($item);
         echo '</th></tr>';
         foreach ($values as $value) {
             $class = strlen(trim($value->value)) ? '' : ' class="isempty"';
             echo '<tr' . $class . '><td colspan="2" class="singlevalue">';
             echo str_replace("\n", '<br />', $value->value);
             echo '</td></tr>';
         }
     }
 }
Exemplo n.º 12
0
 /**
  * Helper function for collected data, both for analysis page and export to excel
  *
  * @param stdClass $item the db-object from feedback_item
  * @param int|false $groupid
  * @param int $courseid
  * @return stdClass
  */
 protected function get_analysed($item, $groupid = false, $courseid = false)
 {
     $presentation = $item->presentation;
     $analysed_val = new stdClass();
     $analysed_val->data = null;
     $analysed_val->name = $item->name;
     $values = feedback_get_group_values($item, $groupid, $courseid);
     if ($values) {
         $data = array();
         foreach ($values as $value) {
             $datavalue = new stdClass();
             switch ($presentation) {
                 case self::MODE_RESPONSETIME:
                     $datavalue->value = $value->value;
                     $datavalue->show = $value->value ? userdate($datavalue->value) : '';
                     break;
                 case self::MODE_COURSE:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
                 case self::MODE_CATEGORY:
                     $datavalue->value = $value->value;
                     $datavalue->show = $datavalue->value;
                     break;
             }
             $data[] = $datavalue;
         }
         $analysed_val->data = $data;
     }
     return $analysed_val;
 }