示例#1
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_PreferenceDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
示例#2
0
 /**
  * Constructor.
  *
  */
 private function __construct()
 {
     $this->preferenceDao = BOL_PreferenceDao::getInstance();
     /* @var $this->preferenceDao BOL_PreferenceDao */
     $this->preferenceSectionDao = BOL_PreferenceSectionDao::getInstance();
     /* @var $this->preferenceSectionDao BOL_PreferenceSectionDao */
     $this->preferenceDataDao = BOL_PreferenceDataDao::getInstance();
     /* @var $this->preferenceDataDao BOL_PreferenceDataDao */
 }
示例#3
0
 public function findUserIdListByPreferenceValues($preferenceValues)
 {
     if (empty($preferenceValues) || !is_array($preferenceValues)) {
         return array();
     }
     $sqlList = array();
     foreach ($preferenceValues as $key => $value) {
         $sqlList[$key] = " SELECT d.userId FROM " . BOL_PreferenceDao::getInstance()->getTableName() . " p\n                LEFT JOIN " . BOL_PreferenceDataDao::getInstance()->getTableName() . " d ON ( d.`key` = p.`key` )\n                WHERE p.`key` = '" . $this->dbo->escapeString($key) . "' AND ( d.value = '" . $this->dbo->escapeString($value) . "' OR d.value IS NULL AND p.defaultValue = '" . $this->dbo->escapeString($value) . "' ) ";
         if (!empty($value) && is_array($value)) {
             $sqlList[$key] = " SELECT d.userId FROM " . BOL_PreferenceDao::getInstance()->getTableName() . " p\n                    LEFT JOIN " . BOL_PreferenceDataDao::getInstance()->getTableName() . " d ON ( d.`key` = p.`key` )\n                    WHERE p.`key` = '" . $this->dbo->escapeString($key) . "' AND ( d.value IN " . $this->dbo->mergeInClause($value) . " OR d.value IS NULL AND p.defaultValue IN " . $this->dbo->mergeInClause($value) . " ) ";
         }
     }
     $sqlString = '';
     $queryNumber = 0;
     foreach ($sqlList as $sql) {
         if ($queryNumber > 0) {
             $sqlString .= ' UNION ';
         }
         $queryNumber++;
         $sqlString .= $sql;
     }
     return $this->dbo->queryForColumnList($sqlString);
 }