ILIAS  Release_4_2_x_branch Revision 61807
 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 include_once "./Modules/Survey/classes/inc.SurveyConstants.php";
26 
27 define("SUBTYPE_NON_RATIO", 3);
28 define("SUBTYPE_RATIO_NON_ABSOLUTE", 4);
29 define("SUBTYPE_RATIO_ABSOLUTE", 5);
30 
43 {
51  var $subtype;
52 
58  var $minimum;
59 
65  var $maximum;
66 
79  $title = "",
80  $description = "",
81  $author = "",
82  $questiontext = "",
83  $owner = -1,
85  )
86  {
88  $this->subtype = $subtype;
89  $this->minimum = "";
90  $this->maximum = "";
91  }
92 
101  {
102  $this->subtype = $subtype;
103  }
104 
112  function setMinimum($minimum = 0)
113  {
114  if($minimum !== NULL)
115  {
116  $minimum = (float)$minimum;
117  }
118  if(!$minimum)
119  {
120  $minimum = NULL;
121  }
122  $this->minimum = $minimum;
123  }
124 
132  function setMaximum($maximum = "")
133  {
134  if($maximum !== NULL)
135  {
136  $maximum = (float)$maximum;
137  }
138  if(!$maximum)
139  {
140  $maximum = NULL;
141  }
142  $this->maximum = $maximum;
143  }
144 
152  function getSubtype()
153  {
154  return $this->subtype;
155  }
156 
164  function getMinimum()
165  {
166  if ((strlen($this->minimum) == 0) && ($this->getSubtype() > 3))
167  {
168  $this->minimum = 0;
169  }
170  return (strlen($this->minimum)) ? $this->minimum : NULL;
171  }
172 
180  function getMaximum()
181  {
182  return (strlen($this->maximum)) ? $this->maximum : NULL;
183  }
184 
193  {
194  global $ilDB;
195 
196  $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",
197  array('integer'),
198  array($id)
199  );
200  if ($result->numRows() == 1)
201  {
202  return $ilDB->fetchAssoc($result);
203  }
204  else
205  {
206  return array();
207  }
208  }
209 
216  function loadFromDb($id)
217  {
218  global $ilDB;
219 
220  $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",
221  array('integer'),
222  array($id)
223  );
224  if ($result->numRows() == 1)
225  {
226  $data = $ilDB->fetchAssoc($result);
227  $this->setId($data["question_id"]);
228  $this->setTitle($data["title"]);
229  $this->setDescription($data["description"]);
230  $this->setObjId($data["obj_fi"]);
231  $this->setAuthor($data["author"]);
232  $this->setOwner($data["owner_fi"]);
233  $this->label = $data['label'];
234  include_once("./Services/RTE/classes/class.ilRTE.php");
235  $this->setQuestiontext(ilRTE::_replaceMediaObjectImageSrc($data["questiontext"], 1));
236  $this->setObligatory($data["obligatory"]);
237  $this->setComplete($data["complete"]);
238  $this->setOriginalId($data["original_id"]);
239  $this->setSubtype($data["subtype"]);
240 
241  $result = $ilDB->queryF("SELECT svy_variable.* FROM svy_variable WHERE svy_variable.question_fi = %s",
242  array('integer'),
243  array($id)
244  );
245  if ($result->numRows() > 0)
246  {
247  if ($data = $ilDB->fetchAssoc($result))
248  {
249  $this->minimum = $data["value1"];
250  if (($data["value2"] < 0) or (strcmp($data["value2"], "") == 0))
251  {
252  $this->maximum = "";
253  }
254  else
255  {
256  $this->maximum = $data["value2"];
257  }
258  }
259  }
260  }
262  }
263 
270  function isComplete()
271  {
272  if (
273  strlen($this->getTitle()) &&
274  strlen($this->getAuthor()) &&
275  strlen($this->getQuestiontext())
276  )
277  {
278  return 1;
279  }
280  else
281  {
282  return 0;
283  }
284  }
285 
291  function saveToDb($original_id = "")
292  {
293  global $ilDB;
294 
295  $affectedRows = parent::saveToDb($original_id);
296  if ($affectedRows == 1)
297  {
298  $affectedRows = $ilDB->manipulateF("DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
299  array('integer'),
300  array($this->getId())
301  );
302  $affectedRows = $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, subtype) VALUES (%s, %s)",
303  array('integer', 'text'),
304  array($this->getId(), $this->getSubType())
305  );
306 
307  // saving material uris in the database
308  $this->saveMaterial();
309 
310  // save categories
311  $affectedRows = $ilDB->manipulateF("DELETE FROM svy_variable WHERE question_fi = %s",
312  array('integer'),
313  array($this->getId())
314  );
315 
316  if (preg_match("/[\D]/", $this->maximum) or (strcmp($this->maximum, "&infin;") == 0))
317  {
318  $max = -1;
319  }
320  else
321  {
322  $max = $this->getMaximum();
323  }
324  $next_id = $ilDB->nextId('svy_variable');
325  $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)",
326  array('integer','integer','integer','float','float','integer','integer'),
327  array($next_id, 0, $this->getId(), $this->getMinimum(), $max, 0, time())
328  );
329  }
330  }
331 
338  function toXML($a_include_header = TRUE, $obligatory_state = "")
339  {
340  include_once("./Services/Xml/classes/class.ilXmlWriter.php");
341  $a_xml_writer = new ilXmlWriter;
342  $a_xml_writer->xmlHeader();
343  $this->insertXML($a_xml_writer, $a_include_header, $obligatory_state);
344  $xml = $a_xml_writer->xmlDumpMem(FALSE);
345  if (!$a_include_header)
346  {
347  $pos = strpos($xml, "?>");
348  $xml = substr($xml, $pos + 2);
349  }
350  return $xml;
351  }
352 
361  function insertXML(&$a_xml_writer, $a_include_header = TRUE, $obligatory_state = "")
362  {
363  $attrs = array(
364  "id" => $this->getId(),
365  "title" => $this->getTitle(),
366  "type" => $this->getQuestiontype(),
367  "subtype" => $this->getSubtype(),
368  "obligatory" => $this->getObligatory()
369  );
370  $a_xml_writer->xmlStartTag("question", $attrs);
371 
372  $a_xml_writer->xmlElement("description", NULL, $this->getDescription());
373  $a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
374  $a_xml_writer->xmlStartTag("questiontext");
375  $this->addMaterialTag($a_xml_writer, $this->getQuestiontext());
376  $a_xml_writer->xmlEndTag("questiontext");
377 
378  $a_xml_writer->xmlStartTag("responses");
379  switch ($this->getSubtype())
380  {
381  case 3:
382  $attrs = array(
383  "id" => "0",
384  "format" => "double"
385  );
386  if (strlen($this->getMinimum()))
387  {
388  $attrs["min"] = $this->getMinimum();
389  }
390  if (strlen($this->getMaximum()))
391  {
392  $attrs["max"] = $this->getMaximum();
393  }
394  break;
395  case 4:
396  $attrs = array(
397  "id" => "0",
398  "format" => "double"
399  );
400  if (strlen($this->getMinimum()))
401  {
402  $attrs["min"] = $this->getMinimum();
403  }
404  if (strlen($this->getMaximum()))
405  {
406  $attrs["max"] = $this->getMaximum();
407  }
408  break;
409  case 5:
410  $attrs = array(
411  "id" => "0",
412  "format" => "integer"
413  );
414  if (strlen($this->getMinimum()))
415  {
416  $attrs["min"] = $this->getMinimum();
417  }
418  if (strlen($this->getMaximum()))
419  {
420  $attrs["max"] = $this->getMaximum();
421  }
422  break;
423  }
424  $a_xml_writer->xmlStartTag("response_num", $attrs);
425  $a_xml_writer->xmlEndTag("response_num");
426 
427  $a_xml_writer->xmlEndTag("responses");
428 
429  if (count($this->material))
430  {
431  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $this->material["internal_link"], $matches))
432  {
433  $attrs = array(
434  "label" => $this->material["title"]
435  );
436  $a_xml_writer->xmlStartTag("material", $attrs);
437  $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
438  if (strcmp($matches[1], "") != 0)
439  {
440  $intlink = $this->material["internal_link"];
441  }
442  $a_xml_writer->xmlElement("mattext", NULL, $intlink);
443  $a_xml_writer->xmlEndTag("material");
444  }
445  }
446 
447  $a_xml_writer->xmlEndTag("question");
448  }
449 
456  function getQuestionTypeID()
457  {
458  global $ilDB;
459  $result = $ilDB->queryF("SELECT questiontype_id FROM svy_qtype WHERE type_tag = %s",
460  array('text'),
461  array($this->getQuestionType())
462  );
463  $row = $ilDB->fetchAssoc($result);
464  return $row["questiontype_id"];
465  }
466 
473  function getQuestionType()
474  {
475  return "SurveyMetricQuestion";
476  }
477 
485  {
486  return "svy_qst_metric";
487  }
488 
495  function &getWorkingDataFromUserInput($post_data)
496  {
497  $entered_value = $post_data[$this->getId() . "_metric_question"];
498  $data = array();
499  if (strlen($entered_value))
500  {
501  array_push($data, array("value" => $entered_value));
502  }
503  return $data;
504  }
505 
515  function checkUserInput($post_data, $survey_id)
516  {
517  $entered_value = $post_data[$this->getId() . "_metric_question"];
518  // replace german notation with international notation
519  $entered_value = str_replace(",", ".", $entered_value);
520 
521  if ((!$this->getObligatory($survey_id)) && (strlen($entered_value) == 0)) return "";
522 
523  if (strlen($entered_value) == 0) return $this->lng->txt("survey_question_obligatory");
524 
525  if (strlen($this->getMinimum()))
526  {
527  if ($entered_value < $this->getMinimum())
528  {
529  return $this->lng->txt("metric_question_out_of_bounds");
530  }
531  }
532 
533  if (strlen($this->getMaximum()))
534  {
535  if (($this->getMaximum() == 1) && ($this->getMaximum() < $this->getMinimum()))
536  {
537  // old &infty; values as maximum
538  }
539  else
540  {
541  if ($entered_value > $this->getMaximum())
542  {
543  return $this->lng->txt("metric_question_out_of_bounds");
544  }
545  }
546  }
547 
548  if (!is_numeric($entered_value))
549  {
550  return $this->lng->txt("metric_question_not_a_value");
551  }
552 
553  if (($this->getSubType() == SUBTYPE_RATIO_ABSOLUTE) && (intval($entered_value) != doubleval($entered_value)))
554  {
555  return $this->lng->txt("metric_question_floating_point");
556  }
557  return "";
558  }
559 
565  public function saveRandomData($active_id)
566  {
567  global $ilDB;
568  // single response
569  $number = rand($this->getMinimum(), (strlen($this->getMaximum())) ? $this->getMaximum() : 100);
570  $next_id = $ilDB->nextId('svy_answer');
571  $affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
572  array('integer','integer','integer','float','text','integer'),
573  array($next_id, $this->getId(), $active_id, $number, NULL, time())
574  );
575  }
576 
577  function saveUserInput($post_data, $active_id, $a_return = false)
578  {
579  global $ilDB;
580 
581  $entered_value = $post_data[$this->getId() . "_metric_question"];
582 
583  // replace german notation with international notation
584  $entered_value = str_replace(",", ".", $entered_value);
585 
586  if($a_return)
587  {
588  return array(array("value"=>$entered_value, "textanswer"=>null));
589  }
590  if (strlen($entered_value) == 0) return;
591 
592  $next_id = $ilDB->nextId('svy_answer');
593  $affectedRows = $ilDB->manipulateF("INSERT INTO svy_answer (answer_id, question_fi, active_fi, value, textanswer, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
594  array('integer','integer','integer','float','text','integer'),
595  array($next_id, $this->getId(), $active_id, (strlen($entered_value)) ? $entered_value : NULL, NULL, time())
596  );
597  }
598 
599  function &getCumulatedResults($survey_id, $nr_of_users)
600  {
601  global $ilDB;
602 
603  $question_id = $this->getId();
604 
605  $result_array = array();
606  $cumulated = array();
607 
608  $result = $ilDB->queryF("SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_answer.question_fi = %s AND svy_finished.survey_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
609  array('integer', 'integer'),
610  array($question_id, $survey_id)
611  );
612 
613  while ($row = $ilDB->fetchAssoc($result))
614  {
615  $cumulated[$row["value"]]++;
616  }
617  asort($cumulated, SORT_NUMERIC);
618  end($cumulated);
619  $numrows = $result->numRows();
620  $result_array["USERS_ANSWERED"] = $result->numRows();
621  $result_array["USERS_SKIPPED"] = $nr_of_users - $result->numRows();
622  $result_array["MODE"] = key($cumulated);
623  $result_array["MODE_VALUE"] = key($cumulated);
624  $result_array["MODE_NR_OF_SELECTIONS"] = $cumulated[key($cumulated)];
625  ksort($cumulated, SORT_NUMERIC);
626  $counter = 0;
627  foreach ($cumulated as $value => $nr_of_users)
628  {
629  $percentage = 0;
630  if ($numrows > 0)
631  {
632  $percentage = (float)($nr_of_users/$numrows);
633  }
634  $result_array["values"][$counter++] = array("value" => $value, "selected" => (int)$nr_of_users, "percentage" => $percentage);
635  }
636  $median = array();
637  $total = 0;
638  $x_i = 0;
639  $p_i = 1;
640  $x_i_inv = 0;
641  $sum_part_zero = false;
642  foreach ($cumulated as $value => $key)
643  {
644  $total += $key;
645  for ($i = 0; $i < $key; $i++)
646  {
647  array_push($median, $value);
648  $x_i += $value;
649  $p_i *= $value;
650  if ($value != 0)
651  {
652  $sum_part_zero = true;
653  $x_i_inv += 1/$value;
654  }
655  }
656  }
657  if ($total > 0)
658  {
659  if (($total % 2) == 0)
660  {
661  $median_value = 0.5 * ($median[($total/2)-1] + $median[($total/2)]);
662  }
663  else
664  {
665  $median_value = $median[(($total+1)/2)-1];
666  }
667  }
668  else
669  {
670  $median_value = "";
671  }
672  if ($total > 0)
673  {
674  if (($x_i/$total) == (int)($x_i/$total))
675  {
676  $result_array["ARITHMETIC_MEAN"] = $x_i/$total;
677  }
678  else
679  {
680  $result_array["ARITHMETIC_MEAN"] = sprintf("%.2f", $x_i/$total);
681  }
682  }
683  else
684  {
685  $result_array["ARITHMETIC_MEAN"] = "";
686  }
687  $result_array["MEDIAN"] = $median_value;
688  $result_array["QUESTION_TYPE"] = "SurveyMetricQuestion";
689  return $result_array;
690  }
691 
701  function setExportDetailsXLS(&$workbook, &$format_title, &$format_bold, &$eval_data, $export_label)
702  {
703  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
704  $worksheet =& $workbook->addWorksheet();
705  $rowcounter = 0;
706  switch ($export_label)
707  {
708  case 'label_only':
709  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
710  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->label));
711  break;
712  case 'title_only':
713  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
714  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
715  break;
716  default:
717  $worksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title")), $format_bold);
718  $worksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->getTitle()));
719  $rowcounter++;
720  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("label")), $format_bold);
721  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->label));
722  break;
723  }
724  $rowcounter++;
725  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question")), $format_bold);
726  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->getQuestiontext()));
727  $rowcounter++;
728  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("question_type")), $format_bold);
729  $worksheet->writeString($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())));
730  $rowcounter++;
731  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_answered")), $format_bold);
732  $worksheet->write($rowcounter, 1, $eval_data["USERS_ANSWERED"]);
733  $rowcounter++;
734  $worksheet->writeString($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("users_skipped")), $format_bold);
735  $worksheet->write($rowcounter, 1, $eval_data["USERS_SKIPPED"]);
736  $rowcounter++;
737 
738  $worksheet->write($rowcounter, 0, $this->lng->txt("subtype"), $format_bold);
739  switch ($this->getSubtype())
740  {
741  case SUBTYPE_NON_RATIO:
742  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("non_ratio")), $format_bold);
743  break;
745  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_non_absolute")), $format_bold);
746  break;
748  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($this->lng->txt("ratio_absolute")), $format_bold);
749  break;
750  }
751  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode")), $format_bold);
752  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
753  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_text")), $format_bold);
754  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE"]));
755  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections")), $format_bold);
756  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MODE_NR_OF_SELECTIONS"]));
757  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("median")), $format_bold);
758  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["MEDIAN"]));
759  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean")), $format_bold);
760  $worksheet->write($rowcounter++, 1, ilExcelUtils::_convert_text($eval_data["ARITHMETIC_MEAN"]));
761  $worksheet->write($rowcounter, 0, ilExcelUtils::_convert_text($this->lng->txt("values")), $format_bold);
762  $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($this->lng->txt("value")), $format_title);
763  $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($this->lng->txt("category_nr_selected")), $format_title);
764  $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($this->lng->txt("percentage_of_selections")), $format_title);
765  $values = "";
766  if (is_array($eval_data["values"]))
767  {
768  foreach ($eval_data["values"] as $key => $value)
769  {
770  $worksheet->write($rowcounter, 1, ilExcelUtils::_convert_text($value["value"]));
771  $worksheet->write($rowcounter, 2, ilExcelUtils::_convert_text($value["selected"]));
772  $worksheet->write($rowcounter++, 3, ilExcelUtils::_convert_text($value["percentage"]), $format_percent);
773  }
774  }
775  }
776 
784  function addUserSpecificResultsData(&$a_array, &$resultset)
785  {
786  if (count($resultset["answers"][$this->getId()]))
787  {
788  foreach ($resultset["answers"][$this->getId()] as $key => $answer)
789  {
790  array_push($a_array, $answer["value"]);
791  }
792  }
793  else
794  {
795  array_push($a_array, $this->lng->txt("skipped"));
796  }
797  }
798 
807  {
808  global $ilDB;
809 
810  $answers = array();
811 
812  $result = $ilDB->queryF("SELECT svy_answer.* FROM svy_answer, svy_finished WHERE svy_finished.survey_fi = %s AND svy_answer.question_fi = %s AND svy_finished.finished_id = svy_answer.active_fi",
813  array('integer','integer'),
814  array($survey_id, $this->getId())
815  );
816  while ($row = $ilDB->fetchAssoc($result))
817  {
818  $answers[$row["active_fi"]] = $row["value"];
819  }
820  return $answers;
821  }
822 
829  function importResponses($a_data)
830  {
831  foreach ($a_data as $id => $data)
832  {
833  $this->setMinimum($data["min"]);
834  $this->setMaximum($data["max"]);
835  }
836  }
837 
845  {
846  return TRUE;
847  }
848 
856  {
857  return array("<", "<=", "=", "<>", ">=", ">");
858  }
859 
866  function outPreconditionSelectValue(&$template)
867  {
868  $template->setCurrentBlock("textfield");
869  $template->setVariable("TEXTFIELD_VALUE", "");
870  $template->parseCurrentBlock();
871  }
872 
879  public function getPreconditionSelectValue($default = "", $title, $variable)
880  {
881  include_once "./Services/Form/classes/class.ilNumberInputGUI.php";
882  $step3 = new ilNumberInputGUI($title, $variable);
883  $step3->setValue($default);
884  return $step3;
885  }
886 
893  function getMinMaxText()
894  {
895  $min = $this->getMinimum();
896  $max = $this->getMaximum();
897  if (strlen($min) && strlen($max))
898  {
899  return "(" . $min . " " . strtolower($this->lng->txt("to")) . " " . $max . ")";
900  }
901  else if (strlen($min))
902  {
903  return "(&gt;= " . $min . ")";
904  }
905  else if (strlen($max))
906  {
907  return "(&lt;= " . $max . ")";
908  }
909  else
910  {
911  return "";
912  }
913  }
914 }
915 ?>