Beispiel #1
0
 /**
  * Display the list of photos a user has uploaded
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAdsense($user, $params)
 {
     $appParam = $this->app->getParams();
     $code = $params->get('profile_adsense_code', $appParam->get('profile_adsense_code', ''));
     $this->set('code', $code);
     return parent::display('widgets/profile/adsense');
 }
Beispiel #2
0
 /**
  * Displays the dashboard widget
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function sidebarBottom()
 {
     // Get the app params
     $params = $this->app->getParams();
     $key = $params->get('dashboard_show_uniquekey', 'BIRTHDAY');
     $displayYear = $params->get('dashboard_show_birthday', 1);
     // Get current logged in user
     $my = FD::user();
     $birthdays = $this->getUpcomingBirthdays($key, $my->id);
     $ids = array();
     $dateToday = FD::date()->toFormat('md');
     $today = array();
     $otherDays = array();
     // Hide app when there's no upcoming birthdays
     if (!$birthdays) {
         return;
     }
     $my = FD::user();
     $privacy = FD::privacy($my->id);
     if ($birthdays) {
         foreach ($birthdays as $birthday) {
             $ids[] = $birthday->uid;
         }
         // Preload list of users
         FD::user($ids);
         foreach ($birthdays as $birthday) {
             $obj = new stdClass();
             $obj->user = FD::user($birthday->uid);
             $obj->birthday = $birthday->displayday;
             //Checking to display year here
             if ($displayYear) {
                 $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DMY');
                 //check birtday the year privacy
                 if (!$privacy->validate('field.birthday', $birthday->field_id, 'year', $birthday->uid)) {
                     $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
                 }
             } else {
                 $dateFormat = JText::_('COM_EASYSOCIAL_DATE_DM');
             }
             $obj->display = FD::date($obj->birthday)->format($dateFormat);
             if ($birthday->day == $dateToday) {
                 $today[] = $obj;
             } else {
                 $otherDays[] = $obj;
             }
         }
     }
     $this->set('ids', $ids);
     $this->set('birthdays', $birthdays);
     $this->set('today', $today);
     $this->set('otherDays', $otherDays);
     echo parent::display('widgets/upcoming.birthday');
 }
Beispiel #3
0
 /**
  * Display the list of photos a user has uploaded
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPhotos($user, $params)
 {
     // Get photos model
     $model = FD::model('Photos');
     $options = array('uid' => $user->id, 'type' => SOCIAL_TYPE_USER);
     $photos = $model->getPhotos($options);
     $total = $model->getTotalPhotos($options);
     $this->set('params', $params);
     $this->set('total', $total);
     $this->set('user', $user);
     $this->set('photos', $photos);
     return parent::display('widgets/profile/photos');
 }
Beispiel #4
0
 /**
  * Display the list of photo albums
  *
  * @since   1.2
  * @access  public
  * @param   SocialEvent The event object
  */
 public function getAlbums(&$event)
 {
     $params = $this->getParams();
     if (!$params->get('widgets_album', true)) {
         return;
     }
     // Get the album model
     $model = FD::model('Albums');
     $albums = $model->getAlbums($event->id, SOCIAL_TYPE_EVENT);
     $options = array('core' => false, 'withCovers' => true, 'pagination' => 10);
     // Get the total number of albums
     $total = $model->getTotalAlbums(array('uid' => $event->id, 'type' => SOCIAL_TYPE_EVENT));
     $this->set('total', $total);
     $this->set('albums', $albums);
     $this->set('event', $event);
     return parent::display('widgets/widget.albums');
 }
Beispiel #5
0
 /**
  * Display the list of photo albums
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getAlbums(&$group)
 {
     $params = $this->getParams();
     if (!$params->get('widgets_album', true)) {
         return;
     }
     $model = FD::model('Albums');
     // Get the list of albums from this group
     $albums = $model->getAlbums($group->id, SOCIAL_TYPE_GROUP);
     $options = array('uid' => $group->id, 'type' => SOCIAL_TYPE_GROUP);
     // Get the total number of albums
     $total = $model->getTotalAlbums($options);
     $this->set('total', $total);
     $this->set('albums', $albums);
     $this->set('group', $group);
     return parent::display('widgets/widget.albums');
 }
Beispiel #6
0
 /**
  * Display the list of photos a user has uploaded
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPhotos($user, $params)
 {
     // Get photos model
     $model = FD::model('Photos');
     // Get the photo limit from the app setting
     $limit = $params->get('photo_widget_listing_total', 20);
     // limit <- get from the getPhotos function
     $options = array('uid' => $user->id, 'type' => SOCIAL_TYPE_USER, 'limit' => $limit);
     $photos = $model->getPhotos($options);
     $total = $model->getTotalPhotos($options);
     $this->set('params', $params);
     $this->set('total', $total);
     $this->set('limit', $limit);
     $this->set('user', $user);
     $this->set('photos', $photos);
     return parent::display('widgets/profile/photos');
 }
Beispiel #7
0
 /**
  * Display the list of photo albums
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getAlbums(&$group)
 {
     $params = $this->getParams();
     // If the app is disabled, do not continue
     if (!$params->get('widgets_album', true)) {
         return;
     }
     $model = FD::model('Albums');
     // Determines the total number of albums to retrieve
     $limit = $params->get('limit', 10);
     // Get the list of albums from this group
     $albums = $model->getAlbums($group->id, SOCIAL_TYPE_GROUP, array('limit' => $limit));
     $options = array('uid' => $group->id, 'type' => SOCIAL_TYPE_GROUP);
     // Get the total number of albums
     $total = $model->getTotalAlbums($options);
     $this->set('total', $total);
     $this->set('albums', $albums);
     $this->set('group', $group);
     return parent::display('widgets/widget.albums');
 }
Beispiel #8
0
 /**
  * Display the list of photos a user has uploaded
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAlbums($user)
 {
     $params = $this->getUserParams($user->id);
     $appParam = $this->app->getParams();
     $albums = array();
     // Load up albums model
     $model = FD::model('Albums');
     $sorting = $params->get('ordering', $appParam->get('ordering', 'latest'));
     $options = array('order' => 'assigned_date', 'direction' => $sorting == 'latest' ? 'desc' : 'asc');
     $options['excludeblocked'] = 1;
     // privacy lib
     $privacy = Foundry::privacy(Foundry::user()->id);
     $results = $model->getAlbums($user->id, SOCIAL_TYPE_USER, $options);
     if ($results) {
         foreach ($results as $item) {
             // we need to check the photo's album privacy to see if user allow to view or not.
             if ($privacy->validate('albums.view', $item->id, SOCIAL_TYPE_ALBUM, $item->user_id)) {
                 $albums[] = $item;
             }
         }
     }
     if (empty($albums)) {
         return;
     }
     // If sorting is set to random, then we shuffle the albums
     if ($sorting == 'random') {
         shuffle($albums);
     }
     // since we are getting all albums belong to user,
     // we do not need to run another query to count the albums.
     // just do array count will be fine.
     // $total		= $model->getTotalAlbums($options);
     $total = count($albums);
     $limit = $params->get('limit', $appParam->get('limit', 10));
     $this->set('total', $total);
     $this->set('appParams', $appParam);
     $this->set('params', $params);
     $this->set('user', $user);
     $this->set('albums', $albums);
     $this->set('limit', $limit);
     $this->set('privacy', $privacy);
     return parent::display('widgets/profile/albums');
 }