/** * 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) { if (!empty($formId)) { $sections = $this->_selectSections($formId, $langId); $oElements = new FormElementObject(); foreach ($sections as $index => $section) { //Find elements related to this section $elements = $oElements->getElements($section['FS_ID'], $langId, true); //push it into the the section array $sections[$index]['elements'] = $elements; } } //return the data return $sections; }
/** * 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; }