/** * Adding an image for the Image manager * * @return string The constructed HTML form for the adding of an image */ function showAddImgForm($imgcat_id) { global $target, $type; $imgcat_handler = icms::handler('icms_image_category'); $form = new icms_form_Theme(_ADDIMAGE, 'image_form', $_SERVER['SCRIPT_NAME'], 'post', TRUE); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new icms_form_elements_Text(_IMAGENAME, 'image_nicename', 50, 255), TRUE); $select = new icms_form_elements_Select(_IMAGECAT, 'imgcat_id', (int) $imgcat_id); $select->addOptionArray($imgcat_handler->getCategList()); $form->addElement($select, TRUE); $form->addElement(new icms_form_elements_File(_IMAGEFILE, 'image_file', 5000000)); $form->addElement(new icms_form_elements_Text(_IMGWEIGHT, 'image_weight', 3, 4, 0)); $form->addElement(new icms_form_elements_Radioyn(_IMGDISPLAY, 'image_display', 1, _YES, _NO)); $form->addElement(new icms_form_elements_Hidden('imgcat_id', $imgcat_id)); $form->addElement(new icms_form_elements_Hidden('op', 'addfile')); $form->addElement(new icms_form_elements_Hidden('target', $target)); $form->addElement(new icms_form_elements_Hidden('type', $type)); $tray = new icms_form_elements_Tray('' , ''); $tray->addElement(new icms_form_elements_Button('', 'img_button', _SUBMIT, 'submit')); $btn = new icms_form_elements_Button('', 'reset', _CANCEL, 'button'); $btn->setExtra('onclick="document.getElementById(\'addimgform\').style.display = \'none\'; return FALSE;"'); $tray->addElement($btn); $form->addElement($tray); return $form->render(); }
public function __construct($caption, $name, $value = "", $type = "button") { parent::__construct($caption, $name, $value, $type); $this->_deprecated = icms_core_Debug::setDeprecated('icms_form_elements_Button', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }
/** * Add an element to the form * * @param string $form_name name of the form * @param string $form_caption caption of the form * @param string $submit_button_caption caption of the button */ private function createButtons($form_name, $form_caption, $submit_button_caption = FALSE) { $button_tray = new icms_form_elements_Tray('', ''); $button_tray->addElement(new icms_form_elements_Hidden('op', $form_name)); if (!$submit_button_caption) { if ($this->targetObject->isNew()) { $butt_create = new icms_form_elements_Button('', 'create_button', _CO_ICMS_CREATE, 'submit'); } else { $butt_create = new icms_form_elements_Button('', 'modify_button', _CO_ICMS_MODIFY, 'submit'); } } else { $butt_create = new icms_form_elements_Button('', 'modify_button', $submit_button_caption, 'submit'); } $butt_create->setExtra('onclick="this.form.elements.op.value=\'' . $form_name . '\'"'); $button_tray->addElement($butt_create); //creating custom buttons if ($this->_custom_button) { foreach ($this->_custom_button as $custom_button) { $butt_custom = new icms_form_elements_Button('', $custom_button['name'], $custom_button['caption'], 'submit'); if ($custom_button['onclick']) { $butt_custom->setExtra('onclick="' . $custom_button['onclick'] . '"'); } $button_tray->addElement($butt_custom); unset($butt_custom); } } // creating the "cancel" button $butt_cancel = new icms_form_elements_Button('', 'cancel_button', _CO_ICMS_CANCEL, 'button'); if ($this->_cancel_js_action) { $butt_cancel->setExtra('onclick="' . $this->_cancel_js_action . '"'); } else { $butt_cancel->setExtra('onclick="history.go(-1)"'); } $button_tray->addElement($butt_cancel); $this->addElement($button_tray); }
/** * generate merge form * * @return icms_form_Theme merge form */ public function getMergeForm() { $form = new icms_form_Theme(_AM_PROFILE_TRIBES_MERGE_DSC, 'mergetribes', ''); $form->addElement(new icms_form_elements_Label(_AM_PROFILE_TRIBE, $this->getVar('title'))); $tribes_select = new icms_form_elements_Select(_AM_PROFILE_TRIBES_MERGEWITH, 'merge_tribes_id'); $tribes_select->addOptionArray($this->handler->getList(new icms_db_criteria_Compo(new icms_db_criteria_Item('tribes_id', $this->getVar('tribes_id'), '<>')))); $form->addElement($tribes_select); $form->addElement(new icms_form_elements_Label(_AM_PROFILE_TRIBES_MERGE_WARNING, sprintf(_AM_PROFILE_TRIBES_MERGE_WARNING_DSC, $this->getVar('title')))); $button_tray = new icms_form_elements_Tray('', ''); $button_tray->addElement(new icms_form_elements_Button('', 'modify_button', _AM_PROFILE_TRIBES_MERGE, 'submit')); $butt_cancel = new icms_form_elements_Button('', 'cancel_button', _CO_ICMS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $form->addElement($button_tray); $form->addElement(new icms_form_elements_Hidden('tribes_id', $this->getVar('tribes_id'))); $form->addElement(new icms_form_elements_Hidden('op', 'mergefinal')); return $form; }
case 'form': default: include_once ICMS_ROOT_PATH . "/modules/" . PROFILE_DIRNAME . "/class/smartuser.php"; icms_cp_header(); icms_adminMenu(11, _AM_SPROFILE_FINDUSER); $custom_fields = $profile_smartuser_handler->getFields(); $sform = new icms_form_Theme(_AM_SPROFILE_FINDUSER, "op", xoops_getenv('PHP_SELF'), 'post'); $uname_elt = new icms_form_elements_Text(sprintf(_AM_SPROFILE_FINDUSER_CRIT, _AM_SPROFILE_UNAME), 'uname', 50, 255, ''); $sform->addElement($uname_elt); $email_elt = new icms_form_elements_Text(sprintf(_AM_SPROFILE_FINDUSER_CRIT, _AM_SPROFILE_EMAIL), 'email', 50, 255, ''); $sform->addElement($email_elt); foreach ($custom_fields as $key => $field) { if (!in_array($key, $hidden_fields_form)) { $elt = new icms_form_elements_Text(sprintf(_AM_SPROFILE_FINDUSER_CRIT, $field->getVar('field_title')), $key, 50, 255, ''); $sform->addElement($elt); unset($elt); } } $button_tray = new icms_form_elements_Tray('', ''); $hidden = new icms_form_elements_Hidden('op', 'post'); $button_tray->addElement($hidden); $butt_find = new icms_form_elements_Button('', '', _SUBMIT, 'submit'); $button_tray->addElement($butt_find); $butt_cancel = new icms_form_elements_Button('', '', _CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); break; } icms_cp_footer();