/**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_QuestionSectionDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
 public function reOrderSection(array $sectionOrder)
 {
     if ($sectionOrder === null || !is_array($sectionOrder) || count($sectionOrder) === 0) {
         return false;
     }
     $sectionNameList = array_keys($sectionOrder);
     $sections = $this->sectionDao->findBySectionNameList($sectionNameList);
     foreach ($sections as $key => $section) {
         if (isset($sectionOrder[$section->name])) {
             $sections[$key]->sortOrder = $sectionOrder[$section->name];
         }
     }
     return $this->sectionDao->batchReplace($sections);
 }
Exemple #3
0
 * All rights reserved.
 *
 * ATTENTION: This commercial software is intended for exclusive use with SkaDate Dating Software (http://www.skadate.com) and is licensed under SkaDate Exclusive License by Skalfa LLC.
 *
 * Full text of this license can be found at http://www.skadate.com/sel.pdf
 */
Updater::getLanguageService()->importPrefixFromZip(dirname(dirname(dirname(__FILE__))) . DS . 'langs.zip', 'matchmaking');
$example = new OW_Example();
$example->andFieldEqual('name', 'about_my_match');
$matchSection = BOL_QuestionSectionDao::getInstance()->findObjectByExample($example);
if (empty($matchSection)) {
    $matchSection = new BOL_QuestionSection();
    $matchSection->name = 'about_my_match';
    $matchSection->sortOrder = 1;
    $matchSection->isHidden = 0;
    BOL_QuestionSectionDao::getInstance()->save($matchSection);
}
$dbPrefix = OW_DB_PREFIX;
try {
    $sql = "UPDATE `{$dbPrefix}base_question` SET `onJoin` = '1', `required` = '1' WHERE `name` = 'match_age' OR `name`='birthdate'";
    Updater::getDbo()->query($sql);
} catch (Exception $e) {
}
try {
    $sql = "UPDATE `{$dbPrefix}base_question` SET `sectionName` = 'about_my_match', `onEdit` = 0, `onJoin` = 0 WHERE `name` <> 'match_age' AND `name`<>'match_sex' AND `parent` <> '' AND `parent` IS NOT NULL";
    Updater::getDbo()->query($sql);
} catch (Exception $e) {
}
try {
    $sql = "SELECT *  FROM `{$dbPrefix}base_question_section` WHERE `sortOrder` = 0";
    $sectionData = Updater::getDbo()->queryForRow($sql);
 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);
 }
Exemple #5
0
 public function findBaseSignUpQuestions()
 {
     $sql = " SELECT `question`.* FROM `" . $this->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                    WHERE `question`.`base` = 1 AND `question`.`onJoin` = '1' AND ( `section`.isHidden IS NULL OR `section`.isHidden = 0 )\n                    ORDER BY IF( `section`.`name` IS NULL, 0, 1 ),  `section`.`sortOrder`, `question`.`sortOrder` ";
     return $this->dbo->queryForList($sql);
 }