Example #1
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_QuestionDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
 public function findQuestionsForAccountType($accountType)
 {
     $sql = ' SELECT `question`.*  FROM  ' . BOL_QuestionDao::getInstance()->getTableName() . ' as `question`
                 INNER JOIN ' . $this->getTableName() . ' as `atq` ON ( `atq`.`questionName` = `question`.`name` )
                 INNER JOIN ' . BOL_QuestionAccountTypeDao::getInstance()->getTableName() . ' as `account` ON ( `account`.`name` = `atq`.`accountType` )
             WHERE  `atq`.`accountType` = :accountType ';
     return $this->dbo->queryForObjectList($sql, BOL_QuestionDao::getInstance()->getDtoClassName(), array('accountType' => $accountType));
 }
 public function findMatchQuestionsForUser($userId)
 {
     if ($userId === null) {
         return array();
     }
     if (!OW::getPluginManager()->isPluginActive('skadate')) {
         return array();
     }
     $genderAccTypes = SKADATE_BOL_AccountTypeToGenderService::getInstance()->findAll();
     $lookingForValue = BOL_QuestionService::getInstance()->getQuestionData(array($userId), array('match_sex'));
     $lookingForValues = array();
     foreach ($genderAccTypes as $type) {
         if ($lookingForValue[$userId]['match_sex'] & $type->genderValue) {
             $lookingForValues[] = $type->genderValue;
         }
     }
     if (empty($lookingForValues)) {
         return array();
     }
     $lookingForValues = $this->dbo->mergeInClause($lookingForValues);
     $sql = " SELECT DISTINCT `question`.* FROM `" . BOL_QuestionDao::getInstance()->getTableName() . "` as `question`\n\n                    LEFT JOIN  `" . BOL_QuestionSectionDao::getInstance()->getTableName() . "` as `section`\n                            ON ( `question`.`sectionName` = `section`.`name` AND `question`.`sectionName` != '' AND `question`.`sectionName` IS NOT NULL )\n\n                    LEFT JOIN " . BOL_QuestionToAccountTypeDao::getInstance()->getTableName() . " as `qta` ON ( `question`.`parent` = `qta`.`questionName` )\n\n                    LEFT JOIN `" . SKADATE_BOL_AccountTypeToGenderDao::getInstance()->getTableName() . "` as `atg` ON (`qta`.`accountType` = `atg`.`accountType`)\n\n                    WHERE `question`.`sectionName`='about_my_match' AND `atg`.`genderValue` IN ( {$lookingForValues} )\n\n                    ORDER BY IF( `section`.`name` IS NULL, 0, 1 ),  `section`.`sortOrder`, `question`.`sortOrder` ";
     return $this->dbo->queryForList($sql);
 }
 public function findCountExlusiveQuestionForAccount($accountType)
 {
     $sql = ' SELECT COUNT( `questions`.`id` ) AS `questionCount`
         FROM ' . BOL_QuestionDao::getInstance()->getTableName() . ' as `questions`
                 INNER JOIN ' . BOL_QuestionToAccountTypeDao::getInstance()->getTableName() . ' as `qta` ON( `questions`.`name` = `qta`.`questionName` )
                 
         WHERE `qta`.`accountType` = :accountType ';
     return $this->dbo->queryForColumn($sql, array('accountType' => $accountType));
 }
 public function findQuestionsValuesByQuestionNameList(array $questionNameList)
 {
     if (isset($questionNameList) && count($questionNameList) > 0) {
         $list = array();
         $questionList = BOL_QuestionDao::getInstance()->findQuestionByNameList($questionNameList);
         $parentList = array();
         foreach ($questionList as $question) {
             $parentList[$question->parent] = $question->parent;
             $list[$question->name] = $question->name;
         }
         $parentQuestionList = BOL_QuestionDao::getInstance()->findQuestionByNameList($parentList);
         $parentQuestions = array();
         foreach ($parentQuestionList as $question) {
             $parentQuestions[$question->name] = $question->name;
         }
         foreach ($parentList as $key => $value) {
             if (!empty($parentQuestions[$value])) {
                 $list[$value] = $value;
             }
         }
         $example = new OW_Example();
         $example->andFieldInArray('questionName', $list);
         $example->setOrder('questionName, sortOrder');
         $values = $this->findListByExample($example);
         $result = array();
         $questionName = '';
         $count = 0;
         foreach ($values as $key => $value) {
             if ($questionName !== $value->questionName) {
                 if (!empty($questionName)) {
                     $result[$questionName]['count'] = $count;
                     $count = 0;
                 }
                 $questionName = $value->questionName;
             }
             $result[$value->questionName]['values'][] = $value;
             $count++;
         }
         foreach ($questionList as $question) {
             if (!empty($question->parent) && !empty($parentQuestions[$question->parent])) {
                 $result[$question->name]['values'] = empty($result[$question->parent]['values']) ? array() : $result[$question->parent]['values'];
             }
         }
         if (!empty($questionName)) {
             $result[$questionName]['count'] = $count;
         }
         return $result;
     }
     return array();
 }
 public function findQuestionChildren($parentQuestionName)
 {
     return $this->questionDao->findQuestionChildren($parentQuestionName);
 }
Example #7
0
 /**
  * @param int $stamp
  */
 public function deleteByCreatedStamp($stamp)
 {
     $this->emailVerifiedDao->deleteByCreatedStamp($stamp);
 }
Example #8
0
 public function savePreference(BOL_Preference $preferenceDto)
 {
     $this->preferenceDao->save($preferenceDto);
 }
Example #9
0
 */
/**
 * @author Podyachev Evgeny <*****@*****.**>
 * @package ow_plugins.google_maps_location
 * @since 1.0
 */
$cache = array('question' => null, 'accountTypes' => array());
$question = BOL_QuestionService::getInstance()->findQuestionByName('googlemap_location');
if (!empty($question)) {
    /*$question->accountTypeName = 'none';
        $question->onEdit = 0;
        $question->onJoin = 0;
        $question->onSearch = 0;
        $question->onView = 0;
    
        BOL_QuestionService::getInstance()->saveOrUpdateQuestion($question);*/
    $cache['question'] = get_object_vars($question);
    BOL_QuestionDao::getInstance()->deleteById($question->id);
}
$accountTypeToQuestionDtoList = BOL_QuestionService::getInstance()->findAccountTypeListByQuestionName('googlemap_location');
$accountTypeList = array();
foreach ($accountTypeToQuestionDtoList as $accountTypeToQuestionDtoList) {
    /* @var $accountTypeToQuestionDtoList BOL_QuestionToAccountType */
    $accountTypeList[$accountTypeToQuestionDtoList->accountType] = $accountTypeToQuestionDtoList->accountType;
}
$cache['accountTypes'] = $accountTypeList;
try {
    OW::getConfig()->saveConfig('googlemap_location', 'cache', serialize($cache));
} catch (Exception $ex) {
}
BOL_ComponentAdminService::getInstance()->deleteWidget('GOOGLELOCATION_CMP_GroupsWidget');