コード例 #1
0
ファイル: DataModelUtils.php プロジェクト: sbadi/shareatrip
 public static function getObjectList($dto, $objectArray)
 {
     $objectList = array();
     $index = strtolower(substr($dto, 0, -3));
     for ($i = 0; $i < sizeof($objectArray); $i++) {
         $objectList[$index . $i] = DataModelUtils::getObjectDTO($dto, $objectArray[$i]);
     }
     return $objectList;
 }
コード例 #2
0
ファイル: AddressDAO.php プロジェクト: sbadi/shareatrip
 public function checkIfAddressExist(\AddressDTO $addressDTO)
 {
     $objectArray = array();
     $query = "SELECT * FROM " . ADDRESS_TABLE . " WHERE longitude = " . $addressDTO->getLongitude() . " AND latitude = " . $addressDTO->getLatitude();
     try {
         $this->userAutentication();
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             return DataModelUtils::getObjectDTO(ADDRESSDTO, $objectArray[0]);
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
コード例 #3
0
ファイル: PostDAO.php プロジェクト: sbadi/shareatrip
 public function getPostByPostId($postId)
 {
     $query = "select \n                pt.postid as POSTID,\n                pt.TEXT\tas TEXT,\n                pt.DATE as DATE,\n                postph.LONGITUDE as LONGITUDE,\n                postph.LATITUDE as LATITUDE,\n                postph.PHOTOID as POSTPHOTOID,\n                postph.PHOTOURL as POSTPHOTOURL,\n                authut.USERID as AUTHORID,\n                authut.USERNAME as AUTHORUSERNAME,\n                authph.PHOTOURL as AUTHORPHOTOURL,\n                authph.PHOTOID as AUTHORPHOTOID,\n                dashut.USERID as DASHBOARDUSERID,\n                dashph.PHOTOURL as DASHBOARDPHOTOURL,\n                dashph.PHOTOID as DASHBOARDPHOTOID,\n                dashut.USERNAME as DASHBOARDUSERNAME" . " from sat_post pt, sat_photo postph, sat_user authut, sat_photo authph,sat_user dashut, sat_photo dashph" . " where pt.postid = " . $postId . " and pt.dashboardid = dashut.userid " . " and postph.photoid = pt.photoid " . " and pt.authorid = authut.userid " . " and authut.profilephoto = authph.photoid " . " and dashut.profilephoto = dashph.photoid " . " order by pt.date desc";
     //        var_dump($query);
     try {
         $this->userAutentication();
         $objectDto = $this->getDB()->execQuery($query);
         if (is_null($objectDto)) {
             return NULL;
         } else {
             $objectListDTO = DataModelUtils::getObjectDTO(POSTDTO, $objectDto[0]);
             return $objectListDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
コード例 #4
0
ファイル: UserDAO.php プロジェクト: sbadi/shareatrip
 public function getUserByUserId($userId)
 {
     $query = "select ut.*, pht.* from sat_user ut, sat_photo pht where ut.userid = {$userId}  and ut.PROFILEPHOTO = pht.PHOTOID ";
     try {
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             $objectDTO = DataModelUtils::getObjectDTO(USERDTO, $objectArray[0]);
             return $objectDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (Exception $e) {
         throw $e;
     }
 }
コード例 #5
0
ファイル: PhotoDAO.php プロジェクト: sbadi/shareatrip
 public function getPhotoByPhotoId($photoId)
 {
     $query = "select * from  " . PHOTO_TABLE . " where PHOTOID = {$photoId} ";
     try {
         $this->userAutentication();
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             $objectDTO = DataModelUtils::getObjectDTO(PHOTODTO, $objectArray[0]);
             return $objectDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
コード例 #6
0
ファイル: AlbumDAO.php プロジェクト: sbadi/shareatrip
 public function getAlbumByAlbumId($albumId)
 {
     $query = "SELECT at.*, pht.* from sat_album at, sat_photo pht WHERE " . " at.COVER = pht.PHOTOID AND " . " at.albumid = {$albumId}";
     try {
         $this->userAutentication();
         $objectArray = $this->getDB()->execQuery($query);
         if (is_null($objectArray)) {
             return NULL;
         } else {
             $objectDTO = DataModelUtils::getObjectDTO(ALBUMDTO, $objectArray[0]);
             return $objectDTO;
         }
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }