/** * Hook for node form - if type is Filemanager Node, add extra fields * * @param Zend_Form $form * @param array $arguments */ public function nodeForm(Zend_Form &$form, &$arguments) { $item =& array_shift($arguments); if (!Zend_Controller_Front::getInstance()->getRequest()->isXmlHttpRequest() && $item->type == "filemanager_file") { // Add Filemanager fields $form->setAttrib('enctype', 'multipart/form-data'); $file = new Zend_Form_Element_File('filemanager_file'); $file->setLabel("Select file")->setDestination(ZfApplication::$_data_path . DIRECTORY_SEPARATOR . "files")->setRequired(false); $form->addElement($file); $fields[] = 'filemanager_file'; if ($item->id > 0) { // Fetch Filemanager object $factory = new Filemanager_File_Factory(); $file_item = $factory->find($item->id)->current(); if ($file_item) { $existing = new Zend_Form_Element_Image('filemanager_image'); if (substr($file_item->mimetype, 0, 5) == "image") { $imageid = $file_item->nid; } else { $imageid = 0; } $urlOptions = array('module' => 'filemanager', 'controller' => 'file', 'action' => 'show', 'id' => $imageid); $existing->setImage(Zend_Controller_Front::getInstance()->getRouter()->assemble($urlOptions, 'default')); $fields[] = 'filemanager_image'; } } $options = array('legend' => Zoo::_("File upload")); $form->addDisplayGroup($fields, 'filemanager_fileupload', $options); } else { // Add content node image selector } }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $quan_trong = new Zend_Form_Element_Select('quan_trong'); $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $image = new Zend_Form_Element_Image('image'); $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat'); $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4')); $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet'); $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea')); $pdf = new Zend_Form_Element_File('pdf'); $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form')); }
public function __construct($project_id, $options = null) { parent::__construct($options); $this->setName('deploymentSetup'); $servers_map = new GD_Model_ServersMapper(); $servers = $servers_map->getServersByProject($project_id); if (!is_array($servers) || count($servers) == 0) { throw new GD_Exception("There are no servers configured for this project."); } $server_id = new Zend_Form_Element_Select('serverId'); $server_id->setLabel(_r('Server'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); foreach ($servers as $server) { $server_id->addMultiOption($server->getId(), $server->getDisplayName()); } $from_revision = new Zend_Form_Element_Text('fromRevision'); $from_revision->setLabel(_r('Current revision'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('readonly', 'readonly')->setAttrib('disabled', 'disabled'); $to_revision = new Zend_Form_Element_Text('toRevision'); $to_revision->setLabel(_r('Deploy revision or tag'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDescription('<a href="javascript:;" onclick="getLatestRevision();">Click to get latest revision</a><span id="get_latest_revision_status"></span>'); $comment = new Zend_Form_Element_Text('comment'); $comment->setLabel(_r('Comment (optional)'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $submitRun = new Zend_Form_Element_Image('submitRun'); $submitRun->setImage('/images/buttons/small/deploy.png'); $submitRun->class = "processing_btn size_small"; $submitPreview = new Zend_Form_Element_Image('submitPreview'); $submitPreview->setImage('/images/buttons/small/inverted/preview.png'); $submitPreview->class = "preview processing_btn size_small"; $this->addElements(array($server_id, $from_revision, $to_revision, $comment, $submitRun, $submitPreview)); }
protected function buildElements() { // Quick search field $full_name = new Zend_Form_Element_Text('fullname'); $full_name->setLabel('Your Name:'); $full_name->setAttrib('class', 'contactforminput'); $full_name->setAttrib('hint', 'your name'); $this->addElement($full_name); // create EMAIL input tag // Unique check, require, email address valid check, length less than 100(database length for this field) // do email address validation(default each email element do email address validation) $credit_email = new Zend_Form_Element_Text('email_from'); $credit_email->setLabel('Your Email:'); $credit_email->setAttrib('class', 'contactforminput'); $this->addElement($credit_email); // create Description Textarea tag // filed type in db is Text $description = new Zend_Form_Element_Textarea('question'); $description->setLabel('Your Question:'); $description->setAttrib('class', 'contactforminput'); $description->setAttrib('hint', 'your question'); $this->addElement($description); // Quick search btn $send = new Zend_Form_Element_Image('submit'); $send->setImage('/images/sitetemplate/send_button.png'); $send->setAttribs(array('rows' => 22, 'cols' => 60)); $send->setImageValue(true); $this->addElement($send); $this->setName("contactform"); $this->setAttrib("onSubmit", "return ValidateForm();"); }
/** * 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 __construct($options = null) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $imgField = $options['imgField']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Image for the product line $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); // Name of the group of banner // Set the texte for the image $textDescription = new Zend_Form_Element_Textarea('BII_Text'); $textDescription->setLabel($this->_view->getCibleText('form_banner_image_text_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea'); $label = $textDescription->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $textUrl = new Zend_Form_Element_Text('BII_Url'); $textUrl->setLabel($this->_view->getCibleText('form_banner_image_texturl_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdText'); $label = $textUrl->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $groupImage = new Zend_Form_Element_Select('BI_GroupID'); $groupImage->setLabel($this->_view->getCibleText('form_banner_image_group'))->setAttrib('class', 'largeSelect'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $groupImage->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $label = $groupImage->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); // Image for the product line $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId)); $imagePicker->removeDecorator('Label'); $this->addElement($imageView); $this->addElement($imagePicker); $this->addElement($groupImage); $this->addElement($textDescription); $this->addElement($textUrl); }
public function __construct($options = null) { parent::__construct($options); $newsletterID = $options['newsletterID']; $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; // Title $title = new Zend_Form_Element_Text('NA_Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // article image if ($newsletterID == '') { $pathTmp = "../../../../../data/images/newsletter/tmp"; } else { $pathTmp = "../../../../../data/images/newsletter/{$newsletterID}/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); //$newImage->setDecorators(array('ViewHelper')); $this->addElement($newImage); $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' => $newsletterID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $imageAlt = new Zend_Form_Element_Text("NA_ImageAlt"); $imageAlt->setLabel($this->getView()->getCibleText('form_label_description_image'))->setAttrib('class', 'stdTextInput'); $this->addElement($imageAlt); // resume text $resume = new Cible_Form_Element_Editor('NA_Resume', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $resume->setLabel($this->getView()->getCibleText('form_label_short_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field')))); $resume->setAttrib('class', 'largeEditor'); $this->addElement($resume); $optionText = new Zend_Form_Element_Radio('NA_TextLink'); $optionText->setRequired(true)->addMultiOption('1', $this->getView()->getCibleText('extranet_newsletter_option_text_url_text'))->addMultiOption('2', $this->getView()->getCibleText('extranet_newsletter_option_text_url_url'))->addMultiOption('3', $this->getView()->getCibleText('extranet_newsletter_option_text_url_nothing')); // Text $text = new Cible_Form_Element_Editor('NA_Text', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'class' => 'textAreaToMoveUp')); $text->setLabel($this->getView()->getCibleText('form_label_text'))->setAttrib('class', 'largeEditor'); $this->addElement($text); $url = new Zend_Form_Element_Text('NA_URL'); $url->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInputNewsletterURL'); $this->addElement($optionText); $this->addElement($url); $this->addDisplayGroup(array('NA_TextLink', 'NA_URL'), 'linkTo', array('legend' => $this->getView()->getCibleText('extranet_newsletter_text_url'))); }
public function __construct($options = null) { parent::__construct($options); $this->setName('adminsetup_form'); $username = new Zend_Form_Element_Text('username'); $username->setLabel(_r('Username'))->setValue("admin")->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $password = new Zend_Form_Element_Password('password'); $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $passwordConfirm = new Zend_Form_Element_Password('passwordconf'); $passwordConfirm->setLabel(_r('Confirm Password'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty')->addValidator('Identical', false, array('token' => 'password')); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/next.png')->setAttrib('style', 'float: right;'); $this->addElements(array($username, $password, $passwordConfirm, $submit)); }
public function __construct($options = null) { $this->_addSubmitSaveClose = false; parent::__construct($options); $galleryID = $options['galleryID']; $imageSrc = ""; // show online $showOnline = new Zend_Form_Element_Checkbox('GI_Online'); $showOnline->setValue(1); $showOnline->setLabel($this->getView()->getCibleText('form_label_showOnline')); $showOnline->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showOnline); // image position $position = new Zend_Form_Element_Text('GI_Position'); $position->setLabel($this->getView()->getCibleText('form_label_position')); $position->setRequired(true); $position->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); $position->addValidator('Int', true, array('messages' => array('notInt' => $this->getView()->getCibleText('validation_message_int_field')))); $this->addElement($position); // IMAGE /* $imageSrc = ""; $imageView = new Zend_Form_Element_Image('imageView',array('src' => $imageSrc)); $imageView->setOrder(4); $this->addElement($imageView); */ if ($galleryID != "") { $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->setDecorators(array('ViewHelper')); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('src' => $imageSrc, 'onclick' => 'return false;')); $imageView->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImageGalleryPicker('ImageSrc', array('associatedElement' => 'imageView', 'galleryID' => $galleryID)); $imagePicker->removeDecorator('label'); $this->addElement($imagePicker); } // Title $title = new Zend_Form_Element_Text('II_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'); $this->addElement($title); // Description $title = new Zend_Form_Element_Text('II_Description'); $title->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); }
public function __construct($options = null) { parent::__construct($options); $this->setName('changepassword_form'); $password = new Zend_Form_Element_Password('password'); $password->setLabel(_r('New Password'))->setRequired(true)->addFilter('StripTags'); $not_empty = new Zend_Validate_NotEmpty(); $password->addValidators(array($not_empty)); $passwordConfirm = new Zend_Form_Element_Password('passwordconf'); $passwordConfirm->setLabel(_r('Confirm Password'))->setRequired(true)->addFilter('StripTags'); $passwordConfirm->addValidators(array($not_empty)); $passwordConfirm->addValidator('Identical', false, array('token' => 'password')); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/save-changes.png'); $this->addElements(array($password, $passwordConfirm, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setName('databasesetup_form'); $hostname = new Zend_Form_Element_Text('hostname'); $hostname->setLabel(_r('Hostname'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $username = new Zend_Form_Element_Text('db_username'); $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $password = new Zend_Form_Element_Password('db_password'); $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $dbname = new Zend_Form_Element_Text('dbname'); $dbname->setLabel(_r('Database Name'))->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/next.png')->setAttrib('style', 'float: right;'); $this->addElements(array($hostname, $username, $password, $dbname, $submit)); }
public function __construct($options = null) { parent::__construct($options); $username = new Zend_Form_Element_Text('username'); $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new GD_Validate_UniqueUser($options['current_user'])); $password = new Zend_Form_Element_Password('password'); $password->setLabel(_r('Password'))->setAttrib('autocomplete', 'off')->setDescription('To leave the user\'s password unchanged, leave this empty.'); $passwordConfirm = new Zend_Form_Element_Password('passwordconf'); $passwordConfirm->setLabel(_r('Confirm Password'))->addValidator('Identical', false, array('token' => 'password'))->setAttrib('autocomplete', 'off'); $admin = new Zend_Form_Element_Checkbox('admin'); $admin->setLabel(_r('Is this user an admin?')); $active = new Zend_Form_Element_Checkbox('active'); $active->setLabel(_r('Is this user active?')); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/login.png'); $this->addElements(array($username, $password, $passwordConfirm, $admin, $active, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setName('serverSettings'); $server_name = new Zend_Form_Element_Text('name'); $server_name->setLabel(_r('Name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Server Name')); $server_name->addValidators(array($not_empty)); $hostname = new Zend_Form_Element_Text('hostname'); $hostname->setLabel(_r('Hostname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Hostname')); $hostname->addValidators(array($not_empty)); $ct_map = new GD_Model_ConnectionTypesMapper(); $connection_types = $ct_map->fetchAll(); $connection_type_id = new Zend_Form_Element_Select('connectionTypeId'); $connection_type_id->setLabel(_r('Connection Type'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please choose a Connection Type')); $connection_type_id->addValidators(array($not_empty)); foreach ($connection_types as $connection_type) { $connection_type_id->addMultiOption($connection_type->getId(), $connection_type->getName()); } $port = new Zend_Form_Element_Text('port'); $port->setLabel(_r('Port'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Port Number')); $port->addValidators(array($not_empty)); $username = new Zend_Form_Element_Text('username'); $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Username')); $username->addValidators(array($not_empty)); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('autocomplete', 'off')->setAttrib('renderPassword', true); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Password')); $password->addValidators(array($not_empty)); $report_path = new Zend_Form_Element_Text('remotePath'); $report_path->setLabel(_r('Remote Path'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim'); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/save-changes.png'); $this->addElements(array($server_name, $hostname, $connection_type_id, $port, $username, $password, $report_path, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setName('login_form')->setAction('/auth/login')->setMethod('post'); $username = new Zend_Form_Element_Text('username'); $username->setLabel(_r('Username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter your User Name')); $username->addValidators(array($not_empty)); $password = new Zend_Form_Element_Password('password'); $password->setLabel(_r('Password'))->setRequired(true)->addFilter('StripTags'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter your Password')); $password->addValidators(array($not_empty)); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/login.png'); $this->addElements(array($username, $password, $submit)); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data'); $this->addElement('Hidden', 'search', array('value' => 1)); $chu_de = new Zend_Form_Element_Text('chu_de'); $chu_de->setLabel('Chủ đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $managementOptions = array("multiOptions" => Default_Model_Constraints::hoithao_capquanly()); $cap_quan_ly = new Zend_Form_Element_Radio('cap_quan_ly', $managementOptions); $cap_quan_ly->setRequired(true)->setLabel('Quy mô (*)')->setValue(1)->setSeparator('')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'cap_ql')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $so_luong_dai_bieu = new Zend_Form_Element_Text('so_luong_dai_bieu'); $so_luong_dai_bieu->setLabel('Số lượng đại biểu')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input'); $dia_diem = new Zend_Form_Element_Text('dia_diem'); $dia_diem->setLabel('Địa điểm')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $don_vi = new Default_Model_DonVi(); $dvptOptions = array("multiOptions" => $don_vi->getDSDVSGU()); $don_vi_id = new Zend_Form_Element_Select('don_vi_id', $dvptOptions); $don_vi_id->setRequired(true)->setLabel('Đơn vị quản lý (*)')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $don_vi_phu_trach = new Zend_Form_Element_Text('don_vi_phu_trach'); $don_vi_phu_trach->setLabel('Đơn vị phụ trách')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $ngay_to_chuc = new Zend_Form_Element_Text('ngay_to_chuc'); $ngay_to_chuc->setRequired(true)->setLabel('Ngày tổ chức')->setDescription('(dd-mm-YYYY)')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('class' => 'text-input', 'id' => 'ngay_to_chuc')); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'trang_thai')))); $anh_trang_bia = new Zend_Form_Element_File('file_anh_trang_bia'); $anh_trang_bia->setLabel('Upload ảnh trang bìa')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/images/hoi_thao/')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $thong_cao_bao_chi = new Zend_Form_Element_File('file_thong_cao_bao_chi'); $thong_cao_bao_chi->setLabel('Thông cáo báo chí')->setDescription('(*.doc, *.docx, *.pdf , < 10MB )')->setDestination(BASE_PATH . '/upload/files/hoi_thao/')->addValidator(new Zend_Validate_File_Extension(array('doc,docx,pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $image = new Zend_Form_Element_Image('image'); $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $mo_ta = new Zend_Form_Element_Textarea('mo_ta'); $mo_ta->setLabel('Nội dung')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta', 'class' => 'text-input textarea')); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setLabel('Lưu và tiếp tục')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setLabel('Lưu và thoát')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'hoi-thao', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Không lưu')->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($chu_de, $don_vi_id, $don_vi_phu_trach, $ngay_to_chuc, $cap_quan_ly, $so_luong_dai_bieu, $dia_diem, $anh_trang_bia, $image, $thong_cao_bao_chi, $mo_ta, $trang_thai, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'hoi_thao')), 'Form')); }
public function __construct(GD_Model_Project $project, $options = null, $new_project = false) { parent::__construct($options); $this->setName('projectSettings'); $project_name = new Zend_Form_Element_Text('name'); $project_name->setLabel(_r('Project Name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the project name')); $project_name->addValidators(array($not_empty)); // if we're adding a new project, we need to make sure it's unique if ($new_project) { $unique_name = new GD_Validate_UniqueName(); $project_name->addValidators(array($unique_name)); } $git_validator = new GD_Validate_GitUrl(); $repository_url = new Zend_Form_Element_Text('repositoryUrl'); $repository_url->setLabel(_r('Repository URL'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Repository URL')); $repository_url->addValidators(array($not_empty, $git_validator)); $deployment_branch = new Zend_Form_Element_Text('deploymentBranch'); $deployment_branch->setLabel(_r('Deployment Branch'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the name of the Deployment Branch')); $deployment_branch->addValidators(array($not_empty)); if (!$new_project) { $deployment_branch->addValidator(new GD_Validate_GitBranch($project)); } $public_key = new Zend_Form_Element_Textarea('publicKey'); $public_key->setLabel(_r('Public Key'))->setRequired(false)->setAttrib('readonly', 'readonly'); $not_empty = new Zend_Validate_NotEmpty(); $not_empty->setMessage(_r('Please enter the Public Key')); $public_key->addValidators(array($not_empty)); $submit = new Zend_Form_Element_Image('btn_submit'); $submit->setImage('/images/buttons/small/save-changes.png'); $submit->class = "processing_btn size_small"; $this->addElements(array($project_name, $repository_url, $deployment_branch, $public_key, $submit)); }
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, $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'); } }
/** * build Listing Form * @see library/CrFramework/CrFramework_Form#init() */ public function init() { logfire('dsfsdf', 'sdfsdfdsfs'); $this->setMethod('post'); $this->setName('refineform'); $this->buildQuickSearchElements(); $this->buildCat1Element(); $this->buildCat2Element(); $this->buildCat3Element(); $this->buildCat4Element(); $this->buildCat5Element(); $this->buildExtraElements(); $this->buildLocationElements(); $this->addElement(Common::createHiddenElement('searchtype', '')); $this->addElement(Common::createHiddenElement('locationid', $this->_location->getLocationId())); $this->setAction('/refine/' . str_replace(' ', '', strtolower($this->_business->getBusinessType()))); /* $cat4 = new Zend_Form_Element_Select('cat4'); $cat4->setLabel($this->_cat4Name); $cat3->addMultiOptions($this->_business->getCat3Options($cat1selectArray[0])); $this->addElement($cat3); $cat3 = new Zend_Form_Element_Select('cat5'); $cat3->setLabel($this->_cat3Name); $cat1selectArray = explode('|', $this->_business->getFirstCat2Option()); $cat3->addMultiOptions($this->_business->getCat3Options($cat1selectArray[0])); $this->addElement($cat3); */ // Quick search btn $submit = new Zend_Form_Element_Image('submit'); $submit->setImage('/images/sitetemplate/find-2-80.png'); $submit->setAttribs(array('rows' => 22, 'cols' => 80)); $submit->setAttrib('onclick', 'return setsearch(2);'); $submit->setImageValue(true); $this->addElement($submit); //$this->addAttribs(array('onsubmit'=>'beforeSubmit()')); // use view script to render form $this->setDecorators(array('FormElements', array('ViewScript', array('viewScript' => 'forms/_refineform.phtml', 'class' => 'hotspotform', 'placement' => false)), 'Form')); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // Photo (id_foto) // File picker $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto'); $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp'); $profilePhotoPicker->addValidator('Count', false, 1); $profilePhotoPicker->addValidator('Size', false, 2097152); $profilePhotoPicker->removeDecorator('Label'); $this->addElement($profilePhotoPicker, 'profilePhoto'); $avatar = new Zend_Form_Element_Image('avatar'); $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle")); $this->addElement($avatar, 'avatar'); // First name (jmeno) $firstName = $this->createElement('text', 'jmeno'); $firstName->addFilter('StringTrim'); $firstName->setRequired(true); $firstName->setAttrib('class', 'form-control'); $firstName->setAttrib('placeholder', 'First name'); $firstName->removeDecorator('Label'); $this->addElement($firstName); // Last name (prijmeni) $lastName = $this->createElement('text', 'prijmeni'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'Surname'); $lastName->removeDecorator('Label'); $this->addElement($lastName); // E-mail (email) $lastName = $this->createElement('text', 'email'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'E-mail'); $lastName->removeDecorator('Label'); $this->addElement($lastName); //heslo $pass = $this->createElement('password', 'heslo'); $pass->setAttrib('class', 'form-control'); $pass->setAttrib('placeholder', 'Password'); $pass->removeDecorator('Label'); $login = Zend_Auth::getInstance()->getIdentity(); $user = My_Model::get('Users')->getUserByEmail($login); if ($user !== NULL) { $this->addElement($pass); } // ###################### BUTTON ###################### $close = new Zend_Form_Element_Submit('closeButton'); $close->setLabel('Back'); $close->setAttrib('class', 'btn btn-default'); $close->setDecorators(array('ViewHelper')); $this->addElement($close, 'closeButton'); $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); $delete = new Zend_Form_Element_Submit('deleteButton'); $delete->setLabel('Delete'); $delete->setAttrib('class', 'btn btn-danger'); $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;'); $delete->setDecorators(array('ViewHelper')); $this->addElement($delete, 'deleteButton'); }
/** * Inicializace formulare * */ public function init() { $this->setMethod(self::METHOD_POST); // ################## FIRST COLUMN ################### // Photo (id_foto) // File picker $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto'); $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp'); $profilePhotoPicker->addValidator('Count', false, 1); $profilePhotoPicker->addValidator('Size', false, 2097152); $profilePhotoPicker->removeDecorator('Label'); $this->addElement($profilePhotoPicker, 'profilePhoto'); $avatar = new Zend_Form_Element_Image('avatar'); $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle")); $this->addElement($avatar, 'avatar'); // First name (jmeno) $firstName = $this->createElement('text', 'jmeno'); $firstName->addFilter('StringTrim'); $firstName->setRequired(true); $firstName->setAttrib('class', 'form-control'); $firstName->setAttrib('placeholder', 'First name'); $firstName->removeDecorator('Label'); $this->addElement($firstName); // Last name (prijmeni) $lastName = $this->createElement('text', 'prijmeni'); $lastName->addFilter('StringTrim'); $lastName->setRequired(true); $lastName->setAttrib('class', 'form-control'); $lastName->setAttrib('placeholder', 'Surname'); $lastName->removeDecorator('Label'); $this->addElement($lastName); // Date of birth (datum_narozeni) // Date picker $birthdate = $this->createElement('text', 'datum_narozeni'); $birthdate->setRequired(true); $birthdate->setAttrib('class', array('form-control', 'date-picker')); $birthdate->removeDecorator('Label'); $birthdate->setAttrib('placeholder', 'Birthdate'); $this->addElement($birthdate); // ################## SECOND COLUMN ################## // Status (id_status) // Select box $status = new Zend_Form_Element_Select('id_status'); $status->removeDecorator('Label'); $status->setAttrib('class', 'form-control'); $this->addElement($status, 'id_status'); // Position (id_pozice) // Select box $position = new Zend_Form_Element_Select('id_pozice'); $position->removeDecorator('Label'); $position->setAttrib('class', 'form-control'); $this->addElement($position, 'id_pozice'); // Technology (kandidat_technologie) // Multi select $technology = new Zend_Form_Element_Multiselect('kandidat_technologie'); $technology->removeDecorator('Label'); $technology->setAttrib('class', 'form-control'); $this->addElement($technology, 'kandidat_technologie'); // Seniority (id_seniorita) // Select box $seniority = new Zend_Form_Element_Select('id_seniorita'); $seniority->removeDecorator('Label'); $seniority->setAttrib('class', 'form-control'); $this->addElement($seniority, 'id_seniorita'); // Comment (komentar) $comment = $this->createElement('textarea', 'komentar'); $comment->addFilter('StringTrim'); $comment->setAttrib('class', 'form-control'); $comment->setAttrib('rows', '3'); $comment->setAttrib('placeholder', 'Enter your comment…'); $comment->removeDecorator('Label'); $this->addElement($comment); // ################### ATTACHEMENTS ################### // Attchements (kandidat_priloha) // File picker $attachments = new Zend_Form_Element_File('attachments'); $attachments->setDestination(PUBLIC_PATH . '/temp'); $attachments->addValidator('Count', false, array('min' => 0, 'max' => 4)); $attachments->addValidator('Size', false, 2097152); $attachments->setMultiFile(4); $attachments->removeDecorator('Label'); $this->addElement($attachments, 'attachments'); $attachmentsCheckGroup = new Zend_Form_Element_MultiCheckbox('attachmentsCheckGroup'); $comment->removeDecorator('Label'); $this->addElement($attachmentsCheckGroup, 'attachmentsCheckGroup'); // ###################### BUTTON ###################### $close = new Zend_Form_Element_Submit('closeButton'); $close->setLabel('Back'); $close->setAttrib('class', 'btn btn-default'); $close->setDecorators(array('ViewHelper')); $this->addElement($close, 'closeButton'); $save = new Zend_Form_Element_Submit('saveButton'); $save->setLabel('Save'); $save->setAttrib('class', 'btn btn-success'); $save->setDecorators(array('ViewHelper')); $this->addElement($save, 'saveButton'); $delete = new Zend_Form_Element_Submit('deleteButton'); $delete->setLabel('Delete'); $delete->setAttrib('class', 'btn btn-danger'); $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;'); $delete->setDecorators(array('ViewHelper')); $this->addElement($delete, 'deleteButton'); }
/** * 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); $this->setName('page'); $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; $menuId = $options['menuId']; if ($menuId == '') { $pathTmp = "../../../../../data/images/menu/tmp"; } else { $pathTmp = "../../../../../data/images/menu/{$menuId}/tmp"; } // input text for the title of the page $title = new Zend_Form_Element_Text('MenuTitle'); $title->setLabel(Cible_Translation::getCibleText('form_label_menu_title'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput'); $this->addElement($title); $menuItemType = new Zend_Form_Element_Radio('menuItemType'); $menuItemType->setLabel(Cible_Translation::getCibleText('form_label_menu_type'))->addMultiOption('page', Cible_Translation::getCibleText('form_label_menu_type_page'))->addMultiOption('placeholder', Cible_Translation::getCibleText('form_label_menu_type_placeholder'))->addMultiOption('external', Cible_Translation::getCibleText('form_label_menu_type_external'))->setValue('page')->setAttrib('onclick', 'javascript:openTypePanel(this.value)')->setSeparator(''); $this->addElement($menuItemType); $menuItemSecured = new Zend_Form_Element_Radio('menuItemSecured'); $menuItemSecured->setLabel(Cible_Translation::getCibleText('manage_block_secured_menu_status'))->addMultiOption('0', Cible_Translation::getCibleText('button_no'))->addMultiOption('1', Cible_Translation::getCibleText('button_yes'))->setValue('0')->setSeparator(''); $this->addElement($menuItemSecured); $controllerName = new Zend_Form_Element_Text('ControllerName'); $controllerName->setLabel(Cible_Translation::getCibleText('form_label_menu_destination_page'))->setAttrib('onfocus', "openPagePicker('page-picker-pagePicker');")->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput'); $this->addElement($controllerName); $pagePicker = new Cible_Form_Element_PagePicker('pagePicker', array('menu' => 'Principal', 'associatedElement' => 'ControllerName', 'onclick' => "javascript:closePagePicker(\"page-picker-pagePicker\")")); $pagePicker->setLabel(Cible_Translation::getCibleText('form_label_page_picker'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_page_selection_required'))); $pagePicker->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => "page-picker", 'id' => "page-picker-pagePicker")))); $this->addElement($pagePicker); $this->addDisplayGroup(array('ControllerName', 'pagePicker'), 'pageSelectionGroup'); $this->getDisplayGroup('pageSelectionGroup')->setAttrib('class', 'pageSelectionGroup')->removeDecorator('DtDdWrapper'); $link = new Zend_Form_Element_Text('MenuLink'); $link->setLabel(Cible_Translation::getCibleText('form_label_menu_destination_link'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->addPrefixPath('Cible', 'Cible')->setAttrib('class', 'stdTextInput'); $this->addElement($link); // input text for the css li $style = new Zend_Form_Element_Text('MenuTitleStyle'); $style->setLabel(Cible_Translation::getCibleText('form_label_menu_title_style'))->setAttrib('class', 'stdTextInput'); $this->addElement($style); $this->addDisplayGroup(array('MenuLink'), 'externalLinkSelectionGroup'); $this->getDisplayGroup('externalLinkSelectionGroup')->setAttrib('class', 'externalLinkSelectionGroup')->setAttrib('style', 'display: none')->removeDecorator('DtDdWrapper'); // Uses image $loadImage = new Zend_Form_Element_Checkbox('loadImage'); $loadImage->setLabel($this->getView()->getCibleText('form_label_menu_load_image')); $loadImage->removeDecorator('DtDdWrapper'); $loadImage->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // Show this menu item $MID_Show = new Zend_Form_Element_Checkbox('MID_Show'); $MID_Show->setValue(1); $MID_Show->setLabel($this->getView()->getCibleText('form_label_menu_show_item')); $MID_Show->removeDecorator('DtDdWrapper'); $MID_Show->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($MID_Show); $this->addElement($loadImage); // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // To allow to display title and image $imgTitle = new Zend_Form_Element_Checkbox('menuImgAndTitle'); $imgTitle->setLabel($this->getView()->getCibleText('form_label_menu_display_image_and_title')); $imgTitle->removeDecorator('DtDdWrapper'); $imgTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($imgTitle); // IMAGE $imageTmp = new Zend_Form_Element_Hidden('menuImage_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('menuImage_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('menuImage_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc)->removeDecorator('DtDdWrapper'); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('menuImage', array('onchange' => "document.getElementById('imageView').src = document.getElementById('menuImage').value", 'associatedElement' => 'menuImage_preview', 'pathTmp' => $pathTmp, 'contentID' => $menuId)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $this->addDisplayGroup(array('menuImgAndTitle', 'isNewImage', 'menuImage_tmp', 'menuImage_original', 'menuImage_preview', 'menuImage'), 'imageGroup'); $this->getDisplayGroup('imageGroup')->setAttrib('class', 'imageGroup')->setAttrib('style', 'display: none')->removeDecorator('DtDdWrapper'); }
public function __construct($options = null) { $galleryID = $options['galleryID']; $imageSrc = $options['imageSrc']; $isNewImage = $options['isNewImage']; if ($galleryID) { $this->_addSubmitSaveClose = true; } parent::__construct($options); // show online $showOnline = new Zend_Form_Element_Checkbox('G_Online'); $showOnline->setValue(1); $showOnline->setLabel($this->getView()->getCibleText('form_label_showOnline')); $showOnline->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showOnline); // gallery position $position = new Zend_Form_Element_Text('G_Position'); $position->setLabel($this->getView()->getCibleText('form_label_position')); $position->setRequired(true); $position->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); $position->addValidator('Int', true, array('messages' => array('notInt' => $this->getView()->getCibleText('validation_message_int_field')))); $this->addElement($position); // default gallery image $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true)))); $this->addElement($imageTmp); // hidden specify if new image for the gallery $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->setDecorators(array('ViewHelper')); $this->addElement($newImage); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'closeOnly' => true)))); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $imageView->removeDecorator('label'); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImageGalleryPicker('ImageSrc', array('associatedElement' => 'imageView', 'galleryID' => $galleryID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $blockCategory = new Zend_Form_Element_Select('G_CategoryID'); $blockCategory->setLabel('Catégorie de cette galerie')->setAttrib('class', 'largeSelect')->setOrder(5); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 9)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } $gall = new Categories(); $select = $gall->select()->setIntegrityCheck(false)->from('Galleries')->where('G_ID = ?', $galleryID); $gallArray = $gall->fetchAll($select); $blockCategory->setValue($gallArray[0]['G_CategoryID']); $this->addElement($blockCategory); // Title $title = new Zend_Form_Element_Text('GI_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'); $this->addElement($title); // $description = new Zend_Form_Element_Text('GI_Description'); // $description->setLabel($this->getView()->getCibleText('form_label_description')) // ->setRequired(false); // Description $description = new Cible_Form_Element_Editor('GI_Description', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $description->setLabel($this->getView()->getCibleText('form_label_description'))->setAttrib('class', 'mediumEditor'); $this->addElement($description); }
public function __construct($options = null) { $this->tableFieldPrefix = ''; $this->tableName = 'EventsData'; parent::__construct($options); $imageSrc = $options['imageSrc']; $eventID = $options['eventID']; $isNewImage = $options['isNewImage']; if ($eventID == '') { $pathTmp = "../../../../../data/images/event/tmp"; } else { $pathTmp = "../../../../../data/images/event/{$eventID}/tmp"; } // hidden specify if new image for the events $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); if (isset($options['categoriesList']) && $options['categoriesList'] == 'true') { // select box category (Parameter #1) $categoryEvents = new Zend_Form_Element_Select('Param1'); $categoryEvents->setLabel('Catégorie de l\'événement')->setAttrib('class', 'largeSelect'); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $categoryEvents->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($categoryEvents); } // Date picker $datePicker = new Cible_Form_Element_DateRangePicker('DateRange'); $datePicker->setLabel('Dates de l\'événement :')->setRequired()->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_invalid_date')))); $this->addElement($datePicker); // Status $status = new Zend_Form_Element_Checkbox('Status'); $status->setLabel('événement 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' => $eventID)); $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('Lieu *')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_invalid_text'))))->setAttrib('class', 'mediumEditor'); $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('Texte *')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_invalid_text'))))->setAttrib('class', 'mediumEditor'); $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) { $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); }
/** * @see ZF-2714 */ public function testImageElementAttributesPassedWithDecoratorOptionsToViewHelper() { $element = new Zend_Form_Element_Image('foo'); $element->setValue('foobar')->setAttrib('onClick', 'foo()')->setAttrib('id', 'foo-element')->setView($this->getView()); $this->decorator->setElement($element)->setOption('class', 'imageclass'); $image = $this->decorator->render(''); $this->assertContains('class="imageclass"', $image); $this->assertContains('onClick="foo()"', $image); $this->assertContains('id="foo-element"', $image); }
public function testCanPrependImageToContent() { $element = new Zend_Form_Element_Image('foo'); $element->setValue('foobar') ->setView($this->getView()); $this->decorator->setElement($element) ->setOption('placement', 'prepend'); $image = $this->decorator->render('content'); $this->assertRegexp('#<input[^>]*>.*?(content)#s', $image, $image); }