当前位置: 首页>>代码示例>>PHP>>正文


PHP FD::albums方法代码示例

本文整理汇总了PHP中FD::albums方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::albums方法的具体用法?PHP FD::albums怎么用?PHP FD::albums使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FD的用法示例。


在下文中一共展示了FD::albums方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move

 /**
  * Allows caller to move a photo over to album
  *
  * @since   1.0
  * @access  public
  * @return
  */
 public function move()
 {
     // Check for request forgeries
     FD::checkToken();
     // Only allow logged in user
     FD::requireLogin();
     // Get the view
     $view = $this->getCurrentView();
     // Get the current photo id.
     $id = JRequest::getInt('id');
     $photo = FD::table('Photo');
     $photo->load($id);
     // Only allow valid photos
     if (!$id || !$photo->id) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Get the target album id to move this photo to.
     $albumId = JRequest::getInt('albumId');
     $album = FD::table('Album');
     $album->load($albumId);
     if (!$albumId || !$album->id) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_INVALID_ALBUM_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load the library
     $lib = FD::photo($photo->uid, $photo->type, $photo);
     // Check if the user can actually manage this photo
     if (!$lib->canMovePhoto()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_NO_PERMISSION_TO_MOVE_PHOTO'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Load up the target album
     $albumLib = FD::albums($album->uid, $album->type, $album);
     // Check if the target album is owned by the user
     if (!$albumLib->isOwner()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_NO_PERMISSION_TO_MOVE_PHOTO'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     // Try to move the photo to the new album now
     if (!$photo->move($albumId)) {
         $view->setMessage($photo->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__);
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_PHOTOS_PHOTO_MOVED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:54,代码来源:photos.php

示例2: output

 /**
  * Displays the albums a user has
  *
  * @since	1.0
  * @access	public
  * @author	Mark Lee <mark@stackideas.com>
  */
 public function output($uid, $type, $content = '', $album = false)
 {
     // Load up the albums library
     $lib = FD::albums($uid, $type, $album ? $album->id : null);
     // If no layout was given, load recent layout
     $layout = $this->input->get('layout', 'recent', 'cmd');
     // Browser menu
     $id = $this->input->get('id', '', 'int');
     // Load up the model
     $model = FD::model('Albums');
     // Get a list of core albums
     $coreAlbums = $model->getAlbums($lib->uid, $lib->type, array('coreAlbumsOnly' => true));
     // Get a list of normal albums
     $options = array();
     $options['core'] = false;
     $options['order'] = 'a.assigned_date';
     $options['direction'] = 'DESC';
     $options['privacy'] = true;
     $albums = $model->getAlbums($lib->uid, $lib->type, $options);
     // Browser frame
     // Get the user alias
     $userAlias = '';
     // $userAlias	= $user->getAlias();
     $this->set('lib', $lib);
     $this->set('userAlias', $userAlias);
     $this->set('id', $id);
     $this->set('coreAlbums', $coreAlbums);
     $this->set('albums', $albums);
     $this->set('content', $content);
     $this->set('uuid', uniqid());
     $this->set('layout', $layout);
     echo parent::display('site/albums/default');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:40,代码来源:view.html.php

示例3: create_album

 public function create_album()
 {
     // Get the uid and type
     $app = JFactory::getApplication();
     $uid = $app->input->get('uid', 0, 'INT');
     $type = $app->input->get('type', 0, 'USER');
     $title = $app->input->get('title', 0, 'USER');
     // Load the album
     $album = FD::table('Album');
     $album->load();
     // Determine if this item is a new item
     $isNew = true;
     if ($album->id) {
         $isNew = false;
     }
     // Load the album's library
     $lib = FD::albums($uid, $type);
     // Check if the person is allowed to create albums
     if ($isNew && !$lib->canCreateAlbums()) {
         return false;
     }
     // Set the album uid and type
     $album->uid = $uid;
     $album->type = $type;
     $album->title = $title;
     // Determine if the user has already exceeded the album creation
     if ($isNew && $lib->exceededLimits()) {
         return false;
     }
     // Set the album creation alias
     $album->assigned_date = FD::date()->toMySQL();
     // Set custom date
     if (isset($post['date'])) {
         $album->assigned_date = $post['date'];
         unset($post['date']);
     }
     // Set the user creator
     $album->user_id = $uid;
     // Try to store the album
     $state = $album->store();
     // Throw error when there's an error saving album
     if (!$state) {
         return false;
     }
     $photo_obj = new EasySocialApiUploadHelper();
     $photodata = $photo_obj->albumPhotoUpload($uid, $type, $album->id);
     $album->params = $photodata;
     if (!$album->cover_id) {
         $album->cover_id = $photodata->id;
         // Store the album
         $album->store();
     }
     return $album;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:54,代码来源:album.php

示例4: store

 /**
  * Post processing when creating a new album
  *
  * @since	1.0
  * @access	public
  */
 public function store($album = null)
 {
     $ajax = FD::ajax();
     if ($this->hasErrors()) {
         return $ajax->reject($this->getMessage());
     }
     // Success message
     $theme = FD::themes();
     $theme->set('album', $album);
     $message = $theme->output('site/albums/message.album.save');
     // Notify user that the msg is saved
     $ajax->notify($message, SOCIAL_MSG_SUCCESS);
     // Load up the library
     $lib = FD::albums($album->uid, $album->type, $album->id);
     $output = $lib->renderItem();
     return $ajax->resolve($album->export(), $output);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:23,代码来源:view.ajax.php


注:本文中的FD::albums方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。