本文整理汇总了PHP中ACL::post方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::post方法的具体用法?PHP ACL::post怎么用?PHP ACL::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
?>
<div class="controls">
<?php
echo Form::input('author_name', $author, array('class' => 'form-control', 'data-items' => 10), 'autocomplete/user');
?>
</div>
</div>
<?php
}
?>
</div>
</div>
<div class="panel-footer">
<div id="major-publishing-actions" class="row">
<?php
if ($post->loaded() and ACL::post('delete', $post)) {
?>
<div id="delete-action" class="btn btn-default pull-left">
<i class="fa fa-trash-o"></i>
<?php
echo HTML::anchor($post->delete_url . URL::query($destination), __('Move to Trash'), array('class' => 'submitdelete'));
?>
</div>
<?php
}
?>
<div id="publishing-action">
<?php
echo Form::submit('page', __('Save'), array('class' => 'btn btn-success pull-right'));
?>
示例2: action_delete
/**
* Delete page
*
* @uses ACL::post
* @uses Request::query
* @uses Request::redirect
* @uses Route::get
* @uses Route::uri
* @uses URL::query
* @uses ORM::delete
* @uses Cache::delete
* @uses Message::success
* @uses Message::error
* @uses Log::add
* @throws HTTP_Exception_403
*/
public function action_delete()
{
$id = (int) $this->request->param('id', 0);
$post = ORM::factory('blog', $id);
if (!ACL::post('delete', $post)) {
// If the post was not loaded, we return access denied.
throw HTTP_Exception::factory(403, 'Access denied!');
}
$this->title = __('Delete :title', array(':title' => $post->title));
$destination = $this->request->query('destination') !== NULL ? array('destination' => $this->request->query('destination')) : array();
$view = View::factory('form/confirm')->set('action', Route::get('blog')->uri(array('action' => 'delete', 'id' => $post->id)) . URL::query($destination))->set('title', $post->title);
// If deletion is not desired, redirect to post
if (isset($_POST['no']) and $this->valid_post()) {
$this->request->redirect($post->url);
}
// If deletion is confirmed
if (isset($_POST['yes']) and $this->valid_post()) {
try {
$title = $post->title;
$post->delete();
Cache::instance('blog')->delete('blog-' . $id);
Log::info('Blog :title deleted.', array(':title' => $title));
Message::success(__('Blog %title deleted successful!', array('%title' => $title)));
} catch (Exception $e) {
Log::error('Error occurred deleting blog id: :id, :msg', array(':id' => $post->id, ':msg' => $e->getMessage()));
Message::error(__('An error occurred deleting blog %post', array('%post' => $post->title)));
}
$redirect = empty($destination) ? Route::get('blog')->uri(array('action' => 'list')) : $this->request->query('destination');
$this->request->redirect($redirect);
}
$this->response->body($view);
}