本文整理汇总了PHP中Bookmark::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Bookmark::exists方法的具体用法?PHP Bookmark::exists怎么用?PHP Bookmark::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bookmark
的用法示例。
在下文中一共展示了Bookmark::exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIdentityMapAndRecordStatus
/**
* This test case demonstrates an issue with the identity case in the
* Doctrine_Table class. The brief summary is that if you create a
* record, then delete it, then create another record with the same
* primary keys, the record can get into a state where it is in the
* database but may appear to be marked as TCLEAN under certain
* circumstances (such as when it comes back as part of a collection).
* This makes the $record->exists() method return false, which prevents
* the record from being deleted among other things.
*/
public function testIdentityMapAndRecordStatus()
{
// load our user and our collection of pages
$user = Doctrine_Query::create()->query('SELECT * FROM BookmarkUser u WHERE u.name=?', array('Anonymous'))->getFirst();
$pages = Doctrine_Query::create()->query('SELECT * FROM Page');
// bookmark the pages (manually)
foreach ($pages as $page) {
$bookmark = new Bookmark();
$bookmark['page_id'] = $page['id'];
$bookmark['user_id'] = $user['id'];
$bookmark->save();
}
// select all bookmarks
$bookmarks = Doctrine_Manager::connection()->query('SELECT * FROM Bookmark b');
$this->assertEqual(count($bookmarks), 1);
// verify that they all exist
foreach ($bookmarks as $bookmark) {
$this->assertTrue($bookmark->exists());
}
// now delete them all.
$user['Bookmarks']->delete();
// verify count when accessed directly from database
$bookmarks = Doctrine_Query::create()->query('SELECT * FROM Bookmark');
$this->assertEqual(count($bookmarks), 0);
// now recreate bookmarks and verify they exist:
foreach ($pages as $page) {
$bookmark = new Bookmark();
$bookmark['page_id'] = $page['id'];
$bookmark['user_id'] = $user['id'];
$bookmark->save();
}
// select all bookmarks for the user
$bookmarks = Doctrine_Manager::connection()->query('SELECT * FROM Bookmark b');
$this->assertEqual(count($bookmarks), 1);
// verify that they all exist
foreach ($bookmarks as $bookmark) {
$this->assertTrue($bookmark->exists());
}
}
示例2: isBookmarked
/**
* Проверяет имеется ли тема в закладках
* @param integer $user_id id пользователя
* @return boolean имеется ли тема в закладках
*/
public function isBookmarked($user_id)
{
return Bookmark::exists(['conditions' => ['topic_id = ? AND user_id = ?', $this->id, $user_id]]);
}
示例3: showThumb
$a->content = showThumb($avatar_id, 'Avatar', 150, 150);
echo $a->render();
$lb = new YuiLightbox();
echo $lb->render() . '<br/>';
}
}
echo '<br/>';
if ($session->id && $user_id != $session->id) {
echo '» ' . ahref('u/messages/send/' . $user_id, 'Send message') . '<br/>';
echo '» ' . ahref('u/poke/send/' . $user_id, 'Poke user') . '<br/>';
//XXX: FIXME move to rr-project view
echo '» ' . ahref('videomsg/send/' . $user_id, 'Send video message') . '<br/>';
if (Bookmark::exists(BOOKMARK_FAVORITEUSER, $user_id, $session->id)) {
echo '» ' . ahref('u/bookmark/removeuser/' . $user_id, 'Remove favorite') . '<br/>';
} else {
echo '» ' . ahref('u/bookmark/adduser/' . $user_id, 'Add favorite') . '<br/>';
}
echo '<br/>';
if (Bookmark::exists(BOOKMARK_USERBLOCK, $user_id, $session->id)) {
echo '<b>THIS USER IS BLOCKED FROM CONTACTING YOU</b><br/>';
} else {
echo '» ' . ahref('u/block/user/' . $user_id, 'Block user') . '<br/>';
}
echo '» ' . ahref('u/report/user/' . $user_id, 'Report user') . '<br/>';
}
echo '» ' . ahref('u/guestbook/' . $user_id, 'Guestbook') . '<br/>';
echo '» ' . ahref('u/album/overview/' . $user_id, 'Photos') . '<br/>';
echo '<br/>';
if ($session->id && $user_id == $session->id) {
echo '» ' . ahref('u/edit', 'Edit profile') . '<br/>';
}
示例4: nl2br
case PRIV_MSG:
echo nl2br($msg->body) . '<br/>';
break;
case RECORDING_MSG:
echo 'VIDEO MSG!!!<br/>';
echo embed_flv($msg->body) . '<br/>';
break;
default:
throw new \Exception('eh');
}
echo '<hr/>';
}
break;
case 'send':
// child = send to user id
if (Bookmark::exists(BOOKMARK_USERBLOCK, $session->id, $this->child)) {
echo 'User has blocked you from access';
return;
}
function msgSubmit($p)
{
Message::send($p['to'], $p['msg']);
js_redirect('u/messages/inbox');
}
$user = User::get($this->child);
echo '<h2>Send a message to ' . $user->name . '</h2>';
$form = new XhtmlForm();
$form->addTextarea('msg', 'Msg');
$form->addHidden('to', $this->child);
$form->addSubmit('Send');
$form->setHandler('msgSubmit');