Esempio n. 1
0
 /**
  * @param $start
  * @param $end
  * @return array
  */
 public function fetchBetween($start, $end)
 {
     $query = $this->getAdapter()->select()->from(["e" => $this->getTableName()], ["*", new \Zend_Db_Expr("UNIX_TIMESTAMP(start)*1000 AS start"), new \Zend_Db_Expr("UNIX_TIMESTAMP(start)*1000 AS end")])->joinLeft(["g" => $this->_dbprefix . "events_guests"], "g.eventid=e.id AND g.userid=" . $this->getAdapter()->quote($_SESSION['user']->userid), ["guestid", "status"])->joinLeft(["u" => $this->_dbprefix . "users"], "e.userid = u.userid", ["username", "name"])->joinLeft(["pi" => $this->_dbprefix . "gallery_images"], "pi.id = u.profileImage AND e.type = 'birthday'", "filename AS pimg")->where("e.start BETWEEN " . $this->getAdapter()->quote($start) . " AND " . $this->getAdapter()->quote($end))->where("e.type = 'event' OR (e.type = 'birthday' AND e.userid IN (" . FriendQuery::getFriendListQuery("=2") . "))")->where("(g.guestid IS NULL AND e.type = 'birthday') OR (g.guestid IS NOT NULL AND e.type = 'event')");
     return $this->getAdapter()->fetchAll($query);
 }
Esempio n. 2
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->friendslistQuery = FriendQuery::getFriendListQuery();
     $this->eventslistQuery = EventsQuery::getEventsListQuery();
 }