public function init() { $this->setAction("assignCourse"); $user = new Zend_Form_Element_Select('uid'); $user->setLabel('Select User:'******'1'=>'programing languages','2'=>'graphics')); $user->setRequired(true)->addValidator('NotEmpty', true); $user->setAttrib("class", "form-control"); $user->getDecorator("Label")->setOption("class", "control-label"); $user->getDecorator("Errors")->setOption("class", "alert alert-danger"); $user->getDecorator("Errors")->setOption("style", " list-style-type:none"); $course = new Zend_Form_Element_Select('cid'); $course->setLabel('Select Course:'); //$course ->setMultiOptions(array( '1'=>'programing languages','2'=>'graphics')); $course->setRequired(true)->addValidator('NotEmpty', true); $course->setAttrib("class", "form-control"); $course->getDecorator("Label")->setOption("class", "control-label"); $course->getDecorator("Errors")->setOption("class", "alert alert-danger"); $course->getDecorator("Errors")->setOption("style", " list-style-type:none"); $registration_date = new Zend_Form_Element_Hidden("registration_date"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); //$submit->setAttrib("class", "btn"); $this->addElements(array($user, $course, $registration_date, $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() { /* Form Elements & Other Definitions Here ... */ $this->setMethod("POST"); $name = new Zend_Form_Element_Text("name"); $name->setRequired(); $name->setLabel("material name:"); $name->setAttrib("placeholder", "Enter material name"); $name->addValidator(new Zend_Validate_Alnum("true")); $name->setAttrib("class", "form-control"); $name->getDecorator("Label")->setOption("class", "control-label"); $name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $name->getDecorator("Errors")->setOption("style", " list-style-type:none"); $path = new Zend_Form_Element_File('path'); $path->setLabel('Select File:'); $path->setRequired(); $path->setAttrib("class", "form-control"); $path->setAttrib("class", "file-loading"); $path->getDecorator("Label")->setOption("class", "control-label"); $path->getDecorator("Errors")->setOption("class", "alert alert-danger"); $path->getDecorator("Errors")->setOption("style", " list-style-type:none"); $course = new Zend_Form_Element_Select('cid'); $course->setLabel('Course Name:'); //$course ->setMultiOptions(array( '5'=>'a','6'=>'c')); $course->setRequired(true)->addValidator('NotEmpty', true); $course->setAttrib("class", "form-control"); $course->getDecorator("Label")->setOption("class", "control-label"); $course->getDecorator("Errors")->setOption("class", "alert alert-danger"); $course->getDecorator("Errors")->setOption("style", " list-style-type:none"); $type = new Zend_Form_Element_Select('tid'); $type->setLabel('Material Type:'); //$type->setMultiOptions(array( '1'=>'pdf','2'=>'ppt')); $type->setRequired(true)->addValidator('NotEmpty', true); $type->setAttrib("class", "form-control"); $type->getDecorator("Label")->setOption("class", "control-label"); $type->getDecorator("Errors")->setOption("class", "alert alert-danger"); $type->getDecorator("Errors")->setOption("style", " list-style-type:none"); $mdate = new Zend_Form_Element_Hidden("mdate"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); //$submit->setAttrib("class", "btn"); $this->addElements(array($name, $path, $course, $type, $mdate, $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); }