コード例 #1
0
 /**
  *
  * @param string $promoCode
  * @return pcPromotionCode|null
  */
 public static function getValidPromoCodeEntry($promoCode)
 {
     $c = new Criteria();
     $c->add(self::EXPIRY_DATE, PcUtils::getMysqlTimestamp(time()), Criteria::GREATER_EQUAL);
     $c->add(self::ID, $promoCode);
     return self::doSelectOne($c);
 }
コード例 #2
0
 /**
  *
  * @param int $fromTimestamp (=null) - GMT
  * @param int $toTimestamp (=null) - GMT
  * @return array of PcRepetition
  */
 public static function retrieveUpdatedSince($fromTimestamp = null, $toTimestamp = null)
 {
     $c = new Criteria();
     if ($fromTimestamp !== null) {
         $c->add(self::UPDATED_AT, PcUtils::getMysqlTimestamp($fromTimestamp), Criteria::GREATER_EQUAL);
         $c->addAnd(self::UPDATED_AT, PcUtils::getMysqlTimestamp($toTimestamp), Criteria::LESS_THAN);
     }
     $c->addAscendingOrderByColumn(self::SORT_ORDER);
     return self::doSelect($c);
 }
コード例 #3
0
ファイル: PcUser.php プロジェクト: ntemple/intelli-plancake
 public function refreshLastLogin()
 {
     $this->setLastLogin(PcUtils::getMysqlTimestamp(time()));
     return $this;
 }
コード例 #4
0
 /**
  *
  * @param int $fromTs (=null) - GMT
  * @param int $toTs (=null) - GMT
  * @param int $taskId (=null)
  * @param int $listId (=null)
  * @param int $tagId (=null)
  * @param bool $completed (=false)
  * @param bool $onlyWithDueDate (=false)
  * @param bool $onlyWithoutDueDate (=false)
  * @param bool $onlyDueTodayOrTomorrow (=false)
  * @param bool $onlyStarred (=false)
  * @param string $byDate (=null)  - in the format yyyy-mm-dd
  * @param Criteria $c (=null)
  * @return array of PcTask
  */
 public static function getTasksByMultipleCriteria($fromTs = null, $toTs = null, $taskId = null, $listId = null, $tagId = null, $completed = false, $onlyWithDueDate = false, $onlyWithoutDueDate = false, $onlyDueTodayOrTomorrow = false, $onlyStarred = false, $byDate = null, Criteria $c = null)
 {
     $c = $c === null ? new Criteria() : $c;
     if ($byDate !== null && strlen($byDate) > 0) {
         return PcTaskPeer::getTasksByDate($byDate);
     } else {
         if ($taskId !== null) {
             // the request is for a specific task
             $c->add(self::ID, $taskId);
         } else {
             if ($fromTs !== null) {
                 $c->add(self::UPDATED_AT, PcUtils::getMysqlTimestamp($fromTs), Criteria::GREATER_EQUAL);
                 $c->addAnd(self::UPDATED_AT, PcUtils::getMysqlTimestamp($toTs), Criteria::LESS_THAN);
             }
             if ($listId !== null) {
                 $c->add(self::LIST_ID, $listId);
             }
             if ($tagId !== null) {
                 $c->addJoin(PcTasksContextsPeer::TASK_ID, self::ID);
                 $c->add(PcTasksContextsPeer::USERS_CONTEXTS_ID, $tagId);
             }
             $c->add(self::IS_COMPLETED, (int) $completed);
             if ($onlyWithDueDate) {
                 $c->add(self::DUE_DATE, null, Criteria::ISNOTNULL);
             }
             if ($onlyWithoutDueDate) {
                 $c->add(self::DUE_DATE, null, Criteria::ISNULL);
             }
             if ($onlyDueTodayOrTomorrow) {
                 $tomorrow = date('Y-m-d', strtotime('tomorrow'));
                 $c->add(self::DUE_DATE, $tomorrow, Criteria::LESS_EQUAL);
                 $c->addAscendingOrderByColumn(PcTaskPeer::DUE_DATE);
                 $c->addAscendingOrderByColumn(PcTaskPeer::DUE_TIME);
             }
             if ($onlyStarred) {
                 $c->add(self::IS_STARRED, 1);
             }
             if ($completed) {
                 $c->addDescendingOrderByColumn(PcTaskPeer::COMPLETED_AT);
             } else {
                 if ($onlyWithDueDate) {
                     $c->addAscendingOrderByColumn(PcTaskPeer::DUE_DATE);
                     $c->addAscendingOrderByColumn(PcTaskPeer::DUE_TIME);
                 } else {
                     $c->addDescendingOrderByColumn(PcTaskPeer::SORT_ORDER);
                 }
             }
         }
         return self::doSelect($c);
     }
 }