本文整理汇总了PHP中Blog::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::getId方法的具体用法?PHP Blog::getId怎么用?PHP Blog::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MergeBlogs
/**
* Объединяет два блога. Текущий удаляется
*
* @param Blog $newBlog тэг, в который слить текущий
*/
public function MergeBlogs($newBlog)
{
if ($this->getId() == $newBlog->getId()) {
return;
}
// удаляем все записи из блога, которые уже есть в новом блоге
$query = "DELETE bp1\r\n FROM blog_post bp1\r\n LEFT JOIN blog_post bp2 ON bp1.post_id = bp2.post_id\r\n WHERE bp1.blog_id = " . $this->getId() . "\r\n AND bp2.blog_id = " . $newBlog->getId();
Doctrine_Manager::connection()->execute($query);
// меняем все записи на новый блог
Doctrine_Query::create()->update('BlogPost')->set('blog_id', $newBlog->getId())->where('blog_id = ?', $this->getId())->execute();
// удаляем нас
$this->delete();
}
示例2: login
public function login(Blog $blog)
{
$this->setAuthenticated(true);
$this->setAttribute('id', $blog->getId(), 'user');
$this->setAttribute('mid', $blog->getMid(), 'user');
$this->setAttribute('name', $blog->getAuthor(), 'user');
}
示例3: getNewestTimestamp
public static function getNewestTimestamp(Blog $blog)
{
$c = new Criteria();
$c->addDescendingOrderByColumn(PostPeer::CREATED_AT);
$c->add(PostPeer::BLOG_ID, $blog->getId());
$post = PostPeer::doSelectOne($c);
return $post ? $post->getCreatedAt(null) : 0;
}
示例4: takeAction
/**
* Performs the action; returns true on success, false on error.
*
* @param $p_context - the current context object
* @return bool
*/
public function takeAction(CampContext &$p_context)
{
$Blog = new Blog($this->m_properties['blog_id']);
if (!$Blog->exists()) {
$this->m_error = new PEAR_Error('None or invalid blog was given.', ACTION_BLOGENTRY_ERR_INVALID_BLOG);
return false;
}
/*
if (!$p_context->user->defined) {
$this->m_error = new PEAR_Error('User must be logged in to add interview question.', ACTION_INTERVIEWITEM_ERR_NO_USER);
return false;
}
*/
if ($this->m_blogentry->exists()) {
/*
// to edit existing blogentry, check privileges
$MetaInterview = new MetaInterview($this->m_blogentry->getProperty('fk_interview_id'));
$is_admin = $MetaInterview->isUserAdmin($p_context);
$is_moderator = $MetaInterview->isUserModerator($p_context);
$is_guest = $MetaInterview->isUserGuest($p_context);
if (!$is_admin && !$is_moderator && !$is_guest) {
return false;
}
if ($is_guest) {
# have to answer, change status automatically
if (!strlen($this->m_properties['answer'])) {
$this->m_error = new PEAR_Error('An answer was not given.', ACTION_INTERVIEWITEM_ERR_NO_ANSWER);
return false;
}
$this->m_blogentry->setProperty('answer', $this->m_properties['answer']);
$this->m_blogentry->setProperty('status', 'date');
}
if ($is_moderator) {
if (isset($this->m_properties['question'])) {
$this->m_blogentry->setProperty('question', $this->m_properties['question']);
}
if (isset($this->m_properties['answer'])) {
$this->m_blogentry->setProperty('answer', $this->m_properties['answer']);
}
if (isset($this->m_properties['status']) && ($is_admin || $is_moderator)) {
$this->m_blogentry->setProperty('status', $this->m_properties['status']);
}
}
if ($is_admin) {
if (isset($this->m_properties['question'])) {
$this->m_blogentry->setProperty('question', $this->m_properties['question']);
}
if (isset($this->m_properties['answer'])) {
$this->m_blogentry->setProperty('answer', $this->m_properties['answer']);
}
if (isset($this->m_properties['status']) && ($is_admin || $is_moderator)) {
$this->m_blogentry->setProperty('status', $this->m_properties['status']);
}
}
$this->m_error = ACTION_OK;
return true;
*/
} else {
// create new blogentry
if (!strlen($this->m_properties['title'])) {
$this->m_error = new PEAR_Error('No entry title was given.', ACTION_BLOGENTRY_ERR_NO_TITLE);
return false;
}
if (!strlen($this->m_properties['content'])) {
$this->m_error = new PEAR_Error('No entry was given.', ACTION_BLOGENTRY_ERR_NO_CONTENT);
return false;
}
if ($this->m_blogentry->create($Blog->getId(),
$p_context->user->identifier,
$this->m_properties['title'],
$this->m_properties['content'],
null,
$this->m_properties['mood_id'])) {
//$_REQUEST['f_blogentry_id'] = $this->m_blogentry->identifier;
$this->m_error = ACTION_OK;
return true;
}
//.........这里部分代码省略.........
示例5: setBlog
/**
* Declares an association between this object and a Blog object.
*
* @param Blog $v
* @return void
* @throws PropelException
*/
public function setBlog($v)
{
if ($v === null) {
$this->setBlogId(NULL);
} else {
$this->setBlogId($v->getId());
}
$this->aBlog = $v;
}