• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Form/classes/class.ilCheckboxInputGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2007 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00031 class ilCheckboxInputGUI extends ilSubEnabledFormPropertyGUI
00032 {
00033         protected $value = "1";
00034         protected $checked;
00035         protected $optiontitle = "";
00036         
00043         function __construct($a_title = "", $a_postvar = "")
00044         {
00045                 parent::__construct($a_title, $a_postvar);
00046                 $this->setType("checkbox");
00047         }
00048 
00054         function setValue($a_value)
00055         {
00056                 $this->value = $a_value;
00057         }
00058 
00064         function getValue()
00065         {
00066                 return $this->value;
00067         }
00068 
00074         function setChecked($a_checked)
00075         {
00076                 $this->checked = $a_checked;
00077         }
00078 
00084         function getChecked()
00085         {
00086                 return $this->checked;
00087         }
00088 
00094         function setOptionTitle($a_optiontitle)
00095         {
00096                 $this->optiontitle = $a_optiontitle;
00097         }
00098 
00104         function getOptionTitle()
00105         {
00106                 return $this->optiontitle;
00107         }
00108 
00114         function setValueByArray($a_values)
00115         {
00116                 $this->setChecked($a_values[$this->getPostVar()]);
00117                 foreach($this->getSubItems() as $item)
00118                 {
00119                         $item->setValueByArray($a_values);
00120                 }
00121         }
00122 
00128         function checkInput()
00129         {
00130                 global $lng;
00131                 
00132                 $_POST[$this->getPostVar()] = 
00133                         ilUtil::stripSlashes($_POST[$this->getPostVar()]);
00134 
00135                 $ok = $this->checkSubItemsInput();
00136                 return $ok;
00137         }
00138 
00143         function insert(&$a_tpl)
00144         {
00145                 $a_tpl->setCurrentBlock("prop_checkbox");
00146                 $a_tpl->setVariable("POST_VAR", $this->getPostVar());
00147                 $a_tpl->setVariable("ID", $this->getFieldId());
00148                 $a_tpl->setVariable("PROPERTY_VALUE", $this->getValue());
00149                 $a_tpl->setVariable("OPTION_TITLE", $this->getOptionTitle());
00150                 if ($this->getChecked())
00151                 {
00152                         $a_tpl->setVariable("PROPERTY_CHECKED",
00153                                 'checked="checked"');
00154                 }
00155                 $a_tpl->parseCurrentBlock();
00156         }
00157 
00158 }

Generated on Fri Dec 13 2013 17:56:57 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1