本文整理汇总了PHP中Bookmark::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Bookmark::getList方法的具体用法?PHP Bookmark::getList怎么用?PHP Bookmark::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bookmark
的用法示例。
在下文中一共展示了Bookmark::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
<?php
namespace cd;
$session->requireLoggedIn();
switch ($this->owner) {
case 'adduser':
// child = user id
Bookmark::create(BOOKMARK_FAVORITEUSER, $this->child);
js_redirect('u/bookmark/listusers');
break;
case 'removeuser':
// child = user id
Bookmark::remove(BOOKMARK_FAVORITEUSER, $this->child);
js_redirect('u/bookmark/listusers');
break;
case 'listusers':
echo '<h1>Favorite users</h1>';
$bookmarks = Bookmark::getList(BOOKMARK_FAVORITEUSER, $session->id);
foreach ($bookmarks as $bm) {
$u = User::get($bm->value);
echo ahref('u/profile/' . $u->id, $u->name);
echo ' ';
echo ahref('u/bookmark/removeuser/' . $u->id, 'Remove');
echo '<br/>';
}
break;
default:
echo 'No handler for view ' . $this->owner;
}
示例2: switch
namespace cd;
$session->requireLoggedIn();
switch ($this->owner) {
case 'user':
// child = user id
if (!$this->child || $this->child == $session->id) {
die('meh');
}
if (confirmed('You sure you want to block this user from contacting you?')) {
Bookmark::create(BOOKMARK_USERBLOCK, $this->child);
js_redirect('u/profile/' . $this->child);
}
break;
case 'remove':
// child = user id
Bookmark::remove(BOOKMARK_USERBLOCK, $this->child);
js_redirect('u/block/manage');
break;
case 'manage':
echo '<h1>Manage your blocked users</h1>';
$list = Bookmark::getList(BOOKMARK_USERBLOCK, $session->id);
foreach ($list as $o) {
echo ahref('u/profile/' . $o->value, User::get($o->value)->name) . ' ';
echo ahref('u/block/remove/' . $o->value, 'Remove block') . '<br/>';
}
break;
default:
echo 'no such view: ' . $this->owner;
}