Exemple #1
0
 public function getEventFromWeek($firstDayOfWeek, $lastDayOfWeek)
 {
     $query = "select ue.id, ue.eid, ue.attending, e.owner, e.name, e.address, e.adjustable, e.location, e.description, e.joinable, ue.dateFrom, ue.timeFrom, ue.timeTo, ue.privacy, ue.remember, ue.modify\n                    from userEvent as ue, event as e\n                    where ue.eid = e.eid and ue.dateFrom >= '" . $firstDayOfWeek . "' and ue.dateFrom <= '" . $lastDayOfWeek . "' and ue.uid = " . $this->user['uid'] . " and " . $this->user['relation'] . " <= ue.privacy\n                    order by timeFrom";
     $queryResult = parent::query($query);
     $event = array();
     while ($result = parent::fetchArray($queryResult)) {
         $event[] = array('id' => $result['id'], 'eid' => $result['eid'], 'attending' => $result['attending'], 'owner' => $result['owner'], 'name' => $result['name'], 'address' => $result['address'], 'adjustable' => $result['adjustable'], 'location' => $result['location'], 'description' => $result['description'], 'joinable' => $result['joinable'], 'dateFrom' => $result['dateFrom'], 'timeFrom' => $result['timeFrom'], 'timeTo' => $result['timeTo'], 'privacy' => $result['privacy'], 'remember' => $result['remember'], 'modify' => $result['modify']);
     }
     return $event;
 }
Exemple #2
0
 public function getAttenders($eid)
 {
     $query = "select u.uid, u.firstname, u.lastname from users as u, userEvent as ue where u.uid = ue.uid and ue.eid = " . $eid . " and ue.privacy = 3 group by ue.uid order by u.firstname";
     $queryResult = parent::query($query);
     $attenders = array();
     while ($result = parent::fetchArray($queryResult)) {
         $attenders[] = array('uid' => $result['uid'], 'name' => $result['firstname'] . ' ' . $result['lastname']);
     }
     return $attenders;
 }
Exemple #3
0
 public function getEventSearchResult($searchKeyword)
 {
     $query = "select e.eid, e.owner, e.name, e.description, e.dateFrom, e.timeFrom, e.timeTo, e.joinable, u.firstname, u.lastname\n                    from event as e, users as u\n                    where e.owner = u.uid and e.searchable = 1 and (e.name like '%" . $searchKeyword . "%' or e.description like '%" . $searchKeyword . "%') group by e.eid desc limit 0, 200";
     $queryResult = parent::query($query);
     $eventSearch = array();
     while ($result = parent::fetchArray($queryResult)) {
         $eventSearch[] = array('eid' => $result['eid'], 'owner' => $result['owner'], 'eventName' => $result['name'], 'name' => $result['firstname'] . ' ' . $result['lastname'], 'description' => $result['description'], 'joinable' => $result['joinable'], 'dateFrom' => $result['dateFrom'], 'timeFrom' => $result['timeFrom'], 'timeTo' => $result['timeTo']);
     }
     return $eventSearch;
 }
Exemple #4
0
 public function getUser($uid)
 {
     $query = "select firstname, lastname, email from users where uid = " . $uid;
     $queryResult = parent::query($query);
     $userData = array();
     while ($result = parent::fetchArray($queryResult)) {
         $userData = array('name' => $result['firstname'] . ' ' . $result['lastname'], 'firstname' => $result['firstname'], 'lastname' => $result['lastname'], 'email' => $result['email']);
     }
     return $userData;
 }
Exemple #5
0
 public function getFriendInvitationFromHash($hash)
 {
     $query = "select uid, email from friendEmailInvitation where hash = '" . $hash . "'";
     $queryResult = parent::query($query);
     $invitation = array();
     while ($result = parent::fetchArray($queryResult)) {
         $invitation = array('uid' => $result['uid'], 'email' => $result['email']);
     }
     return $invitation;
 }
Exemple #6
0
 public function getAllPrivatemsgGetSub($pid)
 {
     $query = "select ps.id, ps.writer, ps.content, ps.readed, ps.created, u.firstname, u.lastname from privatemsgSub as ps, users as u where ps.writer = u.uid and ps.pid = " . $pid . " order by ps.created";
     $queryResult = parent::query($query);
     $privatemsgGetSub = array();
     while ($result = parent::fetchArray($queryResult)) {
         $privatemsgGetSub[] = array('id' => $result['id'], 'writer' => $result['writer'], 'name' => $result['firstname'] . ' ' . $result['lastname'], 'content' => $result['content'], 'created' => date('d F \\a\\t H:i', strtotime($result['created'])));
     }
     return $privatemsgGetSub;
 }
Exemple #7
0
 public function getEventRecommend()
 {
     $query = "select eid, owner, name from event where eid in (select eid from userEvent) and searchable = 1 and joinable > 1 order by dateFrom desc limit 0, 50";
     $queryResult = parent::query($query);
     $eventRecommend = array();
     $i = 0;
     while ($result = parent::fetchArray($queryResult)) {
         if (self::getAttenderCount($result['eid']) > 1 && $i < 7) {
             $eventRecommend[] = array('eid' => $result['eid'], 'owner' => $result['owner'], 'name' => $result['name']);
             $i++;
         }
     }
     return $eventRecommend;
 }
Exemple #8
0
 public function getShortInfo($uid)
 {
     $query = "select pb.gender, pb.birth, pb.relationship, pb.aboutMe, pb.location, pv.view from profileBasic as pb, pageView as pv where pv.uid = pb.uid and pb.uid = " . $uid;
     $queryResult = parent::query($query);
     return parent::fetchArray($queryResult);
 }
Exemple #9
0
 public function getEmailEventUser($eid, $uid)
 {
     $query = "select u.email, u.uid, u.firstname from users as u, userEvent as ue, notificationSetting as ns where u.uid = ns.uid and u.uid = ue.uid and ns.eventComment = 1 and ue.uid != " . $uid . " and ue.eid = " . $eid . " group by u.uid";
     $queryResult = parent::query($query);
     $sendEmailToArray = array();
     while ($result = parent::fetchArray($queryResult)) {
         $sendEmailToArray[] = array('uid' => $result['uid'], 'firstname' => $result['firstname'], 'email' => $result['email']);
     }
     return $sendEmailToArray;
 }
Exemple #10
0
 public function getAllRequest($uid)
 {
     $query = "select fr.request, u.firstname, u.lastname from friendRequest as fr, users as u where fr.request = u.uid and fr.accept = " . $uid;
     $queryResult = parent::query($query);
     $requestList = array();
     while ($result = parent::fetchArray($queryResult)) {
         $requestList[] = array('request' => $result['request'], 'name' => $result['firstname'] . ' ' . $result['lastname'], 'firstname' => $result['firstname'], 'lastname' => $result['lastname'], 'eventCount' => application_frontend_event_model::getEventOfThisWeek($result['request']));
     }
     return $requestList;
 }
Exemple #11
0
 public function getNotificationSetting($uid)
 {
     $query = "select comment, commentSub, eventInvite, eventComment, eventRequest, eventUpdate, privateMessage, friendRequest from notificationSetting where uid = " . $uid;
     $queryResult = parent::query($query);
     return parent::fetchArray($queryResult);
 }