本文整理汇总了PHP中Date::fuzzy_span方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::fuzzy_span方法的具体用法?PHP Date::fuzzy_span怎么用?PHP Date::fuzzy_span使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::fuzzy_span方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('lecture', $lecture)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
if ($this->action == 'add') {
$lecture = ORM::factory('lecture', $this->respective_id);
if ($this->check_deleted($lecture)) {
return View::factory('feed/unavaliable')->render();
}
} else {
if ($this->action == 'canceled') {
$lecture = Model_Lecture::get_lecture_from_event($this->respective_id);
$event = ORM::factory('event', $this->respective_id);
if ($this->check_deleted($lecture)) {
return View::factory('feed/unavaliable')->render();
}
$view->bind('event', $event);
}
}
$user = ORM::factory('user', $this->actor_id);
$span = Date::fuzzy_span($this->time);
$feed_id = $this->id;
$curr_user = Auth::instance()->get_user();
$role = $curr_user->role()->name;
$comment = ORM::factory('feedcomment');
$comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
$comments = $comment->find_all();
$url = Url::site('profile/view/id/');
return $view->render();
}
示例2: render
public function render()
{
$span = Date::fuzzy_span($this->time);
$feed_id = $this->id;
$comment = ORM::factory('feedcomment');
$comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
$comments = $comment->find_all();
$curr_user = Auth::instance()->get_user();
$role = $curr_user->role()->name;
$url = Url::site('profile/view/id/');
if ($this->action == "publish_result") {
$examgroup = ORM::factory('examgroup', $this->respective_id);
if ($this->check_deleted($examgroup)) {
return View::factory('feed/unavaliable')->render();
}
$percent = $examgroup->get_ExamGroupPercent();
$user = ORM::factory('user', $this->actor_id);
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('user', $user)->bind('percent', $percent)->bind('id', $this->respective_id)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
} else {
$exam = ORM::factory('exam', $this->respective_id);
if ($this->check_deleted($exam)) {
return View::factory('feed/unavaliable')->render();
}
$user = ORM::factory('user', $this->actor_id);
$event = ORM::factory('event', $exam->event_id);
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('exam', $exam)->bind('user', $user)->bind('event', $event)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
}
return $view->render();
}
示例3: logs
public function logs()
{
$return = array();
if (count($this->logs) > 0) {
foreach ($this->logs as $log) {
$return[] = array('time' => Date::fuzzy_span($log->time), 'message' => __($log->message, array(':username' => $log->params['username'], ':item_name' => $log->params['item_name'], ':price' => $log->params['price'])));
}
}
return $return;
}
示例4: process
public static function process($datetime, $fuzzy = TRUE)
{
$format = __('DateTimeFormat');
// default datetime format if DateTimeFormat for current language is not set:
if ($format == 'DateTimeFormat') {
$format = 'Y-m-d H:i:s';
}
if ($fuzzy) {
return "<span class='datetimefuzzy'>" . "<span class='fuzzy'>" . __(Date::fuzzy_span(strtotime($datetime))) . "</span>" . "<span class='datetime'>" . date($format, strtotime($datetime)) . "</span>" . "</span>";
} else {
$date = date_create($datetime);
return date_format($date, $format);
}
}
示例5: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
?>
<dl>
<?php
echo $this->user->homepage ? '<dt>' . __('Homepage') . '</dt><dd>' . HTML::anchor($this->user->homepage, HTML::chars($this->user->homepage)) . '</dd>' : '';
?>
<?php
echo $this->user->gender ? '<dt>' . __('Gender') . '</dt><dd>' . ($this->user->gender == 'm' ? __('Male') : __('Female')) . '</dd>' : '';
?>
<?php
echo $this->user->dob ? '<dt>' . __('Date of Birth') . '</dt><dd>' . Date::format('DMYYYY', $this->user->dob) . ' (' . Date::age($this->user->dob) . ')</dd>' : '';
?>
<dt><?php
echo __('Registered');
?>
</dt><dd><?php
echo HTML::time(Date::fuzzy_span($this->user->created), $this->user->created);
?>
(<?php
echo __('member #:member', array(':member' => '<var>' . number_format($this->user->id) . '</var>'));
?>
)</dd>
<dt><?php
echo __('Updated');
?>
</dt><dd><?php
echo HTML::time(Date::fuzzy_span($this->user->modified), $this->user->modified);
?>
</dd>
<dt><?php
echo __('Last login');
?>
</dt><dd><?php
echo HTML::time(Date::fuzzy_span($this->user->last_login), $this->user->last_login);
?>
(<?php
echo __($this->user->login_count == 1 ? ':logins login' : ':logins logins', array(':logins' => '<var>' . number_format($this->user->login_count) . '</var>'));
?>
)</dd>
</dl>
<?php
return ob_get_clean();
}
示例6: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
// Title
if ($this->user['title']) {
echo HTML::chars(trim($this->user['title'])) . '<br />';
}
// Image
if ($this->user['thumb']) {
echo '<figure>' . HTML::image($this->user['thumb'], array('width' => 160)) . '</figure>';
}
// Last login
echo __('Last login: :login', array(':login' => HTML::time(Date::fuzzy_span($this->user['last_login']), $this->user['last_login'])));
return ob_get_clean();
}
示例7: render
public function render()
{
$span = Date::fuzzy_span($this->time);
$flashcard = ORM::factory('flashcard', $this->respective_id);
if ($this->check_deleted($flashcard)) {
return View::factory('feed/unavaliable')->render();
}
$user = ORM::factory('user', $this->actor_id);
$feed_id = $this->id;
$comment = ORM::factory('feedcomment');
$comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
$comments = $comment->find_all();
$curr_user = Auth::instance()->get_user();
$role = $curr_user->role()->name;
$url = Url::site('profile/view/id/');
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('flashcard', $flashcard)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
return $view->render();
}
示例8: render
public function render()
{
$user = ORM::factory('user', $this->actor_id);
$event = ORM::factory('event', $this->respective_id);
if ($this->check_deleted($event)) {
return View::factory('feed/unavaliable')->render();
}
$attendance = $event->get_Attendance();
$class = 'Event_' . $event->eventtype;
$dynamic_object = new $class($this->respective_id);
$event_details = $dynamic_object->get_event_details();
$span = Date::fuzzy_span($this->time);
$feed_id = $this->id;
$comment = ORM::factory('feedcomment');
$comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
$comments = $comment->find_all();
$curr_user = Auth::instance()->get_user();
$role = $curr_user->role()->name;
$url = Url::site('profile/view/id/');
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('user', $user)->bind('event', $event)->bind('event_details', $event_details)->bind('attendance', $attendance)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
return $view->render();
}
示例9: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if ($this->blog_entries && count($this->blog_entries)) {
// List blog entries
foreach ($this->blog_entries as $blog_entry) {
/** @var Model_Blog_Entry $blog_entry */
$author = $blog_entry->author();
?>
<article class="row blog-entry">
<div class="span1"><?php
echo HTML::avatar($author['avatar'], $author['username']);
?>
</div>
<div class="span7">
<header>
<h4><?php
echo HTML::anchor(Route::model($blog_entry), HTML::chars($blog_entry->name));
?>
</h4>
<p><?php
echo __('By :user :ago', array(':user' => HTML::user($author), ':ago' => HTML::time(Date::fuzzy_span($blog_entry->created), $blog_entry->created)));
?>
</p>
</header>
</div>
</article>
<?php
}
} else {
// No blog entries available
echo new View_Alert(__('Alas, the quill seems to be dry, no blog entries found.'), View_Alert::INFO);
}
return ob_get_clean();
}
示例10: render
public function render()
{
$view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('post', $post)->bind('user', $user)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url)->bind('link', $query)->bind('video', $query_video);
$feed_id = $this->id;
$post = ORM::factory('post', $this->respective_id);
$user = ORM::factory('user', $this->actor_id);
$curr_user = Auth::instance()->get_user();
$role = $curr_user->role()->name;
$span = Date::fuzzy_span($this->time);
$comment = ORM::factory('feedcomment');
$comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
$comments = $comment->find_all();
$url = Url::site('profile/view/id/');
$query = "";
if ($post->link == 'link') {
$query = DB::select('key', 'value')->from('post_meta')->where('post_id', '=', $post->id)->execute()->as_array('key', 'value');
}
$query_video = "";
if ($post->link == 'video') {
$query_video = DB::select('key', 'value')->from('post_meta')->where('post_id', '=', $post->id)->execute()->as_array('key', 'value');
}
return $view->render();
}
示例11:
' style='width: 40px; height: 40px;' /></a>
</td>
<td class='vatop pad5' style='width: 350px;'>
<a href="<?php
echo $url . "/" . $comment->user_id;
?>
" style='font-size: 14px; font-weight: bold;'><?php
echo $comment_user->firstname . " " . $comment_user->lastname;
?>
</a>
<span class='hpad10' style='font-size: 12px;'><?php
echo Html::chars($comment->comment);
?>
</span>
<p class='vpad10' style='font-size: 11px; color: #777;'><?php
echo Date::fuzzy_span($comment->date);
?>
</p>
</td>
<td class="vatop w2 pad5">
<?php
if (Acl::instance()->is_allowed('post_delete') && $role == 'Admin') {
?>
<a onclick="delete_comment(this, <?php
echo $comment->id;
?>
);" class="del-comment" style="font-size: 11px; font-weight: bold; display: none; cursor: pointer;">X</a>
<?php
} else {
if (Acl::instance()->is_allowed('post_delete') && $role == 'studentmoderator' && $user->role()->name == 'Student') {
?>
示例12: action_track
/**
* Action: music track
*/
public function action_track()
{
$track_id = (int) $this->request->param('id');
// Load track
$track = Model_Music_Track::factory($track_id);
if (!$track->loaded()) {
throw new Model_Exception($track, $track_id);
}
Permission::required($track, Model_Music_Track::PERMISSION_READ);
// Build page
$author = $track->author();
$this->view = new View_Page($track->name);
$this->view->tab = 'music';
$this->view->subtitle = __('By :user :ago', array(':user' => HTML::user($track->author(), null, null, Route::url('profile_music', array('username' => urlencode($author['username'])))), ':ago' => HTML::time(Date::fuzzy_span($track->created), $track->created)));
// Set actions
$this->_set_page_actions(false);
$this->view->actions[] = array('link' => Route::model($track, 'listen'), 'text' => '<i class="fa fa-play"></i> ' . __('Listen'), 'class' => 'btn btn-primary', 'target' => '_blank', 'rel' => 'nofollow');
$this->view->tabs['music'] = array('link' => Route::model($track), 'text' => $track->type == Model_Music_Track::TYPE_MIX ? __('Mixtape') : __('Track'));
if ($track->forum_topic_id) {
$this->view->tabs[] = array('link' => Route::url('forum_topic', array('id' => $track->forum_topic_id)), 'text' => __('Forum') . ' »');
}
if (Permission::has($track, Model_Music_Track::PERMISSION_UPDATE)) {
$this->view->actions[] = array('link' => Route::model($track, 'edit'), 'text' => '<i class="fa fa-edit"></i> ' . __('Edit'));
}
// Share
Anqh::page_meta('type', $track->type == Model_Music_Track::TYPE_MIX ? 'album' : 'song');
Anqh::page_meta('title', $track->name);
Anqh::page_meta('url', URL::site(Route::model($track), true));
Anqh::page_meta('description', $track->description);
if (Valid::url($track->cover)) {
Anqh::page_meta('image', $track->cover);
}
Anqh::share(true);
// Content
$this->view->add(View_Page::COLUMN_CENTER, $this->section_track_main($track));
$this->view->add(View_Page::COLUMN_RIGHT, $this->section_track_info($track));
}
示例13: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
$offset = $this->pagination->offset;
$previous = null;
foreach ($this->forum_topic->posts($offset, $this->pagination->items_per_page) as $post) {
// Ignore
if (!Permission::has($post, Model_Forum_Post::PERMISSION_READ, self::$_user)) {
continue;
}
// Time difference between posts
$current = strtotime($post->created);
$difference = $previous && $current - $previous > Date::YEAR ? Date::fuzzy_span($previous, $current) : false;
if ($difference) {
?>
<div class="offset1 post-old">
<span class="label label-inverse muted">¡ <?php
echo __('Previous post :ago', array(':ago' => $difference));
?>
!</span>
</div>
<?php
}
$previous = $current;
$post = new View_Forum_Post($post, $this->forum_topic);
$post->nth = ++$offset;
$post->private = $this->private;
echo $post;
}
?>
<script>
head.ready('anqh', function() {
// Edit post
$('section.topic').on('click', 'a.post-edit', function _editPost(e) {
e.preventDefault();
var href = $(this).attr('href')
, post = href.match(/([0-9]*)\/edit/);
$('#post-' + post[1] + ' .ago').fadeOut();
$.get(href, function _loaded(data) {
$('#post-' + post[1] + ' .bubble').replaceWith(data);
});
});
// Delete post
$('a.post-delete').each(function deletePost() {
var $action = $(this);
$action.data('action', function addAction() {
var post = $action.attr('href').match(/([0-9]*)\/delete/);
if (post) {
$('#post-' + post[1]).slideUp();
$.get($action.attr('href'));
}
});
});
// Quote post
$('section.topic').on('click', 'a.post-quote', function _quotePost(e) {
e.preventDefault();
var href = $(this).attr('href')
, post = href.match(/([0-9]*)\/quote/)
, $article = $(this).closest('article');
$('#post-' + post[1] + ' .ago').fadeOut();
$.get(href, function _loaded(data) {
$article.after(data);
// Scroll form to view
var $quote = $article.next('article');
if ($quote.offset().top + $quote.outerHeight() > $(window).scrollTop() + $(window).height()) {
window.scrollTo(0, $quote.offset().top + $quote.outerHeight() - $(window).height() );
}
});
});
// Save post
$('section.topic').on('submit', '.post form', function(e) {
e.preventDefault();
var post = $(this).closest('article');
post.loading();
$.post($(this).attr('action'), $(this).serialize(), function(data) {
post.replaceWith(data);
});
});
// Cancel quote
//.........这里部分代码省略.........
示例14: date
<li><?php
echo $exam->passing_marks;
?>
Marks Passing Out of <?php
echo $exam->total_marks;
?>
</li>
<li>On <?php
echo date('d M Y h:i A', $exam->event->eventstart);
?>
</li>
<li><span class="<?php
echo $exam->event->eventstart < time() + 86500 ? "upcomingAttention" : "";
?>
"><?php
echo Date::fuzzy_span($exam->event->eventstart);
?>
</span></li>
</ul>
</li>
<?php
}
?>
</ul>
</div>
<br/><br/><br/>
<div id="upcoming_exams">
<div class="sectionTitle">
<span class="l">Past Exams</span>
<span class="rm30 r h5"><?php
echo HTML::anchor('exammarksheet', 'View Marksheet');
示例15: get_profile_info
/**
* Get User Profile Info
* @param type $data
* @return type as Array
*/
public static function get_profile_info($data)
{
try {
$user_info = ORM::factory('UserInfo')->select('cfm_users.email', 'cfm_users.is_active', 'cfm_users.last_login', DB::expr('cfm_users.created_at AS profile_created_at'), DB::expr('cfm_users.updated_at AS profile_activated_at'), 'cfm_pre_qualification.*', DB::expr('count(cfm_client_personal_info.user_id) AS clients_count'))->join('cfm_users', 'RIGHT OUTER')->on('user_id', '=', 'cfm_users.id')->join('cfm_pre_qualification', 'RiGHT OUTER')->on('cfm_pre_qualification.user_id', '=', 'cfm_users.id')->join('cfm_client_personal_info', 'RiGHT OUTER')->on('cfm_client_personal_info.user_id', '=', 'cfm_users.id')->where('cfm_users.id', '=', $data)->find()->as_array();
$user_info['last_login'] = Date::fuzzy_span($user_info['last_login']);
return array('success' => true, "user_info" => $user_info);
} catch (ErrorException $ex) {
return array('success' => false, "message" => "Internal sever problem");
}
}