コード例 #1
1
ファイル: Module.php プロジェクト: anunay/stentors
 public function __construct($options = null)
 {
     parent::__construct($options);
     if (empty($this->tableName)) {
         throw new Exception('You need to set the $tableName protected variable in your Form instance');
     }
     $baseDir = $options['baseDir'];
     Zend_Registry::set('baseUrl', $baseDir);
     $cancel_url = $options['cancelUrl'];
     // Title
     $title = new Zend_Form_Element_Text($this->tableFieldPrefix . 'Title');
     $title->setLabel(Cible_Translation::getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
     $label = $title->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $this->addElement($title);
     // Status
     $status = new Zend_Form_Element_Select($this->tableFieldPrefix . 'Status');
     $status->setLabel(Cible_Translation::getCibleText('form_label_status'))->setAttrib('class', 'stdSelect');
     $db = $this->_db;
     $sql = 'SELECT * FROM Status';
     $status_options = $db->fetchAll($sql);
     foreach ($status_options as $_option) {
         $status->addMultiOption($_option['S_ID'], Cible_Translation::getCibleText("status_{$_option['S_Code']}"));
     }
     $this->addElement($status);
 }
コード例 #2
0
ファイル: AuthController.php プロジェクト: anunay/stentors
 function loginAction()
 {
     $form = $this->getForm();
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $auth = Zend_Auth::getInstance();
             // Setup adapter
             $adapter = new Zend_Auth_Adapter_DbTable($this->_db, 'Extranet_Users', 'EU_Username', 'EU_Password', 'MD5(?)');
             $adapter->setIdentity($_POST['username'])->setCredential($_POST['password']);
             // Authenticate
             $result = $auth->authenticate($adapter);
             switch ($result->getCode()) {
                 case Zend_Auth_Result::FAILURE:
                 case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
                 case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
                 case Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS:
                     $error = Cible_Translation::getCibleText('error_auth_failure');
             }
             if (!$result->isValid()) {
                 $this->view->assign('error', $error);
             } else {
                 $auth->getStorage()->write($adapter->getResultRowObject(array('EU_ID', 'EU_LName', 'EU_FName', 'EU_Email')));
                 // build ACL rights
                 $data = (array) $auth->getStorage()->read();
                 $acl = Cible_FunctionsAdministrators::getACLUser($data['EU_ID']);
                 $defaultSession = new Zend_Session_Namespace();
                 $defaultSession->acl = $acl;
                 $this->_redirect($this->getRequest()->getParam('redirect'));
             }
         }
     }
     $this->view->assign('form', $form);
 }
コード例 #3
0
 public static function getFilterCategories($moduleID)
 {
     $categories = self::getRootCategoriesList($moduleID);
     $choices = array('' => Cible_Translation::getCibleText('filter_empty_category'));
     foreach ($categories as $category) {
         if (!isset($choices[$category['C_ID']])) {
             $choices[$category['C_ID']] = $category['CI_Title'];
         }
     }
     return $choices;
 }
コード例 #4
0
 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')));
 }
コード例 #5
0
ファイル: Abstract.php プロジェクト: anunay/stentors
 public function listPositionsAction()
 {
     $_pageID = $this->_request->getParam('ID');
     $_zoneID = $this->_request->getParam('zoneID');
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $positions = Cible_FunctionsBlocks::getAllPositions($_pageID, $_zoneID);
     $cpt = count($positions);
     for ($i = 0; $i < $cpt; $i++) {
         $positions[$i]['BI_BlockTitle'] = htmlentities(str_replace('%TEXT%', $positions[$i]['BI_BlockTitle'], Cible_Translation::getCibleText("form_select_option_position_below")));
     }
     //echo Zend_Json::encode( Cible_FunctionsBlocks::getAllPositions($_pageID, $_zoneID) );
     echo Zend_Json::encode($positions);
 }
コード例 #6
0
ファイル: FunctionsBlocks.php プロジェクト: anunay/stentors
 public static function fillSelectPosition($Form, $PositionsArray, $Action, $blockPosition = 0)
 {
     $TotalPos = count($PositionsArray);
     if ($Action == 'update') {
         if ($TotalPos > 0) {
             $i = 0;
             foreach ($PositionsArray as $Pos) {
                 if ($i == 0) {
                     $Form->B_Position->addMultiOption('-1', 'Première position');
                 } else {
                     $Form->B_Position->addMultiOption($Pos["B_ID"], str_replace('%TEXT%', $PositionsArray[$i - 1]["BI_BlockTitle"], Cible_Translation::getCibleText("form_select_option_position_below")));
                 }
                 $i++;
             }
         } else {
             $Form->B_Position->addMultiOption('-1', 'Première position');
         }
     } else {
         if ($TotalPos > 0) {
             $Cpt = 0;
             foreach ($PositionsArray as $Pos) {
                 if ($Cpt == 0) {
                     $Form->B_Position->addMultiOption($Pos["B_Position"], 'Première position');
                     if ($Cpt == $TotalPos - 1 && $Action == "add") {
                         $Form->B_Position->addMultiOption($Pos["B_Position"] + 1, 'Dernière position');
                     }
                 } elseif ($Cpt == $TotalPos - 1) {
                     if ($Action == "add") {
                         $Form->B_Position->addMultiOption($Pos["B_Position"], str_replace('%TEXT%', $PositionsArray[$Cpt - 1]["BI_BlockTitle"], Cible_Translation::getCibleText("form_select_option_position_below")));
                         $Form->B_Position->addMultiOption($Pos["B_Position"] + 1, 'Dernière position');
                     } else {
                         $Form->B_Position->addMultiOption($Pos["B_Position"], 'Dernière position');
                     }
                 } else {
                     $Form->B_Position->addMultiOption($Pos["B_Position"], str_replace('%TEXT%', $PositionsArray[$Cpt - 1]["BI_BlockTitle"], Cible_Translation::getCibleText("form_select_option_position_below")));
                 }
                 $Cpt++;
             }
         } else {
             $Form->B_Position->addMultiOption('1', 'Première position');
         }
     }
     return $Form;
 }
コード例 #7
0
ファイル: DateRangePicker.php プロジェクト: anunay/stentors
 public function isValid($value, $context = null)
 {
     $result = parent::isValid($value, $context);
     if ($result) {
         $_ranges = $this->getValue();
         if (is_array($_ranges)) {
             $dateRange_validator = new Cible_Validate_DateRange('YY-mm-dd');
             $dateRange_validator->setMessages(array('dateNotYYYY-MM-DD' => Cible_Translation::getCibleText('validation_message_invalid_date_format'), 'endDateEarlier' => Cible_Translation::getCibleText('validation_message_endDate_earlier')));
             foreach ($_ranges as $_range) {
                 if (!$dateRange_validator->isValid($_range)) {
                     $this->addErrorMessages($dateRange_validator->getMessages());
                     $result = false;
                 }
             }
         }
         $errors = $this->getErrorMessages();
         $this->setErrorMessages(array_unique($errors));
     }
     return $result;
 }
