Пример #1
0
 private function assertAlbum($row, $albumId, $userId, $title, $desc, $loc, $numPics)
 {
     $this->assertEquals($albumId, $row[FB_PHOTOS_AID]);
     $this->assertEquals($userId, $row[FB_PHOTOS_OWNER]);
     $this->assertEquals($title, $row[FB_PHOTOS_NAME]);
     $this->assertEquals($desc, $row[FB_PHOTOS_DESCRIPTION]);
     $this->assertEquals($loc, $row[FB_PHOTOS_LOCATION]);
     $this->assertEquals(Api_Bo_Photos::createAlbumLink($albumId, $userId), $row[FB_PHOTOS_LINK]);
     $this->assertEquals($numPics, $row[FB_PHOTOS_SIZE]);
 }
Пример #2
0
 /**
  * Execute the Photos.getTags method
  *
  * @return The information about the retrieved albums.  This is returned in an associative aray:
  *  array( 
  *     'photo_tag' => array(
  *        array( 'pid'=>1, 'subject'=>2, 'xcoord'=>12.3423, 'ycoord'=>13.5435, 'created'=>1543142324 ),
  *        array( 'pid'=>2, 'subject'=>6, 'xcoord'=>12.3423, 'ycoord'=>13.5435, 'created'=>1543142324 ),
  *        array( 'pid'=>3, 'subject'=>8, 'xcoord'=>12.3423, 'ycoord'=>13.5435, 'created'=>1543142324 )
  *      )
  * )
  */
 public function execute()
 {
     $tags = Api_Bo_Photos::getPhotoTags($this->m_pids);
     $retVal = array();
     $retVal[FB_PHOTOS_PHOTO_TAG] = array();
     $i = 0;
     foreach ($tags as $tag) {
         $retVal[FB_PHOTOS_PHOTO_TAG][$i] = array(FB_PHOTOS_PID => $tag['pid'], FB_PHOTOS_SUBJECT => $tag['subject_id'], FB_PHOTOS_XCOORD => $tag['xcoord'], FB_PHOTOS_YCOORD => $tag['ycoord'], FB_PHOTOS_CREATED => $tParsedTime = strtotime($tag['created'] . ' GMT'));
         $i++;
     }
     return $retVal;
 }
Пример #3
0
 /**
  * Execute the Photos.createAlbum method
  *
  * @return The information about the created album.  This is returned in an associative aray:
  *  array( 'aid'=>12345,
  *         'cover_pid'=>0
  *         'owner'=>23212
  *         'name'=>My photo album name
  *         'created'=>1042652187
  *         'modified'=>1042652200
  *         'description'=>my photo album description
  *         'location'=>London, England
  *         'link'=>http://www.ringside.com/album.php?aid=12345&id=23212
  *         'size'=>0 )
  */
 public function execute()
 {
     $time = time();
     $aid = Api_Bo_Photos::createAlbum(0, $this->getDescription(), $this->getLocation(), $this->getName(), $this->getUserId());
     if ($aid) {
         $link = Api_Bo_Photos::createAlbumLink($aid, $this->getUserId());
         $retVal = array();
         $retVal[FB_PHOTOS_AID] = $aid;
         $retVal[FB_PHOTOS_COVER_PID] = 0;
         $retVal[FB_PHOTOS_CREATED] = $time;
         $retVal[FB_PHOTOS_DESCRIPTION] = $this->getDescription();
         $retVal[FB_PHOTOS_LINK] = $link;
         $retVal[FB_PHOTOS_LOCATION] = $this->getLocation();
         $retVal[FB_PHOTOS_MODIFIED] = $time;
         $retVal[FB_PHOTOS_NAME] = $this->getName();
         $retVal[FB_PHOTOS_OWNER] = $this->getUserId();
         $retVal[FB_PHOTOS_SIZE] = 0;
     }
     return $retVal;
 }
 public function testExecute()
 {
     $uid = 10001;
     $apiParams = array();
     $apiParams['api_key'] = "32";
     $apiParams['name'] = "crazy album name";
     $apiParams['location'] = "loc";
     $apiParams['description'] = "desc";
     $faf = $this->initRest(new PhotosCreateAlbum(), $apiParams, $uid);
     $result = $faf->execute();
     $aid = $result[FB_PHOTOS_AID];
     $link = Api_Bo_Photos::createAlbumLink($aid, $uid);
     try {
         $this->assertEquals(10, count($result));
         $this->assertTrue($result[FB_PHOTOS_AID] > 0);
         $this->assertEquals(0, $result[FB_PHOTOS_COVER_PID]);
         $this->assertEquals(10001, $result[FB_PHOTOS_OWNER]);
         $this->assertEquals("crazy album name", $result[FB_PHOTOS_NAME]);
         $this->assertEquals($result[FB_PHOTOS_CREATED], $result[FB_PHOTOS_MODIFIED]);
         $this->assertEquals("desc", $result[FB_PHOTOS_DESCRIPTION]);
         $this->assertEquals("loc", $result[FB_PHOTOS_LOCATION]);
         $this->assertEquals($link, $result[FB_PHOTOS_LINK]);
         $this->assertEquals(0, $result[FB_PHOTOS_SIZE]);
         // make sure the db is populated.
         $dbRes = $this->getAlbum();
         $this->assertEquals($dbRes['aid'], $result[FB_PHOTOS_AID]);
         $this->assertEquals($dbRes['cover_pid'], $result[FB_PHOTOS_COVER_PID]);
         $this->assertEquals($dbRes['owner'], $result[FB_PHOTOS_OWNER]);
         $this->assertEquals($dbRes['name'], $result[FB_PHOTOS_NAME]);
         $this->assertEquals($dbRes[description], $result[FB_PHOTOS_DESCRIPTION]);
         $this->assertEquals($dbRes['location'], $result[FB_PHOTOS_LOCATION]);
     } catch (Exception $exc) {
         try {
             $this->removeAlbum($aid);
         } catch (Exception $e2) {
         }
         throw $exc;
     }
     $this->removeAlbum($aid);
 }
