本文整理汇总了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__);
}
示例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');
}
示例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;
}
示例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);
}