示例#1
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	$value	Pre-selected value (or array of them).
  * 							Legal values are {@link XOOPS_MATCH_START}, {@link XOOPS_MATCH_END},
  * 							{@link XOOPS_MATCH_EQUAL}, and {@link XOOPS_MATCH_CONTAIN}
  * @param	int		$size	Number of rows. "1" makes a drop-down-list
  */
 public function __construct($caption, $name, $value = null, $size = 1)
 {
     parent::__construct($caption, $name, $value, $size, false);
     $this->addOption(XOOPS_MATCH_START, _STARTSWITH);
     $this->addOption(XOOPS_MATCH_END, _ENDSWITH);
     $this->addOption(XOOPS_MATCH_EQUAL, _MATCHES);
     $this->addOption(XOOPS_MATCH_CONTAIN, _CONTAINS);
 }
示例#2
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	bool	$include_anon	Include group "anonymous"?
  * @param	mixed	$value	    	Pre-selected value (or array of them).
  * @param	int		$size	        Number or rows. "1" makes a drop-down-list.
  * @param	bool    $multiple       Allow multiple selections?
  */
 public function __construct($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     parent::__construct($caption, $name, $value, $size, $multiple);
     $member_handler = icms::handler('icms_member');
     if (!$include_anon) {
         $this->addOptionArray($member_handler->getGroupList(new icms_db_criteria_Item('groupid', ICMS_GROUP_ANONYMOUS, '!=')));
     } else {
         $this->addOptionArray($member_handler->getGroupList());
     }
 }
示例#3
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     $var = $object->vars[$key];
     $size = isset($var['size']) ? $var['size'] : ($this->_multiple ? 5 : 1);
     parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'), $size, $this->_multiple);
     $sql = "SELECT uid, uname FROM " . icms::$xoopsDB->prefix("users") . " ORDER BY uname ASC";
     $result = icms::$xoopsDB->query($sql);
     if ($result) {
         while ($myrow = icms::$xoopsDB->fetchArray($result)) {
             $uArray[$myrow["uid"]] = $myrow["uname"];
         }
     }
     $this->addOptionArray($uArray);
 }
示例#4
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     $var = $object->vars[$key];
     $timearray = array();
     for ($i = 0; $i < 24; $i++) {
         for ($j = 0; $j < 60; $j = $j + 10) {
             $key_t = $i * 3600 + $j * 60;
             $timearray[$key_t] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
         }
     }
     ksort($timearray);
     parent::__construct($var['form_caption'], $key, $object->getVar($key, 'e'));
     $this->addOptionArray($timearray);
 }
示例#5
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     $var = $object->vars[$key];
     $size = isset($var['size']) ? $var['size'] : ($this->_multiple ? 5 : 1);
     // 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);
     $value = isset($control['value']) ? $control['value'] : $object->getVar($key, 'e');
     parent::__construct($var['form_caption'], $key, $value, $size, $this->_multiple);
     if (isset($control['options'])) {
         $this->addOptionArray($control['options']);
     } else {
         // let's find 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 select element
                     $this->addOptionArray($option_array);
                 }
             }
         } else {
             // finding the itemHandler; if none, let's take the itemHandler of the $object
             if (isset($control['itemHandler'])) {
                 if (!isset($control['module'])) {
                     // Creating the specified core object handler
                     $control_handler = icms::handler($control['itemHandler']);
                 } else {
                     $control_handler =& icms_getModuleHandler($control['itemHandler'], $control['module']);
                 }
             } else {
                 $control_handler =& $object->handler;
             }
             // Checking if the specified method exists
             if (method_exists($control_handler, $control['method'])) {
                 $option_array = call_user_func_array(array($control_handler, $control['method']), isset($control['params']) ? $control['params'] : array());
                 if (is_array($option_array) && count($option_array) > 0) {
                     // Adding the options array to the select element
                     $this->addOptionArray($option_array);
                 }
             }
         }
     }
 }
示例#6
0
 /**
  * Constructor
  * @param	object    $object   reference to targetobject (@link icms_ipf_Object)
  * @param	string    $key      the form name
  */
 public function __construct($object, $key)
 {
     $category_title_field = $object->handler->identifierName;
     $addNoParent = isset($object->controls[$key]['addNoParent']) ? $object->controls[$key]['addNoParent'] : true;
     $criteria = new icms_db_criteria_Compo();
     $criteria->setSort("weight, " . $category_title_field);
     $category_handler = icms_getModuleHandler('category', $object->handler->_moduleName);
     $categories = $category_handler->getObjects($criteria);
     $mytree = new icms_ipf_Tree($categories, "category_id", "category_pid");
     parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
     $ret = array();
     $options = $this->getOptionArray($mytree, $category_title_field, 0, $ret, "");
     if ($addNoParent) {
         $newOptions = array('0' => '----');
         foreach ($options as $k => $v) {
             $newOptions[$k] = $v;
         }
         $options = $newOptions;
     }
     $this->addOptionArray($options);
 }
示例#7
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	$value	Pre-selected value (or array of them).
  * 							Legal is any name of a ICMS_ROOT_PATH."/language/" subdirectory.
  * @param	int		$size	Number of rows. "1" makes a drop-down-list.
  */
 public function __construct($caption, $name, $value = null, $size = 1)
 {
     parent::__construct($caption, $name, $value, $size);
     $this->addOptionArray(icms_core_Filesystem::getDirList(ICMS_ROOT_PATH . "/language/"));
 }
示例#8
0
 /**
  * Construtor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	  $value	Value for the Select attribute
  * @param	string	$cat    Name of the Category
  */
 public function __construct($caption, $name, $value = NULL, $cat = NULL)
 {
     parent::__construct($caption, $name, $value);
     $this->addOptGroupArray($this->getImageList($cat));
 }
示例#9
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	$value	Pre-selected value (or array of them).
  * 							Legal values are "-12" to "12" with some ".5"s strewn in ;-)
  * @param	int		$size	Number of rows. "1" makes a drop-down-box.
  */
 public function __construct($caption, $name, $value = null, $size = 1)
 {
     parent::__construct($caption, $name, $value, $size);
     $this->addOptionArray(self::getTimeZoneList());
 }
示例#10
0
 /**
  * Constructor
  *
  * @param	string	$caption
  * @param	string	$name
  * @param	mixed	$value	Pre-selected value (or array of them).
  * @param	int		$size	Number or rows. "1" makes a drop-down-list
  */
 public function __construct($caption, $name, $value = null, $size = 1)
 {
     parent::__construct($caption, $name, $value, $size);
     $this->addOptionArray(icms_view_theme_Factory::getThemesList());
 }
示例#11
0
 function XoopsFormSelect($caption, $name, $value = null, $size = 1, $multiple = false)
 {
     parent::__construct($caption, $name, $value, $size, $multiple);
     $this->_deprecated = icms_core_Debug::setDeprecated('icms_form_elements_Select', sprintf(_CORE_REMOVE_IN_VERSION, '1.4'));
 }