Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/feedback/item/multichoicerated/lib.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 defined('MOODLE_INTERNAL') OR die('not allowed');
00018 require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_class.php');
00019 
00020 define('FEEDBACK_RADIORATED_ADJUST_SEP', '<<<<<');
00021 
00022 define('FEEDBACK_MULTICHOICERATED_MAXCOUNT', 10); //count of possible items
00023 define('FEEDBACK_MULTICHOICERATED_VALUE_SEP', '####');
00024 define('FEEDBACK_MULTICHOICERATED_VALUE_SEP2', '/');
00025 define('FEEDBACK_MULTICHOICERATED_TYPE_SEP', '>>>>>');
00026 define('FEEDBACK_MULTICHOICERATED_LINE_SEP', '|');
00027 define('FEEDBACK_MULTICHOICERATED_ADJUST_SEP', '<<<<<');
00028 define('FEEDBACK_MULTICHOICERATED_IGNOREEMPTY', 'i');
00029 define('FEEDBACK_MULTICHOICERATED_HIDENOSELECT', 'h');
00030 
00031 class feedback_item_multichoicerated extends feedback_item_base {
00032     protected $type = "multichoicerated";
00033     private $commonparams;
00034     private $item_form;
00035     private $item;
00036 
00037     public function init() {
00038 
00039     }
00040 
00041     public function build_editform($item, $feedback, $cm) {
00042         global $DB, $CFG;
00043         require_once('multichoicerated_form.php');
00044 
00045         //get the lastposition number of the feedback_items
00046         $position = $item->position;
00047         $lastposition = $DB->count_records('feedback_item', array('feedback'=>$feedback->id));
00048         if ($position == -1) {
00049             $i_formselect_last = $lastposition + 1;
00050             $i_formselect_value = $lastposition + 1;
00051             $item->position = $lastposition + 1;
00052         } else {
00053             $i_formselect_last = $lastposition;
00054             $i_formselect_value = $item->position;
00055         }
00056         //the elements for position dropdownlist
00057         $positionlist = array_slice(range(0, $i_formselect_last), 1, $i_formselect_last, true);
00058 
00059         $item->presentation = empty($item->presentation) ? '' : $item->presentation;
00060         $info = $this->get_info($item);
00061 
00062         $item->ignoreempty = $this->ignoreempty($item);
00063         $item->hidenoselect = $this->hidenoselect($item);
00064 
00065         //all items for dependitem
00066         $feedbackitems = feedback_get_depend_candidates_for_item($feedback, $item);
00067         $commonparams = array('cmid'=>$cm->id,
00068                              'id'=>isset($item->id) ? $item->id : null,
00069                              'typ'=>$item->typ,
00070                              'items'=>$feedbackitems,
00071                              'feedback'=>$feedback->id);
00072 
00073         //build the form
00074         $customdata = array('item' => $item,
00075                             'common' => $commonparams,
00076                             'positionlist' => $positionlist,
00077                             'position' => $position,
00078                             'info' => $info);
00079 
00080         $this->item_form = new feedback_multichoicerated_form('edit_item.php', $customdata);
00081     }
00082 
00083     //this function only can used after the call of build_editform()
00084     public function show_editform() {
00085         $this->item_form->display();
00086     }
00087 
00088     public function is_cancelled() {
00089         return $this->item_form->is_cancelled();
00090     }
00091 
00092     public function get_data() {
00093         if ($this->item = $this->item_form->get_data()) {
00094             return true;
00095         }
00096         return false;
00097     }
00098 
00099     public function save_item() {
00100         global $DB;
00101 
00102         if (!$item = $this->item_form->get_data()) {
00103             return false;
00104         }
00105 
00106         if (isset($item->clone_item) AND $item->clone_item) {
00107             $item->id = ''; //to clone this item
00108             $item->position++;
00109         }
00110 
00111         $this->set_ignoreempty($item, $item->ignoreempty);
00112         $this->set_hidenoselect($item, $item->hidenoselect);
00113 
00114         $item->hasvalue = $this->get_hasvalue();
00115         if (!$item->id) {
00116             $item->id = $DB->insert_record('feedback_item', $item);
00117         } else {
00118             $DB->update_record('feedback_item', $item);
00119         }
00120 
00121         return $DB->get_record('feedback_item', array('id'=>$item->id));
00122     }
00123 
00124 
00125     //gets an array with three values(typ, name, XXX)
00126     //XXX is an object with answertext, answercount and quotient
00127     public function get_analysed($item, $groupid = false, $courseid = false) {
00128         $analysed_item = array();
00129         $analysed_item[] = $item->typ;
00130         $analysed_item[] = $item->name;
00131 
00132         //die moeglichen Antworten extrahieren
00133         $info = $this->get_info($item);
00134         $lines = null;
00135         $lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00136         if (!is_array($lines)) {
00137             return null;
00138         }
00139 
00140         //die Werte holen
00141         $values = feedback_get_group_values($item, $groupid, $courseid, $this->ignoreempty($item));
00142         if (!$values) {
00143             return null;
00144         }
00145         //schleife ueber den Werten und ueber die Antwortmoeglichkeiten
00146 
00147         $analysed_answer = array();
00148         $sizeoflines = count($lines);
00149         for ($i = 1; $i <= $sizeoflines; $i++) {
00150             $item_values = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $lines[$i-1]);
00151             $ans = null;
00152             $ans->answertext = $item_values[1];
00153             $avg = 0.0;
00154             $anscount = 0;
00155             foreach ($values as $value) {
00156                 //ist die Antwort gleich dem index der Antworten + 1?
00157                 if ($value->value == $i) {
00158                     $avg += $item_values[0]; //erst alle Werte aufsummieren
00159                     $anscount++;
00160                 }
00161             }
00162             $ans->answercount = $anscount;
00163             $ans->avg = doubleval($avg) / doubleval(count($values));
00164             $ans->value = $item_values[0];
00165             $ans->quotient = $ans->answercount / count($values);
00166             $analysed_answer[] = $ans;
00167         }
00168         $analysed_item[] = $analysed_answer;
00169         return $analysed_item;
00170     }
00171 
00172     public function get_printval($item, $value) {
00173         $printval = '';
00174 
00175         if (!isset($value->value)) {
00176             return $printval;
00177         }
00178 
00179         $info = $this->get_info($item);
00180 
00181         $presentation = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00182         $index = 1;
00183         foreach ($presentation as $pres) {
00184             if ($value->value == $index) {
00185                 $item_label = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $pres);
00186                 $printval = $item_label[1];
00187                 break;
00188             }
00189             $index++;
00190         }
00191         return $printval;
00192     }
00193 
00194     public function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
00195         $sep_dec = get_string('separator_decimal', 'feedback');
00196         if (substr($sep_dec, 0, 2) == '[[') {
00197             $sep_dec = FEEDBACK_DECIMAL;
00198         }
00199 
00200         $sep_thous = get_string('separator_thousand', 'feedback');
00201         if (substr($sep_thous, 0, 2) == '[[') {
00202             $sep_thous = FEEDBACK_THOUSAND;
00203         }
00204 
00205         $analysed_item = $this->get_analysed($item, $groupid, $courseid);
00206         if ($analysed_item) {
00207             echo '<tr><th colspan="2" align="left">';
00208             echo $itemnr.'&nbsp;('.$item->label.') '.$analysed_item[1];
00209             echo '</th></tr>';
00210             $analysed_vals = $analysed_item[2];
00211             $pixnr = 0;
00212             $avg = 0.0;
00213             foreach ($analysed_vals as $val) {
00214                 $intvalue = $pixnr % 10;
00215                 $pix = "pics/$intvalue.gif";
00216                 $pixnr++;
00217                 $pixwidth = intval($val->quotient * FEEDBACK_MAX_PIX_LENGTH);
00218 
00219                 $avg += $val->avg;
00220                 $quotient = number_format(($val->quotient * 100), 2, $sep_dec, $sep_thous);
00221                 echo '<tr>';
00222                 echo '<td align="left" valign="top">';
00223                 echo '-&nbsp;&nbsp;'.trim($val->answertext).' ('.$val->value.'):</td>';
00224                 echo '<td align="left" style="width: '.FEEDBACK_MAX_PIX_LENGTH.'">';
00225                 echo '<img alt="'.$intvalue.'" src="'.$pix.'" height="5" width="'.$pixwidth.'" />';
00226                 echo $val->answercount;
00227                 if ($val->quotient > 0) {
00228                     echo '&nbsp;('.$quotient.'&nbsp;%)';
00229                 } else {
00230                     echo '';
00231                 }
00232                 echo '</td></tr>';
00233             }
00234             $avg = number_format(($avg), 2, $sep_dec, $sep_thous);
00235             echo '<tr><td align="left" colspan="2"><b>';
00236             echo get_string('average', 'feedback').': '.$avg.'</b>';
00237             echo '</td></tr>';
00238         }
00239     }
00240 
00241     public function excelprint_item(&$worksheet, $row_offset,
00242                              $xls_formats, $item,
00243                              $groupid, $courseid = false) {
00244 
00245         $analysed_item = $this->get_analysed($item, $groupid, $courseid);
00246 
00247         $data = $analysed_item[2];
00248 
00249         //write the item
00250         $worksheet->write_string($row_offset, 0, $item->label, $xls_formats->head2);
00251         $worksheet->write_string($row_offset, 1, $analysed_item[1], $xls_formats->head2);
00252         if (is_array($data)) {
00253             $avg = 0.0;
00254             $sizeofdata = count($data);
00255             for ($i = 0; $i < $sizeofdata; $i++) {
00256                 $analysed_data = $data[$i];
00257 
00258                 $worksheet->write_string($row_offset,
00259                                 $i + 2,
00260                                 trim($analysed_data->answertext).' ('.$analysed_data->value.')',
00261                                 $xls_formats->value_bold);
00262 
00263                 $worksheet->write_number($row_offset + 1,
00264                                 $i + 2,
00265                                 $analysed_data->answercount,
00266                                 $xls_formats->default);
00267 
00268                 $avg += $analysed_data->avg;
00269             }
00270             //mittelwert anzeigen
00271             $worksheet->write_string($row_offset,
00272                                 count($data) + 2,
00273                                 get_string('average', 'feedback'),
00274                                 $xls_formats->value_bold);
00275 
00276             $worksheet->write_number($row_offset + 1,
00277                                 count($data) + 2,
00278                                 $avg,
00279                                 $xls_formats->value_bold);
00280         }
00281         $row_offset +=2;
00282         return $row_offset;
00283     }
00284 
00292     public function print_item_preview($item) {
00293         global $OUTPUT, $DB;
00294 
00295         $align = right_to_left() ? 'right' : 'left';
00296         $info = $this->get_info($item);
00297         $str_required_mark = '<span class="feedback_required_mark">*</span>';
00298 
00299         $lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00300         $requiredmark =  ($item->required == 1) ? $str_required_mark : '';
00301         //print the question and label
00302         echo '<div class="feedback_item_label_'.$align.'">';
00303         echo '('.$item->label.') ';
00304         echo format_text($item->name.$requiredmark, true, false, false);
00305         if ($item->dependitem) {
00306             if ($dependitem = $DB->get_record('feedback_item', array('id'=>$item->dependitem))) {
00307                 echo ' <span class="feedback_depend">';
00308                 echo '('.$dependitem->label.'-&gt;'.$item->dependvalue.')';
00309                 echo '</span>';
00310             }
00311         }
00312         echo '</div>';
00313 
00314         //print the presentation
00315         echo '<div class="feedback_item_presentation_'.$align.'">';
00316         switch($info->subtype) {
00317             case 'r':
00318                 $this->print_item_radio($item, false, $info, $align, true, $lines);
00319                 break;
00320             case 'd':
00321                 $this->print_item_dropdown($item, false, $info, $align, true, $lines);
00322                 break;
00323         }
00324         echo '</div>';
00325     }
00326 
00336     public function print_item_complete($item, $value = '', $highlightrequire = false) {
00337         global $OUTPUT;
00338         $align = right_to_left() ? 'right' : 'left';
00339         $info = $this->get_info($item);
00340         $str_required_mark = '<span class="feedback_required_mark">*</span>';
00341 
00342         $lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00343         $requiredmark =  ($item->required == 1) ? $str_required_mark : '';
00344         if ($highlightrequire AND $item->required AND intval($value) <= 0) {
00345             $highlight = ' missingrequire';
00346         } else {
00347             $highlight = '';
00348         }
00349 
00350         //print the question and label
00351         echo '<div class="feedback_item_label_'.$align.$highlight.'">';
00352             echo format_text($item->name.$requiredmark, true, false, false);
00353         echo '</div>';
00354 
00355         //print the presentation
00356         echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';
00357         switch($info->subtype) {
00358             case 'r':
00359                 $this->print_item_radio($item, $value, $info, $align, false, $lines);
00360                 break;
00361             case 'd':
00362                 $this->print_item_dropdown($item, $value, $info, $align, false, $lines);
00363                 break;
00364         }
00365         echo '</div>';
00366     }
00367 
00376     public function print_item_show_value($item, $value = '') {
00377         global $OUTPUT;
00378         $align = right_to_left() ? 'right' : 'left';
00379         $info = $this->get_info($item);
00380 
00381         $lines = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00382         $requiredmark = ($item->required == 1)?'<span class="feedback_required_mark">*</span>':'';
00383 
00384         //print the question and label
00385         echo '<div class="feedback_item_label_'.$align.'">';
00386             echo '('.$item->label.') ';
00387             echo format_text($item->name . $requiredmark, true, false, false);
00388         echo '</div>';
00389 
00390         //print the presentation
00391         echo '<div class="feedback_item_presentation_'.$align.'">';
00392         $index = 1;
00393         foreach ($lines as $line) {
00394             if ($value == $index) {
00395                 $item_value = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $line);
00396                 echo $OUTPUT->box_start('generalbox boxalign'.$align);
00397                 echo text_to_html($item_value[1], true, false, false);
00398                 echo $OUTPUT->box_end();
00399                 break;
00400             }
00401             $index++;
00402         }
00403         echo '</div>';
00404     }
00405 
00406     public function check_value($value, $item) {
00407         if ((!isset($value) OR $value == '' OR $value == 0) AND $item->required != 1) {
00408             return true;
00409         }
00410         if (intval($value) > 0) {
00411             return true;
00412         }
00413         return false;
00414     }
00415 
00416     public function create_value($data) {
00417         $data = trim($data);
00418         return $data;
00419     }
00420 
00421     //compares the dbvalue with the dependvalue
00422     //dbvalue is the number of one selection
00423     //dependvalue is the presentation of one selection
00424     public function compare_value($item, $dbvalue, $dependvalue) {
00425 
00426         if (is_array($dbvalue)) {
00427             $dbvalues = $dbvalue;
00428         } else {
00429             $dbvalues = explode(FEEDBACK_MULTICHOICERATED_LINE_SEP, $dbvalue);
00430         }
00431 
00432         $info = $this->get_info($item);
00433         $presentation = explode (FEEDBACK_MULTICHOICERATED_LINE_SEP, $info->presentation);
00434         $index = 1;
00435         foreach ($presentation as $pres) {
00436             $presvalues = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $pres);
00437 
00438             foreach ($dbvalues as $dbval) {
00439                 if ($dbval == $index AND trim($presvalues[1]) == $dependvalue) {
00440                     return true;
00441                 }
00442             }
00443             $index++;
00444         }
00445         return false;
00446     }
00447 
00448     public function get_presentation($data) {
00449         $present = $this->prepare_presentation_values_save(trim($data->itemvalues),
00450                                             FEEDBACK_MULTICHOICERATED_VALUE_SEP2,
00451                                             FEEDBACK_MULTICHOICERATED_VALUE_SEP);
00452         if (!isset($data->subtype)) {
00453             $subtype = 'r';
00454         } else {
00455             $subtype = substr($data->subtype, 0, 1);
00456         }
00457         if (isset($data->horizontal) AND $data->horizontal == 1 AND $subtype != 'd') {
00458             $present .= FEEDBACK_MULTICHOICERATED_ADJUST_SEP.'1';
00459         }
00460         return $subtype.FEEDBACK_MULTICHOICERATED_TYPE_SEP.$present;
00461     }
00462 
00463     public function get_hasvalue() {
00464         return 1;
00465     }
00466 
00467     private function get_info($item) {
00468         $presentation = empty($item->presentation) ? '' : $item->presentation;
00469 
00470         $info = new stdClass();
00471         //check the subtype of the multichoice
00472         //it can be check(c), radio(r) or dropdown(d)
00473         $info->subtype = '';
00474         $info->presentation = '';
00475         $info->horizontal = false;
00476 
00477         $parts = explode(FEEDBACK_MULTICHOICERATED_TYPE_SEP, $item->presentation);
00478         @list($info->subtype, $info->presentation) = $parts;
00479 
00480         if (!isset($info->subtype)) {
00481             $info->subtype = 'r';
00482         }
00483 
00484         if ($info->subtype != 'd') {
00485             $parts = explode(FEEDBACK_MULTICHOICERATED_ADJUST_SEP, $info->presentation);
00486             @list($info->presentation, $info->horizontal) = $parts;
00487 
00488             if (isset($info->horizontal) AND $info->horizontal == 1) {
00489                 $info->horizontal = true;
00490             } else {
00491                 $info->horizontal = false;
00492             }
00493         }
00494 
00495         $info->values = $this->prepare_presentation_values_print($info->presentation,
00496                                                     FEEDBACK_MULTICHOICERATED_VALUE_SEP,
00497                                                     FEEDBACK_MULTICHOICERATED_VALUE_SEP2);
00498         return $info;
00499     }
00500 
00501     private function print_item_radio($item, $value, $info, $align, $showrating, $lines) {
00502         $index = 1;
00503         $checked = '';
00504 
00505         if ($info->horizontal) {
00506             $hv = 'h';
00507         } else {
00508             $hv = 'v';
00509         }
00510         echo '<ul>';
00511         if (!$this->hidenoselect($item)) {
00512             ?>
00513                 <li class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
00514                     <span class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
00515                         <?php
00516                         echo '<input type="radio" '.
00517                                     'name="'.$item->typ.'_'.$item->id.'" '.
00518                                     'id="'.$item->typ.'_'.$item->id.'_xxx" '.
00519                                     'value="" checked="checked" />';
00520                         ?>
00521                     </span>
00522                     <span class="feedback_item_radiolabel_<?php echo $hv.'_'.$align;?>">
00523                         <label for="<?php echo $item->typ . '_' . $item->id.'_xxx';?>">
00524                         <?php print_string('not_selected', 'feedback');?>&nbsp;
00525                         </label>
00526                     </span>
00527                 </li>
00528             <?php
00529         }
00530         foreach ($lines as $line) {
00531             if ($value == $index) {
00532                 $checked = 'checked="checked"';
00533             } else {
00534                 $checked = '';
00535             }
00536             $radio_value = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $line);
00537             $inputname = $item->typ . '_' . $item->id;
00538             $inputid = $inputname.'_'.$index;
00539         ?>
00540             <li class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
00541                 <span class="feedback_item_radio_<?php echo $hv.'_'.$align;?>">
00542                 <?php
00543                 echo '<input type="radio" '.
00544                             'name="'.$inputname.'" '.
00545                             'id="'.$inputid.'" '.
00546                             'value="'.$index.'" '.$checked.' />';
00547                 ?>
00548                 </span>
00549                 <span class="feedback_item_radiolabel_<?php echo $hv.'_'.$align;?>">
00550                     <label for="<?php echo $inputid;?>">
00551                         <?php
00552                             if ($showrating) {
00553                                 $str_rating_value = '('.$radio_value[0].') '.$radio_value[1];
00554                                 echo text_to_html($str_rating_value, true, false, false);
00555                             } else {
00556                                 echo text_to_html($radio_value[1], true, false, false);
00557                             }
00558                         ?>
00559                     </label>
00560                 </span>
00561             </li>
00562         <?php
00563             $index++;
00564         }
00565         echo '</ul>';
00566     }
00567 
00568     private function print_item_dropdown($item, $value, $info, $align, $showrating, $lines) {
00569         if ($info->horizontal) {
00570             $hv = 'h';
00571         } else {
00572             $hv = 'v';
00573         }
00574         echo '<ul>';
00575         ?>
00576         <li class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
00577             <select name="<?php echo $item->typ.'_'.$item->id;?>">
00578                 <option value="0">&nbsp;</option>
00579                 <?php
00580                 $index = 1;
00581                 $checked = '';
00582                 foreach ($lines as $line) {
00583                     if ($value == $index) {
00584                         $selected = 'selected="selected"';
00585                     } else {
00586                         $selected = '';
00587                     }
00588                     $dropdown_value = explode(FEEDBACK_MULTICHOICERATED_VALUE_SEP, $line);
00589                     if ($showrating) {
00590                         echo '<option value="'.$index.'" '.$selected.'>';
00591                         echo clean_text('('.$dropdown_value[0].') '.$dropdown_value[1]);
00592                         echo '</option>';
00593                     } else {
00594                         echo '<option value="'.$index.'" '.$selected.'>';
00595                         echo clean_text($dropdown_value[1]);
00596                         echo '</option>';
00597                     }
00598                     $index++;
00599                 }
00600                 ?>
00601             </select>
00602         </li>
00603         <?php
00604         echo '</ul>';
00605     }
00606 
00607     public function prepare_presentation_values($linesep1,
00608                                          $linesep2,
00609                                          $valuestring,
00610                                          $valuesep1,
00611                                          $valuesep2) {
00612 
00613         $lines = explode($linesep1, $valuestring);
00614         $newlines = array();
00615         foreach ($lines as $line) {
00616             $value = '';
00617             $text = '';
00618             if (strpos($line, $valuesep1) === false) {
00619                 $value = 0;
00620                 $text = $line;
00621             } else {
00622                 @list($value, $text) = explode($valuesep1, $line, 2);
00623             }
00624 
00625             $value = intval($value);
00626             $newlines[] = $value.$valuesep2.$text;
00627         }
00628         $newlines = implode($linesep2, $newlines);
00629         return $newlines;
00630     }
00631 
00632     public function prepare_presentation_values_print($valuestring, $valuesep1, $valuesep2) {
00633         return $this->prepare_presentation_values(FEEDBACK_MULTICHOICERATED_LINE_SEP,
00634                                                   "\n",
00635                                                   $valuestring,
00636                                                   $valuesep1,
00637                                                   $valuesep2);
00638     }
00639 
00640     public function prepare_presentation_values_save($valuestring, $valuesep1, $valuesep2) {
00641         return $this->prepare_presentation_values("\n",
00642                         FEEDBACK_MULTICHOICERATED_LINE_SEP,
00643                         $valuestring,
00644                         $valuesep1,
00645                         $valuesep2);
00646     }
00647 
00648     public function set_ignoreempty($item, $ignoreempty=true) {
00649         $item->options = str_replace(FEEDBACK_MULTICHOICERATED_IGNOREEMPTY, '', $item->options);
00650         if ($ignoreempty) {
00651             $item->options .= FEEDBACK_MULTICHOICERATED_IGNOREEMPTY;
00652         }
00653     }
00654 
00655     public function ignoreempty($item) {
00656         if (strstr($item->options, FEEDBACK_MULTICHOICERATED_IGNOREEMPTY)) {
00657             return true;
00658         }
00659         return false;
00660     }
00661 
00662     public function set_hidenoselect($item, $hidenoselect=true) {
00663         $item->options = str_replace(FEEDBACK_MULTICHOICERATED_HIDENOSELECT, '', $item->options);
00664         if ($hidenoselect) {
00665             $item->options .= FEEDBACK_MULTICHOICERATED_HIDENOSELECT;
00666         }
00667     }
00668 
00669     public function hidenoselect($item) {
00670         if (strstr($item->options, FEEDBACK_MULTICHOICERATED_HIDENOSELECT)) {
00671             return true;
00672         }
00673         return false;
00674     }
00675 
00676     public function can_switch_require() {
00677         return true;
00678     }
00679 
00680 }
 All Data Structures Namespaces Files Functions Variables Enumerations