function initVar($key, $data_type, $value = null, $required = false, $maxlength = null, $options = '') { parent::initVar($key, $data_type, $value, $required, $maxlength, $options); $this->vars[$key]['var_class'] = XOBJ_VCLASS_TFIELD; }
/** * * @param string $key key of this field. This needs to be the name of the field in the related database table * @param int $data_type set to one of XOBJ_DTYPE_XXX constants (set to XOBJ_DTYPE_OTHER if no data type ckecking nor text sanitizing is required) * @param mixed $value default value of this variable * @param bool $required set to TRUE if this variable needs to have a value set before storing the object in the table * @param int $maxlength maximum length of this variable, for XOBJ_DTYPE_TXTBOX type only * @param string $options does this data have any select options? * @param bool $multilingual is this field needs to support multilingual features (NOT YET IMPLEMENTED...) * @param string $form_caption caption of this variable in a {@link SmartobjectForm} and title of a column in a {@link SmartObjectTable} * @param string $form_dsc description of this variable in a {@link SmartobjectForm} * @param bool $sortby set to TRUE to make this field used to sort objects in SmartObjectTable * @param bool $persistent set to FALSE if this field is not to be saved in the database */ function initVar($key, $data_type, $value = null, $required = false, $maxlength = null, $options = '', $multilingual = false, $form_caption = '', $form_dsc = '', $sortby = false, $persistent = true, $displayOnForm = true) { //url_ is reserved for files. if (substr($key, 0, 4) == 'url_') { trigger_error("Cannot use variable starting with 'url_'."); } parent::initVar($key, $data_type, $value, $required, $maxlength, $options); if ($this->handler && (!$form_caption || $form_caption == '')) { $dyn_form_caption = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key); if (defined($dyn_form_caption)) { $form_caption = constant($dyn_form_caption); } } if ($this->handler && (!$form_dsc || $form_dsc == '')) { $dyn_form_dsc = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key . '_DSC'); if (defined($dyn_form_dsc)) { $form_dsc = constant($dyn_form_dsc); } } $this->vars[$key] = array_merge($this->vars[$key], array('multilingual' => $multilingual, 'form_caption' => $form_caption, 'form_dsc' => $form_dsc, 'sortby' => $sortby, 'persistent' => $persistent, 'displayOnForm' => $displayOnForm, 'displayOnSingleView' => true, 'readonly' => false)); }