コード例 #8
0
ファイル: FormBlockCatalog.php プロジェクト: anunay/stentors
 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(Cible_Translation::getCibleText('catalog_category_block_page'))->setAttrib('class', 'largeSelect')->setOrder(2);
     $langId = $this->getView()->_defaultEditLanguage;
     $oCategory = new CatalogCategoriesObject();
     $categories = $oCategory->getAll($langId);
     foreach ($categories as $category) {
         $blockCategory->addMultiOption($category['CC_ID'], $category['CCI_Name']);
     }
     $this->addElement($blockCategory);
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param1', 'Param999'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
 }
コード例 #9
0
ファイル: IndexController.php プロジェクト: anunay/stentors
 public function dictionnaryAction()
 {
     $identifier = $this->_getParam('identifier');
     $lang = $this->_getParam('lang');
     $type = $this->_getParam('type');
     $this->view->assign('success', 'false');
     $dictionaryForm = new FormDictionnary();
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($dictionaryForm->isValid($formData)) {
             Cible_Translation::set($identifier, $type, $formData['ST_Value'], $lang);
             $this->view->assign('success', 'true');
             $this->view->assign('value', $formData['ST_Value']);
         } else {
             $dictionaryForm->populate($formData);
         }
     } else {
         var_dump(Cible_Translation::__($identifier, $type, $lang));
         exit;
         $data = array('ST_Identifier' => $identifier, 'ST_Value' => Cible_Translation::__($identifier, $type, $lang), 'ST_LangID' => $lang, 'ST_Type' => $type);
         $dictionaryForm->populate($data);
     }
     $this->view->assign('form', $dictionaryForm);
 }
コード例 #10
0
ファイル: FormMenu.php プロジェクト: anunay/stentors
 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');
 }
コード例 #11
0
ファイル: FormNews.php プロジェクト: anunay/stentors
 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);
 }
コード例 #12
0
 public static function getNewAssociationSetBoxSelect($associationSetID, $fieldPrefix, $dataFieldToDisplay, $associationSetData, $associationSetCpt, $associationSetTitle, $associationsData, $associationArray = array(), $errorsMessage = array())
 {
     $idOffset = $fieldPrefix . 'ID';
     if (count($associationArray) == 0) {
         //            $associationArray[0] = -1;
     } else {
         $associationArrayTmp = array();
         foreach ($associationArray as $association) {
             $associationArrayTmp[] = $association;
         }
         $associationArray = $associationArrayTmp;
     }
     $cptAssociation = count($associationArray);
     $newSetBox = '';
     $newSetBox .= '<fieldset id="fieldset-' . $associationSetID . '">';
     $newSetBox .= ' <div id="associationSet_' . $associationSetCpt . '" class="associationSetContent" associationSetID="' . $associationSetID . '">';
     $newSetBox .= "     <div class='associationSetContent_action'>";
     $newSetBox .= "         <div class='action'>";
     $newSetBox .= "             <fieldset id='fieldset-actions-association'>";
     $newSetBox .= "                 <ul class='actions-buttons'>";
     $newSetBox .= "                     <li><button name='addAssociation' id='addAssociation' type='button' class='stdButton addAssociation'>Ajouter</button></li>";
     $newSetBox .= "                 </ul>";
     $newSetBox .= "             </fieldset>";
     $newSetBox .= "         </div>";
     $newSetBox .= "         <div class='title'>" . $associationSetTitle . "</div>";
     $newSetBox .= "     </div>";
     $newSetBox .= '     <div class="associationContent">';
     $newSetBox .= '         <input type="hidden" id="associationCountID" value="' . $cptAssociation . '"/>';
     $newSetBox .= '         <input type="hidden" id="associationCount" value="' . $cptAssociation . '"/>';
     $newSetBox .= '         <table cellpadding="0" cellspacing="0">';
     for ($i = 0; $i < $cptAssociation; $i++) {
         if ($i % 2) {
             $row = 'row_odd';
         } else {
             $row = 'row_even';
         }
         $newSetBox .= '             <tr class="association ' . $row . '" associationID="' . $i . '">';
         $newSetBox .= '                 <td class="tdSelectAssociationOption ' . $row . '">';
         if (count($associationArray) > 0) {
             $newSetBox .= '                    <select name="' . $associationSetID . 'Set[' . $i . '][colorID]" id="' . $associationSetID . 'Set" class="selectMenu selectAssociationOption">';
             $newSetBox .= "                         <option value='-1'>" . Cible_Translation::getCibleText("association_set_selectOne") . "-</option>";
             $selected = '';
             foreach ($associationsData as $association) {
                 $titleValue = '';
                 $class = '';
                 if (array_key_exists($associationSetData, $association)) {
                     $titleValue = $association[$associationSetData];
                     $class = 'color';
                 }
                 $newSetBox .= "                     <option value='" . $association[$idOffset] . "'";
                 if (isset($associationArray[$i]['value']) && $association[$idOffset] == $associationArray[$i]['value'] || $association[$idOffset] == $associationArray[$i] || isset($associationArray[$i]['colorID']) && $association[$idOffset] == $associationArray[$i]['colorID']) {
                     $newSetBox .= " selected='selected'";
                     $selected = $association[$idOffset];
                 }
                 $newSetBox .= " title='" . $titleValue . "' class='" . $class . "'>" . $association[$dataFieldToDisplay] . "</option>";
             }
             $newSetBox .= "                     </select> <span class='field_required'>*</span>";
             if (!empty($errorsMessage['emptyColorMsg']) && $selected < 1) {
                 $newSetBox .= '<ul class="errors">';
                 $newSetBox .= '<li>' . $errorsMessage['emptyColorMsg'] . '</li>';
                 $newSetBox .= '</ul>';
             }
         }
         $newSetBox .= "                 </td>";
         $newSetBox .= '                 <td class="tdSelectAssociationOption ' . $row . '">';
         if (count($associationArray) > 0) {
             $newSetBox .= '                     <select name="' . $associationSetID . 'Set[' . $i . '][type]" id="' . $associationSetID . 'SetType" class="selectAssociationOption">';
             $newSetBox .= "                         <option value='-1'>" . Cible_Translation::getCibleText("association_set_selectOne") . "-</option>";
             $hasSelected = false;
             $selectedFirst = '';
             $selectedSec = '';
             if (isset($associationArray[$i]['CCP_Type']) && $associationArray[$i]['CCP_Type'] == 1 || isset($associationArray[$i]['type']) && $associationArray[$i]['type'] == 1) {
                 $selectedFirst = true;
                 $hasSelected = true;
             } elseif (isset($associationArray[$i]['CCP_Type']) && $associationArray[$i]['CCP_Type'] == 2 || isset($associationArray[$i]['type']) && $associationArray[$i]['type'] == 2) {
                 $selectedSec = true;
                 $hasSelected = true;
             }
             $newSetBox .= "                         <option value='1'" . ($selectedFirst ? 'selected="selected" ' : "") . ">" . Cible_Translation::getCibleText("association_set_colorType_available") . "</option>";
             $newSetBox .= "                         <option value='2'" . ($selectedSec ? 'selected="selected" ' : "") . ">" . Cible_Translation::getCibleText("association_set_colorType_order") . "</option>";
             $newSetBox .= "                     </select> <span class='field_required'>*</span>";
             if (!empty($errorsMessage['emptyTypeMsg']) && !$hasSelected) {
                 $newSetBox .= '<ul class="errors">';
                 $newSetBox .= '<li>' . $errorsMessage['emptyTypeMsg'] . '</li>';
                 $newSetBox .= '</ul>';
             }
         }
         $newSetBox .= "                 </td>";
         $newSetBox .= '                 <td class="tdAssociationAction ' . $row . '">';
         if (count($associationArray) > 0) {
             $newSetBox .= "                     <div class='action'>";
             $newSetBox .= "                         <fieldset id='fieldset-actions-association'>";
             $newSetBox .= "                             <ul class='actions-buttons'>";
             $newSetBox .= "                                 <li><button name='deleteAssociation' id='deleteAssociation' type='button' class='stdButton delAssociation'>Supprimer</button></li>";
             $newSetBox .= "                             </ul>";
             $newSetBox .= "                         </fieldset>";
             $newSetBox .= "                     </div>";
         }
         $newSetBox .= "                 </td>";
         $newSetBox .= "             </tr>";
     }
     $newSetBox .= "         </table>";
     $newSetBox .= "     </div>";
     $newSetBox .= " </div>";
     $newSetBox .= "</fieldset>";
     return $newSetBox;
 }
