/**
  *
  * @param array $data
  * @param int $userId
  *
  * return array()
  */
 public function getQuestionData(array $userIdList, array $fieldsList)
 {
     if ($userIdList === null || !is_array($userIdList) || count($userIdList) === 0) {
         return array();
     }
     if ($fieldsList === null || !is_array($fieldsList) || count($fieldsList) === 0) {
         return array();
     }
     $usersBol = BOL_UserService::getInstance()->findUserListByIdList($userIdList);
     if ($usersBol === null || count($usersBol) === 0) {
         return array();
     }
     $userData = array();
     // get not cached questions
     $notCachedQuestionsData = array();
     foreach ($userIdList as $userId) {
         if (array_key_exists($userId, $this->questionsData)) {
             foreach ($fieldsList as $field) {
                 if (array_key_exists($field, $this->questionsData[$userId])) {
                     $userData[$userId][$field] = $this->questionsData[$userId][$field];
                 } else {
                     if (!array_key_exists($field, $notCachedQuestionsData)) {
                         $notCachedQuestionsData[$field] = $field;
                     }
                 }
             }
         } else {
             $userData = array();
             $notCachedQuestionsData = $fieldsList;
             break;
         }
     }
     if (count($notCachedQuestionsData) > 0) {
         $questionsBolArray['base'] = array();
         $questionsBolArray['notBase'] = array();
         // -- get questions BOL --
         $notCachedQuestions = array();
         foreach ($notCachedQuestionsData as $field) {
             if (array_key_exists($field, $this->questionsBOL['base'])) {
                 $questionsBolArray['base'][$field] = $this->questionsBOL['base'][$field];
             } else {
                 if (array_key_exists($field, $this->questionsBOL['notBase'])) {
                     $questionsBolArray['notBase'][$field] = $this->questionsBOL['notBase'][$field];
                 } else {
                     $notCachedQuestions[$field] = $field;
                 }
             }
         }
         if (count($notCachedQuestions) > 0) {
             $questions = $this->questionDao->findQuestionsByQuestionNameList($notCachedQuestions);
             foreach ($questions as $question) {
                 if ($question->base) {
                     $questionsBolArray['base'][$question->name] = $question;
                 } else {
                     $questionsBolArray['notBase'][$question->name] = $question;
                 }
             }
             $this->questionsBOL['base'] = array_merge($questionsBolArray['base'], $this->questionsBOL['base']);
             $this->questionsBOL['notBase'] = array_merge($questionsBolArray['notBase'], $this->questionsBOL['notBase']);
         }
         $baseFields = array_keys($questionsBolArray['base']);
         $notBaseFields = array_keys($questionsBolArray['notBase']);
         unset($questionsBolArray);
         if (count($notBaseFields) === 0 && count($baseFields) === 0) {
             return array();
         }
         // -------------------- --
         if (count($notBaseFields) > 0) {
             //get not base question values
             $questionsData = $this->dataDao->findByQuestionsNameListForUserList($notBaseFields, $userIdList);
             if (count($questionsData) > 0) {
                 foreach ($userIdList as $userId) {
                     foreach ($notBaseFields as $field) {
                         if (isset($questionsData[$userId][$field])) {
                             $value = null;
                             switch ($this->questionsBOL['notBase'][$field]->type) {
                                 case self::QUESTION_VALUE_TYPE_BOOLEAN:
                                 case self::QUESTION_VALUE_TYPE_SELECT:
                                 case self::QUESTION_VALUE_TYPE_MULTISELECT:
                                     $value = $questionsData[$userId][$field]->intValue;
                                     break;
                                 case self::QUESTION_VALUE_TYPE_TEXT:
                                     $value = $questionsData[$userId][$field]->textValue;
                                     break;
                                 case self::QUESTION_VALUE_TYPE_DATETIME:
                                     $value = $questionsData[$userId][$field]->dateValue;
                                     break;
                             }
                             $userData[$userId][$field] = $value;
                         }
                     }
                 }
             }
         }
         if (count($baseFields) > 0) {
             //get base question values
             $usersBolArray = array();
             foreach ($usersBol as $userBol) {
                 $usersBolArray[$userBol->id] = $userBol;
             }
             foreach ($userIdList as $userId) {
                 foreach ($baseFields as $field) {
                     $userData[$userId][$field] = null;
                     if (isset($usersBolArray[$userId]->{$field})) {
                         $userData[$userId][$field] = $usersBolArray[$userId]->{$field};
                     }
                 }
             }
         }
     }
     //cached questions data
     if (count($userData) > 0) {
         foreach ($userData as $userId => $fields) {
             if (isset($this->questionsData[$userId])) {
                 $this->questionsData[$userId] = array_merge($fields, $this->questionsData[$userId]);
             } else {
                 $this->questionsData[$userId] = $fields;
             }
         }
     }
     $result = array();
     foreach ($usersBol as $user) {
         $result[$user->id] = isset($userData[$user->id]) ? $userData[$user->id] : array();
     }
     $event = new OW_Event('base.questions_get_data', array('userIdList' => $userIdList, 'fieldsList' => $fieldsList), $result);
     OW::getEventManager()->trigger($event);
     return $event->getData();
 }