ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.SurveyMetricQuestion.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
25 
38 {
39  const SUBTYPE_NON_RATIO = 3;
42 
50  var $subtype;
51 
57  var $minimum;
58 
64  var $maximum;
65 
78  $title = "",
79  $description = "",
80  $author = "",
81  $questiontext = "",
82  $owner = -1,
83  $subtype = self::SUBTYPE_NON_RATIO
84  )
85  {
87  $this->subtype = $subtype;
88  $this->minimum = "";
89  $this->maximum = "";
90  }
91 
99  function setSubtype($subtype = self::SUBTYPE_NON_RATIO)
100  {
101  $this->subtype = $subtype;
102  }
103 
111  function setMinimum($minimum = 0)
112  {
113  if($minimum !== NULL)
114  {
115  $minimum = (float)$minimum;
116  }
117  if(!$minimum)
118  {
119  $minimum = NULL;
120  }
121  $this->minimum = $minimum;
122  }
123 
131  function setMaximum($maximum = "")
132  {
133  if($maximum !== NULL)
134  {
135  $maximum = (float)$maximum;
136  }
137  if(!$maximum)
138  {
139  $maximum = NULL;
140  }
141  $this->maximum = $maximum;
142  }
143 
151  function getSubtype()
152  {
153  return $this->subtype;
154  }
155 
163  function getMinimum()
164  {
165  if ((strlen($this->minimum) == 0) && ($this->getSubtype() > 3))
166  {
167  $this->minimum = 0;
168  }
169  return (strlen($this->minimum)) ? $this->minimum : NULL;
170  }
171 
179  function getMaximum()
180  {
181  return (strlen($this->maximum)) ? $this->maximum : NULL;
182  }
183 
192  {
193  global $ilDB;
194 
195  $result = $ilDB->queryF("SELECT svy_question.*, " . $this->getAdditionalTableName() . ".* FROM svy_question, " . $this->getAdditionalTableName() . " WHERE svy_question.question_id = %s AND svy_question.question_id = " . $this->getAdditionalTableName() . ".question_fi",
196  array('integer'),
197  array($id)
198  );
199  if ($result->numRows() == 1)
200  {
201  return $ilDB->fetchAssoc($result);
202  }
203  else
204  {
205  return array();
206  }
207  }
208 
215  function loadFromDb($id)
216  {
217  global $ilDB;
218 
219  $result = $ilDB->queryF("SELECT svy_question.*, " . $this->getAdditionalTableName() . ".* FROM svy_question LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = svy_question.question_id WHERE svy_question.question_id = %s",
220  array('integer'),
221  array($id)
222  );
223  if ($result->numRows() == 1)
224  {
225  $data = $ilDB->fetchAssoc($result);
226  $this->setId($data["question_id"]);
227  $this->setTitle($data["title"]);
228  $this->setDescription($data["description"]);
229  $this->setObjId($data["obj_fi"]);
230  $this->setAuthor($data["author"]);
231  $this->setOwner($data["owner_fi"]);
232  $this->label = $data['label'];
233  include_once("./Services/RTE/classes/class.ilRTE.php");
234  $this->setQuestiontext(ilRTE::_replaceMediaObjectImageSrc($data["questiontext"], 1));
235  $this->setObligatory($data["obligatory"]);
236  $this->setComplete($data["complete"]);
237  $this->setOriginalId($data["original_id"]);
238  $this->setSubtype($data["subtype"]);
239 
240  $result = $ilDB->queryF("SELECT svy_variable.* FROM svy_variable WHERE svy_variable.question_fi = %s",
241  array('integer'),
242  array($id)
243  );
244  if ($result->numRows() > 0)
245  {
246  if ($data = $ilDB->fetchAssoc($result))
247  {
248  $this->minimum = $data["value1"];
249  if (($data["value2"] < 0) or (strcmp($data["value2"], "") == 0))
250  {
251  $this->maximum = "";
252  }
253  else
254  {
255  $this->maximum = $data["value2"];
256  }
257  }
258  }
259  }
261  }
262 
269  function isComplete()
270  {
271  if (
272  strlen($this->getTitle()) &&
273  strlen($this->getAuthor()) &&
274  strlen($this->getQuestiontext())
275  )
276  {
277  return 1;
278  }
279  else
280  {
281  return 0;
282  }
283  }
284 
290  function saveToDb($original_id = "")
291  {
292  global $ilDB;
293 
294  $affectedRows = parent::saveToDb($original_id);
295  if ($affectedRows == 1)
296  {
297  $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
298  array('integer'),
299  array($this->getId())
300  );
301  $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, subtype) VALUES (%s, %s)",
302  array('integer', 'text'),
303  array($this->getId(), $this->getSubType())
304  );
305 
306  // saving material uris in the database
307  $this->saveMaterial();
308 
309  // save categories
310  $affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s",
311  array('integer'),
312  array($this->getId())
313  );
314 
315  if (preg_match("/[\D]/", $this->maximum) or (strcmp($this->maximum, "&infin;") == 0))
316  {
317  $max = -1;
318  }
319  else
320  {
321  $max = $this->getMaximum();
322  }
323  $next_id = $ilDB->nextId('svy_variable');
324  $affectedRows = $ilDB->manipulateF("INSERT INTO svy_variable (variable_id, category_fi, question_fi, value1, value2, sequence, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
325  array('integer','integer','integer','float','float','integer','integer'),
326  array($next_id, 0, $this->getId(), $this->getMinimum(), $max, 0, time())
327  );
328  }
329  }
330 
337  function toXML($a_include_header = TRUE, $obligatory_state = "")
338  {
339  include_once("./Services/Xml/classes/class.ilXmlWriter.php");
340  $a_xml_writer = new ilXmlWriter;
341  $a_xml_writer->xmlHeader();
342  $this->insertXML($a_xml_writer, $a_include_header, $obligatory_state);
343  $xml = $a_xml_writer->xmlDumpMem(FALSE);
344  if (!$a_include_header)
345  {
346  $pos = strpos($xml, "?>");
347  $xml = substr($xml, $pos + 2);
348  }
349  return $xml;
350  }
351 
360  function insertXML(&$a_xml_writer, $a_include_header = TRUE, $obligatory_state = "")
361  {
362  $attrs = array(
363  "id" => $this->getId(),
364  "title" => $this->getTitle(),
365  "type" => $this->getQuestiontype(),
366  "subtype" => $this->getSubtype(),
367  "obligatory" => $this->getObligatory()
368  );
369  $a_xml_writer->xmlStartTag("question", $attrs);
370 
371  $a_xml_writer->xmlElement("description", NULL, $this->getDescription());
372  $a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
373  $a_xml_writer->xmlStartTag("questiontext");
374  $this->addMaterialTag($a_xml_writer, $this->getQuestiontext());
375  $a_xml_writer->xmlEndTag("questiontext");
376 
377  $a_xml_writer->xmlStartTag("responses");
378  switch ($this->getSubtype())
379  {
380  case 3:
381  $attrs = array(
382  "id" => "0",
383  "format" => "double"
384  );
385  if (strlen($this->getMinimum()))
386  {
387  $attrs["min"] = $this->getMinimum();
388  }
389  if (strlen($this->getMaximum()))
390  {
391  $attrs["max"] = $this->getMaximum();
392  }
393  break;
394  case 4:
395  $attrs = array(
396  "id" => "0",
397  "format" => "double"
398  );
399  if (strlen($this->getMinimum()))
400  {
401  $attrs["min"] = $this->getMinimum();
402  }
403  if (strlen($this->getMaximum()))
404  {
405  $attrs["max"] = $this->getMaximum();
406  }
407  break;
408  case 5:
409  $attrs = array(
410  "id" => "0",
411  "format" => "integer"
412  );
413  if (strlen($this->getMinimum()))
414  {
415  $attrs["min"] = $this->getMinimum();
416  }
417  if (strlen($this->getMaximum()))
418  {
419  $attrs["max"] = $this->getMaximum();
420  }
421  break;
422  }
423  $a_xml_writer->xmlStartTag("response_num", $attrs);
424  $a_xml_writer->xmlEndTag("response_num");
425 
426  $a_xml_writer->xmlEndTag("responses");
427 
428  if (count($this->material))
429  {
430  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
431  {
432  $attrs = array(
433  "label" => $this->material["title"]
434  );
435  $a_xml_writer->xmlStartTag("material", $attrs);
436  $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
437  if (strcmp($matches[1], "") != 0)
438  {
439  $intlink = $this->material["internal_link"];
440  }
441  $a_xml_writer->xmlElement("mattext", NULL, $intlink);
442  $a_xml_writer->xmlEndTag("material");
443  }
444  }
445 
446  $a_xml_writer->xmlEndTag("question");
447  }
448 
455  function getQuestionTypeID()
456  {
457  global $ilDB;
458  $result = $ilDB->queryF("SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
459  array('text'),
460  array($this->getQuestionType())
461  );
462  $row = $ilDB->fetchAssoc($result);
463  return $row["questiontype_id"];
464  }
465 
472  function getQuestionType()
473  {
474  return "SurveyMetricQuestion";
475  }
476 
484  {
485  return "svy_qst_metric";
486  }
487 
494  function &getWorkingDataFromUserInput($post_data)
495  {
496  $entered_value = $post_data[$this->getId() . "_metric_question"];
497  $data = array();
498  if (strlen($entered_value))
499  {
500  array_push($data, array("value" => $entered_value));
501  }
502  return $data;
503  }
504 
514  function checkUserInput($post_data, $survey_id)
515  {
516  $entered_value = $post_data[$this->getId() . "_metric_question"];
517  // replace german notation with international notation
518  $entered_value = str_replace(",", ".", $entered_value);
519 
520  if ((!$this->getObligatory($survey_id)) && (strlen($entered_value) == 0)) return "";
521 
522  if (strlen($entered_value) == 0) return $this->lng->txt("survey_question_obligatory");
523 
524  if (strlen($this->getMinimum()))
525  {
526  if ($entered_value < $this->getMinimum())
527  {
528  return $this->lng->txt("metric_question_out_of_bounds");
529  }
530  }
531 
532  if (strlen($this->getMaximum()))
533  {
534  if (($this->getMaximum() == 1) && ($this->getMaximum() < $this->getMinimum()))
535  {
536  // old &infty; values as maximum
537  }
538  else
539  {
540  if ($entered_value > $this->getMaximum())
541  {
542  return $this->lng->txt("metric_question_out_of_bounds");
543  }
544  }
545  }
546 
547  if (!is_numeric($entered_value))
548  {
549  return $this->lng->txt("metric_question_not_a_value");
550  }
551 
552  if (($this->getSubType() == self::SUBTYPE_RATIO_ABSOLUTE) && (intval($entered_value) != doubleval($entered_value)))
553  {
554  return $this->lng->txt("metric_question_floating_point");
555  }
556  return "";
557  }
558 
564  public function saveRandomData($active_id)
565  {
566  global $ilDB;
567  // single response
568  $number = rand($this->getMinimum(), (strlen($this->getMaximum())) ? $this->getMaximum() : 100);
569  $next_id = $ilDB->nextId('svy_answer');
570  $affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
571  array('integer','integer','integer','float','text','integer'),
572  array($next_id, $this->getId(), $active_id, $number, NULL, time())
573  );
574  }
575 
576  function saveUserInput($post_data, $active_id, $a_return = false)
577  {
578  global $ilDB;
579 
580  $entered_value = $post_data[$this->getId() . "_metric_question"];
581 
582  // replace german notation with international notation
583  $entered_value = str_replace(",", ".", $entered_value);
584 
585  if($a_return)
586  {
587  return array(array("value"=>$entered_value, "textanswer"=>null));
588  }
589  if (strlen($entered_value) == 0) return;
590 
591  $next_id = $ilDB->nextId('svy_answer');
592  $affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
593  array('integer','integer','integer','float','text','integer'),
594  array($next_id, $this->getId(), $active_id, (strlen($entered_value)) ? $entered_value : NULL, NULL, time())
595  );
596  }
597 
598  function &getCumulatedResults($survey_id, $nr_of_users, $finished_ids)
599  {
600  global $ilDB;
601 
602  $question_id = $this->getId();
603 
604  $result_array = array();
605  $cumulated = array();
606 
607  $sql = "SELECT svy_answer.* FROM svy_answer".
608  " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
609  " WHERE svy_answer.question_fi = ".$ilDB->quote($question_id, "integer").
610  " AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
611  if($finished_ids)
612  {
613  $sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
614  }
615 
616  $result = $ilDB->query($sql);
617  while ($row = $ilDB->fetchAssoc($result))
618  {
619  $cumulated[$row["value"]]++;
620  }
621  asort($cumulated, SORT_NUMERIC);
622  end($cumulated);
623  $numrows = $result->numRows();
624  $result_array["USERS_ANSWERED"] = $result->numRows();
625  $result_array["USERS_SKIPPED"] = $nr_of_users - $result->numRows();
626  if(sizeof($cumulated))
627  {
628  $result_array["MODE"] = key($cumulated);
629  $result_array["MODE_VALUE"] = key($cumulated);
630  $result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
631  ksort($cumulated, SORT_NUMERIC);
632  }
633  $counter = 0;
634  foreach ($cumulated as $value => $nr_of_users)
635  {
636  $percentage = 0;
637  if ($numrows > 0)
638  {
639  $percentage = (float)($nr_of_users/$numrows);
640  }
641  $result_array["values"][$counter++] = array("value" => $value, "selected" => (int)$nr_of_users, "percentage" => $percentage);
642  }
643  $median = array();
644  $total = 0;
645  $x_i = 0;
646  $p_i = 1;
647  $x_i_inv = 0;
648  $sum_part_zero = false;
649  foreach ($cumulated as $value => $key)
650  {
651  $total += $key;
652  for ($i = 0; $i < $key; $i++)
653  {
654  array_push($median, $value);
655  $x_i += $value;
656  $p_i *= $value;
657  if ($value != 0)
658  {
659  $sum_part_zero = true;
660  $x_i_inv += 1/$value;
661  }
662  }
663  }
664  if ($total > 0)
665  {
666  if (($total % 2) == 0)
667  {
668  $median_value = 0.5 * ($median[($total/2)-1] + $median[($total/2)]);
669  }
670  else
671  {
672  $median_value = $median[(($total+1)/2)-1];
673  }
674  }
675  else
676  {
677  $median_value = "";
678  }
679  if ($total > 0)
680  {
681  if (($x_i/$total) == (int)($x_i/$total))
682  {
683  $result_array["ARITHMETIC_MEAN"] = $x_i/$total;
684  }
685  else
686  {
687  $result_array["ARITHMETIC_MEAN"] = sprintf("%.2f", $x_i/$total);
688  }
689  }
690  else
691  {
692  $result_array["ARITHMETIC_MEAN"] = "";
693  }
694  $result_array["MEDIAN"] = $median_value;
695  $result_array["QUESTION_TYPE"] = "SurveyMetricQuestion";
696  return $result_array;
697  }
698 
708  function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
709  {
710  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
711  $worksheet =& $workbook->addWorksheet();
712  $rowcounter = 0;
713  switch ($export_label)
714  {
715  case 'label_only':
716  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
717  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label));
718  break;
719  case 'title_only':
720  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
721  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
722  break;
723  default:
724  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
725  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
726  $rowcounter++;
727  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
728  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label));
729  break;
730  }
731  $rowcounter++;
732  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold);
733  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
734  $rowcounter++;
735  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold);
736  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())));
737  $rowcounter++;
738  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
739  $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]);
740  $rowcounter++;
741  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
742  $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]);
743  $rowcounter++;
744 
745  $worksheet->write($rowcounter, 0, $this->lng->txt("subtype"), $format_bold);
746  switch ($this->getSubtype())
747  {
748  case self::SUBTYPE_NON_RATIO:
749  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("non_ratio")), $format_bold);
750  break;
751  case self::SUBTYPE_RATIO_NON_ABSOLUTE:
752  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_non_absolute")), $format_bold);
753  break;
754  case self::SUBTYPE_RATIO_ABSOLUTE:
755  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_absolute")), $format_bold);
756  break;
757  }
758  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold);
759  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
760  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold);
761  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
762  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold);
763  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_NR_OF_SELECTIONS"]));
764  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold);
765  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MEDIAN"]));
766  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean")), $format_bold);
767  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["ARITHMETIC_MEAN"]));
768  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("values")), $format_bold);
769  $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title);
770  $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title);
771  $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title);
772  $values = "";
773  if (is_array($eval_data["values"]))
774  {
775  foreach ($eval_data["values"] as $key => $value)
776  {
777  $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["value"]));
778  $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($value["selected"]));
779  $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($value["percentage"]), $format_percent);
780  }
781  }
782  }
783 
791  function addUserSpecificResultsData(&$a_array, &$resultset)
792  {
793  if (count($resultset["answers"][$this->getId()]))
794  {
795  foreach ($resultset["answers"][$this->getId()] as $key => $answer)
796  {
797  array_push($a_array, $answer["value"]);
798  }
799  }
800  else
801  {
802  array_push($a_array, $this->getSkippedValue());
803  }
804  }
805 
813  function &getUserAnswers($survey_id, $finished_ids)
814  {
815  global $ilDB;
816 
817  $answers = array();
818 
819  $sql = "SELECT svy_answer.* FROM svy_answer".
820  " JOIN svy_finished ON (svy_finished.finished_id = svy_answer.active_fi)".
821  " WHERE svy_answer.question_fi = ".$ilDB->quote($this->getId(), "integer").
822  " AND svy_finished.survey_fi = ".$ilDB->quote($survey_id, "integer");
823  if($finished_ids)
824  {
825  $sql .= " AND ".$ilDB->in("svy_finished.finished_id", $finished_ids, "", "integer");
826  }
827 
828  $result = $ilDB->query($sql);
829  while ($row = $ilDB->fetchAssoc($result))
830  {
831  $answers[$row["active_fi"]] = $row["value"];
832  }
833  return $answers;
834  }
835 
842  function importResponses($a_data)
843  {
844  foreach ($a_data as $id => $data)
845  {
846  $this->setMinimum($data["min"]);
847  $this->setMaximum($data["max"]);
848  }
849  }
850 
858  {
859  return TRUE;
860  }
861 
869  {
870  return array("<", "<=", "=", "<>", ">=", ">");
871  }
872 
879  function outPreconditionSelectValue(&$template)
880  {
881  $template->setCurrentBlock("textfield");
882  $template->setVariable("TEXTFIELD_VALUE", "");
883  $template->parseCurrentBlock();
884  }
885 
892  public function getPreconditionSelectValue($default = "", $title, $variable)
893  {
894  include_once "./Services/Form/classes/class.ilNumberInputGUI.php";
895  $step3 = new ilNumberInputGUI($title, $variable);
896  $step3->setValue($default);
897  return $step3;
898  }
899 
906  function getMinMaxText()
907  {
908  $min = $this->getMinimum();
909  $max = $this->getMaximum();
910  if (strlen($min) && strlen($max))
911  {
912  return "(" . $min . " " . strtolower($this->lng->txt("to")) . " " . $max . ")";
913  }
914  else if (strlen($min))
915  {
916  return "(&gt;= " . $min . ")";
917  }
918  else if (strlen($max))
919  {
920  return "(&lt;= " . $max . ")";
921  }
922  else
923  {
924  return "";
925  }
926  }
927 }
928 ?>