Ejemplo n.º 1
0
 /**
  * Get questions data from db
  *
  * @param int $elemId
  * @param int $langId
  * @param int $questType
  *
  * @return array
  */
 protected function _selectQuestions($elemId, $langId = 1, $questType = null)
 {
     $oQuestion = new FormQuestion();
     $oQstIndex = new FormQuestionIndex();
     $oType = new FormQuestionType();
     $select = $oQuestion->select()->setIntegrityCheck(false)->from(array('FQ' => $oQuestion->info('name')))->joinLeft(array('FQI' => $oQstIndex->info('name')), 'FQI_QuestionID = FQ_ID', array('FQI_Title'))->joinRight($oType->info('name'), 'FQ_TypeID = FQT_ID', array('FQT_TypeName', 'FQT_ImageLink'))->where('FQ_ElementID = ?', $elemId);
     if ($langId != null) {
         $select->where('FQI_LanguageID = ?', $langId);
         $select->where('FQTI_LanguageID = ?', $langId);
     }
     if ($questType != null) {
         $select->where('FQ_TypeID = ?', $questType);
     }
     $questions = $oQuestion->fetchAll($select)->toArray();
     return $questions;
 }