本文整理汇总了PHP中Album类的典型用法代码示例。如果您正苦于以下问题:PHP Album类的具体用法?PHP Album怎么用?PHP Album使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Album类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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));
}
示例3: createAlbum
protected function createAlbum()
{
$album = new Album();
$album->setName('Test Album');
$album->setArtistId(3);
return $album;
}
示例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
}
}
}
示例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++;
}
}
}
示例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);
}
示例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";
}
示例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);
}
}
示例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();
}
示例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());
}
示例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;
}
示例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());
}
示例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());
}
示例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));
}
示例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;
}