コード例 #13
0
ファイル: GetClientText.php プロジェクト: anunay/stentors
 public function getClientText($key, $lang = null)
 {
     return Cible_Translation::__($key, Cible_Translation::TRANSLATION_TYPE_CLIENT, $lang);
 }
コード例 #14
0
ファイル: FormEvents.php プロジェクト: anunay/stentors
 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);
 }
コード例 #15
0
ファイル: FunctionsGeneral.php プロジェクト: anunay/stentors
 /**
  * Fetch salutation identifier and retrieve text fron static texts table.
  *
  * @param int $id   <OPTIONAL> If null then all the salutations will be returned.
  * @param int $lang <OPTIONAL> If null then the language id will be setted.
  *
  * @return array
  */
 public static function getSalutations($id = null, $lang = null)
 {
     $db = Zend_Registry::get("db");
     if (is_null($lang)) {
         $lang = Zend_Registry::get('languageID');
     }
     $select = $db->select();
     $select->from('Salutations', array('ID' => 'S_ID', 'value' => 'S_StaticTitle'));
     if ($id) {
         $select->where('Salutations.S_ID = ?', $id);
     }
     $salutations = $db->fetchAll($select);
     $result = array();
     foreach ($salutations as $salutation) {
         $result[$salutation['ID']] = Cible_Translation::getCibleText($salutation['value'], $lang);
     }
     return $result;
 }
コード例 #16
0
 public function setKeywords($value)
 {
     if (!empty($value) && $value != Cible_Translation::getCibleText('form_search_catalog_keywords_label')) {
         $this->_keywords = explode(" ", trim($value));
     }
 }
コード例 #17
0
 public function _jobsListSrc($meta = array())
 {
     $src = array();
     $oRef = new ReferencesObject();
     $roles = $oRef->getRefByType('jobs');
     $src[0] = Cible_Translation::getCibleText('form_select_default_label');
     foreach ($roles as $role) {
         $src[$role['R_ID']] = $role['RI_Value'];
     }
     return $src;
 }
コード例 #18
0
ファイル: FunctionsModules.php プロジェクト: anunay/stentors
 public static function getLocalizedModuleTitle($module)
 {
     return ' > ' . Cible_Translation::getCibleText("Module_{$module}");
 }
コード例 #19
0
ファイル: FunctionsPages.php プロジェクト: anunay/stentors
 public static function fillSelectTemplates($Form, $templates)
 {
     foreach ($templates as $template) {
         $Form->P_ViewID->addMultiOption($template['V_ID'], Cible_Translation::getCibleText("form_select_option_zoneViews_" . $template['V_ID']));
     }
     return $Form;
 }
コード例 #20
0
ファイル: FormSectionObject.php プロジェクト: anunay/stentors
 /**
  * Build the html code for section rendering
  *
  * @access private
  *
  * @param string $icone         Path to the section icon (gif).
  * @param string $sectionTitle  Title of the section.
  * @param string $formSectionID String for the id tad of the section.
  * @param int    $sectionSeq    Position of the section in the form.
  * @param string $chkTitle      Title checkbox is checked or not.
  * @param string $chkRepeat     Repeat checkbox is checked or not.
  * @param int    $RepeatMin     Initiate the minimum of repetition.
  * @param int    $RepeatMax     Initiate the maximum of repetition.
  * @param int    $pageBreakVal  Initiate the page break render (default = 0)
  * @param string $elements      Html code for the elements (texzone or question)
  * @param string $pageBreak     Page break html code for rendering.
  * @param string $titleStyle    html style tag to hide or display the title.
  *
  * @return string $html The html code
  */
 private function _render($icone, $sectionTitle = 'new section', $formSectionID = '', $sectionSeq = '', $chkTitle = 'checked="checked"', $chkRepeat = '', $RepeatMin = '1', $RepeatMax = '5', $pageBreakVal = '0', $elements = '&nbsp;', $pageBreak = '&nbsp;', $titleStyle = '')
 {
     $titleLbl = Cible_Translation::getCibleText('form_section_title_label');
     $showTitleLbl = Cible_Translation::getCibleText('form_section_showtitle_label');
     $repeatLbl = Cible_Translation::getCibleText('form_section_repeat_label');
     $repeatMinLbl = Cible_Translation::getCibleText('form_section_repeatMin_label');
     $repeatMaxLbl = Cible_Translation::getCibleText('form_section_repeatMax_label');
     $html = chr(13);
     $html .= "  <div class='section'>" . chr(13);
     $html .= "      <div>" . chr(13);
     $html .= "          <img class='sortableSection' alt='' src='{$icone}' />" . chr(13);
     $html .= "          <div class='floatRight'>" . chr(13);
     $html .= "              <a class='section_options_link' elementType='section'>Options</a>";
     $html .= "              &nbsp;|&nbsp;" . chr(13);
     $html .= "              <a class='section_delete_link' elementType='section'>Supprimer</a>" . chr(13);
     $html .= "          </div>" . chr(13);
     $html .= "          <p class=\"section_title\">" . $sectionTitle . "</p>" . chr(13);
     $html .= "          <form id=\"" . $formSectionID . "\" action=\"\" class=\"params\"" . $titleStyle . " >" . chr(13);
     $html .= "              <input type=\"hidden\" class=\"\" id=\"FS_Seq\" value=\"" . $sectionSeq . "\" />" . chr(13);
     $html .= "              <label for=\"FSI_Title\">" . $titleLbl;
     $html .= "              </label>" . chr(13);
     $html .= "              <input type=\"text\" class=\"section_title_edit\" id=\"FSI_Title\" value=\"" . $sectionTitle . "\"/>" . chr(13);
     $html .= "              <br><input type=\"checkbox\" class=\"label_after_checkbox\" id=\"FS_ShowTitle\" " . $chkTitle . "/>" . chr(13);
     $html .= "              <label for=\"FS_ShowTitle\" class='after_checkbox'>" . $showTitleLbl;
     $html .= "              </label>" . chr(13);
     $html .= "              <input type=\"hidden\" class=\"label_after_checkbox\" id=\"FS_Repeat\" " . $chkRepeat . "/>" . chr(13);
     //      $html .= "              <label for=\"FS_Repeat\">" . utf8_encode($repeatLbl);
     //      $html .= "              </label>" . chr(13);
     $html .= "              <input type=\"hidden\" class=\"section_RepeatMin\" id=\"FS_RepeatMin\" value=\"" . $RepeatMin . "\"/>" . chr(13);
     //      $html .= "              <label for=\"FS_RepeatMin\">" . utf8_encode($repeatMinLbl);
     //      $html .= "              </label>" . chr(13);
     $html .= "              <input type=\"hidden\" class=\"section_RepeatMax\" id=\"FS_RepeatMax\" value=\"" . $RepeatMax . "\"/>" . chr(13);
     //      $html .= "              <label for=\"FS_RepeatMax\">" . utf8_encode($repeatMaxLbl);
     //      $html .= "              </label>" . chr(13);
     $html .= "              <input type=\"hidden\" class=\"\" id=\"FS_PageBreak\" value=\"" . $pageBreakVal . "\" />" . chr(13);
     $html .= "          </form>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "      <div class='drop_zone'>" . chr(13);
     $html .= "          <ul class='section_drop_zone connectedSortable_section ui-sortable'>" . $elements . "</ul>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "      <div class='drop_zone'>" . chr(13);
     $html .= "          <ul class='breakpage_drop_zone connectedSortable_section ui-sortable'>" . $pageBreak . "</ul>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "  </div>" . chr(13);
     return $html;
 }
