public function __construct($options = null) { parent::__construct($options); if (empty($this->tableName)) { throw new Exception('You need to set the $tableName protected variable in your Form instance'); } $baseDir = $options['baseDir']; Zend_Registry::set('baseUrl', $baseDir); $cancel_url = $options['cancelUrl']; // Title $title = new Zend_Form_Element_Text($this->tableFieldPrefix . 'Title'); $title->setLabel(Cible_Translation::getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $title->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($title); // Status $status = new Zend_Form_Element_Select($this->tableFieldPrefix . 'Status'); $status->setLabel(Cible_Translation::getCibleText('form_label_status'))->setAttrib('class', 'stdSelect'); $db = $this->_db; $sql = 'SELECT * FROM Status'; $status_options = $db->fetchAll($sql); foreach ($status_options as $_option) { $status->addMultiOption($_option['S_ID'], Cible_Translation::getCibleText("status_{$_option['S_Code']}")); } $this->addElement($status); }
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"); $uid = new Zend_Form_Element_Hidden("user_id"); //add firstname $f_name = new Zend_Form_Element_Text("f_name"); $f_name->setRequired(); $f_name->setLabel("first Name:"); $f_name->setAttrib("placeholder", "Enter Your first Name"); $f_name->addValidator(new Zend_Validate_Alnum("true")); $f_name->setAttrib("class", "form-control"); $f_name->getDecorator("Label")->setOption("class", "control-label"); $f_name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $f_name->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add lastname $l_name = new Zend_Form_Element_Text("l_name"); $l_name->setRequired(); $l_name->setLabel("Last Name"); $l_name->setAttrib("placeholder", "Enter Your last Name"); $l_name->addValidator(new Zend_Validate_Alnum("true")); $l_name->setAttrib("class", "form-control"); $l_name->getDecorator("Label")->setOption("class", "control-label"); $l_name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $l_name->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add mail $username = new Zend_Form_Element_Text("username"); $username->setRequired(); $username->setLabel("E-Mail"); $username->setAttrib("placeholder", "Enter Your E-Mail"); $username->addValidator(new Zend_Validate_EmailAddress()); $username->getDecorator("Label")->setOption("class", "control-label"); $username->getDecorator("Errors")->setOption("class", "alert alert-danger"); $username->getDecorator("Errors")->setOption("style", " list-style-type:none"); $password = new Zend_Form_Element_Password("password"); $password->setRequired(); $password->setLabel("Password"); $password->setAttrib("placeholder", "Enter Your Password"); $password->setAttrib("class", "form-control"); $password->getDecorator("Label")->setOption("class", "control-label"); $password->getDecorator("Errors")->setOption("class", "alert alert-danger"); $password->getDecorator("Errors")->setOption("style", " list-style-type:none"); $re_password = new Zend_Form_Element_Password("re_password"); $re_password->setRequired(); $re_password->setLabel("Retype Your Password"); $re_password->addValidator('identical', false, array('token' => 'password')); $re_password->setAttrib("placeholder", "Re-enter Your Password"); $re_password->setAttrib("class", "form-control"); $re_password->getDecorator("Label")->setOption("class", "control-label"); $re_password->getDecorator("Errors")->setOption("class", "alert alert-danger"); $re_password->getDecorator("Errors")->setOption("style", " list-style-type:none"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); $this->addElements(array($uid, $f_name, $l_name, $username, $password, $re_password, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setMethod('post'); $title = new Zend_Form_Element_Text(array('name' => 'title', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 4, 'max' => 200)), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[^\\p{C}]+$/u'))), 'label' => 'Post Title')); $tags = new Zend_Form_Element_Text(array('name' => 'tags', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array('content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[\\p{L}\\p{M}\\p{N}_\\-, ]+$/u'))), 'label' => 'Tags', 'description' => 'Comma separated list of tags for this post', 'size' => 40)); $location = new Zend_Form_Element_Text(array('name' => 'location', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array('content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[\\p{L}\\p{M}\\p{N}_\\-,\\. ]+$/u'))), 'label' => 'Location', 'description' => 'Your current location', 'size' => 40)); $text = new Zend_Form_Element_Textarea(array('name' => 'content', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 10)), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^(?:[^\\p{C}]|\\s)+$/u'))), 'label' => 'Content')); $submit = new Zend_Form_Element_Submit(array('name' => 'submit', 'label' => 'Create Post', 'class' => 'button-big')); $title->getDecorator('Label')->setOption('class', 'input-big'); $title->getDecorator('HtmlTag')->setOption('class', 'input-big'); $this->addElement($title)->addElement($text)->addElement($tags)->addElement($location)->addElement($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 __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // Link of the RSS $link = new Zend_Form_Element_Text('Param1'); $link->setLabel($this->getView()->getCibleText('form_label_rss_reader_link'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'link'))))->setAttrib('class', 'stdTextInput '); $label = $link->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($link); // Lien en anglais $link_en = new Zend_Form_Element_Text('Param2'); $link_en->setLabel($this->getView()->getCibleText('form_label_rss_reader_link_en'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'link_en'))))->setAttrib('class', 'stdTextInput '); $label = $link_en->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($link_en); // number of rss link to show in front-end (maxLink) $blockRssMax = new Zend_Form_Element_Text('Param3'); $blockRssMax->setLabel($this->getView()->getCibleText('form_label_rss_reader_link_max'))->setAttrib('class', 'smallTextInput'); $this->addElement($blockRssMax); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param3', 'Param1', 'Param2', 'Param999'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); }
public function init() { $this->setMethod("POST"); $type = new Zend_Form_Element_Text("type_name"); $type->setRequired(); $type->setLabel("Material Type Name:"); $type->setAttrib("placeholder", "Enter Material Type Name"); $type->addValidator(new Zend_Validate_Alnum("true")); $type->setAttrib("class", "form-control"); $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"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); // $submit->setAttrib("class", "btn"); $this->addElements(array($type, $submit)); }
/** * Class constructor * * @return void */ public function __construct($options) { parent::__construct($options); $imageSrc = $options['imageSrc']; if (isset($options['imgField'])) { $imgField = $options['imgField']; } $dataId = $options['dataId']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } $config = Zend_Registry::get('config'); // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Name of the product line $name = new Zend_Form_Element_Text('CCI_Name'); $name->setLabel($this->getView()->getCibleText('form_category_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput '); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($name); if (!empty($imgField)) { // Image for the category $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); $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $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->setLabel($this->getView()->getCibleText('form_category_logo_label')); $this->addElement($imagePicker); } // ImageSrc $imageBanner = new Zend_Form_Element_Select('C_BannerGroupID'); $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect'); $imageBanner->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $this->addElement($imageBanner); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('CCI_MetaId'); $metaTagId->removeDecorator('Label'); $this->addElement($metaTagId); }
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); }
public function init() { $this->setMethod("POST"); $username = new Zend_Form_Element_Text("username"); $username->setRequired(); $username->setLabel("User Name:"); $username->setAttrib("placeholder", "Enter Your E-Mail"); $username->addValidator(new Zend_Validate_EmailAddress()); $username->setAttrib("class", "form-control"); $username->getDecorator("Label")->setOption("class", "control-label"); $username->getDecorator("Errors")->setOption("class", "alert alert-danger"); $username->getDecorator("Errors")->setOption("style", " list-style-type:none"); $password = new Zend_Form_Element_Password("password"); $password->setRequired(); $password->setLabel("Password:"******"placeholder", "Enter Your Password"); $password->setAttrib("class", "form-control"); $password->getDecorator("Label")->setOption("class", "control-label"); $password->getDecorator("Errors")->setOption("class", "alert alert-danger"); $password->getDecorator("Errors")->setOption("style", " list-style-type:none"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); $this->addElements(array($username, $password, $submit)); }
/** * See {@link PHPUnit_Framework_TestCase::setUp()} for details. */ protected function setUp() { parent::setUp(); // Usually a captcha element is rendered by the decorator, // but for testing a text field is just as well. // Using a text field avoids a dependency to the session. $element = new Zend_Form_Element_Text('my_captcha'); $element->setAttrib('id', 'my-id'); // Simulate a HtmlTag ID that is based on the element name (as configured // in the loadDefaultDecorators() mthod of the captcha element). $element->getDecorator('HtmlTag')->setOption('id', $element->getName() . '-element'); $element->setView(new Zend_View()); $this->decorator = new Mol_Form_Decorator_Captcha_Word(); $this->decorator->setElement($element); }
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); }
/** * Class constructor * * @return void */ public function __construct($options) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } $config = Zend_Registry::get('config'); // Name of the product line $name = new Zend_Form_Element_Text('SCI_Name'); $name->setLabel($this->getView()->getCibleText('form_subcategory_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput '); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($name); $oCategories = new CatalogCategoriesObject(); $listCat = $oCategories->getAll(Zend_Registry::get('currentEditLanguage')); $categories = new Zend_Form_Element_Select('SC_CategoryID'); $categories->setLabel($this->getView()->getCibleText('form_select_category_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'largeSelect'); $categories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); foreach ($listCat as $data) { $categories->addMultiOption($data['CC_ID'], $data['CCI_Name']); } $this->addElement($categories); // ImageSrc $imageBanner = new Zend_Form_Element_Select('SC_BannerGroupID'); $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect'); $imageBanner->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $this->addElement($imageBanner); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('SCI_MetaId'); $metaTagId->removeDecorator('Label'); $this->addElement($metaTagId); }
public function __construct($options = null) { parent::__construct($options); $labelCSS = Cible_FunctionsGeneral::getLanguageLabelColor($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); // Value of the reference $value = new Zend_Form_Element_Text('RI_Value'); $value->setLabel($this->getView()->getCibleText('form_reference_value_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $value->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($value); // List of Type $type = new Zend_Form_Element_Select('R_TypeRef'); $type->setLabel($this->getView()->getCibleText('form_reference_type_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdSelect')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title')))); $oRef = new ReferencesObject(); $enums = $oRef->getEnum('R_TypeRef'); $multiOptions = array(); foreach ($enums as $enum) { $multiOptions[$enum] = $this->getView()->getCibleText('form_enum_' . $enum); } $type->addMultiOptions($multiOptions); $this->addElement($type); // Value of the reference $seq = new Zend_Form_Element_Text('RI_Seq'); $seq->setLabel($this->getView()->getCibleText('form_reference_seq_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $seq->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($seq); }
public function __construct($options = null) { parent::__construct($options); $labelCSS = Cible_FunctionsGeneral::getLanguageLabelColor($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"; } // Name of the group of banner $valueName = new Zend_Form_Element_Text('BG_Name'); $valueName->setLabel($this->getView()->getCibleText('form_banner_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueName->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($valueName); }
public function __construct($options = null) { parent::__construct($options); $baseDir = $options['baseDir']; $pageID = $options['pageID']; $toApprove = $options['toApprove']; $this->removeElement('submitSaveClose'); $this->getElement('submitSave')->setLabel($this->getView()->getCibleText('button_save_draft')); // input text for the title of the text online $pageTitle = new Zend_Form_Element_Text('PI_PageTitle'); $pageTitle->setLabel($this->getView()->getCibleText('label_titre_page'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput'); $label = $pageTitle->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($pageTitle); $this->addDisplayGroup(array('PI_PageTitle'), 'infoPage'); $this->getDisplayGroup('infoPage')->setLegend($this->getView()->getCibleText('form_legend_infoPage'))->setAttrib('class', 'infoData'); $draftTitle = new Zend_Form_Element_Hidden('TD_DraftTitle'); $draftTitle->removeDecorator('label'); // tinymce editor for the text of the text online $draftText = new Cible_Form_Element_Editor('TD_DraftText', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $draftText->setLabel($this->getView()->getCibleText('form_label_text_draft'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'mediumEditor'); $label = $draftText->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); if ($this->getView()->aclIsAllowed('text', 'publish', false)) { if ($toApprove == 1) { // submit button (save and return to writing) $submitSaveReturnWriting = new Zend_Form_Element_Submit('submit'); $submitSaveReturnWriting->setLabel($this->getView()->getCibleText('button_save_return_writing'))->setName('submitSaveReturnWriting')->setAttrib('id', 'submitSaveReturnWriting')->setAttrib('class', 'stdButton')->removeDecorator('DtDdWrapper')->setOrder(2); $this->addActionButton($submitSaveReturnWriting); } // submit button (save and put online) $submitSaveOnline = new Zend_Form_Element_Submit('submit'); $submitSaveOnline->setLabel($this->getView()->getCibleText('button_save_publish'))->setName('submitSaveOnline')->setAttrib('id', 'submitSaveOnline')->setAttrib('class', 'stdButton')->removeDecorator('DtDdWrapper')->setOrder(3); $this->addActionButton($submitSaveOnline); } else { if ($toApprove == 1) { $this->getElement('submitSave')->setAttrib('disabled', 'disabled'); } else { // submit button (save and submit text to the reviser) $submitSaveSubmit = new Zend_Form_Element_Submit('submit'); $submitSaveSubmit->setLabel($this->getView()->getCibleText('button_save_submit_auditor'))->setName('submitSaveSubmit')->setAttrib('id', 'submitSaveSubmit')->setAttrib('class', 'stdButton')->removeDecorator('DtDdWrapper')->setOrder(2); $this->addActionButton($submitSaveSubmit); } } // Adds all elements to the form $this->addElements(array($draftText, $draftTitle)); $this->addDisplayGroup(array('TD_DraftText', 'TD_DraftTitle'), 'text'); $this->getDisplayGroup('text')->setLegend($this->getView()->getCibleText('form_legend_blockData'))->setAttrib('class', 'infoData'); $previewButton = new Zend_Form_Element_Button('PreviewButton'); $previewButton->setAttrib('onclick', "showPreview('TD_DraftText');"); $previewButton->setAttrib('class', 'previewButton'); $previewButton->setLabel($this->getView()->getCibleText('button_preview_text')); $previewButton->setAttrib('onmouseover', 'this.className=\'previewButtonOver\';'); $previewButton->setAttrib('onmouseout', 'this.className=\'previewButton\';'); $previewButton->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true, 'class' => 'text-align-right')))); $this->addElement($previewButton); $compareButton = new Zend_Form_Element_Button('CompareButton'); $compareButton->setAttrib('onclick', "showCompare('TD_DraftText');"); $compareButton->setAttrib('class', 'compareButton'); $compareButton->setLabel($this->getView()->getCibleText('button_compare_text')); $compareButton->setAttrib('onmouseover', 'this.className=\'compareButtonOver\';'); $compareButton->setAttrib('onmouseout', 'this.className=\'compareButton\';'); $compareButton->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($compareButton); }
/** * Class constructor * * @return void */ public function __construct($options, $listVideo) { parent::__construct($options); $this->setParameters($options); if ($this->_dataId == '') { $pathTmp = "../../../../../data/images/" . $this->_moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $this->_moduleName . "/" . $this->_dataId . "/tmp"; } $this->_filePath = '../../../' . $this->_filePath; // Name of the banner $name = new Zend_Form_Element_Text('BF_Name'); $name->setLabel($this->getView()->getCibleText('form_label_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', 'Errors', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $this->addElement($name); $listVideos = array(); for ($xx = 0; $xx < count($listVideo); $xx++) { $listVideos[$listVideo[$xx]['V_ID']] = $listVideo[$xx]['V_Alias']; } for ($x = 1; $x <= $this->_numberImageFeature; $x++) { $isNewImage = 'isNewImage' . $x; $newImage = new Zend_Form_Element_Hidden($isNewImage, array('value' => $this->_isNewImage[$x])); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Image to load $IF_Img_tmp = 'IF_Img' . $x . '_tmp'; $IF_Img_original = 'IF_Img' . $x . '_original'; $IF_Img_preview = 'IF_Img' . $x . '_preview'; $IF_Img = 'IF_Img' . $x; $imageTmp = new Zend_Form_Element_Hidden($IF_Img_tmp); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($IF_Img_original); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image($IF_Img_preview, array('onclick' => 'return false;')); $imageView->setImage($this->_imageSrc[$x])->removeDecorator('Label')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'alignCenter', 'id' => 'title')))); $this->addElement($imageView); //echo $IF_Img . $pathTmp . "<br />"; $imagePicker = new Cible_Form_Element_ImagePicker($IF_Img, array('onchange' => "document.getElementById('" . $IF_Img . "').src = document.getElementById('" . $IF_Img . "').value", 'associatedElement' => $IF_Img_preview, 'pathTmp' => $pathTmp, 'contentID' => $this->_dataId)); $imagePicker->setLabel('')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'alignCenter', 'id' => 'title')))); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); // label for the image $IFI_Label = 'IFI_Label' . $x; $labelX = new Zend_Form_Element_Text($IFI_Label); $labelX->setLabel($this->getView()->getCibleText('form_label_label'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $labelX->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($labelX); // label for the link $IFI_UrlVideo = 'IFI_UrlVideo' . $x; $optionUrlVideo = new Zend_Form_Element_Radio($IFI_UrlVideo); $optionUrlVideo->setRequired(false)->addMultiOption('0', $this->getView()->getCibleText('extranet_form_label_url'), 'number1')->addMultiOption('1', $this->getView()->getCibleText('extranet_form_label_video'), 'number2'); $this->addElement($optionUrlVideo); $IFI_Url = 'IFI_Url' . $x; $urlX = new Zend_Form_Element_Text($IFI_Url); $urlX->setLabel($this->getView()->getCibleText('form_label_url'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline_link', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $urlX->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($urlX); /* $optionUrlVideo = new Zend_Form_Element_Radio($IFI_UrlVideo); $optionUrlVideo->setRequired(false) ->addMultiOption('1', $this->getView()->getCibleText('extranet_newsletter_option_text_url_url')) ; $this->addElement($optionUrlVideo);*/ $IFI_Video = 'IFI_Video' . $x; $video = new Zend_Form_Element_Select($IFI_Video); $video->setLabel($this->getView()->getCibleText('form_label_video'))->setAttrib('class', 'largeSelect'); $video->addMultiOptions($listVideos); $this->addElement($video); $IFI_Text1 = 'IFI_TextA' . $x; $IFI_Text2 = 'IFI_TextB' . $x; $IFI_Text1X = new Zend_Form_Element_Text($IFI_Text1); $IFI_Text1X->setLabel($this->getView()->getCibleText('form_label_text_1'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $IFI_Text1X->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($IFI_Text1X); $IFI_Text2X = new Zend_Form_Element_Text($IFI_Text2); $IFI_Text2X->setLabel($this->getView()->getCibleText('form_label_text_2'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $IFI_Text2X->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($IFI_Text2X); $IF_Style = 'IF_Style' . $x; $style = new Zend_Form_Element_Select($IF_Style); $style->setLabel($this->getView()->getCibleText('form_style_label'))->setAttrib('class', 'largeSelect'); $listStyles = array('sec0' => 'Style over 0 secondes', 'sec1' => 'Style over 1 secondes', 'secUp1' => 'Style up 1 secondes'); $style->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); $style->addMultiOptions($listStyles); $this->addElement($style); $imageDisplay = 'imageDisplay' . $x; $this->addDisplayGroup(array($isNewImage, $IF_Img_tmp, $IF_Img_original, $IF_Img_preview, $IF_Img, $IFI_Label, $IFI_UrlVideo, $IFI_Url, $IFI_Video, $IFI_Text1, $IFI_Text2, $IF_Style), $imageDisplay); $this->getDisplayGroup($imageDisplay)->setLegend('Image ' . $x)->setAttrib('class', 'imageGroup first')->removeDecorator('DtDdWrapper'); } }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setMethod("POST"); $id = new Zend_Form_Element_Hidden("id"); //add firstname $f_name = new Zend_Form_Element_Text("f_name"); $f_name->setRequired(); $f_name->setLabel("First Name:"); $f_name->setAttrib("placeholder", "Enter Your first Name"); $f_name->addValidator(new Zend_Validate_Alnum("true")); $f_name->setAttrib("class", "form-control"); $f_name->getDecorator("Label")->setOption("class", "control-label"); $f_name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $f_name->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add lastname $l_name = new Zend_Form_Element_Text("l_name"); $l_name->setRequired(); $l_name->setLabel("Last Name:"); $l_name->setAttrib("placeholder", "Enter Your last Name"); $l_name->addValidator(new Zend_Validate_Alnum("true")); $l_name->setAttrib("class", "form-control"); $l_name->getDecorator("Label")->setOption("class", "control-label"); $l_name->getDecorator("Errors")->setOption("class", "alert alert-danger"); $l_name->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add mail $username = new Zend_Form_Element_Text("username"); $username->setRequired(); $username->setLabel("Username:"******"placeholder", "Enter Your E-Mail"); $username->addValidator(new Zend_Validate_EmailAddress()); $username->setAttrib("class", "form-control"); $username->getDecorator("Label")->setOption("class", "control-label"); $username->getDecorator("Errors")->setOption("class", "alert alert-danger"); $username->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add address $address = new Zend_Form_Element_Text("address"); $address->setLabel("Adress:"); $address->setAttrib("placeholder", "Enter Your adress"); $address->addValidator(new Zend_Validate_Alnum("true")); $address->setAttrib("class", "form-control"); $address->getDecorator("Label")->setOption("class", "control-label"); $address->getDecorator("Errors")->setOption("class", "alert alert-danger"); $address->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add mobile $mobile = new Zend_Form_Element_Text("mobile"); $mobile->setLabel("Mobile:"); $mobile->setAttrib("placeholder", "Enter Your mobile"); $mobile->addValidator(new Zend_Validate_Alnum("true")); $mobile->setAttrib("class", "form-control"); $mobile->getDecorator("Label")->setOption("class", "control-label"); $mobile->getDecorator("Errors")->setOption("class", "alert alert-danger"); $mobile->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add phone $phone = new Zend_Form_Element_Text("phone"); $phone->setLabel("Phone:"); $phone->setAttrib("placeholder", "Enter Your phone"); $phone->addValidator(new Zend_Validate_Alnum("true")); $phone->setAttrib("class", "form-control"); $phone->getDecorator("Label")->setOption("class", "control-label"); $phone->getDecorator("Errors")->setOption("class", "alert alert-danger"); $phone->getDecorator("Errors")->setOption("style", " list-style-type:none"); //add checkbox $status = new Zend_Form_Element_Radio("active"); $status->addMultiOptions(array('1' => 'Active', '0' => 'Notactive')); $status->setLabel('What is your status ?'); $status->setAttrib("class", "form-control"); $status->getDecorator("Label")->setOption("class", "control-label"); $status->setRequired(); $user_type = new Zend_Form_Element_Radio("user_type"); $user_type->addMultiOptions(array('admin' => 'Admin', 'normal' => 'Normal')); $user_type->setLabel('User Type'); $user_type->setAttrib("class", "form-control"); $user_type->getDecorator("Label")->setOption("class", "control-label"); $user_type->setRequired(); $password = new Zend_Form_Element_Password("password"); $password->setRequired(); $password->setLabel("Password:"******"placeholder", "Enter Your Password"); $password->setAttrib("class", "form-control"); $password->getDecorator("Label")->setOption("class", "control-label"); $password->getDecorator("Errors")->setOption("class", "alert alert-danger"); $password->getDecorator("Errors")->setOption("style", " list-style-type:none"); $re_password = new Zend_Form_Element_Password("re_password"); $re_password->setRequired(); $re_password->setLabel("Retype Your Password:"******"placeholder", "Re-enter Your Password"); $re_password->setAttrib("class", "form-control"); $re_password->getDecorator("Label")->setOption("class", "control-label"); $re_password->getDecorator("Errors")->setOption("class", "alert alert-danger"); $re_password->getDecorator("Errors")->setOption("style", " list-style-type:none"); $submit = new Zend_Form_Element_Submit("submit"); $submit->setAttrib("class", "btn btn-xl center-block"); $this->addElements(array($id, $f_name, $l_name, $username, $address, $password, $re_password, $mobile, $phone, $status, $user_type, $submit)); // Add a captcha /*$this->addElement('captcha', 'captcha', array( 'label' => 'Please enter the 5 letters displayed below:', 'required' => true, 'captcha' => array( 'captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 300 ) ));*/ }
public function init() { $this->addDecorators(array("ViewHelper"), array("Errors")); $company = new Zend_Form_Element_Text("company"); $company->setLabel("Company"); $company->class = "span4"; $company->addValidators(array(array("validator" => "stringLength", "options" => array(0, 20)))); $businessType = new Zend_Form_Element_Text("business_type"); $businessType->setRequired(true); $businessType->setLabel("Business Type"); $businessType->class = "span4"; $timezoneGroupModel = new App_TimezoneGroup(); $timezoneGroups = $timezoneGroupModel->getAllTimezonesGrouped(); $items = array(); $items[""] = "Please Select"; foreach ($timezoneGroups as $timezoneGroup) { $timezones = $timezoneGroup["timezones"]; foreach ($timezones as $timezone) { $items[$timezoneGroup["name"]][$timezone["timezone_id"]] = $timezone["name"]; } } $timezone = new Zend_Form_Element_Select("timezone_id"); $timezone->setRequired(true); $timezone->setLabel("What time zone is your business located?"); $timezone->class = "span4"; $timezone->addMultiOptions($items); $website = new Zend_Form_Element_Text("website"); $website->setRequired(true); $website->setLabel("Website"); $website->class = "span4"; $website->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(13, 255))); $items = array(); $items[""] = "Please Select"; $numberOfHitModel = new App_NumberOfHit(); $hits = $numberOfHitModel->fetchAll()->toArray(); foreach ($hits as $hit) { $items[$hit["id"]] = $hit["name"]; } $number_hits = new Zend_Form_Element_Select("number_of_hit_id"); $number_hits->setRequired(true); $number_hits->class = "span4"; $number_hits->setLabel("How many web hits do you currently receive each month?"); $number_hits->addMultiOptions($items); $mobile = new Zend_Form_Element_Text("mobile"); $mobile->setLabel("Contact <span class=\"help\">(Skype, Mobile)</span>"); $mobile->setRequired(true); $mobile->class = "span6"; $mobile->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 20))); $mobile->getDecorator("Label")->setOption("escape", false); $address1 = new Zend_Form_Element_Text("address1"); $address1->setLabel("Address 1"); $address1->class = "span6"; $address1->setRequired(true); $address1->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 255))); $address2 = new Zend_Form_Element_Text("address2"); $address2->setLabel("Address 2"); $address2->class = "span6"; $address2->addValidators(array(array("validator" => "stringLength", "options" => array(10, 255)))); $city = new Zend_Form_Element_Text("city"); $city->setLabel("City"); $city->class = "span4"; $city->setRequired(true); $city->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 255))); $postal = new Zend_Form_Element_Text("postal"); $postal->setLabel("Postal Code"); $postal->class = "span2"; $postal->setRequired(true); $postal->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 30))); $state = new Zend_Form_Element_Text("state"); $state->setLabel("State"); $state->class = "span4"; $state->setRequired(true); $state->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 30))); $items = array(); $items[""] = "Please Select"; $countryModel = new App_Country(); $countries = $countryModel->fetchAll()->toArray(); foreach ($countries as $country) { $items[$country["id"]] = $country["name"]; } $country = new Zend_Form_Element_Select("country_id"); $country->class = "span4"; $country->addMultiOptions($items); $country->setRequired(true); $country->setLabel("Country"); $this->addElements(array($company, $businessType, $state, $country, $postal, $city, $state, $address1, $address2, $mobile, $number_hits, $timezone, $website)); }
public function __construct($options = null) { parent::__construct($options); $labelCSS = Cible_FunctionsGeneral::getLanguageLabelColor($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"; } // Value of the shipping free $valueShippingFees = new Zend_Form_Element_Text('CP_ShippingFees'); $valueShippingFees->setLabel($this->getView()->getCibleText('form_parameters_montant_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueShippingFees->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Value of the shipping fees limit $valueShippingFeesLimit = new Zend_Form_Element_Text('CP_ShippingFeesLimit'); $valueShippingFeesLimit->setLabel($this->getView()->getCibleText('form_parameters_limit_transport_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueShippingFeesLimit->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Value of the COD $valueMontantFraisCOD = new Zend_Form_Element_Text('CP_MontantFraisCOD'); $valueMontantFraisCOD->setLabel($this->getView()->getCibleText('form_parameters_COD_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueMontantFraisCOD->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Email for the command $valueAdminOrdersEmail = new Zend_Form_Element_Text('CP_AdminOrdersEmail'); $valueAdminOrdersEmail->setLabel($this->getView()->getCibleText('form_parameters_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueAdminOrdersEmail->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Id of the free Item // List of products $oItems = new ItemsObject(); $listItem = $oItems->itemsCollection(Zend_Registry::get('currentEditLanguage')); $itemID = new Zend_Form_Element_Select('CP_FreeItemID'); $itemID->setLabel($this->getView()->getCibleText('form_parameters_free_item_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdSelect')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title')))); $itemID->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); $itemID->addMultiOptions($listItem); // Value of the minimum amount to have a free item $valueFreeMiniAmount = new Zend_Form_Element_Text('CP_FreeMiniAmount'); $valueFreeMiniAmount->setLabel($this->getView()->getCibleText('form_parameters_free_item_minimum_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueFreeMiniAmount->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Value of the minimum amount to have a free item $valueBonusPointDollar = new Zend_Form_Element_Text('CP_BonusPointDollar'); $valueBonusPointDollar->setLabel($this->getView()->getCibleText('form_parameters_bonus_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueBonusPointDollar->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Value of the canadian tax TPS $valueTauxTaxeFed = new Zend_Form_Element_Text('CP_TauxTaxeFed'); $valueTauxTaxeFed->setLabel($this->getView()->getCibleText('form_parameters_taxe_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $valueTauxTaxeFed->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($valueShippingFees); $this->addElement($valueShippingFeesLimit); $this->addElement($valueMontantFraisCOD); $this->addElement($valueAdminOrdersEmail); $this->addElement($itemID); $this->addElement($valueFreeMiniAmount); $this->addElement($valueBonusPointDollar); $this->addElement($valueTauxTaxeFed); }
public function init() { $this->addDecorators(array("ViewHelper"), array("Errors")); $firstname = new Zend_Form_Element_Text("first_name"); $firstname->setLabel("Firstname"); $firstname->setRequired(true); $firstname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50)))); $lastname = new Zend_Form_Element_Text("last_name"); $lastname->setLabel("Lastname"); $lastname->setRequired(true); $lastname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50)))); $website = new Zend_Form_Element_Text("website"); $website->setRequired(true); $website->setLabel("Website"); $website->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(13, 255))); /* $username = new Zend_Form_Element_Text("username"); $username->setRequired(true); $username->setLabel("Username"); $username->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alpha", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); $password = new Zend_Form_Element_Password("password"); $password->setRequired(true); $password->setLabel("Password"); $password->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alnum", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); $confirm_password = new Zend_Form_Element_Password("confirm_password"); $confirm_password->setLabel("Confirm Password"); $confirm_password->setRequired(true); $confirm_password->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alnum", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); */ $email = new Zend_Form_Element_Text("email"); $email->setLabel("Email Address"); $email->setRequired(true); $email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50))); $mobile = new Zend_Form_Element_Text("mobile"); $mobile->setLabel("Contact <span class=\"help\">(Skype, Mobile)</span>"); $mobile->setRequired(true); $mobile->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 20))); $mobile->getDecorator("Label")->setOption("escape", false); $fullname_webmaster = new Zend_Form_Element_Text("fullname_webmaster"); $fullname_webmaster->setLabel("Name <span class='help'>(Company's Web Designer)</span>"); $fullname_webmaster->addValidators(array(array("validator" => "stringLength", "options" => array(0, 100)))); $fullname_webmaster->getDecorator("Label")->setOption("escape", false); $email_webmaster = new Zend_Form_Element_Text("email_webmaster"); $email_webmaster->setLabel("Email Address"); $email_webmaster->addValidators(array(array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(0, 50)))); $phone_webmaster = new Zend_Form_Element_Text("phone_webmaster"); $phone_webmaster->setLabel("Phone Number"); $phone_webmaster->addValidators(array(array("validator" => "stringLength", "options" => array(0, 20)))); $company = new Zend_Form_Element_Text("company"); $company->setLabel("Company"); $company->addValidators(array(array("validator" => "stringLength", "options" => array(0, 20)))); $items = array(); $items[""] = "Please Select"; $numberOfHitModel = new App_NumberOfHit(); $hits = $numberOfHitModel->fetchAll()->toArray(); foreach ($hits as $hit) { $items[$hit["id"]] = $hit["name"]; } $number_hits = new Zend_Form_Element_Select("number_of_hit_id"); $number_hits->setRequired(true); $number_hits->setLabel("How many web hits do you currently receive each month?"); $number_hits->addMultiOptions($items); $businessType = new Zend_Form_Element_Text("business_type"); $businessType->setRequired(true); $businessType->setLabel("Business Type"); $timezoneGroupModel = new App_TimezoneGroup(); $timezoneGroups = $timezoneGroupModel->getAllTimezonesGrouped(); $items = array(); $items[""] = "Please Select"; foreach ($timezoneGroups as $timezoneGroup) { $timezones = $timezoneGroup["timezones"]; foreach ($timezones as $timezone) { $items[$timezoneGroup["name"]][$timezone["timezone_id"]] = $timezone["name"]; } } $timezone = new Zend_Form_Element_Select("timezone_id"); $timezone->setRequired(true); $timezone->setLabel("What time zone is your business located?"); $timezone->addMultiOptions($items); $accept = new Zend_Form_Element_Checkbox("accept"); $accept->setLabel("I Accept, the Terms and Service"); $accept->setRequired(true); $accept->setDecorators(array('ViewHelper')); $this->addElements(array($firstname, $lastname, $password, $confirm_password, $username, $email, $mobile, $businessType, $timezone, $website, $number_hits, $company, $fullname_webmaster, $email_webmaster, $phone_webmaster, $accept)); }
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)); }
/** * Class constructor * * @return void */ public function __construct($options) { $this->_addSubmitSaveClose = true; parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; $productFormLeft = new Zend_Form_SubForm(); $productFormRight = new Zend_Form_SubForm(); $productFormBotPub = new Zend_Form_SubForm(); $productFormBotPro = new Zend_Form_SubForm(); 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'); $productFormRight->addElement($newImage); // Name of the product line $name = new Zend_Form_Element_Text('PI_Name'); $name->setLabel($productFormLeft->getView()->getCibleText('product_label_name') . "<span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $productFormLeft->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $productFormLeft->addElement($name); // List of sub categories $oSubCategories = new SubCategoriesObject(); $listSubCat = $oSubCategories->subcatCollection(Zend_Registry::get('currentEditLanguage')); $subCategories = new Zend_Form_Element_Select('P_SubCategoryID'); $subCategories->setLabel($productFormLeft->getView()->getCibleText('form_products_subcat_label') . "<span class='field_required'>*</span>")->setAttrib('class', 'largeSelect')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $productFormLeft->getView()->getCibleText('validation_message_empty_field')))); $subCategories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); $subCategories->addMultiOptions($listSubCat); $productFormLeft->addElement($subCategories); // Checkbox for new product $isNewProd = new Zend_Form_Element_Checkbox('P_New'); $isNewProd->setLabel($productFormLeft->getView()->getCibleText('form_product_isnew_label')); $isNewProd->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $productFormLeft->addElement($isNewProd); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('PI_MetaId'); $metaTagId->removeDecorator('Label'); $productFormLeft->addElement($metaTagId); // Image for the product line $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $productFormRight->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $productFormRight->addElement($imageOrg); $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $productFormRight->addElement($imageView); $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'); $productFormRight->addElement($imagePicker); //Keywords field $keywords = new Zend_Form_Element_Text('PI_MotsCles'); $keywords->setLabel($productFormLeft->getView()->getCibleText('form_product_keywords_label'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline marginTop30', 'id' => 'title'))))->setAttrib('class', 'largeTextInput'); $label = $keywords->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $productFormLeft->addElement($keywords); // Description of the product $descrPublic = new Cible_Form_Element_Editor('PI_DescriptionPublic', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'subFormID' => 'productFormBotPub')); $descrPublic->setLabel($this->getView()->getCibleText('product_label_descriptionPublic'))->setAttrib('class', 'largeEditor'); $label = $descrPublic->getDecorator('label'); $label->setOption('class', $this->_labelCSS); $productFormBotPub->addElement($descrPublic); // Technical specs of the product for public. $urlTechFile = new Zend_Form_Element_Hidden('PI_FicheTechniquePublicPDF'); $urlTechFile->removeDecorator('Label'); $productFormBotPub->addElement($urlTechFile); $techfile = new Zend_Form_Element_Hidden('technicalSpecsName'); $techfile->removeDecorator('Label'); $productFormBotPub->addElement($techfile); // Technical specs of the product. $technicalSpecs = new Cible_Form_Element_FileManager('PI_FicheTechniquePublicPDF', array('associatedElement' => 'productFormBotPub', 'displayElement' => 'technicalSpecsName', 'pathTmp' => $this->_filePath, 'contentID' => $this->_dataId, 'setInit' => true)); $technicalSpecs->setLabel($productFormBotPub->getView()->getCibleText('product_label_technical_specs'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $technicalSpecs->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $productFormBotPub->addElement($technicalSpecs); //----------------------------------------------------- // Description of the product for pro $descrPro = new Cible_Form_Element_Editor('PI_DescriptionPro', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'subFormID' => 'productFormBotPro')); $descrPro->setLabel($this->getView()->getCibleText('product_label_descriptionPro'))->setAttrib('class', 'largeEditor'); $label = $descrPro->getDecorator('label'); $label->setOption('class', $this->_labelCSS); $productFormBotPro->addElement($descrPro); // Technical specs of the product for pro. $urlTechFile = new Zend_Form_Element_Hidden('PI_FicheTechniqueProPDF'); $urlTechFile->removeDecorator('Label'); $productFormLeft->addElement($urlTechFile); $techfile = new Zend_Form_Element_Hidden('technicalSpecsPro'); $techfile->removeDecorator('Label'); $productFormBotPro->addElement($techfile); // Technical specs of the product. $technicalSpecsPro = new Cible_Form_Element_FileManager('PI_FicheTechniqueProPDF', array('associatedElement' => 'productFormBotPro', 'displayElement' => 'technicalSpecsPro', 'pathTmp' => $this->_filePath, 'contentID' => $this->_dataId, 'setInit' => true)); $technicalSpecsPro->setLabel($productFormBotPro->getView()->getCibleText('product_label_technical_specs'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $technicalSpecsPro->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $productFormBotPro->addElement($technicalSpecsPro); $productFormBotPub->setLegend($this->getView()->getCibleText('subform_public_legend')); $productFormBotPub->setAttrib('class', 'fieldsetBorder'); $productFormBotPro->setLegend($this->getView()->getCibleText('subform_professional_legend')); $productFormBotPro->setAttrib('class', 'fieldsetBorder'); $this->addSubForm($productFormLeft, 'productFormLeft'); $this->addSubForm($productFormRight, 'productFormRight'); $this->addSubForm($productFormBotPub, 'productFormBotPub'); $this->addSubForm($productFormBotPro, 'productFormBotPro'); }
public function __construct($options = null) { $this->_addSubmitSaveClose = true; parent::__construct($options); $imageSrc = $options['imageSrc']; $newsID = $options['newsID']; $isNewImage = $options['isNewImage']; $catagoryID = ""; if (isset($options['catagoryID'])) { $catagoryID = $options['catagoryID']; } if ($newsID == '') { $pathTmp = "../../../../../data/images/news/tmp"; } else { $pathTmp = "../../../../../data/images/news/{$newsID}/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); // Title $title = new Zend_Form_Element_Text('Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $title->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($title); if (isset($options['categoriesList']) && $options['categoriesList'] == 'true') { // select box category (Parameter #1) $categoryNews = new Zend_Form_Element_Select('Param1'); $categoryNews->setLabel($this->getView()->getCibleText('form_label_news_category'))->setValue($catagoryID)->setAttrib('class', 'largeSelect'); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 2)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $categoryNews->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($categoryNews); } // Date picker $date = new Cible_Form_Element_DatePicker('Date', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true))); $date->setLabel($this->getView()->getCibleText('form_label_date'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateInvalid' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateFalseFormat' => $this->getView()->getCibleText('validation_message_invalid_date')))); $this->addElement($date); // Date picker $datePicker = new Cible_Form_Element_DatePicker('ReleaseDate', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true))); $datePicker->setLabel($this->getView()->getCibleText('form_extranet_news_label_releaseDate'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateInvalid' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateFalseFormat' => $this->getView()->getCibleText('validation_message_invalid_date')))); $this->addElement($datePicker); // Status $status = new Zend_Form_Element_Checkbox('Status'); $status->setLabel('Nouvelle en ligne'); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($status); // IMAGE $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('ImageSrc', array('onchange' => "document.getElementById('imageView').src = document.getElementById('ImageSrc').value", 'associatedElement' => 'ImageSrc_preview', 'pathTmp' => $pathTmp, 'contentID' => $newsID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $imageAlt = new Zend_Form_Element_Text("ImageAlt"); $imageAlt->setLabel($this->getView()->getCibleText('form_label_description_image'))->setAttrib('class', 'stdTextInput'); $this->addElement($imageAlt); // Breif text $breif = new Cible_Form_Element_Editor('Brief', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $breif->setLabel($this->getView()->getCibleText('form_label_short_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'mediumEditor'); $breif->setDecorators(array('ViewHelper', array('Errors', array('placement' => 'prepend')), array('label', array('placement' => 'prepend')))); $label = $breif->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($breif); // Text $text = new Cible_Form_Element_Editor('Text', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $text->setLabel($this->getView()->getCibleText('form_label_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'mediumEditor')->setDecorators(array('ViewHelper', array('Errors', array('placement' => 'prepend')), array('label', array('placement' => 'prepend')))); $label = $text->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($text); $categoryID = new Zend_Form_Element_Hidden('CategoryID'); $this->addElement($categoryID); }
public function __construct($options = null) { //exit; $this->_addSubmitSaveClose = true; parent::__construct($options); //var_dump($options); // exit; /*$addAction = $options['addAction']; $lang = $options['lang']; $baseDir = $options['baseDir']; $cancelUrl = $options['cancelUrl']; $VI_ID = $options['VI_ID']; $V_Autoplay = $options['V_Autoplay']; $isNewPoster = $options['isNewPoster']; $isNewMP4 = $options['isNewMP4']; $isNewWEBM = $options['isNewWEBM']; $isNewOGG = $options['isNewOGG']; $V_Alias = $options['V_Alias']; $VI_Name = $options['VI_Name']; $V_Width = $options['V_Width']; $V_Height = $options['V_Height']; $VI_Description = $options['VI_Description']; $VI_Poster = $options['VI_Poster']; $VI_MP4 = $options['VI_MP4']; $VI_WEBM = $options['VI_WEBM']; $VI_OGG = $options['VI_OGG'];*/ $imageSrc = $options['imageSrc']; $pathTmp = "../../../../../data/images/tmp"; $VI_ID = new Zend_Form_Element_Hidden('VI_ID'); $VI_ID->removeDecorator('Label'); $this->addElement($VI_ID); $newPoster = new Zend_Form_Element_Hidden('isNewPoster', array('value' => $options['isNewPoster'])); $newPoster->removeDecorator('Label'); $this->addElement($newPoster); $newMP4 = new Zend_Form_Element_Hidden('isNewMP4', array('value' => $options['isNewMP4'])); $newMP4->removeDecorator('Label'); $this->addElement($newMP4); $newWEBM = new Zend_Form_Element_Hidden('isNewWEBM', array('value' => $options['isNewWEBM'])); $newWEBM->removeDecorator('Label'); $this->addElement($newWEBM); $newOGG = new Zend_Form_Element_Hidden('isNewOGG', array('value' => $options['isNewOGG'])); $newOGG->removeDecorator('Label'); $this->addElement($newOGG); $V_Autoplay = new Zend_Form_Element_Checkbox('V_Autoplay'); $V_Autoplay->setLabel($this->getView()->getCibleText('form_label_video_autoplay')); $V_Autoplay->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($V_Autoplay); // Title $V_Alias = new Zend_Form_Element_Text('V_Alias'); $V_Alias->setLabel($this->getView()->getCibleText('form_label_video_alias'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $V_Alias->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Alias); // Title $VI_Name = new Zend_Form_Element_Text('VI_Name'); $VI_Name->setLabel($this->getView()->getCibleText('form_label_video_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $VI_Name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($VI_Name); // Title $V_Width = new Zend_Form_Element_Text('V_Width'); $V_Width->setLabel($this->getView()->getCibleText('form_label_video_width'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $V_Width->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Width); // Title $V_Height = new Zend_Form_Element_Text('V_Height'); $V_Height->setLabel($this->getView()->getCibleText('form_label_video_height'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $V_Height->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Height); $VI_Poster_tmp = new Zend_Form_Element_Hidden('VI_Poster_tmp'); $VI_Poster_tmp->removeDecorator('Label'); $this->addElement($VI_Poster_tmp); $imageOrg = new Zend_Form_Element_Hidden('VI_Poster_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageOrg = new Zend_Form_Element_Hidden('VI_Poster_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $VI_WEBM_tmp = new Zend_Form_Element_Hidden('VI_WEBM_tmp'); $VI_WEBM_tmp->removeDecorator('Label'); $this->addElement($VI_WEBM_tmp); $VI_OGG_tmp = new Zend_Form_Element_Hidden('VI_OGG_tmp'); $VI_OGG_tmp->removeDecorator('Label'); $this->addElement($VI_OGG_tmp); // Image for the product line $imageView = new Zend_Form_Element_Image('VI_Poster_preview', array('onclick' => 'return false;')); $imageView->setAttrib('width', $options['V_Width']); $imageView->setAttrib('height', $options['V_Height']); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePickerPoster = new Cible_Form_Element_ImagePicker('VI_Poster', array('onchange' => "document.getElementById('imageView').src = document.getElementById('VI_Poster').value", 'associatedElement' => 'VI_Poster_preview', 'pathTmp' => $pathTmp, 'contentID' => $options['VI_ID'])); $imagePickerPoster->removeDecorator('Label'); $this->addElement($imagePickerPoster); $VI_MP4_tmpt = new Zend_Form_Element_Hidden('VI_MP4', array('value' => $options['VI_MP4'])); $VI_MP4_tmpt->removeDecorator('Label'); $this->addElement($VI_MP4_tmpt); $VI_MP4_Name_tmp = new Zend_Form_Element_Hidden('VI_MP4_Name'); $VI_MP4_Name_tmp->removeDecorator('Label'); $this->addElement($VI_MP4_Name_tmp); // Technical specs of the product. $video1 = new Cible_Form_Element_FileManager('VI_MP4', array('displayElement' => 'video1', 'pathTmp' => "/videos", 'contentID' => $this->_dataId, 'setInit' => true)); $video1->setLabel($this->getView()->getCibleText('form_label_video_VI_MP4'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $video1->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($video1); $VI_WEBM_tmpt = new Zend_Form_Element_Hidden('VI_WEBM', array('value' => $options['VI_WEBM'])); $VI_WEBM_tmpt->removeDecorator('Label'); $this->addElement($VI_WEBM_tmpt); $VI_WEBM_Name_tmp = new Zend_Form_Element_Hidden('VI_WEBM_Name'); $VI_WEBM_Name_tmp->removeDecorator('Label'); $this->addElement($VI_WEBM_Name_tmp); // Technical specs of the product. $video2 = new Cible_Form_Element_FileManager('VI_WEBM', array('displayElement' => 'video2', 'pathTmp' => "/videos", 'contentID' => $this->_dataId, 'setInit' => true)); $video2->setLabel($this->getView()->getCibleText('form_label_video_VI_WEBM'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $video2->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($video2); $VI_OGG_tmpt = new Zend_Form_Element_Hidden('VI_OGG', array('value' => $options['VI_OGG'])); $VI_OGG_tmpt->removeDecorator('Label'); $this->addElement($VI_OGG_tmpt); $VI_OGG_Name_tmp = new Zend_Form_Element_Hidden('VI_OGG_Name'); $VI_OGG_Name_tmp->removeDecorator('Label'); $this->addElement($VI_OGG_Name_tmp); // Technical specs of the product. $video3 = new Cible_Form_Element_FileManager('VI_OGG', array('displayElement' => 'video3', 'pathTmp' => "/videos", 'contentID' => $this->_dataId, 'setInit' => true)); $video3->setLabel($this->getView()->getCibleText('form_label_video_VI_OGG'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $video3->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($video3); $VI_Description = new Cible_Form_Element_Editor('VI_Description', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'value' => $options['VI_Description'])); $VI_Description->setLabel($this->getView()->getCibleText('form_label_video_description')); $label = $VI_Description->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($VI_Description); /* if($options['VI_ID'] == '') $pathTmp = "../../../../../data/images/videos/tmp"; else $pathTmp = "../../../../../data/images/videos/" . $options['VI_ID'] . "/tmp"; $VI_ID = new Zend_Form_Element_Hidden('VI_ID', array('value'=>$VI_ID)); $VI_ID->removeDecorator('Label'); $this->addElement($VI_ID); $newPoster = new Zend_Form_Element_Hidden('isNewPoster', array('value'=>$isNewPoster)); $newPoster->removeDecorator('Label'); $this->addElement($newPoster); $newMP4 = new Zend_Form_Element_Hidden('isNewMP4', array('value'=>$isNewMP4)); $newMP4->removeDecorator('Label'); $this->addElement($newMP4); $newWEBM = new Zend_Form_Element_Hidden('isNewWEBM', array('value'=>$isNewWEBM)); $newWEBM->removeDecorator('Label'); $this->addElement($newWEBM); $newOGG = new Zend_Form_Element_Hidden('isNewOGG', array('value'=>$isNewOGG)); $newOGG->removeDecorator('Label'); $this->addElement($newOGG); $V_Autoplay = new Zend_Form_Element_Checkbox('$V_Autoplay'); $V_Autoplay->setLabel($this->getView()->getCibleText('form_label_video_autoplay')); $V_Autoplay->setDecorators(array( 'ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')), )); $this->addElement($V_Autoplay); // Title $V_Alias = new Zend_Form_Element_Text('V_Alias'); $V_Alias->setLabel($this->getView()->getCibleText('form_label_video_alias')) ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))) ->setAttrib('class','stdTextInput'); $label = $V_Alias->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Alias); // Title $VI_Name = new Zend_Form_Element_Text('VI_Name'); $VI_Name->setLabel($this->getView()->getCibleText('form_label_video_name')) ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))) ->setAttrib('class','stdTextInput'); $label = $VI_Name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($VI_Name); // Title $V_Width = new Zend_Form_Element_Text('V_Width'); $V_Width->setLabel($this->getView()->getCibleText('form_label_video_width')) ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))) ->setAttrib('class','stdTextInput'); $label = $V_Width->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Width); // Title $V_Height = new Zend_Form_Element_Text('V_Height'); $V_Height->setLabel($this->getView()->getCibleText('form_label_video_height')) ->setRequired(true) ->addFilter('StripTags') ->addFilter('StringTrim') ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))) ->setAttrib('class','stdTextInput'); $label = $V_Height->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($V_Height); $VI_Poster_tmp = new Zend_Form_Element_Hidden('VI_Poster_tmp'); $VI_Poster_tmp->removeDecorator('Label'); $this->addElement($VI_Poster_tmp); $VI_MP4_tmp = new Zend_Form_Element_Hidden('VI_MP4_tmp'); $VI_MP4_tmp->removeDecorator('Label'); $this->addElement($VI_MP4_tmp); $VI_WEBM_tmp = new Zend_Form_Element_Hidden('VI_WEBM_tmp'); $VI_WEBM_tmp->removeDecorator('Label'); $this->addElement($VI_WEBM_tmp); $VI_OGG_tmp = new Zend_Form_Element_Hidden('VI_OGG_tmp'); $VI_OGG_tmp->removeDecorator('Label'); $this->addElement($VI_OGG_tmp); $VI_Poster_original = new Zend_Form_Element_Hidden('VI_Poster_original'); $VI_Poster_original->removeDecorator('Label'); $this->addElement($VI_Poster_original); $VIPosterp = new Zend_Form_Element_Image('VI_Poster_preview', array('onclick'=>'return false;')); $VIPosterp->setImage($VI_Poster); $VIPosterp->setLabel($this->getView()->getCibleText('form_label_video_poster')); $this->addElement($VIPosterp); $imagePickerPoster = new Cible_Form_Element_ImagePicker('VI_Poster', array( 'onchange' => "document.getElementById('VI_Poster').src = document.getElementById('VI_Poster_preview').value", 'associatedElement' => 'VI_Poster_preview','pathTmp'=>$pathTmp,'contentID'=>$VI_ID)); $imagePickerPoster->removeDecorator('Label'); $this->addElement($imagePickerPoster); $VI_MP4_original = new Zend_Form_Element_Hidden('VI_MP4_original'); $VI_MP4_original->removeDecorator('Label'); $this->addElement($VI_MP4_original); $VI_MP4p = new Zend_Form_Element_Image('VI_MP4_preview', array('onclick'=>'return false;')); $VI_MP4p->setImage($VI_MP4); $VI_MP4p->setLabel($this->getView()->getCibleText('form_label_video_VI_MP4')); $this->addElement($VI_MP4p); $imagePickerVI_MP4 = new Cible_Form_Element_ImagePicker('VI_MP4', array( 'onchange' => "document.getElementById('VI_MP4').src = document.getElementById('VI_MP4_preview').value;", 'associatedElement' => 'VI_MP4_preview','pathTmp'=>$pathTmp,'contentID'=>$VI_MP4)); $imagePickerVI_MP4->removeDecorator('Label'); $this->addElement($imagePickerVI_MP4); $VI_WEBM_original = new Zend_Form_Element_Hidden('VI_WEBM_original'); $VI_WEBM_original->removeDecorator('Label'); $this->addElement($VI_WEBM_original); $VI_WEBMp = new Zend_Form_Element_Image('VI_WEBM_preview', array('onclick'=>'return false;')); $VI_WEBMp->setImage($VI_WEBM); $VI_WEBMp->setLabel($this->getView()->getCibleText('form_label_video_VI_WEBM')); $this->addElement($VI_WEBMp); $imagePickerVI_WEBM = new Cible_Form_Element_ImagePicker('VI_WEBM', array( 'onchange' => "document.getElementById('VI_WEBM').src = document.getElementById('VI_WEBM_preview').value", 'associatedElement' => 'VI_WEBM_preview','pathTmp'=>$pathTmp,'contentID'=>$VI_WEBM)); $imagePickerVI_WEBM->removeDecorator('Label'); $this->addElement($imagePickerVI_WEBM); $VI_OGG_original = new Zend_Form_Element_Hidden('VI_OGG_original'); $VI_OGG_original->removeDecorator('Label'); $this->addElement($VI_OGG_original); $VI_OGGp = new Zend_Form_Element_Image('VI_OGG_preview', array('onclick'=>'return false;')); $VI_OGGp->setImage($VI_OGG); $VI_OGGp->setLabel($this->getView()->getCibleText('form_label_video_VI_OGG')); $this->addElement($VI_OGGp); $imagePickerVI_OGG = new Cible_Form_Element_ImagePicker('VI_OGG', array( 'onchange' => "document.getElementById('VI_OGG').src = document.getElementById('VI_OGG_preview').value", 'associatedElement' => 'VI_OGG_preview','pathTmp'=>$pathTmp,'contentID'=>$VI_OGG)); $imagePickerVI_OGG->removeDecorator('Label'); $this->addElement($imagePickerVI_OGG); $VI_Description = new Cible_Form_Element_Editor('VI_Description', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $VI_Description->setLabel($this->getView()->getCibleText('form_label_video_description')); $label = $VI_Description->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($VI_Description); */ }
/** * Class constructor * * @return void */ public function __construct($options = null) { parent::__construct($options); $labelCSS = Cible_FunctionsGeneral::getLanguageLabelColor($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; $formItemPrices = new Zend_Form_SubForm(); $formTop = new Zend_Form_SubForm(); $formBottom = new Zend_Form_SubForm(); // $this = new Zend_Form_SubForm(); 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); // Name of the product line $name = new Zend_Form_Element_Text('II_Name'); $name->setLabel($this->getView()->getCibleText('item_label_name') . "<span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $label = $name->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $formTop->addElement($name); // List of products $oProducts = new ProductsObject(); $listProd = $oProducts->productsCollection(Zend_Registry::get('currentEditLanguage')); $products = new Zend_Form_Element_Select('I_ProductID'); $products->setLabel($this->getView()->getCibleText('form_item_products_label') . "<span class='field_required'>*</span>")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'largeSelect')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title')))); $products->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); $products->addMultiOptions($listProd); // foreach ($listProd as $data) // { // $products->addMultiOption($data['P_ID'], $data['PI_Name']); // } $formTop->addElement($products); // Product $productCode = new Zend_Form_Element_Text('I_ProductCode'); $productCode->setLabel($this->getView()->getCibleText('form_product_code_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $formTop->addElement($productCode); // Item sequence $sequence = new Zend_Form_Element_Text('I_Seq'); $sequence->setLabel($this->getView()->getCibleText('form_product_sequence_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($sequence); // Detail Price $detailPrice = new Zend_Form_Element_Text('I_PriceDetail'); $detailPrice->setLabel($this->getView()->getCibleText('form_item_pricedetail_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($detailPrice); // Pro price $proPrice = new Zend_Form_Element_Text('I_PricePro'); $proPrice->setLabel($this->getView()->getCibleText('form_item_pricepro_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formTop->addElement($proPrice); //******************************************************** //* Sub form containing data defining prices and volumes * //******************************************************** $txtQty = new Cible_Form_Element_Html('lblQty', array('value' => $this->getView()->getCibleText('form_item_qty_label'))); $txtQty->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline left')))); $formItemPrices->addElement($txtQty); $txtPrices = new Cible_Form_Element_Html('lblPrices', array('value' => $this->getView()->getCibleText('form_item_prices_label'))); $txtPrices->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline right')))); $formItemPrices->addElement($txtPrices); // Qty limit 1 $qtyInf = new Zend_Form_Element_Text('I_LimitVol1'); $qtyInf->setLabel($this->getView()->getCibleText('form_item_limitvol1_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColLeft'))))->setAttrib('class', 'smallTextInput left'); $formItemPrices->addElement($qtyInf); // Price Vol 1 $firstPrice = new Zend_Form_Element_Text('I_PriceVol1'); $firstPrice->removeDecorator('Label')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight'))))->setAttrib('class', 'smallTextInput'); $formItemPrices->addElement($firstPrice); // Qty limit 2 $qtyMiddle = new Zend_Form_Element_Text('I_LimitVol2'); $qtyMiddle->setLabel($this->getView()->getCibleText('form_item_limitvol2_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColLeft'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($qtyMiddle); // Price vol 2 $secondPrice = new Zend_Form_Element_Text('I_PriceVol2'); $secondPrice->removeDecorator('Label')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight', 'id' => 'title'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($secondPrice); // Price vol 3 $thirdPrice = new Zend_Form_Element_Text('I_PriceVol3'); $thirdPrice->setLabel($this->getView()->getCibleText('form_item_priceVol3_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'inputColRight'))))->setAttrib('class', 'smallTextInput textRight'); $formItemPrices->addElement($thirdPrice); //******************************************************** $special = new Zend_Form_Element_Checkbox('I_Special'); $special->setLabel($this->getView()->getCibleText('form_item_special_label')); $special->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($special); // Special Price $specialPrice = new Zend_Form_Element_Text('I_PrixSpecial'); $specialPrice->setLabel($this->getView()->getCibleText('form_item_specialPrice_label'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'smallTextInput'); $formBottom->addElement($specialPrice); // Checkbox for tax of the province $taxProv = new Zend_Form_Element_Checkbox('P_TaxProv'); $taxProv->setLabel($this->getView()->getCibleText('form_item_taxprov_label'))->setAttrib('checked', 'checked'); $taxProv->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($taxProv); // Checkbox for federal tax $taxFed = new Zend_Form_Element_Checkbox('P_TaxFed'); $taxFed->setLabel($this->getView()->getCibleText('form_item_taxfed_label'))->setAttrib('checked', 'checked'); $taxFed->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $formBottom->addElement($taxFed); $formItemPrices->setLegend($this->getView()->getCibleText('subform_itemprices_legend')); $formItemPrices->setAttrib('class', 'smallFieldsetBorder'); // $this->setLegend($this->getView()->getCibleText('subform_professional_legend')); // $this->setAttrib('class', 'fieldsetBorder'); // $this->addSubForm($this, 'productFormLeft'); // $this->addSubForm($this, 'productFormRight'); $this->addSubForm($formTop, 'formTop'); $this->addSubForm($formItemPrices, 'formItemPrices'); $this->addSubForm($formBottom, 'formBottom'); }