';
}
}
}
public function excelprint_item(&$worksheet, $row_offset,
$xls_formats, $item,
$groupid, $courseid = false) {
$analysed_item = $this->get_analysed($item, $groupid, $courseid);
$data = $analysed_item[2];
//frage schreiben
$worksheet->write_string($row_offset, 0, $item->label, $xls_formats->head2);
$worksheet->write_string($row_offset, 1, $analysed_item[1], $xls_formats->head2);
if (is_array($data)) {
$sizeofdata = count($data);
for ($i = 0; $i < $sizeofdata; $i++) {
$analysed_data = $data[$i];
$worksheet->write_string($row_offset,
$i + 2,
trim($analysed_data->answertext),
$xls_formats->head2);
$worksheet->write_number($row_offset + 1,
$i + 2,
$analysed_data->answercount,
$xls_formats->default);
$worksheet->write_number($row_offset + 2,
$i + 2,
$analysed_data->quotient,
$xls_formats->procent);
}
}
$row_offset += 3;
return $row_offset;
}
/**
* print the item at the edit-page of feedback
*
* @global object
* @param object $item
* @return void
*/
public function print_item_preview($item) {
global $OUTPUT, $DB;
$info = $this->get_info($item);
$align = right_to_left() ? 'right' : 'left';
$presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
$strrequiredmark = '';
//test if required and no value is set so we have to mark this item
//we have to differ check and the other subtypes
$requiredmark = ($item->required == 1) ? $strrequiredmark : '';
//print the question and label
echo '
';
if ($info->subtype == 'd') {
echo '';
}
echo '
';
//print the presentation
echo '
';
$index = 1;
$checked = '';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '';
}
echo '
';
}
/**
* print the item at the complete-page of feedback
*
* @global object
* @param object $item
* @param string $value
* @param bool $highlightrequire
* @return void
*/
public function print_item_complete($item, $value = null, $highlightrequire = false) {
global $OUTPUT;
$info = $this->get_info($item);
$align = right_to_left() ? 'right' : 'left';
if ($value == null) {
$value = array();
}
$presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
$strrequiredmark = '';
//test if required and no value is set so we have to mark this item
//we have to differ check and the other subtypes
if (is_array($value)) {
$values = $value;
} else {
$values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
}
$requiredmark = ($item->required == 1) ? $strrequiredmark : '';
//print the question and label
$inputname = $item->typ . '_' . $item->id;
echo '
';
if ($info->subtype == 'd') {
echo '';
} else {
echo format_text($item->name . $requiredmark, FORMAT_HTML, array('noclean' => true, 'para' => false));
if ($highlightrequire AND $item->required AND (count($values) == 0 OR $values[0] == '' OR $values[0] == 0)) {
echo ' '.get_string('err_required', 'form').
' ';
}
}
echo '
';
//print the presentation
echo '
';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '';
}
echo '
';
}
/**
* print the item at the complete-page of feedback
*
* @global object
* @param object $item
* @param string $value
* @return void
*/
public function print_item_show_value($item, $value = null) {
global $OUTPUT;
$info = $this->get_info($item);
$align = right_to_left() ? 'right' : 'left';
if ($value == null) {
$value = array();
}
$presentation = explode (FEEDBACK_MULTICHOICE_LINE_SEP, $info->presentation);
//test if required and no value is set so we have to mark this item
//we have to differ check and the other subtypes
if ($info->subtype == 'c') {
if (is_array($value)) {
$values = $value;
} else {
$values = explode(FEEDBACK_MULTICHOICE_LINE_SEP, $value);
}
}
$requiredmark = '';
if ($item->required == 1) {
$requiredmark = '';
}
//print the question and label
echo '
options = str_replace(FEEDBACK_MULTICHOICE_IGNOREEMPTY, '', $item->options);
if ($ignoreempty) {
$item->options .= FEEDBACK_MULTICHOICE_IGNOREEMPTY;
}
}
public function ignoreempty($item) {
if (strstr($item->options, FEEDBACK_MULTICHOICE_IGNOREEMPTY)) {
return true;
}
return false;
}
public function set_hidenoselect($item, $hidenoselect=true) {
$item->options = str_replace(FEEDBACK_MULTICHOICE_HIDENOSELECT, '', $item->options);
if ($hidenoselect) {
$item->options .= FEEDBACK_MULTICHOICE_HIDENOSELECT;
}
}
public function hidenoselect($item) {
if (strstr($item->options, FEEDBACK_MULTICHOICE_HIDENOSELECT)) {
return true;
}
return false;
}
public function can_switch_require() {
return true;
}
public function value_type() {
return PARAM_INT;
}
public function value_is_array() {
return true;
}
public function clean_input_value($value) {
return clean_param_array($value, $this->value_type());
}
}