public function init() { $this->setMethod("POST"); $category = new Zend_Form_Element_Text("name"); $category->setRequired(); $category->setLabel("category Name:"); $category->setAttrib("placeholder", "Enter Category Name"); $category->addValidator(new Zend_Validate_Alnum("true")); $category->setAttrib("class", "form-control"); $category->getDecorator("Label")->setOption("class", "control-label"); $category->getDecorator("Errors")->setOption("class", "alert alert-danger"); $category->getDecorator("Errors")->setOption("role", "alert"); $category->getDecorator("Errors")->setOption("style", " list-style-type:none"); $description = new Zend_Form_Element_Textarea("description"); $description->setLabel('Description:'); $description->setRequired(); $description->setAttrib("rows", "10"); $description->setAttrib("class", "form-control"); $description->getDecorator("Label")->setOption("class", "control-label"); $description->getDecorator("Errors")->setOption("class", "alert alert-danger"); $description->getDecorator("Errors")->setOption("style", " list-style-type:none"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); // $submit->setAttrib("class", "btn"); $this->addElements(array($category, $description, $submit)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod("POST"); //$this->setAttrib("class", "form-group has-success "); //$this->setAttrib("role","form") $course_name = new Zend_Form_Element_Text("name"); $course_name->setRequired(); $course_name->setLabel("course name:"); $course_name->setAttrib("placeholder", "Enter course name"); $course_name->addValidator(new Zend_Validate_Alnum("true")); $course_name->setAttrib("class", "form-control"); $course_name->getDecorator("Label")->setOption("class", "control-label"); $course_name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $course_name->getDecorator("Errors")->setOption("role", "alert"); $course_name->getDecorator("Errors")->setOption("style", " list-style-type:none"); $category = new Zend_Form_Element_Select('catid'); $category->setLabel('category:'); //$category ->setMultiOptions(array( '1'=>'programing languages','2'=>'graphics')); $category->setRequired(true)->addValidator('NotEmpty', true); $category->setAttrib("class", "form-control"); $category->getDecorator("Label")->setOption("class", "control-label"); //$category->getDecorator("Label")->setOption("class", "color-org"); $category->getDecorator("Errors")->setOption("class", "alert alert-danger"); $category->getDecorator("Errors")->setOption("style", " list-style-type:none"); $hours = new Zend_Form_Element_Text("hours"); $hours->setRequired(); $hours->setLabel("hours:"); $hours->setAttrib("placeholder", "Enter Course hours"); $hours->setAttrib("class", "form-control"); $validator = $hours->addValidator(new Zend_Validate_Digits("true")); $hours->getDecorator("Label")->setOption("class", "control-label"); $hours->getDecorator("Errors")->setOption("class", "alert alert-danger"); $hours->getDecorator("Errors")->setOption("style", " list-style-type:none"); $description = new Zend_Form_Element_Textarea("description"); $description->setLabel('Description:'); $description->setRequired(); $description->setAttrib("rows", "10"); $description->setAttrib("class", "form-control"); $description->getDecorator("Label")->setOption("class", "control-label"); $description->getDecorator("Errors")->setOption("class", "alert alert-danger"); $description->getDecorator("Errors")->setOption("style", " list-style-type:none"); //$catid = new Zend_Form_Element_Hidden("catid"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); //$submit->setAttrib("class", "btn"); $this->addElements(array($course_name, $category, $hours, $description, $submit)); }
public function init() { $this->setMethod("POST"); $body = new Zend_Form_Element_Textarea('body'); $body->setLabel("Comment:"); $body->setRequired(); $body->setAttrib("rows", "10"); $body->getDecorator("Errors")->setOption("class", "alert alert-error"); $body->getDecorator("Errors")->setOption("style", " list-style-type:none"); $uid = new Zend_Form_Element_Hidden("uid"); $mid = new Zend_Form_Element_Hidden("mid"); $cdate = new Zend_Form_Element_Hidden("cdate"); $submit = new Zend_Form_Element_Submit("submit"); //$submit->setAttrib("class", "btn"); $this->addElements(array($body, $cdate, $uid, $mid, $submit)); }
public function init() { $this->setMethod("POST"); $body = new Zend_Form_Element_Textarea('body'); $body->setLabel("Request Body:"); $body->setRequired(); $body->getDecorator("Errors")->setOption("class", "alert alert-error"); $body->getDecorator("Errors")->setOption("style", " list-style-type:none"); $uid = new Zend_Form_Element_Hidden("uid"); $rdate = new Zend_Form_Element_Hidden("rdate"); //$rdate->setValue(new Zend_Date()); //$rdate = new Zend_Date($unixtimestamp, Zend_Date::TIMESTAMP); $submit = new Zend_Form_Element_Submit("submit"); //$submit->setAttrib("class", "btn"); $this->addElements(array($body, $rdate, $uid, $submit)); }
public function __construct($options = null) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Image for the product line $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); // Name of the group of banner // Set the texte for the image $textDescription = new Zend_Form_Element_Textarea('BII_Text'); $textDescription->setLabel($this->_view->getCibleText('form_banner_image_text_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $textDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $textUrl = new Zend_Form_Element_Text('BII_Url'); $textUrl->setLabel($this->_view->getCibleText('form_banner_image_texturl_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdText'); $label = $textUrl->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $groupImage = new Zend_Form_Element_Select('BI_GroupID'); $groupImage->setLabel($this->_view->getCibleText('form_banner_image_group'))->setAttrib('class', 'largeSelect'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $groupImage->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $label = $groupImage->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Image for the product line $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId)); $imagePicker->removeDecorator('Label'); $this->addElement($imageView); $this->addElement($imagePicker); $this->addElement($groupImage); $this->addElement($textDescription); $this->addElement($textUrl); }
public function __construct($options = null) { parent::__construct($options); $moduleID = -1; $moduleName = ''; if (!empty($options['moduleID'])) { $moduleID = $options['moduleID']; $moduleName = Cible_FunctionsModules::getModuleNameByID($moduleID); } // input text for the title of the text module $categoryTitle = new Zend_Form_Element_Text('Title'); $categoryTitle->setLabel($this->getView()->getCibleText('form_category_title_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->_view->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $categoryTitle->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($categoryTitle); $categoryDescription = new Zend_Form_Element_Textarea('WordingShowAllRecords'); $categoryDescription->setLabel($this->_view->getCibleText('form_category_view_all_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $categoryDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($categoryDescription); $views = Cible_FunctionsCategories::getCategoryViews($moduleID); foreach ($views as $view) { $pickerName = $view['MV_Name']; $controllerName = new Zend_Form_Element_Text("{$pickerName}_controllerName"); $controllerName->setLabel($this->getView()->getCibleText("form_select_option_view_{$moduleName}_{$pickerName}"))->setAttrib('onfocus', "openPagePicker('page-picker-{$pickerName}');"); $this->addElement($controllerName); $pagePicker = new Cible_Form_Element_PagePicker("{$pickerName}_pageID", array('associatedElement' => "{$pickerName}_controllerName", 'onclick' => "javascript:closePagePicker(\"page-picker-{$pickerName}\")")); $pagePicker->setLabel($this->_view->getCibleText('form_category_associated_page_label')); $pagePicker->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => "page-picker", 'id' => "page-picker-{$pickerName}")))); $this->addElement($pagePicker); } // Check if want to put that category in the RSS Feed $showInRss = new Zend_Form_Element_Checkbox('ShowInRss'); $showInRss->setValue(1); $showInRss->setLabel($this->_view->getCibleText('form_category_add_to_rss_label')); $showInRss->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showInRss); // How many last news in the RSS Feed $rssItemsCount = new Zend_Form_Element_Text('RssItemsCount'); $rssItemsCount->setLabel($this->getView()->getCibleText('form_category_how_many_items_for_rss_label'))->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->_view->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'shortTextInput'); $this->addElement($rssItemsCount); $module = new Zend_Form_Element_Hidden('ModuleID'); $module->setValue($moduleID)->removeDecorator('label')->removeDecorator('DtDdWrapper'); $this->addElement($module); }
public function __construct($options = null) { $this->_addSubmitSaveClose = true; parent::__construct($options); $this->setName('page'); //$imageSrc = $options['imageSrc']; $pageID = $options['pageID']; $imageHeaderArray = $options['imageHeaderArray']; // contains the id of the page $id = new Zend_Form_Element_Hidden('id'); $id->removeDecorator('Label'); $id->removeDecorator('HtmlTag'); // input text for the title of the page $title = new Zend_Form_Element_Text('PI_PageTitle'); $title->setLabel($this->getView()->getCibleText('label_titre_page'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput')->setAttrib('onBlur', 'javascript:fillInControllerName();'); $lblTit = $title->getDecorator('Label'); $lblTit->setOption('class', $this->_labelCSS); // input text for the index of the page $uniqueIndexValidator = new Zend_Validate_Db_NoRecordExists('PagesIndex', 'PI_PageIndex'); $uniqueIndexValidator->setMessage($this->getView()->getCibleText('label_index_already_exists'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND); $reservedWordValidator = new Cible_Validate_Db_NoRecordExists('Modules', 'M_MVCModuleTitle'); $reservedWordValidator->setMessage($this->getView()->getCibleText('label_index_reserved'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND); $index = new Zend_Form_Element_Text('PI_PageIndex'); $index->setLabel($this->getView()->getCibleText('label_name_controller'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->addValidator('stringLength', true, array(1, 50, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => $this->getView()->getCibleText('label_index_more_char'), Zend_Validate_StringLength::TOO_LONG => $this->getView()->getCibleText('label_index_less_char'))))->addValidator('regex', true, array('/^[a-z0-9][a-z0-9_-]*[a-z0-9]$/', 'messages' => $this->getView()->getCibleText('label_only_character_allowed')))->addValidator($uniqueIndexValidator, true)->addValidator($reservedWordValidator, true)->setAttrib('class', 'stdTextInput'); $lblId = $index->getDecorator('Label'); $lblId->setOption('class', $this->_labelCSS); // textarea for the meta and title of the page $metaTitle = new Zend_Form_Element_Textarea('PI_MetaTitle'); $metaTitle->setLabel('Titre (meta)')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaTitle = $metaTitle->getDecorator('Label'); $lblMetaTitle->setOption('class', $this->_labelCSS); // textarea for the meta description of the page $metaDescription = new Zend_Form_Element_Textarea('PI_MetaDescription'); $metaDescription->setLabel($this->getView()->getCibleText('label_description_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaDescr = $metaDescription->getDecorator('Label'); $lblMetaDescr->setOption('class', $this->_labelCSS); // textarea for the meta keywords of the page $metaKeyWords = new Zend_Form_Element_Textarea('PI_MetaKeywords'); $metaKeyWords->setLabel($this->getView()->getCibleText('label_keywords_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaKey = $metaKeyWords->getDecorator('Label'); $lblMetaKey->setOption('class', $this->_labelCSS); // textarea for the meta keywords of the page $metaOthers = new Zend_Form_Element_Textarea('PI_MetaOther'); $metaOthers->setLabel($this->getView()->getCibleText('label_other_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort'); $lblMetaOther = $metaOthers->getDecorator('Label'); $lblMetaOther->setOption('class', $this->_labelCSS); // select box for the templates $layout = new Zend_Form_Element_Select('P_LayoutID'); $layout->setLabel($this->getView()->getCibleText('label_layout_page'))->setAttrib('class', 'stdSelect'); // select box for the templates $template = new Zend_Form_Element_Select('P_ViewID'); $template->setLabel($this->getView()->getCibleText('label_model_page'))->setAttrib('class', 'stdSelect'); // checkbox for the status (0 = offline, 1 = online) $status = new Zend_Form_Element_Checkbox('PI_Status'); $status->setValue(1); $status->setLabel($this->getView()->getCibleText('form_check_label_online')); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // checkbox for the show title of the page (0 = offline, 1 = online) $showTitle = new Zend_Form_Element_Checkbox('P_ShowTitle'); $showTitle->setValue(1); $showTitle->setLabel($this->getView()->getCibleText('form_check_label_show_title')); $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // image group // ImageSrc /*$imageSrc = new Zend_Form_Element_Select('P_BannerGroupID'); $imageSrc->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class','stdSelect'); $imageSrc->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageSrc->addMultiOption($group1['BG_ID'],$group1['BG_Name']); }*/ // page image $imageSrc = new Zend_Form_Element_Select('PI_TitleImageSrc'); $imageSrc->setLabel("Image de l'entête")->setAttrib('class', 'stdSelect'); $imageSrc->addMultiOption('', 'Sans image'); $i = 1; foreach ($imageHeaderArray as $img => $path) { $imageSrc->addMultiOption($path, $path); $i++; } $altImage = new Zend_Form_Element_Text('PI_AltPremiereImage'); $altImage->setLabel($this->getView()->getCibleText('label_altFirstImage'))->setAttrib('class', 'stdTextInput'); // add element to the form $this->addElements(array($title, $index, $status, $showTitle, $layout, $template, $imageSrc, $altImage, $metaTitle, $metaDescription, $metaKeyWords, $metaOthers, $id)); }