Пример #5
0
 /**
  * Execute the Photos.get method
  *
  * @return The information about the retrieved albums.  This is returned in an associative aray:
  *  array( 
  *    'photo'=>array( 
  *        array( 'pid'=>1
  *               'aid'=>2,
  *               'owner'=>10001, 
  *               'src'=>'http://www.ringside.com/231243.jpg',
  *               'src_big'=>'http://www.ringside.com/231243_345.jpg',
  *               'src_small'=>'http://www.ringside.com/231243_764.jpg',
  *               'link'=>'http://www.ringside.com/photo.php?pid=1&id=10001',
  *               'caption'=>'some caption',
  *               'created'=>1245346234 ),
  *        array( 'pid'=>2
  *               'aid'=>2,
  *               'owner'=>10001, 
  *               'src'=>'http://www.ringside.com/2312432.jpg',
  *               'src_big'=>'http://www.ringside.com/2312432_345.jpg',
  *               'src_small'=>'http://www.ringside.com/2312432_764.jpg',
  *               'link'=>'http://www.ringside.com/photo.php?pid=2&id=10001',
  *               'caption'=>'some caption',
  *               'created'=>1245346234 ),
  *       )
  *  )
  */
 public function execute()
 {
     $photos = Api_Bo_Photos::getPhotos($this->m_pids, $this->m_aid, $this->m_subjectId);
     $retVal = array();
     if (count($photos) > 0) {
         $retVal[FB_PHOTOS_PHOTO] = array();
         $i = 0;
         foreach ($photos as $row) {
             $retVal[FB_PHOTOS_PHOTO][$i++] = array(FB_PHOTOS_PID => $row['pid'], FB_PHOTOS_AID => $row['aid'], FB_PHOTOS_OWNER => $row['owner'], FB_PHOTOS_SRC => $row['src'], FB_PHOTOS_SRC_BIG => $row['src_big'], FB_PHOTOS_SRC_SMALL => $row['src_small'], FB_PHOTOS_LINK => $row['link'], FB_PHOTOS_CAPTION => $row['caption'], FB_PHOTOS_CREATED => strtotime($row['created'] . ' GMT'));
         }
     }
     return $retVal;
 }
Пример #6
0
 private function executeTags()
 {
     $tagsArray = $this->explodeTags();
     foreach ($tagsArray as $row) {
         if (isset($row["tag_uid"])) {
             $subjectId = $row["tag_uid"];
             Api_Bo_Photos::createPhotoTag($this->getPid(), $subjectId, null, $row['x'], $row['y'], null);
         } else {
             $text = $row["tag_text"];
             Api_Bo_Photos::createPhotoTag($this->getPid(), null, $text, $row['x'], $row['y'], null);
         }
     }
 }
Пример #7
0
 public function testcreateAlbumLink()
 {
     $aid = 4;
     $uid = 123;
     $this->assertEquals("http://www.ringside.com/album.php?aid=4&id=123", Api_Bo_Photos::createAlbumLink($aid, $uid));
 }
 /**
  * @return float number of photos that the average user has 
  */
 private function getAverageCountOfPhotosPerUser()
 {
     $_totalPhotos = Api_Bo_Photos::getTotalCountOfPhotos();
     return (double) $_totalPhotos / $this->totalUsers;
 }
Пример #9
0
 /**
  * Execute the Photos.getAlbums method
  *
  * @return The information about the retrieved albums.  This is returned in an associative aray:
  *  array( 
  *    'album'=>array( 
  *        array( 'aid'=>1,
  *               'cover_pid'=>2, 
  *               'owner'=>10001, 
  *               'name'=>'album name',
  *               'created'=>1245346234,
  *               'modified'=>1253346234,
  *               'description'=>'some description',
  *               'location'=>'London,England',
  *               'link'=>'http://www.ringside.com/album.php?aid=1&id=10001',
  *               'size'=>2 ),
  *        array( 'aid'=>2,
  *               'cover_pid'=>2356, 
  *               'owner'=>10001, 
  *               'name'=>'another album name',
  *               'created'=>1246546234,
  *               'modified'=>1453332234,
  *               'description'=>'another description',
  *               'location'=>'Paris,France',
  *               'link'=>'http://www.ringside.com/album.php?aid=2&id=10001',
  *               'size'=>10 ),
  *       )
  *  )
  */
 public function execute()
 {
     $albums = Api_Bo_Photos::getAlbums($this->m_aids, $this->m_uid);
     $retVal = array();
     $retVal[FB_PHOTOS_ALBUM] = array();
     $i = 0;
     foreach ($albums as $album) {
         $aid = $album['aid'];
         $link = Api_Bo_Photos::createAlbumLink($aid, $album['owner']);
         $numPhotos = Api_Bo_Photos::getNumberOfPhotots($aid);
         $retVal[FB_PHOTOS_ALBUM][$i++] = array(FB_PHOTOS_AID => $aid, FB_PHOTOS_COVER_PID => $album['cover_pid'], FB_PHOTOS_OWNER => $album['owner'], FB_PHOTOS_NAME => $album['name'], FB_PHOTOS_CREATED => strtotime($album['created'] . ' GMT'), FB_PHOTOS_MODIFIED => strtotime($album['modified'] . ' GMT'), FB_PHOTOS_DESCRIPTION => $album['description'], FB_PHOTOS_LOCATION => $album['location'], FB_PHOTOS_LINK => $link, FB_PHOTOS_SIZE => $numPhotos);
     }
     return $retVal;
 }