コード例 #21
0
ファイル: FormContact.php プロジェクト: anunay/stentors
    public function __construct($options = null)
    {
        $this->_disabledDefaultActions = true;
        parent::__construct($options);
        $baseDir = $this->getView()->baseUrl();
        $this->getView()->jQuery()->addJavascriptFile("{$this->getView()->baseUrl()}/js/jquery/jquery.maskedinput-1.2.2.min.js");
        $script1 = <<<EOS

            \$('.phone_format').mask('(999) 999-9999? x99999');
            \$('.postalCode_format').mask('a9a 9a9');
            \$('.birthDate_format').mask('9999-99-99');

EOS;
        $this->getView()->headScript()->appendScript($script1);
        $script2 = <<<EOS

            function refreshCaptcha(id){
                \$.getJSON('{$this->getView()->baseUrl()}/forms/index/captcha-reload',
                    function(data){
                        \$("dd#dd_captcha img").attr({src : data['url']});
                        \$("#"+id).attr({value: data['id']});
                });
            }

EOS;
        $this->getView()->headScript()->appendScript($script2);
        // name
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel($this->getView()->getCibleText('forms_label_name'))->setAttrib('class', 'stdTextInput');
        // enterprise
        $enterprise = new Zend_Form_Element_Text('prenom');
        $enterprise->setLabel($this->getView()->getCibleText('forms_label_surname'))->setAttrib('class', 'stdTextInput');
        // email
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel($this->getView()->getClientText('forms_become_partner_label_email'))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_field_required'))))->addValidator('EmailAddress', true, array('messages' => Cible_Translation::getCibleText('validation_message_emailAddressInvalid')))->setRequired(true)->setAttrib('class', 'stdTextInput');
        // Commentaires
        $commentaire = new Zend_Form_Element_Textarea('commentaire');
        $commentaire->setLabel($this->getView()->getCibleText('form_label_comments'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextarea');
        $this->addElement($enterprise);
        $this->addElement($name);
        $this->addElement($email);
        $this->addElement($commentaire);
        // Captcha
        $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('newsletter_captcha_label'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 6, 'height' => 50, 'width' => 150, 'timeout' => 600, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp")));
        $captcha->setAttrib('class', 'mediumTextInput');
        $captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))));
        $this->addElement($captcha);
        $french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.');
        $english = array('badCaptcha' => 'Captcha value is wrong');
        $translate = new Zend_Translate('array', $french, 'fr');
        $this->setTranslator($translate);
        $this->getView()->jQuery()->enable();
        // Refresh button
        $refresh_captcha = new Zend_Form_Element_Button('refresh_captcha');
        $refresh_captcha->setLabel($this->getView()->getCibleText('button_captcha_refresh'))->setAttrib('onclick', "refreshCaptcha('captcha[id]')")->setAttrib('class', 'grayish-button')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
        $refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
        $this->addElement($refresh_captcha);
        // Submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($this->getView()->getCibleText('button_submit'))->setAttrib('class', 'grayish-button')->removeDecorator('DtDdWrapper');
        $submit->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'openOnly' => true))));
        $this->addElement($submit);
    }
