本文整理匯總了PHP中url::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP url::model方法的具體用法?PHP url::model怎麽用?PHP url::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類url
的用法示例。
在下文中一共展示了url::model方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get
/**
* Get newsfeed item as HTML
*
* @param Newsfeed_Model $item
* @return string
*/
public static function get(NewsFeedItem_Model $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$gallery = new Gallery_Model($item->data['gallery_id']);
$image = new Image_Model($item->data['image_id']);
if ($gallery->loaded() && $image->loaded()) {
$text = __('commented to an image in :gallery', array(':gallery' => html::anchor(url::model($gallery) . '/' . $image->id, text::title($gallery->name), array('title' => $gallery->name))));
}
break;
}
return $text;
}
示例2: get
/**
* Get newsfeed item as HTML
*
* @param Newsfeed_Model $item
* @return string
*/
public static function get(NewsFeedItem_Model $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_EVENT:
$event = new Event_Model($item->data['event_id']);
if ($event->id) {
$text = __('added new event :event', array(':event' => html::anchor(url::model($event), text::title($event->name), array('title' => $event->name))));
}
break;
case self::TYPE_FAVORITE:
$event = new Event_Model($item->data['event_id']);
if ($event->id) {
$text = __('added event :event to favorites', array(':event' => html::anchor(url::model($event), text::title($event->name), array('title' => $event->name))));
}
break;
}
return $text;
}
示例3: get
/**
* Get newsfeed item as HTML
*
* @param Newsfeed_Model $item
* @return string
*/
public static function get(NewsFeedItem_Model $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_COMMENT:
$entry = new Blog_Entry_Model($item->data['entry_id']);
if ($entry->id) {
$text = __('commented to blog :blog', array(':blog' => html::anchor(url::model($entry), text::title($entry->name), array('title' => $entry->name))));
}
break;
case self::TYPE_ENTRY:
$entry = new Blog_Entry_Model($item->data['entry_id']);
if ($entry->id) {
$text = __('wrote a new blog entry :blog', array(':blog' => html::anchor(url::model($entry), text::title($entry->name), array('title' => $entry->name))));
}
break;
}
return $text;
}
示例4: get
/**
* Get newsfeed item as HTML
*
* @param Newsfeed_Model $item
* @return string
*/
public static function get(NewsFeedItem_Model $item)
{
$text = '';
switch ($item->type) {
case self::TYPE_REPLY:
$topic = new Forum_Topic_Model($item->data['topic_id']);
if ($topic->id) {
$text = __('replied to topic :topic', array(':topic' => html::anchor(url::model($topic) . '/page/last#last', text::title($topic->name), array('title' => $topic->name))));
}
break;
case self::TYPE_TOPIC:
$topic = new Forum_Topic_Model($item->data['topic_id']);
if ($topic->id) {
$text = __('started a new topic :topic', array(':topic' => html::anchor(url::model($topic), text::title($topic->name), array('title' => $topic->name))));
}
break;
}
return $text;
}
示例5: foreach
</h3>
<sup><?php
echo $venue_category->description;
?>
</sup>
<ul>
<?php
$city_id = false;
foreach ($venue_category->venues->find_all() as $venue) {
if ($venue->city_id == $city_id) {
continue;
}
$city_id = $venue->city_id;
?>
<li><?php
echo html::anchor(url::model($venue_category) . '#' . utf8::strtolower($venue->city->city), $venue->city->city);
?>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</div>
</section>
示例6: __
<?php
if ($event->price !== null && $event->price != -1) {
?>
<span class="details price"><?php
echo $event->price == 0 ? __('Free entry') : '<var>' . format::money($event->price, $event->country->currencycode) . '</var>';
?>
</span>
<?php
}
?>
<?php
if ($event->venue_id) {
?>
<span class="details venue">@ <?php
echo html::anchor(url::model($event->venue), $event->venue->name);
?>
, <?php
echo html::chars($event->venue->city->city);
?>
</span>
<?php
} elseif ($event->venue_name || $event->city_name) {
?>
<span class="details venue">@ <?php
echo html::chars($event->venue_name) . ($event->venue_name && $event->city_name ? ', ' : '') . html::chars($event->city_name);
?>
</span>
<?php
}
?>
示例7: foreach
?>
<ul>
<?php
foreach ($galleries as $gallery) {
?>
<li class="unit size1of2">
<div class="thumb unit size2of5">
<?php
echo html::anchor(url::model($gallery), html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/thumb_' . $gallery->default_image->legacy_filename));
?>
</div>
<header>
<h4><?php
echo html::anchor(url::model($gallery), text::title($gallery->name));
?>
</h4>
<span class="details">
<?php
echo html::time(date::format('DMYYYY', $gallery->event_date), $gallery->event_date, true);
?>
,
<?php
echo __2(':images image', ':images images', $gallery->image_count, array(':images' => '<var>' . $gallery->image_count . '</var>'));
?>
</span>
</header>
</li>
<?php
}
示例8: foreach
* @package Anqh
* @author Antti Qvickström
* @copyright (c) 2010 Antti Qvickström
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*/
?>
<?php
if (empty($tags)) {
?>
<div class="notice"><?php
echo Kohana::lang('tags.error_no_tags_found');
?>
</div>
<?php
} else {
?>
<ul>
<?php
foreach ($tags as $tag) {
?>
<li><?php
echo html::anchor(url::model($tag), $tag->name);
?>
</li>
<?php
}
?>
</ul>
<?php
}
示例9: __
<li class="unit size1of2"><?php
echo html::icon_value(array(':topics' => $area->topics), ':topics topic', ':topics topics', 'topics');
?>
</li>
<li class="unit size1of2"><?php
echo html::icon_value(array(':posts' => $area->posts), ':posts post', ':posts posts', 'posts');
?>
</li>
</ul>
</header>
<footer>
<?php
if ($area->topics > 0) {
?>
<?php
echo __('Last post in :area by :user :ago ago', array(':area' => html::anchor(url::model($area->last_topic) . '/page/last#last', text::limit_chars(text::title($area->last_topic->name), 20, '…', true), array('title' => html::specialchars($area->last_topic->name))), ':user' => html::user(null, $area->last_topic->last_poster), ':ago' => html::time(date::timespan_short($area->last_topic->last_posted), $area->last_topic->last_posted)));
?>
<?php
} else {
?>
<sup><?php
echo __('No topics found');
?>
</sup>
<?php
}
?>
</footer>
</article>
<?php
示例10: array
<article class="venue venue-<?php
echo $venue->id;
?>
">
<header>
<h4><?php
echo html::anchor(url::model($venue), $venue->name);
?>
</h4>
</header>
<footer>
<?php
if ($venue->default_image_id) {
?>
<?php
echo html::anchor(url::model($venue), html::img($venue->default_image, 'thumb'), array('style' => 'display:block;height:31px;'));
?>
<?php
}
?>
</footer>
</article>
示例11: foreach
<ul class="contentlist favorites events">
<?php
foreach ($favorites as $favorite) {
?>
<li class="event-<?php
echo $favorite->id;
?>
">
<?php
echo date::format('DDMMYYYY', $favorite->start_time);
?>
<?php
echo html::anchor(url::model($favorite), text::title($favorite->name), array('title' => html::specialchars($favorite->name)));
?>
</li>
<?php
}
?>
</ul>
示例12: bbcode_quote
/**
* Handle forum quotations
*
* @param BBCode $bbcode
* @param string $action
* @param string $name
* @param string $default
* @param array $params
* @param string $content
* @return string
*/
public function bbcode_quote($bbcode, $action, $name, $default, $params, $content)
{
// Pass all to 2nd phase
if ($action == BBCODE_CHECK) {
return true;
}
// Parse parameters
foreach ($params['_params'] as $param) {
switch ($param['key']) {
// Parent post id
case 'post':
$post_id = (int) $param['value'];
$post = ORM::factory('forum_post', $post_id);
break;
// Parent post author
// Parent post author
case 'author':
$author_name = $param['value'];
$author = ORM::factory('user')->find_user($author_name);
break;
}
}
// Add parent post
if (isset($post) && $post->id) {
$quote = '<blockquote cite="' . url::model($post->forum_topic) . '/' . $post->id . '#post-' . $post->id . '">';
// Override author
$author = $post->author;
} else {
$quote = '<blockquote>';
}
$quote .= '<p>' . trim($content) . '</p>';
// Post author
if (isset($author) && $author->id) {
$quote .= '<cite>' . __('-- :author', array(':author' => html::user($author))) . '</cite>';
} else {
if (isset($author_name)) {
$quote .= '<cite>' . __('-- :author', array(':author' => html::specialchars($author_name))) . '</cite>';
}
}
$quote .= '</blockquote>';
return $quote;
}
示例13: _event_edit
/**
* Edit event
*
* @param int|string $event_id
*/
public function _event_edit($event_id = false)
{
$this->history = false;
$event = new Event_Model((int) $event_id);
// For authenticated users only
if (!$this->user || !$event->is_author() && !$this->visitor->logged_in(array('admin', 'event moderator'))) {
url::back('/events');
}
$errors = $form_errors = array();
$form_values = $event->as_array();
$form_values['start_date'] = '';
$form_values['start_hour'] = '';
$form_values['end_hour'] = '';
/***** CHECK POST *****/
if (request::method() == 'post') {
$post = array_merge($this->input->post(), $_FILES);
$extra = array('start_time' => date::unix2sql(strtotime($post['start_date'] . ' ' . date::time_24h($post['start_hour']))));
if (!empty($post['end_hour'])) {
$end_time = strtotime($post['start_date']);
// end hour is earlier than start hour = event ends the next day
if ($post['end_hour'] < $post['start_hour']) {
$end_time = strtotime('+1 day', $end_time);
}
$extra['end_time'] = date('Y-m-d', $end_time) . ' ' . date::time_24h($post['end_hour']) . ':00';
}
// update
$editing = (bool) $event->id;
if ($editing) {
$extra['modified'] = date::unix2sql(time());
$extra['modifies'] = (int) $event->modifies + 1;
} else {
$extra['author_id'] = $this->user->id;
}
$city = ORM::factory('city', $post['city_id']);
if ($city) {
$extra['country_id'] = $city->country_id;
}
if (csrf::valid() && $event->validate($post, true, $extra)) {
// Update tags
$event->remove(ORM::factory('tag'));
if (!empty($post['tags'])) {
foreach ($post['tags'] as $tag_id => $tag) {
$event->add(ORM::factory('tag', $tag_id));
}
$event->save();
}
// Handle flyer uploads
foreach (array('flyer_front_image_id' => $post->flyer_front, 'flyer_back_image_id' => $post->flyer_back) as $image_id => $flyer) {
if (isset($flyer) && empty($flyer['error'])) {
$image = Image_Model::factory('events.flyer', $flyer, $this->user->id);
if ($image->id) {
$event->add($image);
$event->{$image_id} = $image->id;
$event->save();
}
}
}
if (!$editing) {
newsfeeditem_events::event($this->user, $event);
}
url::redirect(url::model($event));
} else {
$form_errors = $post->errors();
}
$form_values = arr::overwrite($form_values, $post->as_array());
}
/***** /CHECK POST *****/
/***** SHOW FORM *****/
if ($event->id) {
$this->page_actions[] = array('link' => url::model($event) . '/delete/?token=' . csrf::token(), 'text' => __('Delete event'), 'class' => 'event-delete');
$this->page_title = text::title($event->name);
$this->page_subtitle = __('Edit event');
list($form_values['start_date'], $form_values['start_hour']) = explode(' ', date('Y-m-d H', strtotime($event->start_time)));
if (!empty($event->end_time)) {
list($temp, $form_values['end_hour']) = explode(' ', date('Y-m-d H', strtotime($event->end_time)));
}
} else {
$this->page_title = __('New event');
}
$form = $event->get_form();
// Tags
if ($tag_group = Kohana::config('events.tag_group')) {
$form['tags'] = $form_values['tags'] = array();
$tags = ORM::factory('tag_group', $tag_group);
foreach ($tags->tags as $tag) {
$form['tags'][$tag->id] = $tag->name;
if ($event->has($tag)) {
$form_values['tags'][$tag->id] = $tag->name;
}
}
}
// City autocomplete
$this->_autocomplete_city('city_name');
// Venue autocomplete
$venues = ORM::factory('venue')->where('event_host', '=', 1)->find_all();
//.........這裏部分代碼省略.........
示例14: foreach
<li class="group">
<h5><?php
echo html::anchor(url::model($group), text::title($group->name));
?>
</h5>
<ul class="areas">
<?php
foreach ($group->forum_areas->find_all() as $area) {
?>
<?php
if ($area->has_access(Forum_Area_Model::ACCESS_READ)) {
?>
<li><?php
echo html::anchor(url::model($area), text::title($area->name), array('title' => strip_tags($area->description)));
?>
</li>
<?php
}
?>
<?php
}
?>
</ul>
</li>
<?php
}
?>
示例15: array
}
?>
</nav>
<?php
if ($next) {
?>
<?php
echo html::anchor(url::model($gallery) . '/' . $next->id, html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/pieni_' . $image->legacy_filename), array('title' => __('Next image')));
?>
<?php
} else {
?>
<?php
echo html::anchor(url::model($gallery), html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/pieni_' . $image->legacy_filename), array('title' => __('Back to gallery')));
?>
<?php
}
?>
<?php
if ($image->description) {
?>
<?php
$names = array();
foreach (explode(',', $image->description) as $name) {
$names[] = html::user(trim($name));
}
?>
<footer>