本文整理汇总了PHP中Route::model_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::model_id方法的具体用法?PHP Route::model_id怎么用?PHP Route::model_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::model_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$gallery = $this->image->gallery();
echo Form::open(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => 'report')), array('class' => Request::current()->is_ajax() ? 'ajaxify' : ''));
?>
<fieldset>
<?php
echo Form::control_group(Form::input('reason', null, array('class' => 'input-block-level')), array('name' => __('Reason')), null, __('You can enter an optional reason for reporting this image, e.g. why it should be removed'));
?>
</fieldset>
<fieldset class="form-actions">
<?php
echo Form::button('save', __('Report'), array('type' => 'submit', 'class' => 'btn btn-danger btn-large'));
?>
<?php
echo Request::current()->is_ajax() ? '' : HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $this->image->id, 'action' => '')), __('Cancel'), array('class' => 'cancel'));
?>
<?php
echo Form::csrf();
?>
</fieldset>
<?php
return ob_get_clean();
}
示例2: get
/**
* Get newsfeed item as HTML
*
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsfeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
if ($gallery->loaded() && $image->loaded()) {
$text = __('commented to an image<br />:gallery', array(':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-camera icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
case self::TYPE_COMMENT_FLYER:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('commented to a flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_FLYER_EDIT:
$flyer = Model_Flyer::factory($item->data['flyer_id']);
if ($flyer->loaded()) {
$text = __('updated flyer<br />:flyer', array(':flyer' => HTML::anchor(Route::url('flyer', array('id' => $flyer->id)), '<i class="icon-picture icon-white"></i> ' . ($flyer->name ? HTML::chars($flyer->name) : __('flyer')), array('class' => 'hoverable'))));
}
break;
case self::TYPE_NOTE:
$gallery = Model_Gallery::factory($item->data['gallery_id']);
$image = Model_Image::factory($item->data['image_id']);
$user = Model_User::find_user($item->data['user_id']);
if ($gallery->loaded() && $image->loaded() && $user->loaded()) {
$text = __('tagged :user to an image<br />:gallery', array(':user' => HTML::user($user), ':gallery' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), '<i class="icon-tag icon-white"></i> ' . HTML::chars($gallery->name), array('class' => 'hoverable'))));
}
break;
}
return $text;
}
示例3: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<div class="row">
<?php
foreach ($this->images as $image) {
$gallery = $image->gallery();
?>
<div class="<?php
echo $this->wide ? 'col-xs-6 col-sm-4 col-md-3 col-lg-2' : 'col-xs-12 col-sm-6';
?>
">
<div class="thumbnail">
<?php
echo HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id)), HTML::image($image->get_url('thumbnail', $gallery->dir)));
?>
<div class="caption">
<h4><?php
echo HTML::anchor(Route::model($gallery), HTML::chars($gallery->name));
?>
</h4>
</div>
<small class="stats label label-default">
<?php
switch ($this->type) {
case Model_Image::TOP_COMMENTED:
echo '<i class="fa fa-comment"></i> ', Num::format($image->comment_count, 0);
break;
case Model_Image::TOP_RATED:
echo '<i class="fa fa-star"></i> ', round($image->rate_total / $image->rate_count, 2);
break;
case Model_Image::TOP_VIEWED:
echo '<i class="fa fa-eye"></i> ', Num::format($image->view_count, 0);
break;
}
?>
</small>
</div>
</div>
<?php
}
?>
</div>
<?php
return ob_get_clean();
}
示例4: get_link
/**
* Get anchor to newsfeed item target.
*
* @static
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get_link(Model_NewsfeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_REPLY:
$topic = Model_Forum_Topic::factory($item->data['topic_id']);
if ($topic->loaded()) {
$text = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($topic), 'id' => $item->data['post_id'])) . '#post-' . $item->data['post_id'], '<i class="fa fa-comments"></i> ' . HTML::chars($topic->name), array('title' => $topic->name));
}
break;
case self::TYPE_TOPIC:
$topic = Model_Forum_Topic::factory($item->data['topic_id']);
if ($topic->loaded()) {
$text = HTML::anchor(Route::model($topic), '<i class="fa fa-comments"></i> ' . HTML::chars($topic->name), array('title' => $topic->name));
}
break;
}
return $text;
}
示例5: get
/**
* Get newsfeed item as HTML
*
* @static
* @param Model_NewsfeedItem $item
* @return string
*/
public static function get(Model_NewsFeedItem $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_REPLY:
$topic = Model_Forum_Topic::factory($item->data['topic_id']);
if ($topic->loaded()) {
$text = __('replied to topic<br />:topic', array(':topic' => HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($topic), 'id' => $item->data['post_id'])) . '#post-' . $item->data['post_id'], '<i class="icon-comment icon-white"></i> ' . HTML::chars($topic->name), array('title' => $topic->name))));
}
break;
case self::TYPE_TOPIC:
$topic = Model_Forum_Topic::factory($item->data['topic_id']);
if ($topic->loaded()) {
$text = __('started a new topic<br />:topic', array(':topic' => HTML::anchor(Route::model($topic), '<i class="icon-comment icon-white"></i> ' . HTML::chars($topic->name), array('title' => $topic->name))));
}
break;
}
return $text;
}
示例6: get
/**
* Get notification as HTML.
*
* @static
* @param Model_Notification
* @return string
*/
public static function get(Model_Notification $notification)
{
$text = '';
switch ($notification->type) {
case self::TYPE_IMAGE_COMMENT:
$user = Model_User::find_user($notification->user_id);
$image = Model_Image::factory($notification->data_id);
if ($user->loaded() && $image->loaded()) {
$gallery = $image->gallery();
$text = __(':user commented your :photo: <em>:comment</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':comment' => Text::smileys(Text::auto_link_urls(HTML::chars($notification->text)))));
} else {
$notification->delete();
}
break;
case self::TYPE_IMAGE_NOTE:
$user = Model_User::find_user($notification->user_id);
$image = Model_Image::factory($notification->data_id);
if ($user->loaded() && $image->loaded()) {
$gallery = $image->gallery();
$text = __(':user tagged you to a :photo', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable'))));
} else {
$notification->delete();
}
break;
case self::TYPE_IMAGE_REPORT:
$user = Model_User::find_user($notification->user_id);
$image = Model_Image::factory($notification->data_id);
if ($user->loaded() && $image->loaded()) {
$gallery = $image->gallery();
$text = __(':user reported a :photo: <em>:reason</em>', array(':user' => HTML::user($user), ':photo' => HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => '')), __('photo'), array('class' => 'hoverable')), ':reason' => $notification->text ? HTML::chars($notification->text) : __('No reason')));
} else {
$notification->delete();
}
break;
}
return $text;
}
示例7: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<div class="image">
<figure>
<?php
if ($this->url) {
echo HTML::anchor($this->url, HTML::image($this->image->get_url(null, $this->gallery->dir)), array('title' => __('Next image'), 'class' => 'image'));
} else {
echo HTML::anchor(Route::model($this->gallery, $this->show_pending ? 'approve' : ''), HTML::image($this->image->get_url(null, $this->gallery->dir)), array('title' => __('Back to gallery'), 'class' => 'image'));
}
?>
<?php
if ($this->can_note) {
?>
<?php
echo Form::open(Route::url('gallery_image', array('gallery_id' => Route::model_id($this->gallery), 'id' => $this->image->id, 'action' => 'note')), array('id' => 'form-note'));
?>
<fieldset>
<?php
echo Form::control_group(Form::input('name'));
?>
<?php
echo Form::submit('save', __('Save'), array('class' => 'btn btn-success'));
?>
<a class="cancel" href="#cancel"><?php
echo __('Cancel');
?>
</a>
<?php
echo Form::hidden('x');
?>
<?php
echo Form::hidden('y');
?>
<?php
echo Form::hidden('width');
?>
<?php
echo Form::hidden('height');
?>
<?php
echo Form::hidden('user_id');
?>
</fieldset>
<?php
echo Form::close();
?>
<?php
}
?>
</figure>
<?php
echo $this->notes();
?>
</div>
<?php
return ob_get_clean();
}
示例8: action_upload
/**
* Action: upload
*/
public function action_upload()
{
// Load existing gallery if any
$gallery_id = (int) $this->request->param('gallery_id');
if (!$gallery_id) {
$gallery_id = (int) $this->request->param('id');
}
if ($gallery_id) {
// Existing gallery
$gallery = Model_Gallery::factory($gallery_id);
if (!$gallery->loaded()) {
throw new Model_Exception($gallery, $gallery_id);
}
} else {
// New gallery
return $this->_edit_gallery(null, Arr::get($_REQUEST, 'event'));
}
Permission::required(new Model_Gallery(), Model_Gallery::PERMISSION_UPLOAD, self::$user);
// Handle post
$errors = array();
if ($_FILES) {
$file = Arr::get($_FILES, 'file');
if ($file) {
// We need to flatten our file one level as ajax uploaded files are set up funnily.
// Support for ajax uploads one by one for now..
foreach ($file as $key => $value) {
is_array($value) and $file[$key] = $value[0];
}
// Needed for IE response
if ($multiple = Arr::get($_REQUEST, 'multiple', false)) {
$this->auto_render = false;
}
// Upload info for JSON
$info = new stdClass();
$info->name = HTML::chars($file['name']);
$info->size = intval($file['size']);
// Save image
try {
// Make sure we don't timeout. An external queue would be better thuough.
set_time_limit(0);
ignore_user_abort(true);
// Duplicate filename check
$uploaded = Session::instance()->get('uploaded', array());
if (isset($uploaded[$gallery->id]) && in_array($file['name'], $uploaded[$gallery->id])) {
throw new Kohana_Exception(__('Already uploaded'));
}
$image = Model_Image::factory();
$image->normal = 'wide';
$image->set_fields(array('author_id' => self::$user->id, 'file' => $file, 'status' => Model_Image::NOT_ACCEPTED, 'created' => time()));
$image->save();
// Save exif
try {
$exif = Model_Image_Exif::factory();
$exif->image_id = $image->id;
$exif->save();
} catch (Kohana_Exception $e) {
throw $e;
}
// Set the image as gallery image
$gallery->relate('images', array($image->id));
$gallery->image_count++;
$gallery->save();
// Mark filename as uploaded for current gallery
$uploaded[$gallery->id][] = $file['name'];
Session::instance()->set('uploaded', $uploaded);
// Make sure the user has photo role to be able to see uploaded pictures
if (!self::$user->has_role('photo')) {
self::$user->add_role('photo');
}
// Show image if uploaded with ajax
if ($this->ajax || $multiple) {
$info->url = $image->get_url();
$info->thumbnail_url = $image->get_url(Model_Image::SIZE_THUMBNAIL);
$info->gallery_url = Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => 'approve'));
$info->delete_url = Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => 'delete')) . '?token=' . Security::csrf();
$info->delete_type = 'GET';
$this->response->body(json_encode(array($info)));
return;
}
$this->request->redirect(Route::model($gallery));
} catch (Validation_Exception $e) {
$errors = $e->array->errors('validation');
} catch (Kohana_Exception $e) {
$errors = array('file' => $e->getMessage());
}
// Show errors if uploading with ajax, skip form
if (($this->ajax || $multiple) && !empty($errors)) {
$info->error = Arr::get($errors, 'file');
$this->response->body(json_encode(array($info)));
return;
}
}
}
// Build page
$this->view = View_Page::factory($gallery->name);
$images = count($gallery->images());
$this->view->subtitle = __($images == 1 ? ':images image' : ':images images', array(':images' => $images)) . ' - ' . HTML::time(Date::format('DMYYYY', $gallery->date), $gallery->date, true);
//.........这里部分代码省略.........
示例9: _edit_post
//.........这里部分代码省略.........
if ($this->private) {
$topic->notify_recipients(self::$user);
}
} else {
// Old post
$post->modify_count++;
$post->modified = time();
$increase = false;
}
try {
$post->save();
if ($increase) {
// Quote, only for public topics
if (!$this->private && $quote_id && $quote->author_id) {
$quoted = $quote->author_id;
$quote = new Model_Forum_Quote();
$quote->user_id = $quoted;
$quote->author_id = self::$user->id;
$quote->forum_topic_id = $topic->id;
$quote->forum_post_id = $post->id;
$quote->created = time();
$quote->save();
}
// Topic
$topic->post_count++;
$topic->last_post_id = $post->id;
$topic->last_poster = $post->author_name;
// If current topic is set to sink, don't update last posted date
if ($topic->status != Model_Forum_Topic::STATUS_SINK) {
$topic->last_posted = $post->created;
}
$topic->save();
// Area, only for public topics
if (!$this->private) {
$area = $topic->area();
$area->post_count++;
$area->last_topic_id = $topic->id;
$area->save();
}
// User
self::$user->post_count++;
self::$user->save();
// News feed
if (!$this->private) {
NewsfeedItem_Forum::reply(self::$user, $post);
}
}
if ($this->ajax) {
$post_route = Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => Route::model_id($topic), 'id' => $post->id));
$post_response = Request::factory($post_route)->execute();
$this->response->body($post_response->body());
return;
}
$this->request->redirect(Route::model($topic, '?page=last#last'));
} catch (Validation_Exception $e) {
$errors = $e->array->errors('validate');
}
}
// Common attributes
if ($quote_id) {
$mode = View_Forum_PostEdit::QUOTE;
} else {
if ($post_id) {
$mode = View_Forum_PostEdit::EDIT_POST;
} else {
$mode = View_Forum_PostEdit::REPLY;
}
}
$section = $this->section_post_edit($mode, $post);
$section->forum_topic = $topic;
$section->errors = $errors;
$section->cancel = $this->ajax ? Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => Route::model_id($topic), 'id' => $quote_id ? $quote_id : $post->id)) : Request::back(Route::model($topic), true);
/* $form = array(
'errors' => $errors,
'ajax' => $this->ajax ? true : null,
'topic' => $topic,
'post' => $post,
'user' => self::$user,
'private' => $this->private,
'cancel' => $this->ajax
? Route::get($this->private ? 'forum_private_post' : 'forum_post')
->uri(array(
'topic_id' => Route::model_id($topic),
'id' => $quote_id ? $quote_id : $post->id,
))
: Request::back(Route::model($topic), true),
);*/
if ($this->ajax) {
$this->response->body($mode == View_Forum_PostEdit::EDIT_POST ? $section->content() : $section);
return;
}
// Build page
$this->view = new View_Page();
$this->view->title_html = Forum::topic($topic);
$this->view->add(View_Page::COLUMN_MAIN, $section);
/*
Widget::add('main', View_Module::factory('forum/reply', array(
'mod_id' => 'reply',
) + $form));*/
}
示例10: __
<?php
if ($note) {
?>
<li><a href="#" class="action small note-add"><?php
echo __('Tag people');
?>
</a></li>
<?php
}
?>
</ul>
</figcaption>
<?php
echo Form::open(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => 'note')), array('id' => 'form-note'));
?>
<fieldset>
<ul>
<?php
echo Form::input_wrap('name');
?>
</ul>
<?php
echo Form::submit_wrap('save', __('Save'), null, '#cancel', null, array('x' => null, 'y' => null, 'width' => null, 'height' => null, 'user_id' => null));
?>
</fieldset>
<?php
echo Form::close();
?>
示例11: find_new_comments
/**
* Get user's new comment counts
*
* @return array
*/
public function find_new_comments()
{
$new = array();
// Profile comments
if ($this->new_comment_count) {
$new['new-comments'] = HTML::anchor(URL::user($this), __(':comments', array(':comments' => '<div></div><var>' . $this->new_comment_count . '</var>')), array('title' => __('New comments')));
}
// Blog comments
$blog_comments = Model_Blog_Entry::find_new_comments($this);
if (count($blog_comments)) {
$new_comments = 0;
foreach ($blog_comments as $blog_entry) {
$new_comments += $blog_entry->new_comment_count;
}
$new['new-blog-comments'] = HTML::anchor(Route::model($blog_entry), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New blog comments')));
}
unset($blog_comments);
// Forum quotes
$forum_quotes = Model_Forum_Quote::find_by_user($this);
if (count($forum_quotes)) {
$new_quotes = count($forum_quotes);
$quote = $forum_quotes->current();
$new['new-forum-quotes'] = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($quote->topic), 'id' => $quote->post->id)) . '#post-' . $quote->post->id, __(':quotes', array(':quotes' => '<div></div><var>' . $new_quotes . '</var>')), array('title' => __('Forum quotes')));
}
// Images waiting for approval
if (Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE_WAITING, $this)) {
$gallery_approvals = Model_Gallery::find_pending(Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE, $this) ? null : $this);
if (count($gallery_approvals)) {
$new_approvals = count($gallery_approvals);
$new['new-gallery-approvals'] = HTML::anchor(Route::get('galleries')->uri(array('action' => 'approval')), __(':galleries', array(':galleries' => '<div></div><var>' . $new_approvals . '</var>')), array('title' => __('Galleries waiting for approval')));
}
}
// Image comments
$image_comments = Model_Image::find_new_comments($this);
if (count($image_comments)) {
$new_comments = 0;
foreach ($image_comments as $image) {
$new_comments += $image->new_comment_count;
}
$new['new-image-comments'] = HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id(Model_Gallery::find_by_image($image->id)), 'id' => $image->id, 'action' => '')), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New image comments')));
}
unset($image_comments);
// Private messages
return $new;
}
示例12: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$current_year = 0;
foreach ($this->images as $image) {
$gallery = $image->gallery();
// Subtitle
$year = date('Y', $image->created);
if ($year !== $current_year) {
if ($current_year) {
?>
</div>
<?php
}
?>
<header><h3><?php
echo $year;
?>
</h3></header>
<div class="row">
<?php
$current_year = $year;
}
?>
<article class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
<div class="thumbnail">
<?php
echo HTML::anchor(Route::url('gallery_image', array('gallery_id' => Route::model_id($gallery), 'id' => $image->id)), HTML::image($image->get_url('thumbnail', $gallery->dir)));
?>
<div class="caption">
<h4><?php
echo HTML::anchor(Route::model($gallery), HTML::chars($gallery->name));
?>
</h4>
</div>
<small class="stats label label-default">
<?php
echo (int) $image->view_count;
?>
<i class="fa fa-eye"></i>
<?php
if ($image->comment_count) {
?>
<?php
echo (int) $image->comment_count;
?>
<i class="fa fa-comment"></i>
<?php
}
?>
</small>
</div>
</article>
<?php
}
?>
</div>
<?php
return ob_get_clean();
}
示例13: array
echo '© ' . HTML::user($copyright);
?>
</header>
<ul class="line">
<?php
}
?>
<li class="grid2<?php
echo Text::alternate(' first', '', '', '');
?>
">
<figure class="thumb">
<?php
echo HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id($gallery), 'id' => $image->id, 'action' => $pending ? 'approve' : '')), HTML::image($image->get_url('thumbnail', $gallery->dir)), $image->description ? array('title' => HTML::chars($image->description)) : null);
?>
<?php
if (!$pending) {
?>
<figcaption>
<?php
echo HTML::icon_value(array(':comments' => (int) $image->comment_count), ':comments comment', ':comments comments', 'posts');
?>
<?php
echo HTML::icon_value(array(':views' => (int) $image->view_count), ':views view', ':views views', 'views');
?>
<br />
</figcaption>
示例14: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<div class="pull-left">
<?php
if ($this->author) {
?>
<?php
echo HTML::avatar($this->author->avatar, $this->author->username);
?>
<p>
<small><?php
echo __('Posts: :posts', array(':posts' => '<var>' . Num::format($this->author->post_count, 0) . '</var>'));
?>
</small>
</p>
<?php
} else {
?>
<?php
echo HTML::avatar(false);
?>
<?php
}
?>
</div>
<div class="arrow"></div>
<div class="media-body">
<header<?php
echo $this->forum_post->id == $this->forum_topic->last_post_id ? ' id="last"' : '';
?>
>
<small class="ago">
<?php
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic))) . '#post-' . $this->forum_post->id, '#' . $this->nth, array('title' => __('Permalink')));
?>
•
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_UPDATE, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'edit')), __('Edit'), array('class' => 'post-edit')) . ' • ';
}
?>
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_DELETE, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'delete')) . '?token=' . Security::csrf(), __('Delete'), array('class' => 'post-delete')) . ' • ';
}
?>
<?php
if (Permission::has($this->forum_topic, Model_Forum_Topic::PERMISSION_POST, self::$_user)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'quote')), __('Reply'), array('class' => 'post-quote')) . ' • ';
}
?>
<?php
echo HTML::time(Date::short_span($this->forum_post->created, true, true), $this->forum_post->created);
?>
</small>
<?php
if ($this->author) {
echo HTML::user($this->author->light_array());
if ($this->author->title) {
echo ' <small>“' . HTML::chars($this->author->title) . '”</small>';
}
} else {
echo $this->forum_post->author_name;
echo ' <small>“' . __('Guest') . '”</small>';
}
?>
</header>
<?php
if ($this->forum_post->parent_id) {
echo __('Replying to :parent', array(':parent' => HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('topic_id' => Route::model_id($this->forum_topic), 'id' => $this->forum_post->parent_id)) . '#post-' . $this->forum_post->parent_id, HTML::chars($this->forum_post->parent()->topic()->name))));
}
?>
<?php
echo BB::factory($this->forum_post->post)->render();
?>
<footer>
<?php
//.........这里部分代码省略.........
示例15: content
/**
* Render view.
*
* @return string
*/
public function content()
{
$bbcode = BB::factory();
ob_start();
if ($this->my) {
$panel_class = 'panel-success';
} elseif ($this->owner) {
$panel_class = 'panel-info';
} else {
$panel_class = 'panel-default';
}
?>
<div class="pull-left">
<?php
if ($this->author) {
?>
<?php
echo HTML::avatar($this->author->avatar_url, $this->author->username);
?>
<p>
<small><?php
echo __('Posts: :posts', array(':posts' => '<var>' . Num::format($this->author->post_count, 0) . '</var>'));
?>
</small>
</p>
<?php
} else {
?>
<?php
echo HTML::avatar(false);
?>
<?php
}
?>
</div>
<div class="media-body panel <?php
echo $panel_class;
?>
">
<header class="panel-heading"<?php
echo $this->forum_post->id == $this->forum_topic->last_post_id ? ' id="last"' : '';
?>
>
<small class="pull-right">
<?php
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic))) . '#post-' . $this->forum_post->id, '#' . $this->nth, array('title' => __('Permalink')));
?>
•
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_UPDATE)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'edit')), __('Edit'), array('class' => 'post-edit'));
}
?>
<?php
if (Permission::has($this->forum_post, Model_Forum_Post::PERMISSION_DELETE)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'delete')) . '?token=' . Security::csrf(), __('Delete'), array('class' => 'post-delete'));
}
?>
<?php
if (Permission::has($this->forum_topic, Model_Forum_Topic::PERMISSION_POST)) {
echo HTML::anchor(Route::url($this->private ? 'forum_private_post' : 'forum_post', array('id' => Route::model_id($this->forum_post), 'topic_id' => Route::model_id($this->forum_topic), 'action' => 'quote')), __('Reply'), array('class' => 'post-quote'));
}
?>
•
<?php
echo HTML::time(Date::short_span($this->forum_post->created, true, true), $this->forum_post->created);
?>
<?php
if ($this->forum_post->modify_count > 0) {
?>
•
<span title="<?php
echo __($this->forum_post->modify_count == 1 ? ':edits edit, :ago' : ':edits edits, last :ago', array(':edits' => $this->forum_post->modify_count, ':ago' => Date::fuzzy_span($this->forum_post->modified)));
?>
"><?php
echo __('Edited');
?>
</span>
<?php
}
?>
//.........这里部分代码省略.........