当前位置: 首页>>代码示例>>PHP>>正文


PHP Bookmark::exists方法代码示例

本文整理汇总了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());
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:49,代码来源:587TestCase.php

示例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]]);
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:9,代码来源:Topic.php

示例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 '&raquo; ' . ahref('u/messages/send/' . $user_id, 'Send message') . '<br/>';
    echo '&raquo; ' . ahref('u/poke/send/' . $user_id, 'Poke user') . '<br/>';
    //XXX: FIXME move to rr-project view
    echo '&raquo; ' . ahref('videomsg/send/' . $user_id, 'Send video message') . '<br/>';
    if (Bookmark::exists(BOOKMARK_FAVORITEUSER, $user_id, $session->id)) {
        echo '&raquo; ' . ahref('u/bookmark/removeuser/' . $user_id, 'Remove favorite') . '<br/>';
    } else {
        echo '&raquo; ' . 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 '&raquo; ' . ahref('u/block/user/' . $user_id, 'Block user') . '<br/>';
    }
    echo '&raquo; ' . ahref('u/report/user/' . $user_id, 'Report user') . '<br/>';
}
echo '&raquo; ' . ahref('u/guestbook/' . $user_id, 'Guestbook') . '<br/>';
echo '&raquo; ' . ahref('u/album/overview/' . $user_id, 'Photos') . '<br/>';
echo '<br/>';
if ($session->id && $user_id == $session->id) {
    echo '&raquo; ' . ahref('u/edit', 'Edit profile') . '<br/>';
}
开发者ID:martinlindhe,项目名称:core_dev,代码行数:31,代码来源:profile.php

示例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');
开发者ID:martinlindhe,项目名称:core_dev,代码行数:31,代码来源:messages.php


注:本文中的Bookmark::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。