Пример #1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     // Title
     $title = new Zend_Form_Element_Text('NR_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);
     // Date picker
     $datePicker = new Cible_Form_Element_DatePicker('NR_Date', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true)));
     $datePicker->setLabel($this->getView()->getCibleText('form_extranet_newsletter_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);
     // Language
     $language = new Zend_Form_Element_Select('NR_LanguageID');
     $language->setLabel($this->getView()->getCibleText('form_label_language'))->setAttrib('class', 'largeSelect');
     $languagesData = Cible_FunctionsGeneral::getAllLanguage();
     foreach ($languagesData as $languageData) {
         $language->addMultiOption($languageData['L_ID'], $languageData['L_Title']);
     }
     $this->addElement($language);
     // Category
     $category = new Zend_Form_Element_Select('NR_CategoryID');
     $category->setLabel($this->getView()->getCibleText('form_label_category'))->setAttrib('class', 'largeSelect');
     $categoriesData = $this->getView()->getAllNewsletterCategories();
     foreach ($categoriesData as $categoryData) {
         $category->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']);
     }
     $this->addElement($category);
     // Model
     $model = new Zend_Form_Element_Select('NR_ModelID');
     $model->setLabel($this->getView()->getCibleText('form_label_model'))->setAttrib('class', 'largeSelect');
     $modelsData = $this->getView()->getAllNewsletterModels();
     foreach ($modelsData as $modelData) {
         $model->addMultiOption($modelData['NMI_NewsletterModelID'], $modelData['NMI_Title']);
     }
     $this->addElement($model);
     //if($this->salutationDefaultText!=""){
     $intro = new Cible_Form_Element_Editor('NR_TextIntro', array('mode' => Cible_Form_Element_Editor::ADVANCED));
     $intro->setLabel($this->getView()->getCibleText('form_label_newsletter_text_intro'))->setAttrib('class', 'largeEditor');
     $this->addElement($intro);
     // show online
     $showOnline = new Zend_Form_Element_Checkbox('NR_Online');
     $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);
     // email
     //            $regexValidate = new Cible_Validate_Email();
     //            $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('NR_AdminEmail');
     $email->setLabel($this->getView()->getCibleText('newsletter_form_label_admin_email'))->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->setAttrib('class', 'stdTextInput');
     /*$email->setDecorators(array(
           'ViewHelper',
           array('label', array('placement' => 'prepend')),
           array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_email'))
       ));*/
     // $email->setAttrib('class', 'newsletter_form_element text_email');
     $this->addElement($email);
 }
Пример #2
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $status = $options['status'];
     $planedDate = $options['planedDate'];
     $planedTime = $options['planedTime'];
     $collectionsData = $options['filterList'];
     $statusOptions = new Zend_Form_Element_Select('NR_Status');
     $statusOptions->setLabel('Action')->setAttrib('class', 'largeSelect');
     $statusOptions->addMultiOption('1', 'Terminé (Ne pas envoyer à nouveau)');
     $statusOptions->addMultiOption('2', "Envoyez à ceux qui ne l'ont pas reçu");
     $statusOptions->addMultiOption('3', 'Envoyez à tous les destinataires');
     $this->addElement($statusOptions);
     $send = new Zend_Form_Element_Submit('newsletter_send');
     $send->setLabel('Envoyer')->setAttrib('class', 'stdButton')->setOrder(2);
     $this->addActionButton($send);
     $collectionFilters = new Zend_Form_Element_Select('NR_CollectionFiltersID');
     $collectionFilters->setLabel($this->getView()->getCibleText('form_label_collection_name'))->setAttrib('class', 'largeSelect');
     //            $collectionsSelect = new NewsletterFilterCollectionsSet();
     //            $select = $collectionsSelect->select()
     //            ->order('NFCS_Name');
     //            $collectionsData = $collectionsSelect->fetchAll($select);
     $collectionFilters->addMultiOption(0, $this->getView()->getCibleText('newsletter_send_filter_selectOne'));
     foreach ($collectionsData as $key => $collection) {
         $collectionFilters->addMultiOption($key, $collection);
     }
     $this->addElement($collectionFilters);
     // MailingDateScheduled
     $datePicker = new Cible_Form_Element_DatePicker('NR_MailingDate', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true)));
     $datePicker->setLabel($this->getView()->getCibleText('form_label_releaseDate_planned_date'))->setAttrib('class', 'stdTextInput')->setValue($planedDate)->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);
     // MailingTimeScheduled
     $regexValidate = new Zend_Validate_Regex('/^([0-1]\\d|2[0-3]):([0-5]\\d)$/');
     $regexValidate->setMessage('Temps invalide (HH:MM)', 'regexNotMatch');
     $time = new Zend_Form_Element_Text('NR_MailingTime');
     $time->setLabel('HH:MM')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setValue($planedTime);
     $this->addElement($time);
 }
Пример #3
0
 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);
 }
Пример #4
0
 /**
  * Defines and build a date picker.
  * According to the parameter elem, it will set the element.
  *
  * $params['exclude']   => boolean; defines if the column is built.
  * $params['required '] => boolean;
  * $params['elem']      => select, checkbox, radio, editor;
  *                         If $params['elem'] = select, then the $params['src']
  *                         parameter must be defined.
  * $params['src']       => string; name of the source for the element.
  *
  * @param array $meta
  * @param array $params
  *
  * @return void
  */
 public function setElementDatepicker(array $meta, array $params)
 {
     $date = new Cible_Form_Element_DatePicker($this->_elemNameId, array('jquery.params' => array('changeYear' => true, 'changeMonth' => true, 'yearRange' => '-25:+10', 'altField' => '#' . $this->_elemNameId . 'Dt', 'altFormat' => 'yy-mm-dd', 'dateFormat' => 'dd-mm-yy', 'defaultDate' => "\$('#" . $this->_elemNameId . "').val()", 'YearOrdering' => 'desc')));
     $date->setLabel($this->getView()->getCibleText('form_label_' . $this->_elemNameId));
     if (!$meta['NULLABLE']) {
         $date->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     }
     if (!empty($params['validate'])) {
         $date->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'))));
     }
     $params['elem'] = 'hidden';
     $params['class'] = '';
     $meta['COLUMN_NAME'] = $meta['COLUMN_NAME'] . 'Dt';
     $this->setElementInput($meta, $params);
     $date = $this->_setBasicDecorator($date);
     $this->addElement($date);
 }
Пример #5
0
 /**
  * Add a date picker element to the form.
  *
  * @see Cible_Form_Element_DatePicker
  *
  * @param array $question
  *
  * @return void
  */
 private function _addDate($question)
 {
     $elemName = $question['FQT_TypeName'] . self::UNDERSCORE . $question['FQ_ElementID'];
     $options['jquery.params'] = array('changeYear' => true, 'changeMonth' => true);
     $element = new Cible_Form_Element_DatePicker($elemName, $options);
     $element->addValidator('Date', true, array('format' => 'dd-mm-yy', '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'))));
     $element->removeDecorator('DtDdWrapper');
     $element->addDecorators(array('UiWidgetElement', array('HtmlTag', array('tag' => 'div', 'class' => 'answer-zone'))));
     $element->setAttrib('class', 'dateTextInput');
     $element->setjQueryParam('dateFormat', 'dd-mm-yy');
     $this->_addExtras($element, $question);
     $this->addElement($element);
     $this->_displayGroupElements[] = $elemName;
 }