Esempio n. 1
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link IcmsPersistableObject)
  * @param	string    $key      the form name
  */
 function __construct($object, $key)
 {
     $var = $object->vars[$key];
     parent::__construct($var['title'], $key, $object->getVar($key, 'e'));
     // Adding the options inside this SelectBox
     // If the custom method is not from a module, than it's from the core
     $control = $object->getControl($key);
     if (isset($control['options'])) {
         $this->addOptionArray($control['options']);
     } else {
         // let's find out if the method we need to call comes from an already defined object
         if (isset($control['object'])) {
             if (method_exists($control['object'], $control['method'])) {
                 if ($option_array = $control['object']->{$control}['method']()) {
                     // Adding the options array to the XoopsFormSelect
                     $this->addOptionArray($option_array);
                 }
             }
         } else {
             // finding the itemHandler; if none, let's take the itemHandler of the $object
             if (isset($control['itemHandler'])) {
                 if (!$control['module']) {
                     // Creating the specified core object handler
                     $control_handler =& xoops_gethandler($control['itemHandler']);
                 } else {
                     $control_handler =& xoops_getmodulehandler($control['itemHandler'], $control['module']);
                 }
             } else {
                 $control_handler =& $object->handler;
             }
             // Checking if the specified method exists
             if (method_exists($control_handler, $control['method'])) {
                 // TODO : How could I pass the parameters in the following call ...
                 if ($option_array = $control_handler->{$control}['method']()) {
                     // Adding the options array to the XoopsFormSelect
                     $this->addOptionArray($option_array);
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	string	$value		Pre-selected value, can be "0" (No) or "1" (Yes)
  * @param	string	$yes		String for "Yes"
  * @param	string	$no			String for "No"
  */
 function __construct($caption, $name, $value = null, $yes = _YES, $no = _NO)
 {
     parent::__construct($caption, $name, $value);
     $this->addOption(1, $yes);
     $this->addOption(0, $no);
 }