本文整理汇总了PHP中Author::id方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::id方法的具体用法?PHP Author::id怎么用?PHP Author::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$form = Form::load('logbook.views.AddBlogEntry');
if($form->validate())
{
$auth = new Author();
$auth->clause('user_id',Application::current()->user()->id());
if($auth->id())
{
$item = new Entry();
$item->parse();
$item->set('author_id',$auth->id());
if(!Application::param('entry_date'))
$item->set('entry_date',date('Y-m-d H:i:s'));
$item->synch();
Entry::setTagsAndSave($item,Application::param('entry_tags'));
$group = new Group();
$group->noForeign();
$author_id = $item->get('author_id');
$entry_id = $item->get('entry_id');
if($groups = $group->fetch())
{
foreach($groups as $group)
{
if(file_exists(Application::MANAGED_CODE.'lbk_default_access_'.$group->get('access_id')))
{
$data = file_get_contents(Application::MANAGED_CODE.'lbk_default_access_'.$group->get('access_id'));
$perms = unserialize($data);
ManageGroupAccess::setPermissionsOnEntryForGroup($author_id,$entry_id,$group->id(),$perms);
}
}
}
Application::setUrlParam('author_id',Application::param('author_id'));
Application::setUrlParam('entry_id',Application::param('entry_id'));
LogbookAccess::publishLookupTables();
$this->redirectOnSave();
}
else
die('You are not an author!');
}
}
示例2: editAboutMe
protected function editAboutMe()
{
$form = Form::load('logbook.views.EditBlogAuthorDetails');
if($form->validate())
{
$item = new Author();
$item->clause('user_id',Application::current()->user()->id());
$item->parse();
$item->synch();
Application::setParam('author_id',$item->id());
$this->redirectOnSave();
}
}
示例3: _createAuthors
/**
* 创建指定数量的 Author 对象,并返回这些对象的 ID
*/
protected function _createAuthors($count)
{
$return = array();
for ($i = 0; $i < $count; $i++) {
$author = new Author(array('name' => 'new author - ' . mt_rand()));
$author->save();
$return[] = $author->id();
}
return $return;
}