本文整理汇总了PHP中Album类的典型用法代码示例。如果您正苦于以下问题:PHP Album类的具体用法?PHP Album怎么用?PHP Album使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Album类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildResponse
/**
* Converts the response in JSON format to the value object i.e Album
*
* @params json
* - response in JSON format
*
* @return Album object filled with json data
*
*/
public function buildResponse($json)
{
$albumsJSONObj = $this->getServiceJSONObject("albums", $json);
$albumJSONObj = $albumsJSONObj->__get("album");
$albumObj = new Album();
$albumObj->setStrResponse($json);
$albumObj->setResponseSuccess($this->isRespponseSuccess($json));
$this->buildObjectFromJSONTree($albumObj, $albumJSONObj);
if (!$albumJSONObj->has("photos")) {
return $albumObj;
}
if (!$albumJSONObj->__get("photos")->has("photo")) {
return $albumObj;
}
if ($albumJSONObj->__get("photos")->__get("photo") instanceof JSONObject) {
// Single Entry
$photoObj = new Photo($albumObj);
$this->buildObjectFromJSONTree($photoObj, $albumJSONObj->__get("photos")->__get("photo"));
$photoObj = $this->setTagList($photoObj, $albumJSONObj->__get("photos")->__get("photo"));
} else {
// Multiple Entry
$photoJSONArray = $albumJSONObj->__get("photos")->getJSONArray("photo");
for ($i = 0; $i < count($photoJSONArray); $i++) {
$photoJsonObj = $photoJSONArray[$i];
$photoJSONObj = new JSONObject($photoJsonObj);
$photoObj = new Photo($albumObj);
$this->buildObjectFromJSONTree($photoObj, $photoJSONObj);
$photoObj = $this->setTagList($photoObj, $photoJSONObj);
}
}
return $albumObj;
}
开发者ID:murnieza,项目名称:App42_PHP_SDK,代码行数:41,代码来源:AlbumResponseBuilder.php
示例2: run
/**
* Run method with main page logic
*
* Populate template and display form for creating a new album entry. For POST request,
* validate form data and save information to database. Available to admins only
* @access public
*/
public function run()
{
$session = Session::getInstance();
$user = $session->getUser();
if (!$user || !$user->isAdmin()) {
$session->setMessage("Do not have permission to access", Session::MESSAGE_ERROR);
header("Location: " . BASE_URL);
return;
}
$albumDAO = AlbumDAO::getInstance();
$album = null;
$form_errors = array();
$form_values = array("title" => "");
if (!empty($_POST)) {
$form_values["title"] = isset($_POST["title"]) ? trim($_POST["title"]) : "";
if (empty($form_values["title"])) {
$form_errors["title"] = "No title specified";
}
if (empty($form_errors)) {
$album = new Album();
$album->setTitle($form_values["title"]);
if ($albumDAO->insert($album)) {
$session->setMessage("Album saved");
header("Location: edit_album.php?id={$album->id}");
return;
} else {
$session->setMessage("Album not saved");
}
}
}
$this->template->render(array("title" => "Create Album", "session" => $session, "main_page" => "create_album_tpl.php", "album" => $album, "form_values" => $form_values, "form_errors" => $form_errors));
}
开发者ID:Ryochan7,项目名称:UGA-Proposal-Website,代码行数:39,代码来源:create_album.php
示例3: createAlbum
protected function createAlbum()
{
$album = new Album();
$album->setName('Test Album');
$album->setArtistId(3);
return $album;
}
开发者ID:netcarver,项目名称:flourish,代码行数:7,代码来源:fORMValidationTest.php
示例4: toolbox_crop_image
function toolbox_crop_image($albumname, $imagename)
{
$album = new Album(new Gallery(), $albumname);
if ($album->isMyItem(ALBUM_RIGHTS)) {
$image = newimage($album, $imagename);
if (isImagePhoto($image)) {
?>
<li>
<a href="<?php
echo WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER;
?>
/crop_image.php?a=<?php
echo pathurlencode($albumname);
?>
&i=<?php
echo urlencode($imagename);
?>
&performcrop=frontend "><?php
echo gettext("Crop image");
?>
</a>
</li>
<?php
}
}
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:26,代码来源:crop_image.php
示例5: action
function action()
{
$category = new Category();
$kdgs = new Kdgs();
$album = new Album();
$story_url = new StoryUrl();
$category_list = $category->get_list("`res_name`='kdgs' and `s_id`='0'");
foreach ($category_list as $k => $v) {
$page = 1;
while (true) {
$album_list = $kdgs->get_children_category_album_list($v['s_p_id'], $page);
if (!$album_list) {
break;
}
foreach ($album_list as $k2 => $v2) {
$exists = $album->check_exists("`link_url` = '{$v2['url']}'");
if ($exists) {
continue;
}
$album_id = $album->insert(array('title' => $v2['title'], 'min_age' => $v2['min_age'], 'max_age' => $v2['max_age'], 'intro' => '', 's_cover' => $v2['cover'], 'link_url' => $v2['url'], 'add_time' => date('Y-m-d H:i:s')));
$story_url->insert(array('res_name' => 'album', 'res_id' => $album_id, 'field_name' => 'cover', 'source_url' => $v2['cover'], 'source_file_name' => ltrim(strrchr($v2['cover'], '/'), '/'), 'add_time' => date('Y-m-d H:i:s')));
}
$page++;
}
}
}
开发者ID:huqq1987,项目名称:clone-lemon,代码行数:26,代码来源:kdgs_album.php
示例6: getGallery
/**
* Get model gallery
* @param Model $Model
* @return mixed
*/
public function getGallery(Model $Model, $object_id = null)
{
$Album = new Album();
if (!$object_id) {
$object_id = $Model->id;
}
return $Album->getAttachedAlbum($Model->alias, $object_id);
}
开发者ID:brnagn7,项目名称:spydercake,代码行数:13,代码来源:GalleryBehavior.php
示例7: invokeHandler
public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $aid)
{
$header->title('PayPic');
$header->import('picbootstrap', 'mypage');
$viewModel->assign("pname", "@RTPic");
$album = new Album($aid);
$viewModel->assign("images", $album->getImges());
return "images";
}
开发者ID:rx-projects,项目名称:comicasa,代码行数:9,代码来源:ViewAlbum.php
示例8: unpublishSubalbums
function unpublishSubalbums($album)
{
global $gallery;
$albums = $album->getAlbums();
foreach ($albums as $albumname) {
$subalbum = new Album($gallery, $albumname);
$subalbum->setShow(false);
$subalbum->save();
unpublishSubalbums($subalbum);
}
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:11,代码来源:scheduled_content.php
示例9: set_album
public function set_album($album_str)
{
if (!Albums::get_by_name($album_str)) {
$album = new Album();
$album->set_name($album_str);
$album->save();
} else {
$album = Albums::get_by_name($album_str);
}
$this->music_album = $album->get_id();
}
开发者ID:radiowarwick,项目名称:digiplay,代码行数:11,代码来源:Track.php
示例10: testCreateAlbum
/**
* TC12: Create operation on Albums
* Test to verify that the database can save new albums
* The test is performed by creating an album object with the required input fields
* Once the test is complete no errors will appear and the album will be in the database
*/
public function testCreateAlbum() {
//Create the album
$album = new Album();
$album['artist_id'] = $this->artist['artist_id'];
$album['name'] = 'testalbum2';
$album['added_by_user_id'] = 1; //SYSTEM user
$album->save();
//Verify it exist now
$this->assertTrue($album->exists());
}
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:19,代码来源:AlbumTest.php
示例11: read
public static function read($id)
{
global $db;
if ($db) {
$q = $db->prepare('SELECT * FROM `album` WHERE id = ?');
$q->execute(array($id));
if ($item = $q->fetch()) {
$album = new Album($item['album_title'], $item['date'], $item['format']);
$album->setID($item['id']);
return $item;
}
}
return false;
}
开发者ID:hathawayhester,项目名称:dig540-1,代码行数:14,代码来源:Album.php
示例12: testCreateAlbum
public function testCreateAlbum()
{
$album = Album::create('My Album');
$album2 = Album::byId($album->getId());
$this->assertEquals($album->getId(), $album2->getId());
$this->assertEquals($album->getName(), $album2->getName());
}
开发者ID:softservlet,项目名称:media-album,代码行数:7,代码来源:AlbumRepositoryTest.php
示例13: testRemoveAlbumFromArtist
public function testRemoveAlbumFromArtist()
{
$artist = Artist::create('id', 'Artist name');
$artist->addAlbum(Album::create('id', 'Album name'));
$artist->removeAlbum(Album::create('id', 'Album name'));
$this->assertCount(0, $artist->getAlbums());
}
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:ArtistTest.php
示例14: getIndex
public function getIndex()
{
if (Auth::guest() || Auth::user()->isAdmin == 0) {
return Redirect::secure('/');
}
// layouts variables
$this->layout->title = 'Админ панел | Нещо Шантаво';
$this->layout->canonical = 'https://neshto.shantavo.com/admin/';
$this->layout->robots = 'noindex,nofollow,noodp,noydir';
$users = count(User::all());
$admins = count(User::where('isAdmin', ">", 0)->get());
$categories = count(Category::all());
$albums = count(Album::all());
$votes = count(DB::table('votes')->get());
$pictures = count(Picture::all());
$pictureSize = 0;
foreach (Picture::all() as $p) {
$pictureSize += $p->size;
}
// get disqus stats
include app_path() . '/config/_disqus.php';
$disqus = new DisqusAPI(getDisqusKey());
$disqus->setSecure(false);
$comments = $disqus->posts->list(array('forum' => 'shantavo'));
// nesting the view into the layout
$this->layout->nest('content', 'admin.index', array('users' => $users, 'admins' => $admins, 'votes' => $votes, 'categories' => $categories, 'albums' => $albums, 'pictures' => $pictures, 'pictureSize' => $pictureSize, 'comments' => $comments));
}
开发者ID:straho99,项目名称:NeshtoShantavo,代码行数:27,代码来源:AdminController.php
示例15: _createContent
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$pAlbumId = $this->getParam('album_id');
$pDossierId = $this->getParam('dossier_id');
// $album_dao = _dao("album");
$dossier_dao = _dao("dossier");
$photo_dao = _dao("photo");
if ($pDossierId > 0) {
$dossier = $dossier_dao->get($pDossierId);
} else {
$dossier->dossier_id = 0;
$dossier->dossier_album = $this->getParam('album_id');
$dossier->dossier_parent = -1;
$dossier->dossier_nom = CopixI18N::get('album|album.message.topfolder');
$dossier->dossier_comment = "";
$dossier->album_id = $pAlbumId;
}
if ($dossier->dossier_album != $pAlbumId) {
return false;
}
$pictures = $photo_dao->findAllByAlbumAndFolder($pAlbumId, $pDossierId);
$tpl->assign('album_id', $pAlbumId);
$tpl->assign('dossier_id', $pDossierId);
$tpl->assign('dossier', $dossier);
$tpl->assign('pictures', $pictures);
$tpl->assign('picture_thumbsize', '_s64');
$dossiers_tree = Album::getFoldersTree($pAlbumId);
$dossiers_commands = Album::tree2commands($dossiers_tree);
$tpl->assign('commands_move', $dossiers_commands);
$toReturn = $tpl->fetch('editphotos.tpl');
return true;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:33,代码来源:editphotos.zone.php
示例16: _createContent
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$dossiers_tree = $this->getParam('tree');
$dossiers_commands = Album::tree2commands($dossiers_tree);
$dossiers_tree_move = Album::tree2move($dossiers_tree, $this->getParam('dossier_id'));
$dossiers_commands_move = Album::tree2commands($dossiers_tree_move);
//Kernel::MyDebug( $dossiers_commands_move );
$tpl->assign('album_id', $this->getParam('album_id'));
$tpl->assign('dossier_id', $this->getParam('dossier_id'));
$tpl->assign('dossier', $this->getParam('dossier'));
$tpl->assign('commands', $dossiers_commands);
$tpl->assign('commands_move', $dossiers_commands_move);
$tpl->assign('dossiermenu', $this->getParam('dossiermenu'));
switch ($this->getParam('mode')) {
case 'htmllist':
$toReturn = $tpl->fetch('dossierstree_htmllist.tpl');
break;
case 'combo':
default:
$toReturn = $tpl->fetch('dossierstree_combo.tpl');
break;
}
return true;
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:25,代码来源:dossierstree.zone.php
示例17: showFiles
function showFiles()
{
$path = $this->path;
if (!$path) {
return false;
}
if (is_dir($path)) {
$dir = opendir($path);
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..' && $file != '.htaccess') {
Album::$sobcategory = basename($path);
Album::$categories[basename($path)] = array('text' => basename($path), 'parent' => $path);
$this->path = "{$path}/{$file}";
$this->showFiles();
unset($file);
}
}
closedir($dir);
unset($dir);
} else {
if (preg_match('/.+(mp3|wav|wma)$/', $path) && is_file($path)) {
Album::$musics[Album::$sobcategory][] = array('music' => $path);
}
}
ksort(Album::$musics);
return Album::$musics;
}
开发者ID:ssuhss,项目名称:radioTrikan,代码行数:27,代码来源:Album.php
示例18: printAlbumMenuJumpAlbum
static function printAlbumMenuJumpAlbum($albums, $option, $albumpath, $level = 1)
{
global $_zp_gallery;
foreach ($albums as $album) {
$subalbum = new Album($_zp_gallery, $album, true);
if ($option === "count" and $subalbum->getNumImages() > 0) {
$count = " (" . $subalbum->getNumImages() . ")";
} else {
$count = "";
}
$arrow = str_replace(':', '» ', str_pad("", $level - 1, ":"));
$selected = self::checkSelectedAlbum($subalbum->name, "album");
$link = "<option {$selected} value='" . htmlspecialchars($albumpath . pathurlencode($subalbum->name)) . "'>" . $arrow . strip_tags($subalbum->getTitle()) . $count . "</option>";
echo $link;
}
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:16,代码来源:PluginOverrides.php
示例19: create
/**
* Create new Album
*
* Also updates Category modification time
*
* @param int $categoryId
*/
public function create($categoryId)
{
$category = $this->getCategoryFinder()->findOneBy('id', $categoryId);
if ($this->slim->request->isGet()) {
$this->slim->render('album/create.html.twig', ['category' => $category, 'sessionUser' => $this->getSessionUser()]);
} elseif ($this->slim->request->isPost()) {
$name = $_POST['name'];
$newAlbum = new Album($this->slim->db);
$newAlbum->setCategoryId($category->getId());
$newAlbum->setName($name);
$newAlbum->insert();
$category->update();
$this->slim->flash('success', 'Album created');
$this->slim->redirect('/categories/' . $categoryId . '/albums');
}
}
开发者ID:lagut-in,项目名称:Slim-Image-Archive,代码行数:23,代码来源:AlbumController.php
示例20: testRemoveTrackFromAlbum
public function testRemoveTrackFromAlbum()
{
$album = Album::create('id', 'Album name');
$album->addTrack(Track::create('id', 'Track name'));
$album->removeTrack(Track::create('id', 'Track name'));
$this->assertCount(0, $album->getTracks());
}
开发者ID:alexgt9,项目名称:PlayCool,代码行数:7,代码来源:AlbumTest.php
注:本文中的Album类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论