public function show($elemId = '', $questionType = null, $langId = 1, $elemSeq = null) { $question = array(); if ($elemId != '') { $question = $this->_selectQuestions($elemId, $langId); if (empty($question)) { $question = $this->_selectQuestions($elemId, Cible_Controller_Action::getDefaultEditLanguage()); } $questionType = $question[0]['FQ_TypeID']; $className = 'Question' . $question[0]['FQT_TypeName'] . 'Object'; $oQuestion = new $className(); $html = '<li questiontype="text" elementtype="question" class="element element_question section_element_question_li" style="display: list-item;" id="element_' . $elemId . '">'; $html .= $oQuestion->showQuestion($question, $elemId, $elemSeq, null, $langId); $html .= "</li>"; } elseif ($questionType != null) { $oQuestTyp = new FormQuestionTypeObject(); $types = $oQuestTyp->populate($questionType, $langId); $className = 'Question' . $types['FQT_TypeName'] . 'Object'; $oQuestion = new $className(); $html = $oQuestion->showQuestion($question, $elemId, $elemSeq, $types, $langId); } return $html; }
public function init() { parent::init(); $this->setModuleId(); $this->view->headLink()->offsetSetStylesheet($this->_moduleID, $this->view->locateFile('sitemap.css')); $this->view->headLink()->appendStylesheet($this->view->locateFile('sitemap.css')); }
/** * Get data and build the list for the options in select and choices. * * @param int $optionId Id of the response option. * @param int $langId Id of the language. * * @return string $html */ public function getOptionsList($optionId, $langId, $value = null) { $this->_selectResponseOptions($optionId, $langId); $nbDefaultLine = count($this->_dataRespOpt); if ($nbDefaultLine == 0) { $this->_selectResponseOptions($optionId, Cible_Controller_Action::getDefaultEditLanguage()); } if (count($this->_dataRespOpt) == 0 && $langId == Cible_Controller_Action::getDefaultEditLanguage()) { $languages = Cible_FunctionsGeneral::getAllLanguage(); foreach ($languages as $key => $lang) { if ($lang['L_ID'] != $langId) { $this->getOptionsList($optionId, $lang['L_ID']); break; } } } if (count($this->_dataRespOpt)) { $this->_typeName = $this->_dataRespOpt[0]['FRO_Type']; } if ($this->_typeName == "select") { $html = $this->selectValuesList($nbDefaultLine); } else { $html = $this->choiceValuesList($nbDefaultLine); } return $html; }
/** * Overwrite the function define in the SiteMapInterface implement in Cible_Controller_Action * * This function return the sitemap specific for this module * * @access public * * @return a string containing xml sitemap */ public function siteMapAction() { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $bannersRob = new FormsRobots(); $dataXml = $bannersRob->getXMLFile($this->_registry->absolute_web_root, $this->_request->getParam('lang')); parent::siteMapAction($dataXml); }
public function getVideosList() { $select = parent::getAll(null, false); $select->where('VI_LanguageID = ?', Cible_Controller_Action::getDefaultEditLanguage()); $select->order('V_Alias ASC'); //echo $select; // exit; $data = $this->_db->fetchAll($select); return $data; }
/** * Returns all the texts for the current element * * @param int $elemId Id of the current element * @param int $langId Id of the language * * @return array $txtList Array with the texts data */ public function getTexts($elemId, $langId) { $txtList = array(); $txtList = $this->_selectTexts($elemId, $langId); if (empty($txtList)) { $langId = Cible_Controller_Action::getDefaultEditLanguage(); $this->getTexts($elemId, $langId); } return $txtList; }
public function init() { parent::init(); $this->view->assign('user', $this->view->auth()); $session = new Cible_Sessions(); // Defines the default interface language if ($this->_config->defaultInterfaceLanguage) { $this->_defaultInterfaceLanguage = $this->_config->defaultInterfaceLanguage; } // Check if the current interface language should be different than the default one $this->_currentInterfaceLanguage = !empty($session->languageID) ? $session->languageID : $this->_defaultInterfaceLanguage; if ($this->_getParam('setLang')) { $this->_currentInterfaceLanguage = Cible_FunctionsGeneral::getLanguageID($this->_getParam('setLang')); } // Registers the current interface language for future uses $this->_registry->set('languageID', $this->_currentInterfaceLanguage); $session->languageID = $this->_currentInterfaceLanguage; $suffix = Cible_FunctionsGeneral::getLanguageSuffix($this->_currentInterfaceLanguage); $this->_registry->set('languageSuffix', $suffix); // Defines the default edit language if ($this->_config->defaultEditLanguage) { $this->_currentEditLanguage = $this->_config->defaultEditLanguage; } else { $this->_currentEditLanguage = $this->_defaultEditLanguage; } $this->_currentEditLanguage = !empty($session->currentEditLanguage) ? $session->currentEditLanguage : $this->_currentEditLanguage; // Check if the current edit language should be different than the default one if ($this->_getParam('lang')) { $this->_currentEditLanguage = Cible_FunctionsGeneral::getLanguageID($this->_getParam('lang')); } // Registers the current edit language for future uses $this->_registry->set('currentEditLanguage', $this->_currentEditLanguage); $session->currentEditLanguage = $this->_currentEditLanguage; if (Cible_FunctionsGeneral::extranetLanguageIsAvailable($this->getCurrentInterfaceLanguage()) == 0) { $session = new Cible_Sessions(); $this->_currentInterfaceLanguage = $this->_config->defaultInterfaceLanguage; // Registers the current interface language for future uses $this->_registry->set('languageID', $this->_currentInterfaceLanguage); $session->languageID = $this->_currentInterfaceLanguage; $suffix = Cible_FunctionsGeneral::getLanguageSuffix($this->_currentInterfaceLanguage); $this->_registry->set('languageSuffix', $suffix); } $hasProfile = false; $hasVideos = true; $modProfile = Cible_FunctionsModules::modulesProfile(); if (count($modProfile) > 0) { $hasProfile = true; } $this->view->assign('hasProfile', $hasProfile); $this->view->assign('hasVideos', $hasVideos); }
/** * Select data from database. * * @param int $id The form id if defined. * @param int $lang The language id if defined. * * @return object $select List of froms from DB. */ public function getFormList($id = null, $lang = null) { $db = new Form(); $select = $db->select()->from($this->_name)->setIntegrityCheck(false)->join('FormIndex', 'Form.F_ID = FormIndex.FI_FormID'); if ($id) { $select->where('Form.F_ID = ?', $id); } if ($lang) { $select->where('FormIndex.FI_LanguageID = ?', $lang); } else { $select->where('FormIndex.FI_LanguageID = ?', Cible_Controller_Action::getDefaultEditLanguage()); } return $select; }
/** * Set some properties to redirect and process actions. * * @access public * * @return void */ public function init() { parent::init(); $this->setModuleId(); $this->view->headLink()->offsetSetStylesheet($this->_moduleID, $this->view->locateFile('banners.css')); $this->view->headLink()->appendStylesheet($this->view->locateFile('banners.css')); $dataImagePath = "data/images/"; $this->_imagesFolder = $dataImagePath . $this->_moduleTitle . "/"; $this->_rootImgPath = Zend_Registry::get("www_root") . "/data/images/" . $this->_moduleTitle . "/"; $this->_rootVideoPath = Zend_Registry::get("www_root") . "/data/files/videos/"; $this->_rootFilePath = "data/files/" . $this->_moduleTitle . "/"; $this->view->cleaction = $this->_name; $this->_imgIndex = 'imagefeat'; }
/** * Build the section zone for displaying. * Add any element found in database (text, questions or page break). * * @access private * @param int $formId The current form to be managed. * @param int $langId The language id. * * @return string $html The html code. */ public function show($formId = '', $langId = null) { $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); $icone = $baseUrl . '/form/index/get-icon/format/48x48/prefix/icon-section/ext/png'; $html = ''; if (!empty($formId)) { $sections = $this->_selectData($formId, $langId); if (empty($sections)) { $langId = Cible_Controller_Action::getDefaultEditLanguage(); $this->show($formId, $langId); } $oElements = new FormElementObject(); foreach ($sections as $section) { $sectionTitle = $section['FSI_Title']; $formSectionID = "section_" . $section['FS_ID']; $sectionSeq = $section['FS_Seq']; $chkTitle = $section['FS_ShowTitle'] == 1 ? "checked=\"checked\"" : ""; $chkRepeat = $section['FS_Repeat'] ? "checked=\"checked\"" : ""; $RepeatMin = $section['FS_RepeatMin']; $RepeatMax = $section['FS_RepeatMax']; $pageBreakVal = $section['FS_PageBreak']; $pageBreak = ' '; if ($pageBreakVal) { $pageBreak = $this->showBreakPage(); } $elements = $oElements->getElements($section['FS_ID'], $langId, true); if (empty($elements)) { $elements = " "; } $titleStyle = "style=\"display: none;\""; $html .= "<li elementtype=\"section\" class=\"section_li\"\r\n style=\"display: list-item;\"\r\n id=\"" . $formSectionID . "\">"; $html .= $this->_render($icone, $sectionTitle, $formSectionID, $sectionSeq, $chkTitle, $chkRepeat, $RepeatMin, $RepeatMax, $pageBreakVal, $elements, $pageBreak, $titleStyle); $html .= "</li>"; } } else { $db = Zend_Registry::get('db'); $table = new FormSection(); $formSectionID = 'section_' . $this->_currentId; $lastSection = $table->fetchRow(null, 'FS_ID DESC'); if ($lastSection) { $formSectionID = "section_" . ($lastSection->FS_ID + 1); } $html = $this->_render($icone, null, $formSectionID); } return $html; }
/** * Initialize object * * Called from {@link __construct()} as final step of object instantiation. * * @return void */ public function init() { parent::init(); $this->_registry = Zend_Registry::getInstance(); $this->view->assign('current_module', $this->_request->getModuleName()); if ($this->_getParam('enableDictionnary')) { $this->_registry->set('enableDictionnary', 'true'); $this->view->assign('enableDictionnary', 'true'); } else { $this->_registry->set('enableDictionnary', 'false'); $this->view->assign('enableDictionnary', 'false'); } $this->_db = $this->_registry->get('db'); $this->_config = $this->_registry->get('config'); if ($this->_config->defaultEditLanguage) { $this->_defaultEditLanguage = $this->_config->defaultEditLanguage; self::$defaultEditLanguage = $this->_config->defaultEditLanguage; } if ($this->_config->dictionnary_is_allowed == true) { $this->_registry->set('dictionnary_is_allowed', 'true'); } else { $this->_registry->set('dictionnary_is_allowed', 'false'); } $_request = $this->_request; if ($this->_request->isXmlHttpRequest()) { $session = new Cible_Sessions(); if (!empty($session->languageID)) { $this->_registry->set('languageID', $session->languageID); } $this->_isXmlHttpRequest = true; Zend_Registry::set('isXmlHttpRequest', $this->_isXmlHttpRequest); $this->disableLayout(); if ($_request->isPost()) { foreach ($_request->getPost() as $key => $value) { $_request->setPost($key, $value); } $this->setRequest($_request); } } else { $this->view->assign('params', $_request->getParams()); } $this->view->assign('request', $_request); }
/** * Render form element * * @param Zend_View_Interface $view * @return string */ public function render(Zend_View_Interface $view = null) { $_baseUrl = $this->getView()->baseUrl(); $this->_view->headScript()->appendFile("{$_baseUrl}/js/cible.form.element.pagepicker.js"); $pages_list = Cible_FunctionsPages::getAllPagesDetailsArray(0, Cible_Controller_Action::getDefaultEditLanguage()); $_pages = array(); foreach ($pages_list as $page) { $tmp = array('ID' => $page['P_ID'], 'Title' => $page['PI_PageTitle'], 'onClick' => str_replace(array('%PAGEID%', '%PAGEINDEX%'), array($page['P_ID'], $page['PI_PageIndex']), $this->_onClick)); if (!empty($page['child'])) { $tmp['child'] = $this->fillChildren($page['child']); } array_push($_pages, $tmp); } $content = $this->getView()->collapsibleTree($_pages, array('id' => $this->getId(), 'images' => array('close' => $this->getView()->baseUrl() . '/themes/default/images/treeview-open.gif', 'open' => $this->getView()->baseUrl() . '/themes/default/images/treeview-close.gif'), 'class' => 'collapsible_tree')); foreach ($this->getDecorators() as $decorator) { $decorator->setElement($this); $content = $decorator->render($content); } return $content; }
private function retrieveChildItems($parentId, $extranet = false) { $tmp_menu = array(); $menuItemObject = new MenuItem(); $select = $menuItemObject->select()->setIntegrityCheck(false)->from('MenuItemData')->joinInner('MenuItemIndex', 'MID_ID = MII_MenuItemDataID')->where('MID_MenuID = ?', $this->_id)->where('MID_ParentID = ?', $parentId)->order('MID_Position'); if ($extranet) { $select->where('MII_LanguageID = ?', Cible_Controller_Action::getDefaultEditLanguage()); } else { $select->where('MII_LanguageID = ?', Zend_Registry::get('languageID')); } if (Zend_Registry::isRegistered('user')) { $user = Zend_Registry::get('user'); if (!$user) { $select->where('MID_Secured = ?', 0); } } $menuItems = $menuItemObject->fetchAll($select)->toArray(); foreach ($menuItems as $item) { $menu_item = array('ID' => $item['MID_ID'], 'MID_Show' => $item['MID_Show'], 'Title' => $item['MII_Title'], 'Link' => $item['MII_Link'], 'PageID' => $item['MII_PageID'], 'Style' => $item['MID_Style'], 'menuImage' => $item['MID_Image'], 'loadImage' => $item['MID_loadImage'], 'menuImgAndTitle' => $item['MID_ImgAndTitle'], 'Placeholder' => $item['MII_Placeholder']); if (preg_match('/useCatalog/', $item['MID_Style'])) { $menu_item['Placeholder'] = 2; $collections = new SubCategoriesObject(); // $menuCatalog = $this->getMenuItemByPageId( null, 'collections'); $catalogMenu = $collections->buildCatalogMenu($menu_item, array('nesting' => 1)); $submenu = $catalogMenu['child']; // $first = $this->populate($menuCatalog['MID_ID']); // $childCombined = array(); // $childCombined = array_merge($catalogMenu['child'], $first); // $catalog['child'] = $childCombined; } else { $submenu = $this->retrieveChildItems($item['MID_ID'], $extranet); } if ($submenu) { $menu_item['child'] = $submenu; } array_push($tmp_menu, $menu_item); } return $tmp_menu; }
public function init() { $Param = $this->getRequest('Params'); //var_dump($this->getRequest()->getActionName()); $Action = $this->getRequest()->getActionName(); parent::init(); // echo $Action; if ($Action != "site-map") { $langId = Zend_Registry::get('languageID'); //parent::init(); $this->setModuleId(); $this->view->headLink()->offsetSetStylesheet($this->_moduleID, $this->view->locateFile('catalog.css')); $this->view->headLink()->appendStylesheet($this->view->locateFile('catalog.css')); // $oTypes = new TypesObject(); $oCollections = new SubCategoriesObject(); // $oClientele = new ClienteleObject(); // $types = $oTypes->getAll($langId); $collections = $oCollections->getAll($langId); // $clienteles = $oClientele->clienteleList($langId); // $this->view->types = $types; $this->view->collections = $collections; // $this->view->clientele = $clienteles; } }
public static function buildTextBreadcrumb($pageID, $lang = null) { if ($lang == null) { $lang = Cible_Controller_Action::getDefaultEditLanguage(); } $_baseUrl = Zend_Registry::get('baseUrl'); $_breadcrumb = array(); $_first = true; while ($pageID != 0) { $_class = ''; if ($_first) { $_first = false; $_class = 'current_page'; } $details = self::getPageDetails($pageID, $lang); array_push($_breadcrumb, "<a href='{$_baseUrl}/page/index/index/ID/{$pageID}' class='{$_class}'>{$details['PI_PageTitle']}</a>"); $pageID = $details['P_ParentID']; } $_breadcrumb = array_reverse($_breadcrumb); return implode(' > ', $_breadcrumb); }