コード例 #1
0
ファイル: privacy_dao.php プロジェクト: vazahat/dudex
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BIRTHDAYS_BOL_PrivacyDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
コード例 #2
0
ファイル: service.php プロジェクト: vazahat/dudex
 /**
  * Constructor.
  */
 private function __construct()
 {
     $this->birthdaysDao = BIRTHDAYS_BOL_UserDao::getInstance();
     $this->birthdaysPrivacyDao = BIRTHDAYS_BOL_PrivacyDao::getInstance();
 }
コード例 #3
0
ファイル: user_dao.php プロジェクト: tammyrocks/birthdays
 public function countByBirthdayPeriod($start, $end, $idList = null, $privacy = null)
 {
     if ($idList === array()) {
         return 0;
     }
     $queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("q", "userId", array("method" => "BIRTHDAYS_BOL_UserDao::countByBirthdayPeriod"));
     $query = "SELECT COUNT(*) FROM `" . BOL_QuestionDataDao::getInstance()->getTableName() . "` q\r\n            " . $queryParts["join"] . " \r\n            " . (!empty($privacy) ? "LEFT JOIN `" . BIRTHDAYS_BOL_PrivacyDao::getInstance()->getTableName() . "` AS `bp` ON( `q`.`userId` = bp.userId AND ( bp.privacy NOT IN (" . $this->dbo->mergeInClause($privacy) . ") ) ) " : '') . "\r\n\t\t\tWHERE " . $queryParts["where"] . " AND " . (!empty($privacy) ? " `bp`.id IS NULL AND " : "") . " q.`questionName` = 'birthdate' AND\r\n            ( DATE_FORMAT(q.`dateValue`, '" . date('Y') . "-%m-%d') BETWEEN :start1 AND :end1 OR DATE_FORMAT(q.`dateValue`, '" . (intval(date('Y')) + 1) . "-%m-%d') BETWEEN :start2 AND :end2 )\r\n            " . (!empty($idList) ? "AND q.`userId` IN (" . $this->dbo->mergeInClause($idList) . ")" : '');
     return $this->dbo->queryForColumn($query, array('start1' => $start, 'start2' => $start, 'end1' => $end, 'end2' => $end));
 }