예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 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;
 }
예제 #4
0
 /**
  * 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;
 }
예제 #5
0
파일: Form.php 프로젝트: anunay/stentors
 /**
  * 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;
 }
예제 #6
0
 /**
  * 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 = '&nbsp;';
             if ($pageBreakVal) {
                 $pageBreak = $this->showBreakPage();
             }
             $elements = $oElements->getElements($section['FS_ID'], $langId, true);
             if (empty($elements)) {
                 $elements = "&nbsp;";
             }
             $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;
 }
예제 #7
0
 /**
  * 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;
 }
예제 #8
0
 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;
 }
예제 #9
0
 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);
 }