コード例 #1
0
 function photos($id = null)
 {
     $this->layout = 'ajax';
     header('Content-type: application/atom+xml');
     if (!is_numeric($id)) {
         return;
     }
     $party = $this->Feed->findById($id);
     $this->set('party', $party);
     if (FLICKR_API_KEY != null && !$party['Feeds']['canceled']) {
         if ($party['Feeds']['useflickr'] == 1) {
             $data = array('type' => 'flickr', 'userid' => $party['Feeds']['flickrid'], 'randomize' => false);
             $flickr = new webServices($data);
             $photoset = $flickr->fetchPhotos(FLICKR_TAG_PREFIX . $id, 30, !$party['Feeds']['flickrperms']);
             $this->set('flickr', $photoset);
         }
     }
 }
コード例 #2
0
 function view($id = null, $page = null)
 {
     if ($id == 'all') {
         $this->pageTitle = 'All Parties';
         $this->set('current', 'parties');
         //Paginate!
         $count = $this->Party->findCount();
         $pages = ceil($count / 100);
         if ($page == null) {
             $page = 1;
         }
         if ($page > 1) {
             $this->set('prev', $page - 1);
         }
         if ($page < $pages) {
             $this->set('next', $page + 1);
         }
         $deck = $this->Party->findAll(null, null, "id ASC", 100, $page);
         shuffle($deck);
         $this->set('parties', $deck);
     } else {
         if (is_numeric($id)) {
             $party = $this->Party->findById($id);
             if (empty($party['Party']['id'])) {
                 $this->redirect('/parties/view/all');
             }
             $this->set('current', 'parties');
             $this->set('host', $this->Party->getHost($party['Party']['owner']));
             $this->set('party', $party);
             $this->set('isguest', $this->Party->isGuest($id, @$_SESSION['User']['id']));
             $this->pageTitle = $party['Party']['name'];
             $this->set('map', 'mapInit(' . $party['Party']['lat'] . ',' . $party['Party']['long'] . ',' . $party['Party']['zoom'] . ',\'stationary\')');
             $this->set('guests', $this->Party->getGuests($party['Party']['id']));
             $this->set('comments', $this->Party->getComments($id));
             if (FLICKR_API_KEY != null) {
                 if ($party['Party']['useflickr'] == 1) {
                     $data = array('type' => 'flickr', 'userid' => $party['Party']['flickrid'], 'randomize' => true);
                     $flickr = new webServices($data);
                     $photoset = $flickr->fetchPhotos(FLICKR_TAG_PREFIX . $party['Party']['id'], 15, $party['Party']['flickrperms'] ? false : true);
                     $this->set('flickr', array_slice($photoset, 0, 9));
                 }
             }
         } else {
             $this->redirect('/parties/view/all');
         }
     }
 }