/** * Home page */ public function index() { $this->page_title = __('Welcome to :site', array(':site' => Kohana::config('site.site_name'))); // Display news feed $newsfeed = new NewsFeed($this->user); $newsfeed->max_items = 25; widget::add('main', View_Mod::factory('generic/newsfeed', array('newsfeed' => $newsfeed->as_array()))); // Shout $shouts = ORM::factory('shout')->find_all(10); widget::add('side', View_Mod::factory('generic/shout', array('mod_title' => __('Shouts'), 'shouts' => $shouts, 'can_shout' => ORM::factory('shout')->has_access(Shout_Model::ACCESS_WRITE, $this->user), 'errors' => array(), 'values' => array()))); // Online $guests = Online_User_Model::get_guest_count(); $online = Online_User_Model::find_online_users(); $counts = array(); if ($guests) { $counts[] = __2(':guests guest', ':guests guests', $guests, array(':guests' => $guests)); } if (count($online)) { $counts[] = __2(':members member', ':members members', count($online), array(':members' => count($online))); } widget::add('side', View_Mod::factory('generic/users', array('mod_title' => __('Online') . ': ' . implode(', ', $counts), 'viewer' => $this->user, 'users' => $online))); }
</dd> <dd><?php echo __('Resolution: :resolution', array(':resolution' => sprintf('<var>%d×%d</var>', $image->original_width, $image->original_height))); ?> </dd> <dt><?php echo __('Statistics'); ?> </dt> <dd><?php echo __('Comments: :comments', array(':comments' => '<var>' . $image->comments . '</var>')); ?> </dd> <dd><?php echo __2('Score: :score (:votes vote)', 'Score: :score (:votes votes)', $image->votes, array(':score' => '<var>' . $image->score . '</var>', ':votes' => '<var>' . $image->votes . '</var>')); ?> </dd> <dd><?php echo __('Views: :views', array(':views' => '<var>' . $image->views . '</var>')); ?> </dd> <?php if ($image->exif) { ?> <dt><?php echo __('Camera'); ?> </dt> <?php
<?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 } ?> </ul>
/** * Print icon with value * * @param integer|array $value :var => value * @param string $singular title for singular value * @param string $plural title for plural value * @param string $class icon class */ public static function icon_value($value, $singular = '', $plural = '', $class = '') { $class = $class ? 'icon ' . $class : 'icon'; if (is_array($value)) { $var = key($value); $value = $value[$var]; } $formatted = Num::format($value, 0); $plural = $plural ? $plural : $singular; $title = $singular && $plural ? ' title="' . __2($singular, $plural, $value, array($var => $formatted)) . '"' : ''; return '<var class="' . $class . '"' . $title . '>' . $formatted . '</var>'; }
/** * Upcoming events */ public function upcoming() { $this->breadcrumb[] = html::anchor('events/upcoming', __('Upcoming events')); $this->page_title = text::title(__('Upcoming events')); $this->tab_id = 'upcoming'; // actions if ($this->visitor->logged_in(array('event', 'event admin', 'admin'))) { $this->page_actions[] = array('link' => 'event/add', 'text' => __('Add event'), 'class' => 'event-add'); } // fetch events if ($this->country) { $country = ORM::factory('country', $this->country); $filter = array('events.country_id' => $country->id); } else { $filter = false; } $events = ORM::factory('event')->find_upcoming(25, $filter); if ($events->count()) { $this->page_subtitle = __2(':events event', ':events events', $events->count(), array(':events' => '<var>' . $events->count() . '</var>')); widget::add('main', View_Mod::factory('generic/filters', array('filters' => $this->_build_filters($events)))); widget::add('main', View_Mod::factory('events/events', array('events' => $this->_build_events_list($events)))); } $this->_side_views(); }
<?php defined('SYSPATH') or die('No direct access allowed.'); /** * Online users * * @package Anqh * @author Antti Qvickström * @copyright (c) 2010 Antti Qvickström * @license http://www.opensource.org/licenses/mit-license.php MIT license */ $guests = Model_User_Online::get_guest_count(); $online = Model_User_Online::find_online_users(); $counts = array(); if (count($online)) { $counts[] = __2(':members member', ':members members', count($online), array(':members' => count($online))); } if ($guests) { $counts[] = __2(':guests guest', ':guests guests', $guests, array(':guests' => $guests)); } echo '<div class="totals">' . __(':users users online', array(':users' => '<var title="' . implode(', ', $counts) . '">' . (count($online) + $guests) . '</var>')) . '</div>'; echo View::factory('generic/users', array('viewer' => $viewer, 'users' => $online));
<?php if (count($short)) { ?> <?php echo implode(', ', $short); ?> <?php } ?> <?php if (count($long)) { ?> <?php echo __('and'); ?> <?php echo html::anchor('#users', sprintf(__2('%d other', '%d others', count($long)), count($long)), array('class' => 'expander', 'title' => __('Show/hide'), 'onclick' => '$(".users .long").toggle("normal"); return false;')); ?> <div class="long"> <?php echo implode(', ', $long); ?> </div> <?php } ?> </div>
/** * Venue category * * @param int|string $id * @param string $action */ public function category($category_id, $action = null) { // New category if ($category_id == 'add') { $this->_category_add(); return; } else { if ($action) { switch ($action) { // Add venue case 'add': $this->_venue_add($category_id); return; // Delete category // Delete category case 'delete': $this->_category_delete($category_id); return; // Edit category // Edit category case 'edit': $this->_category_edit($category_id); return; } } } $venue_category = new Venue_Category_Model((int) $category_id); $errors = $venue_category->id ? array() : array('venues.error_venue_category_not_found'); if (empty($errors)) { $this->breadcrumb[] = html::anchor(url::model($venue_category), $venue_category->name); $this->page_title = text::title($venue_category->name); $this->page_subtitle = html::specialchars($venue_category->description); if ($venue_category->has_access(Venue_Category_Model::ACCESS_EDIT)) { $this->page_actions[] = array('link' => url::model($venue_category) . '/edit', 'text' => __('Edit category'), 'class' => 'category-edit edit'); } if ($venue_category->has_access(Venue_Category_Model::ACCESS_VENUE)) { $this->page_actions[] = array('link' => url::model($venue_category) . '/add', 'text' => __('Add venue'), 'class' => 'venue-add add'); } // Organize by city $venues = $venue_category->find_venues($this->country); $num_cities = count($venues); $num_venues = count($venues, COUNT_RECURSIVE) - $num_cities; $this->page_subtitle .= __2(':cities city', ':cities cities', $num_cities, array(':cities' => '<var>' . $num_cities . '</var>')) . ', ' . __2(':venues venue', ':venues venues', $num_venues, array(':venues' => '<var>' . $num_venues . '</var>')); // Add city filters if more than 1 city if ($num_cities > 1) { widget::add('main', View_Mod::factory('generic/filters', array('filters' => $this->_build_filters($venues)))); } widget::add('main', View_Mod::factory('venues/venues', array('mod_class' => 'venues articles', 'venues' => $venues))); } if (count($errors)) { //$this->_error(Kohana::lang('generic.error'), $errors); } $this->_side_views(); }