public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel($this->getView()->getCibleText('form_gallery_blockCategory_label'))->setAttrib('class', 'largeSelect')->setOrder(11); $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']); } $this->addElement($blockCategory); $blockGallery = new Zend_Form_Element_Select('Param2'); $blockGallery->setLabel($this->getView()->getCibleText('form_gallery_blockGallerey_label'))->setAttrib('class', 'largeSelect')->setOrder(12); $galleries = new Galleries(); $selectG = $galleries->select()->setIntegrityCheck(false)->from('Galleries')->join('GalleriesIndex', 'G_ID = GI_GalleryID')->where('G_Online = 1')->where('GI_LanguageID = ?', Zend_Registry::get("languageID"))->order('GI_Title'); $galleriesArray = $galleries->fetchAll($selectG); //echo $selectG; $blockGallery->addMultiOption('0', $this->getView()->getCibleText('form_gallery_blockGallerey_None')); foreach ($galleriesArray as $gallery) { $blockGallery->addMultiOption($gallery['GI_GalleryID'], $gallery['GI_Title']); } $this->addElement($blockGallery); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->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) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } // number of news to show in front-end (Parameter #2) $at_least_one = new Zend_Validate_GreaterThan('0'); $at_least_one->setMessage('Vous devez afficher au moins un événement.'); $not_null = new Zend_Validate_NotEmpty(); $not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field')); $blockNewsMax = new Zend_Form_Element_Text('Param2'); $blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput'); // show the breif text in front-end (Parameter #3) $blockShowBrief = new Zend_Form_Element_Checkbox('Param3'); $blockShowBrief->setLabel('Afficher le texte bref'); $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief)); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset')); }
function getAllNewsletterCategories() { $categoriesSelect = new Categories(); $select = $categoriesSelect->select()->setIntegrityCheck(false); $select->from('Categories')->join('CategoriesIndex', ' CI_CategoryID = C_ID')->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->where('C_ModuleID = 8')->order('CI_Title'); $categoriesData = $categoriesSelect->fetchAll($select); return $categoriesData; }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel($this->getView()->getCibleText('label_category_news_bloc'))->setAttrib('class', 'largeSelect')->setOrder(3); $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) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($blockCategory); // number of news to show in front-end (Parameter #2) $blockNewsMax = new Zend_Form_Element_Text('Param2'); $blockNewsMax->setLabel($this->getView()->getCibleText('label_number_news_show'))->setAttrib('class', 'smallTextInput')->setOrder(4); $this->addElement($blockNewsMax); // show the breif text in front-end (Parameter #3) $blockShowBrief = new Zend_Form_Element_Checkbox('Param3'); $blockShowBrief->setLabel($this->getView()->getCibleText('label_show_brief_text'))->setOrder(5); $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($blockShowBrief); // display order (Parameter #4) $blockOrder = new Zend_Form_Element_Select('Param4'); $blockOrder->setLabel($this->getView()->getCibleText('label_order_display'))->setAttrib('class', 'largeSelect')->setOrder(6); $blockOrder->addMultiOption('ND_Date DESC', $this->getView()->getCibleText('label_date_desc')); $blockOrder->addMultiOption('ND_Date ASC', $this->getView()->getCibleText('label_date_asc')); $blockOrder->addMultiOption('ND_Title ASC', $this->getView()->getCibleText('label_alpha_asc')); $this->addElement($blockOrder); // display news date (Parameter #5) $blockDate = new Zend_Form_Element_Checkbox('Param5'); $blockDate->setLabel($this->getView()->getCibleText('label_date_news'))->setOrder(7); $blockDate->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($blockDate); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3', 'Param4', 'Param5'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset')); }
public function __construct($options = null) { $this->_addSubmitSaveClose = true; parent::__construct($options); $imageSrc = $options['imageSrc']; $newsID = $options['newsID']; $isNewImage = $options['isNewImage']; $catagoryID = ""; if (isset($options['catagoryID'])) { $catagoryID = $options['catagoryID']; } if ($newsID == '') { $pathTmp = "../../../../../data/images/news/tmp"; } else { $pathTmp = "../../../../../data/images/news/{$newsID}/tmp"; } // hidden specify if new image for the news $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage)); $newImage->removeDecorator('Label'); $this->addElement($newImage); // Title $title = new Zend_Form_Element_Text('Title'); $title->setLabel($this->getView()->getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $label = $title->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($title); if (isset($options['categoriesList']) && $options['categoriesList'] == 'true') { // select box category (Parameter #1) $categoryNews = new Zend_Form_Element_Select('Param1'); $categoryNews->setLabel($this->getView()->getCibleText('form_label_news_category'))->setValue($catagoryID)->setAttrib('class', 'largeSelect'); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 2)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $categoryNews->addMultiOption($category['C_ID'], $category['CI_Title']); } $this->addElement($categoryNews); } // Date picker $date = new Cible_Form_Element_DatePicker('Date', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true))); $date->setLabel($this->getView()->getCibleText('form_label_date'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateInvalid' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateFalseFormat' => $this->getView()->getCibleText('validation_message_invalid_date')))); $this->addElement($date); // Date picker $datePicker = new Cible_Form_Element_DatePicker('ReleaseDate', array('jquery.params' => array('changeYear' => true, 'changeMonth' => true))); $datePicker->setLabel($this->getView()->getCibleText('form_extranet_news_label_releaseDate'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator('Date', true, array('messages' => array('dateNotYYYY-MM-DD' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateInvalid' => $this->getView()->getCibleText('validation_message_invalid_date'), 'dateFalseFormat' => $this->getView()->getCibleText('validation_message_invalid_date')))); $this->addElement($datePicker); // Status $status = new Zend_Form_Element_Checkbox('Status'); $status->setLabel('Nouvelle en ligne'); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($status); // IMAGE $imageTmp = new Zend_Form_Element_Hidden('ImageSrc_tmp'); $imageTmp->removeDecorator('Label'); $this->addElement($imageTmp); $imageOrg = new Zend_Form_Element_Hidden('ImageSrc_original'); $imageOrg->removeDecorator('Label'); $this->addElement($imageOrg); $imageView = new Zend_Form_Element_Image('ImageSrc_preview', array('onclick' => 'return false;')); $imageView->setImage($imageSrc); $this->addElement($imageView); $imagePicker = new Cible_Form_Element_ImagePicker('ImageSrc', array('onchange' => "document.getElementById('imageView').src = document.getElementById('ImageSrc').value", 'associatedElement' => 'ImageSrc_preview', 'pathTmp' => $pathTmp, 'contentID' => $newsID)); $imagePicker->removeDecorator('Label'); $this->addElement($imagePicker); $imageAlt = new Zend_Form_Element_Text("ImageAlt"); $imageAlt->setLabel($this->getView()->getCibleText('form_label_description_image'))->setAttrib('class', 'stdTextInput'); $this->addElement($imageAlt); // Breif text $breif = new Cible_Form_Element_Editor('Brief', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $breif->setLabel($this->getView()->getCibleText('form_label_short_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'mediumEditor'); $breif->setDecorators(array('ViewHelper', array('Errors', array('placement' => 'prepend')), array('label', array('placement' => 'prepend')))); $label = $breif->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($breif); // Text $text = new Cible_Form_Element_Editor('Text', array('mode' => Cible_Form_Element_Editor::ADVANCED)); $text->setLabel($this->getView()->getCibleText('form_label_text'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'mediumEditor')->setDecorators(array('ViewHelper', array('Errors', array('placement' => 'prepend')), array('label', array('placement' => 'prepend')))); $label = $text->getDecorator('Label'); $label->setOption('class', $this->_labelCSS); $this->addElement($text); $categoryID = new Zend_Form_Element_Hidden('CategoryID'); $this->addElement($categoryID); }
public function __construct($options = null) { $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 static function getRssCategories($lang = null) { $db = Zend_Registry::get("db"); if (is_null($lang)) { $lang = Zend_Registry::get('languageID'); } //$select = $db->select(); $category = new Categories(); $select = $category->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'CI_CategoryID = C_ID')->where('C_ShowInRss = 1')->where('CI_LanguageID = ?', $lang); $categoryData = $category->fetchAll($select); return $categoryData->toArray(); }
public function __construct() { $this->categories_list = Categories::select()->orderBy('category')->get(); $this->branch_list = Branch::select()->orderBy('id')->get(); $this->student_categories_list = StudentCategories::select()->orderBy('cat_id')->get(); }
public function setcategoryAction() { $form = new Zend_Form(); $form->setAction(PUBLIC_PATH . $this->getRequest()->getControllerName() . '/setcategory/'); $form->setMethod('post'); $form->setAttrib('id', 'CategoryForm'); $type = new Zend_Form_Element_Select('Categorie'); //$type->setLabel('Choisissez la catégorie de vos saisies'); $type->setRequired(true); $table = new Categories(); $select = $table->select(); $objects = $table->fetchAll($select); foreach ($objects as $object) { $type->addMultiOption($object->Id, $object->Name); } if (!empty($this->session->category)) { $type->setValue($this->session->category); } else { $type->setValue($objects[0]->Id); } $type->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', array('tag' => 'dd', 'class' => 'PositionCenter')))); $submit = new Zend_Form_Element_Submit('Enregistrer'); $form->addElement($type); $form->addElement($submit); if ($this->getRequest()->isPost() && $form->isValid($_POST)) { $values = $form->getValues(); $row = $table->find($values['Categorie'])->current(); unset($_COOKIE['PreviousCategory']); setcookie('PreviousCategory', $row->Id, time() + 365 * 24 * 60 * 60, '/'); $this->session->category = $row->Id; $this->session->categoryName = $row->Name; $this->session->message = '<div class = "success">Vos saisies seront désormais pris en compte et rentrés dans la catégorie <strong>' . $row->Name . '</strong></div>'; return $this->_forward('index'); } else { $this->rememberCategory(); $this->view->message .= '<div class = "notice">Choisissez le métier sur lequel vous souhaitez travailler</div>'; $this->view->form = $form; return $this->render('form'); } }
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); }