コード例 #22
0
ファイル: FormPage.php プロジェクト: anunay/stentors
 public function __construct($options = null)
 {
     $this->_addSubmitSaveClose = true;
     parent::__construct($options);
     $this->setName('page');
     //$imageSrc = $options['imageSrc'];
     $pageID = $options['pageID'];
     $imageHeaderArray = $options['imageHeaderArray'];
     // contains the id of the page
     $id = new Zend_Form_Element_Hidden('id');
     $id->removeDecorator('Label');
     $id->removeDecorator('HtmlTag');
     // input text for the title of the page
     $title = new Zend_Form_Element_Text('PI_PageTitle');
     $title->setLabel($this->getView()->getCibleText('label_titre_page'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->setAttrib('class', 'stdTextInput')->setAttrib('onBlur', 'javascript:fillInControllerName();');
     $lblTit = $title->getDecorator('Label');
     $lblTit->setOption('class', $this->_labelCSS);
     // input text for the index of the page
     $uniqueIndexValidator = new Zend_Validate_Db_NoRecordExists('PagesIndex', 'PI_PageIndex');
     $uniqueIndexValidator->setMessage($this->getView()->getCibleText('label_index_already_exists'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND);
     $reservedWordValidator = new Cible_Validate_Db_NoRecordExists('Modules', 'M_MVCModuleTitle');
     $reservedWordValidator->setMessage($this->getView()->getCibleText('label_index_reserved'), Zend_Validate_Db_NoRecordExists::ERROR_RECORD_FOUND);
     $index = new Zend_Form_Element_Text('PI_PageIndex');
     $index->setLabel($this->getView()->getCibleText('label_name_controller'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => Cible_Translation::getCibleText('error_field_required')))->addValidator('stringLength', true, array(1, 50, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => $this->getView()->getCibleText('label_index_more_char'), Zend_Validate_StringLength::TOO_LONG => $this->getView()->getCibleText('label_index_less_char'))))->addValidator('regex', true, array('/^[a-z0-9][a-z0-9_-]*[a-z0-9]$/', 'messages' => $this->getView()->getCibleText('label_only_character_allowed')))->addValidator($uniqueIndexValidator, true)->addValidator($reservedWordValidator, true)->setAttrib('class', 'stdTextInput');
     $lblId = $index->getDecorator('Label');
     $lblId->setOption('class', $this->_labelCSS);
     // textarea for the meta and title of the page
     $metaTitle = new Zend_Form_Element_Textarea('PI_MetaTitle');
     $metaTitle->setLabel('Titre (meta)')->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort');
     $lblMetaTitle = $metaTitle->getDecorator('Label');
     $lblMetaTitle->setOption('class', $this->_labelCSS);
     // textarea for the meta description of the page
     $metaDescription = new Zend_Form_Element_Textarea('PI_MetaDescription');
     $metaDescription->setLabel($this->getView()->getCibleText('label_description_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort');
     $lblMetaDescr = $metaDescription->getDecorator('Label');
     $lblMetaDescr->setOption('class', $this->_labelCSS);
     // textarea for the meta keywords of the page
     $metaKeyWords = new Zend_Form_Element_Textarea('PI_MetaKeywords');
     $metaKeyWords->setLabel($this->getView()->getCibleText('label_keywords_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort');
     $lblMetaKey = $metaKeyWords->getDecorator('Label');
     $lblMetaKey->setOption('class', $this->_labelCSS);
     // textarea for the meta keywords of the page
     $metaOthers = new Zend_Form_Element_Textarea('PI_MetaOther');
     $metaOthers->setLabel($this->getView()->getCibleText('label_other_meta'))->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextareaShort');
     $lblMetaOther = $metaOthers->getDecorator('Label');
     $lblMetaOther->setOption('class', $this->_labelCSS);
     // select box for the templates
     $layout = new Zend_Form_Element_Select('P_LayoutID');
     $layout->setLabel($this->getView()->getCibleText('label_layout_page'))->setAttrib('class', 'stdSelect');
     // select box for the templates
     $template = new Zend_Form_Element_Select('P_ViewID');
     $template->setLabel($this->getView()->getCibleText('label_model_page'))->setAttrib('class', 'stdSelect');
     // checkbox for the status (0 = offline, 1 = online)
     $status = new Zend_Form_Element_Checkbox('PI_Status');
     $status->setValue(1);
     $status->setLabel($this->getView()->getCibleText('form_check_label_online'));
     $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     // checkbox for the show title of the page (0 = offline, 1 = online)
     $showTitle = new Zend_Form_Element_Checkbox('P_ShowTitle');
     $showTitle->setValue(1);
     $showTitle->setLabel($this->getView()->getCibleText('form_check_label_show_title'));
     $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     // image group
     // ImageSrc
     /*$imageSrc = new Zend_Form_Element_Select('P_BannerGroupID');
             $imageSrc->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class','stdSelect');
             $imageSrc->addMultiOption('', 'Sans image');
     
             $group = new GroupObject();
             $groupArray = $group->groupCollection();
             foreach ($groupArray as $group1)
             {
                 $imageSrc->addMultiOption($group1['BG_ID'],$group1['BG_Name']);
             }*/
     // page image
     $imageSrc = new Zend_Form_Element_Select('PI_TitleImageSrc');
     $imageSrc->setLabel("Image de l'entête")->setAttrib('class', 'stdSelect');
     $imageSrc->addMultiOption('', 'Sans image');
     $i = 1;
     foreach ($imageHeaderArray as $img => $path) {
         $imageSrc->addMultiOption($path, $path);
         $i++;
     }
     $altImage = new Zend_Form_Element_Text('PI_AltPremiereImage');
     $altImage->setLabel($this->getView()->getCibleText('label_altFirstImage'))->setAttrib('class', 'stdTextInput');
     // add element to the form
     $this->addElements(array($title, $index, $status, $showTitle, $layout, $template, $imageSrc, $altImage, $metaTitle, $metaDescription, $metaKeyWords, $metaOthers, $id));
 }
コード例 #23
0
 public function addNewChoiceLine($optionId = 0, $type = '')
 {
     $inputType = 'radio';
     if ($optionId == 0) {
         $optionId = $this->_currentId;
     }
     if ($this->_typeName == 'multi') {
         $inputType = 'checkbox';
     }
     $file = new Cible_View_Helper_BaseUrl();
     $deleteTitle = Cible_Translation::getCibleText('button_delete');
     $html = "<tr id='responseOption_" . $optionId . "' class='ui-state-default option option_response ui-draggable'>" . chr(13);
     $html .= "    <td id='FRO_Seq'>" . chr(13);
     $html .= "       " . chr(13);
     $html .= "        <input id='FRO_Seq' type='hidden' value='" . $this->_sequence . "' />" . chr(13);
     $html .= "    </td>" . chr(13);
     $html .= "    <td>" . chr(13);
     $html .= "        <input id='FROI_Label' type='text' class='optionValue' value='" . $this->_label . "' />" . chr(13);
     $html .= "    </td>" . chr(13);
     $html .= "    <td>" . chr(13);
     $html .= "        <input id='FRO_Default' type='" . $inputType . "' class='radio' " . $this->_defaultChecked . " name='default' value='' />" . chr(13);
     $html .= "    </td>" . chr(13);
     $html .= "    <td>" . chr(13);
     $html .= "        <input id='FRO_Other' type='checkbox' class='radio' " . $this->_detailsChecked . " name='details' value='' />" . chr(13);
     $html .= "    </td>" . chr(13);
     $html .= "    <td>" . chr(13);
     $html .= "        <input type='button' id='" . $this->_typeName . "_" . $optionId . "' class='delete' title='" . $deleteTitle . "' elementtype='option' value=' ' />" . chr(13);
     $html .= "    </td>" . chr(13);
     $html .= "</tr>" . chr(13);
     return $html;
 }
コード例 #24
0
ファイル: GetCibleText.php プロジェクト: anunay/stentors
 public function getCibleText($key, $lang = null)
 {
     return Cible_Translation::__($key, Cible_Translation::TRANSLATION_TYPE_CIBLE, $lang);
 }
コード例 #25
0
ファイル: FormTextObject.php プロジェクト: anunay/stentors
 /**
  * Build the html code.
  *
  * @access private
  * @param  string $icon       Path to the icon image.
  * @param  string $text       Content of the text zone.
  * @param  string $textZoneId Content for the id tag of the text zone.
  * @param  string $formElemId Content for the id tag of the element.
  *
  * @return string $html Html code for the zone text.
  */
 private function _render($icon, $text, $textZoneId = 1, $formElemId = '', $elemSeq = 1, $href = '')
 {
     $html = chr(13);
     $html .= "  <div id=\"" . $textZoneId . "\" class='textzone'>" . chr(13);
     $html .= "      <div class='header'>" . chr(13);
     $html .= "          <img class='sortableElement' alt='' src=\"" . $icon . "\" />" . chr(13);
     $html .= "          <form id='" . $formElemId . "' action='' class='hidden'>" . chr(13);
     $html .= "              <input id='FE_Seq' class='hidden' value='" . $elemSeq . "'/>" . chr(13);
     $html .= "          </form>" . chr(13);
     $html .= "          <div class='floatRight'>" . chr(13);
     $html .= "              <p class='textzone'>Zone de texte (ceci n'est pas une question)</p>" . chr(13);
     $html .= "              <p class='links'>" . chr(13);
     $html .= "                  <a href=\"" . $href . "\" class='textzone_edit_link'\r\n                                            elementType='textzone'>" . Cible_Translation::getCibleText('form_element_edit_link') . "</a>" . chr(13);
     $html .= "                  &nbsp;|&nbsp;" . chr(13);
     $html .= "                  <a class='textzone_delete_link' elementType='textzone'>" . Cible_Translation::getCibleText('form_element_delete_link') . "</a>" . chr(13);
     $html .= "              </p>" . chr(13);
     $html .= "          </div>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "      <div class='center' style='clear:both;'>" . chr(13);
     $html .= "          <div class='previewText'>" . chr(13);
     $html .= $text . chr(13);
     $html .= "          </div>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "  </div>" . chr(13);
     return $html;
 }
コード例 #26
0
ファイル: GenerateForm.php プロジェクト: anunay/stentors
 protected function _modulesSrc(array $meta = array())
 {
     $modules = Cible_FunctionsModules::getModules();
     foreach ($modules as $data) {
         $this->_srcData[$data['M_ID']] = Cible_Translation::getCibleText($data['M_MVCModuleTitle'] . "_module_name");
     }
 }
コード例 #27
0
ファイル: IndexController.php プロジェクト: anunay/stentors
 /**
  * Saves quote request data and send email to client and manager.
  *
  * @return void
  */
 public function sendOrder()
 {
     $session = new Zend_Session_Namespace('order');
     $page = Cible_FunctionsCategories::getPagePerCategoryView(0, 'list_collections', 14);
     if (!count($session->customer)) {
         $this->_redirect($page);
     }
     $oCart = new Cart();
     // Créer les tableaux pour sauvegarder les données de la commande
     $language = Cible_FunctionsGeneral::getLanguageTitle($session->customer['identification']['language']);
     $custAccount = array('O_LastName' => $session->customer['identification']['lastName'], 'O_FirstName' => $session->customer['identification']['firstName'], 'O_Email' => $session->customer['identification']['email'], 'O_AcombaId' => $session->customer['identification']['acombaNum'], 'O_Salutation' => $session->customer['identification']['salutation'], 'O_Language' => $language);
     if (!empty($session->customer['addressFact']['A_CityId'])) {
         $cityBill = $session->customer['addressFact']['A_CityId'];
     } else {
         $cityBill = $session->customer['addressFact']['A_CityTextValue'];
     }
     if (!empty($session->customer['addressShipping']['A_CityId'])) {
         $cityShip = $session->customer['addressShipping']['A_CityId'];
     } else {
         $cityShip = $session->customer['addressShipping']['A_CityTextValue'];
     }
     $addressBilling = array('O_FirstBillingTel' => $session->customer['addressFact']['AI_FirstTel'], 'O_SecondBillingTel' => $session->customer['addressFact']['AI_SecondTel'], 'O_FirstBillingAddr' => $session->customer['addressFact']['AI_FirstAddress'], 'O_SecondBillingAddr' => $session->customer['addressFact']['AI_SecondAddress'], 'O_BillingCity' => $cityBill, 'O_BillingState' => $session->customer['addressFact']['A_StateId'], 'O_BillingCountry' => $session->customer['addressFact']['A_CountryId'], 'O_ZipCode' => $session->customer['addressFact']['A_ZipCode']);
     $addressShipping = array('O_FirstShippingTel' => $session->customer['addressShipping']['AI_FirstTel'], 'O_SecondShippingTel' => $session->customer['addressShipping']['AI_FirstTel'], 'O_FirstShippingAddr' => $session->customer['addressShipping']['AI_FirstAddress'], 'O_SecondShippingAddr' => $session->customer['addressShipping']['AI_SecondAddress'], 'O_ShippingCity' => $cityShip, 'O_ShippingState' => $session->customer['addressShipping']['A_StateId'], 'O_ShippingCountry' => $session->customer['addressShipping']['A_CountryId'], 'O_ShippingZipCode' => $session->customer['addressShipping']['A_ZipCode']);
     $paid = false;
     $responseId = 0;
     $datePayed = 0;
     $bankTransId = 0;
     $cardHolder = '';
     $cardNumber = '';
     $cardType = '';
     $chargeTotal = $session->order['charge_total'];
     $cardexpiryDate = 0;
     if (isset($session->order['confirmation'])) {
         $paid = true;
         $responseId = $session->order['confirmation']['response_order_id'];
         $datePayed = $session->order['confirmation']['date_stamp'] . ' ' . $session->order['confirmation']['time_stamp'];
         $bankTransId = $session->order['confirmation']['bank_transaction_id'];
         $cardHolder = $session->order['confirmation']['cardholder'];
         $cardNumber = $session->order['confirmation']['f4l4'];
         switch ($session->order['confirmation']['card']) {
             case 'V':
                 $cardType = 'INTERNET';
                 break;
             case 'M':
                 $cardType = 'INTERNET';
                 break;
             default:
                 break;
         }
         if ($session->customer['paymentMeans'] == 'visa' || $session->customer['paymentMeans'] == 'mastercard') {
             $cardType = 'INTERNET';
         }
         $cardexpiryDate = $session->order['confirmation']['expiry_date'];
         $chargeTotal = $session->order['confirmation']['charge_total'];
     }
     $transFees = $session->order['shipFee'];
     $display = true;
     if (Cible_FunctionsGeneral::compareFloats($session->order['subTotal'], ">=", $session->order['limitShip'])) {
         $display = false;
         $transFees = 0;
     }
     $nbPoints = 0;
     if ($session->customer['identification']['cumulPoint']) {
         $nbPoints = $session->order['nbPoint'];
     }
     $orderData = array('O_ResponseOrderID' => $responseId, 'O_ClientProfileId' => $session->customer['identification']['member_id'], 'O_Comments' => $session->customer['O_Comments'], 'O_CreateDate' => date('Y-m-d H:i:s', time()), 'O_ApprobDate' => date('Y-m-d H:i:s', time()), 'O_SubTotal' => $session->order['subTotal'], 'O_TotTaxProv' => $session->order['taxProv'], 'O_TotTaxFed' => $session->order['taxFed'], 'O_RateTaxProv' => sprintf('%.2f', $session->order['rateProv']['TP_Rate']), 'O_RateTaxFed' => $session->order['rateFed'], 'O_TaxProvId' => $session->stateId, 'O_TransFees' => $transFees, 'O_Total' => $session->order['charge_total'], 'O_PaymentMode' => $session->customer['paymentMeans'], 'O_Paid' => $paid, 'O_DatePayed' => $datePayed, 'O_BankTransactionId' => $bankTransId, 'O_CardHolder' => $cardHolder, 'O_CardNum' => $cardNumber, 'O_CardType' => $cardType, 'O_CardExpiryDate' => $cardexpiryDate, 'O_TotalPaid' => $chargeTotal, 'O_BonusPoint' => $session->order['nbPoint']);
     $order = array_merge($orderData, $addressBilling, $addressShipping, $custAccount);
     //Enregistrer la commades dans la db
     //Recuprer l'id pour inserer le numéro de commande
     $oOrder = new OrderObject();
     $orderId = $oOrder->insert($order, 1);
     //Créer le numéro de commade
     $OrderNumber = 'I' . $orderId;
     //Mettre à jour la cde avec son numéro
     $oOrder->save($orderId, array('O_OrderNumber' => $OrderNumber), 1);
     $memberInfos = $session->customer['identification'];
     //Créer les données pour les lignes de commades
     $oOrderLine = new OrderLinesObject();
     $oCart = new Cart();
     $allIds = $oCart->getAllIds();
     $oProduct = new ProductsCollection();
     $oItems = new ItemsObject();
     $productData = array();
     $productItems = array();
     foreach ($allIds['cartId'] as $key => $id) {
         $itemId = $allIds['itemId'][$key];
         $prodId = $allIds['prodId'][$key];
         // Récupérer la ligne du cart
         $cartDetails = $oCart->getItem($id, $itemId);
         if (!$cartDetails['Disable']) {
             // Récupérer les produits
             $productData = $oProduct->getDetails($prodId, $itemId);
             // Recupérer les items
             $itemDetails = $oItems->getAll(null, true, $itemId);
             //Calcul des taxes et des montants
             $price = $cartDetails['Quantity'] * $itemDetails[0]['I_PriceVol1'];
             $discount = abs($price - $cartDetails['Total']);
             $itemPrice = $cartDetails['Total'] / $cartDetails['Quantity'];
             $codeProd = $itemDetails[0]['I_ProductCode'];
             $taxProv = Cible_FunctionsGeneral::provinceTax($cartDetails['Total']);
             $taxFed = 0;
             if ($session->stateId == 11) {
                 $taxFed = Cible_FunctionsGeneral::federalTax($cartDetails['Total']);
             }
             // Tableau pour la liste des données
             $lineData = array('OL_ProductId' => $prodId, 'OL_OrderId' => $orderId, 'OL_ItemId' => $itemId, 'OL_Type' => 'LigneItem', 'OL_Quantity' => $cartDetails['Quantity'], 'OL_ProductCode' => $codeProd, 'OL_Price' => $itemPrice, 'OL_Discount' => $discount, 'OL_FinalPrice' => $cartDetails['Total'], 'OL_FirstTax' => $itemDetails[0]['I_TaxFed'], 'OL_SecondTax' => $itemDetails[0]['I_TaxProv'], 'OL_TotFirstTax' => $taxFed, 'OL_TotSecondTax' => $taxProv, 'OL_Description' => $productData['data']['PI_Name'] . ' - ' . $itemDetails[0]['II_Name']);
             //Enregistrer les lignes
             if ($cartDetails['PromoId'] > 0) {
                 $lineDataTxt = array('OL_ProductId' => $prodId, 'OL_OrderId' => $orderId, 'OL_ItemId' => $itemId, 'OL_Type' => 'LigneTexte', 'OL_Description' => Cible_Translation::getClientText('alert_special_offer_item'));
                 $oOrderLine->insert($lineDataTxt, 1);
                 $lineData['OL_Price'] = $cartDetails['Total'] / $cartDetails['Quantity'];
                 array_push($productItems, $lineDataTxt);
             }
             $oOrderLine->insert($lineData, 1);
             array_push($productItems, $lineData);
         }
     }
     // send a notification to the client
     // Set data to the view
     $this->_emailRenderData['emailHeader'] = "<img src='" . Zend_Registry::get('absolute_web_root') . "/themes/default/images/common" . "/logoEmail.jpg' alt='' border='0'>";
     $this->_emailRenderData['footer'] = $this->view->getClientText("email_notification_footer");
     $this->view->assign('template', $this->_emailRenderData);
     $this->view->assign('subTotal', $session->order['subTotal']);
     $this->view->assign('orderNumber', $OrderNumber);
     $this->view->assign('orderNumber', $OrderNumber);
     $this->view->assign('custAccount', $custAccount);
     $this->view->assign('addressBilling', $addressBilling);
     $this->view->assign('addressShipping', $addressShipping);
     $this->view->assign('cardType', $cardType);
     $this->view->assign('cardHolder', $cardHolder);
     $this->view->assign('cardNumber', $cardNumber);
     $this->view->assign('cardExpiryDate', $cardexpiryDate);
     $this->view->assign('productItems', $productItems);
     $this->view->assign('chargeTotal', $chargeTotal);
     $this->view->assign('taxeTVQ', $session->order['taxProv']);
     $this->view->assign('taxeTPS', $session->order['taxFed']);
     $this->view->assign('shipFee', $session->order['shipFee']);
     $this->view->assign('limitShip', $session->order['limitShip']);
     $this->view->assign('CODFees', $session->order['CODFees']);
     $this->view->assign('comments', $session->customer['O_Comments']);
     $this->view->assign('display', $display);
     if (isset($session->order['cod'])) {
         $this->view->assign('displayCODFees', true);
     }
     $this->view->assign('paid', $paid);
     //Get html content for email and page displaying
     $view = $this->getHelper('ViewRenderer')->view;
     $view->assign('online', false);
     $html = $view->render('index/emailToSend.phtml');
     //Prepare notification email for customer
     $adminEmail = Cible_FunctionsGeneral::getParameters('CP_AdminOrdersEmail');
     $notification = new Cible_Notify();
     $notification->isHtml(1);
     $notification->addTo($memberInfos['email']);
     $notification->setFrom($adminEmail);
     $notification->setTitle($this->view->getClientText('email_to_customer_title') . ': n° ' . $OrderNumber);
     $notification->setMessage($html);
     //Prepare notification email for admin
     $notifyAdmin = new Cible_Notify();
     $notifyAdmin->isHtml(1);
     $notifyAdmin->addTo($adminEmail);
     $notifyAdmin->setFrom($memberInfos['email']);
     $notifyAdmin->setTitle($this->view->getClientText('email_to_company_title') . $OrderNumber);
     $notifyAdmin->setMessage($html);
     //Send emails
     $notifyAdmin->send();
     $notification->send();
     //Create the csv file to export orders - Set status to exported
     $this->writeFile();
     //Display message on the site.
     $view->assign('online', true);
     $html = $view->render('index/emailToSend.phtml');
     $this->view->assign('html', $html);
     //Empty data
     $this->emptyCart();
     $session->unsetAll();
     //        new Cart();
 }
コード例 #28
0
 /**
  * Build the html code for the question of type text.
  * This type will represent a label and an input text field for the front end.
  *
  * @access private
  * @param array $params Data nedeed for the fields of the question
  *                      icon       Path to the icon image
  *                      formElemId Id of the element
  *                      elemSeq    Sequence of the element (position)
  *                      label      Value for the question text in front end
  *                      qTextId    Id of the question
  *                      title      Name(type) of this question
  *                      descr      Description of the question
  *                      htmlOpt    The html code for the options of
  *                                 the question in order to make validation
  * @return string
  */
 private function _render()
 {
     // Define the id of the question type, used in the jQuery.
     $typeQuestion = self::TYPE_QUESTION;
     $html = chr(13);
     $html .= "  <div id=\"" . $this->_qTextId . "\" class='question_" . $typeQuestion . "'>" . chr(13);
     $html .= "      <div class='header'>" . chr(13);
     $html .= "          <img class='sortableElement' alt='' src='" . $this->_icon . "' />" . chr(13);
     $html .= "          <p class='title'>" . $this->_title . "" . chr(13);
     $html .= "          <span class='description'>" . $this->_descr . "</span></p>" . chr(13);
     $html .= "          <form id='" . $this->_formElemId . "' action='' class='hidden'>" . chr(13);
     $html .= "              <input id='FE_Seq' class='hidden' value='" . $this->_elemSeq . "'/>" . chr(13);
     $html .= "          </form>" . chr(13);
     $html .= "          <div class='floatRight'>" . chr(13);
     $html .= "              <p class='links'>" . chr(13);
     $html .= "                  <a class='question_delete_link' elementType='question'>" . Cible_Translation::getCibleText('button_delete') . "</a>" . chr(13);
     $html .= "              </p>" . chr(13);
     $html .= "          </div>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "      <div class='center' style='clear:both;'>" . chr(13);
     $html .= "          <form id='" . $this->_qTextId . "' action=''>" . chr(13);
     $html .= "              <span>" . Cible_Translation::getCibleText('form_question_text_label') . "</span>" . chr(13);
     $html .= "              <textarea id=\"FQI_Title\" class=\"questionLabel\">" . $this->_label . "</textarea>" . chr(13);
     $html .= "          </form>" . chr(13);
     $html .= "          <form id='" . $this->_qValidId . "' action='' class='qParam'>" . chr(13);
     if ($this->_htmlOpt != '') {
         $html .= "              <p class='zoneLbl'>Options</p>" . chr(13);
         $html .= "                   " . $this->_htmlOpt . chr(13);
     }
     $html .= "              <p class='zoneLbl'>Validations</p>" . chr(13);
     $html .= $this->_htmlVal . chr(13);
     $html .= "              <p class='zoneLbl'>Valeurs</p>" . chr(13);
     $html .= $this->_htmlList . chr(13);
     $html .= "          </form>" . chr(13);
     $html .= "      </div>" . chr(13);
     $html .= "  </div>" . chr(13);
     return $html;
 }
コード例 #29
0
ファイル: FormBlockBanners.php プロジェクト: anunay/stentors
    public function __construct($options = null)
    {
        $baseDir = $options['baseDir'];
        $pageID = $options['pageID'];
        parent::__construct($options);
        /****************************************/
        // PARAMETERS
        /****************************************/
        // select box category (Parameter #1)
        $blockBanners = new Zend_Form_Element_Select('Param1');
        $blockBanners->setLabel(Cible_Translation::getCibleText('banners_image_group_block_page'))->setAttrib('class', 'largeSelect');
        $langId = $this->getView()->_defaultEditLanguage;
        $oGroup = new GroupObject();
        $groups = $oGroup->getAll($langId);
        foreach ($groups as $group) {
            $blockBanners->addMultiOption($group['BG_ID'], $group['BG_Name']);
        }
        $oBanner = new BannerFeaturedObject();
        $banners = $oBanner->getAll($langId);
        foreach ($banners as $banner) {
            $id = $banner['BF_ID'] . '_f';
            $blockBanners->addMultiOption($id, $banner['BF_Name']);
        }
        // Status
        $autoPlay = new Zend_Form_Element_Checkbox('Param2');
        $autoPlay->setLabel(Cible_Translation::getCibleText('banners_autoPlay_block_page'));
        $autoPlay->setDecorators(array('ViewHelper', array('label', array('placement' => 'append', 'class' => 'label_checkbox_banniere check_auto_box')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_banniere'))));
        // select box category (Parameter #3)
        $blockDelais = new Zend_Form_Element_Text('Param3');
        $blockDelais->setLabel(Cible_Translation::getCibleText('banners_delais_block_page'))->setAttrib('class', 'largeSelect')->setValue(3);
        // select box category (Parameter #4)
        $blockTransition = new Zend_Form_Element_Text('Param4');
        $blockTransition->setLabel(Cible_Translation::getCibleText('banners_transition_block_page'))->setAttrib('class', 'largeSelect')->setValue('1000');
        // Status
        $navi = new Zend_Form_Element_Checkbox('Param5');
        $navi->setLabel(Cible_Translation::getCibleText('banners_navigation_block_page'));
        $navi->setDecorators(array('ViewHelper', array('label', array('placement' => 'append', 'class' => 'label_checkbox_banniere')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_banniere'))));
        $blockEffect = new Zend_Form_Element_Select('Param6');
        $blockEffect->setLabel(Cible_Translation::getCibleText('banners_effect_block_page'))->setAttrib('class', 'largeSelect');
        $effects = array('none' => 'Aucun', 'fade' => 'fading', 'scrollHorz' => 'slide');
        $blockEffect->addMultiOptions($effects);
        $this->addElement($blockBanners);
        $this->addElement($blockDelais);
        $this->addElement($blockTransition);
        $this->addElement($navi);
        $this->addElement($autoPlay);
        $this->addElement($blockEffect);
        $this->addDisplayGroup(array('Param1', 'Param2', 'Param3', 'Param4', 'Param5', 'Param6', 'Param999'), 'parameters');
        $parameters = $this->getDisplayGroup('parameters');
        $script = <<<EOS
        \$('#Param999').change(function(){
       // console.log('passe');
            if (\$(this).val() == 'index')
            {
                \$('#Param2').show();
                \$('label[for=Param2]').show();
                \$('#Param3').show();
                \$('label[for=Param3]').show();
                \$('#Param4').show();
                \$('label[for=Param4]').show();
                \$('#Param5').show();
                \$('label[for=Param5]').show();
                \$('#Param6').show();
                \$('label[for=Param6]').show();
            }
            else
            {
                \$('#Param2').hide();
                \$('label[for=Param2]').hide();
                \$('#Param3').hide();
                \$('label[for=Param3]').hide();
                \$('#Param4').hide();
                \$('label[for=Param4]').hide();
                \$('#Param5').hide();
                \$('label[for=Param5]').hide();
                \$('#Param6').hide();
                \$('label[for=Param6]').hide();
            }
        }).change();
EOS;
        $this->getView()->inlineScript()->appendScript($script);
        //var_dump($this->getView()->inlineScript());
    }