Beispiel #1
0
 /**
  * Action: browse tracks
  */
 public function action_browse()
 {
     $type = $this->request->param('music') == 'mixtapes' ? Model_Music_Track::TYPE_MIX : Model_Music_Track::TYPE_TRACK;
     $genre = $this->request->param('genre');
     // Load requested music
     $limit = 25;
     $music = Model_Music_Track::factory();
     $count = $music->count_by_type($type, $genre);
     // Build page
     $this->view = View_Page::factory($type == Model_Music_Track::TYPE_MIX ? __('Mixtapes') : __('Tracks'));
     // Set actions
     $this->_set_page_actions();
     $this->view->tab = $this->request->param('music');
     // Filters
     $this->view->add(View_Page::COLUMN_CENTER, $this->section_filters($this->request->param('music'), $genre));
     // Pagination
     $this->view->add(View_Page::COLUMN_CENTER, $pagination = $this->section_pagination($limit, $count));
     $this->view->subtitle = __($pagination->total_pages == 1 ? ':pages page' : ':pages pages', array(':pages' => Num::format($pagination->total_pages, 0)));
     // Browse
     $tracks = $music->find_by_type($type, $genre, $limit, $pagination->offset);
     $this->view->add(View_Page::COLUMN_CENTER, $this->section_browse($tracks));
     // Pagination
     $this->view->add(View_Page::COLUMN_CENTER, $pagination);
     // New
     $this->view->add(View_Page::COLUMN_RIGHT, $this->section_list($music->find_new(Model_Music_Track::TYPE_MIX, 10), __('New mixtapes')));
     $this->view->add(View_Page::COLUMN_RIGHT, $this->section_list($music->find_new(Model_Music_Track::TYPE_TRACK, 10), __('New tracks')));
 }
Beispiel #2
0
 public function verbose($value)
 {
     $value = $this->value($value);
     if ($this->decimals) {
         $value = Num::format($value, $this->decimals);
     }
     return (string) $value;
 }
 /**
  * @see     Num::format
  */
 public function test_format()
 {
     $output = Num::format('1234567890', '(000) 000-0000');
     $expected = '(123) 456-7890';
     $this->assertEquals($expected, $output);
     $output = Num::format(null, '(000) 000-0000');
     $this->assertNull($output);
     $output = Num::format('1234567890', null);
     $expected = '1234567890';
     $this->assertEquals($expected, $output);
 }
Beispiel #4
0
Datei: num.php Projekt: anqh/anqh
 /**
  * Get currency based on date. Used for currency chances such as Euro.
  *
  * @static
  * @param   float    $amount
  * @param   integer  $date
  * @return  string
  */
 public static function currency($amount, $date = null)
 {
     static $change;
     // Show decimals only if required
     $amount = $amount == (int) $amount ? (int) $amount : Num::format($amount, 2, true);
     // Finland switched to Euro on January 1st, 2002
     if (!$change) {
         $change = mktime(0, 0, 0, 1, 1, 2002);
     }
     $currency = !$date || $date >= $change ? '€' : 'mk';
     return $amount . $currency;
 }
Beispiel #5
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Title
        if ($this->area->description) {
            echo $this->area->description . '<hr>';
        }
        if ($this->area->topic_count) {
            // Area has topics
            $last_topic = $this->area->last_topic();
            $last_poster = $last_topic->last_post()->author();
            ?>

		<div class="media">
			<div class="pull-left">
				<?php 
            echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
            ?>
			</div>
			<div class="media-body">
				<small class="ago"><?php 
            echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
            ?>
</small>
				<?php 
            echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
            ?>
				<br>
				<?php 
            echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
            ?>
<br />
			</div>
		</div>

		<small class="stats muted">
			<i class="icon-comments"></i> <?php 
            echo Num::format($this->area->topic_count, 0);
            ?>
			<i class="icon-comment"></i> <?php 
            echo Num::format($this->area->post_count, 0);
            ?>
		</small>

<?php 
        } else {
            // Empty area
            echo __('No topics yet.');
        }
        return ob_get_clean();
    }
Beispiel #6
0
 public function rules()
 {
     return ['amount' => function ($value) {
         if ($value <= 0) {
             return 'Еще нет средств на расход';
         }
         $amount = $this->model('Salary')->getReady();
         $amount = intval($amount);
         $value = intval($value);
         if ($amount !== $value) {
             return 'Сумма изменилась должно быть:' . \Num::format($amount);
         }
     }];
 }
Beispiel #7
0
 public function rules()
 {
     return ['out' => function ($value) {
         $salary = $this->salary;
         $out = $salary['out'] + $salary['balance'];
         // должно быть всего выдано
         $_balance = $this->getData('balance', 0);
         if (!empty($value)) {
             if ($value > $out) {
                 return 'нельзя выдать больше чем должно быть ' . \Num::format($out);
             }
         }
         /*$summa = $value + $_balance;
           if($summa != $out){
               return 'Сумма Выдано + Осталось выдать НЕ Совпадает ('.\Num::format($out-$_balance).'), должно быть '.\Num::format($out);
           }*/
     }];
 }
Beispiel #8
0
 static function pretty_format($price, $valute = NULL, $discount = NULL)
 {
     if ($valute === 'LVL' or $valute === NULL) {
         if ($discount !== NULL) {
             return Num::format($price / 100 - $price / 100 * ($discount / 100), 2) . ' ls';
         }
         return Num::format($price / 100, 2) . ' Ls';
     } elseif ($valute === 'EUR') {
         if ($discount !== NULL) {
             return '€' . Num::format(($price / 100 - $price / 100 * ($discount / 100)) / 0.7, 2);
         }
         return '€' . Num::format($price / 100 / 0.7, 2);
     } elseif ($valute === 'USD') {
         if ($discount !== NULL) {
             return Num::format(($price / 100 - $price / 100 * ($discount / 100)) / 0.57, 2);
         }
         return '$ ' . Num::format($price / 100 / 0.57, 2);
     }
 }
Beispiel #9
0
 /**
  * Get prefixed forum title.
  *
  * @static
  * @param   Model_Forum_Topic  $topic
  * @return  string
  */
 public static function topic(Model_Forum_Topic $topic)
 {
     $prefix = array();
     // Private topic
     if ($topic->recipient_count) {
         $prefix[] = $topic->recipient_count > 2 ? '<i class="fa fa-group text-muted" title="' . __(':recipients recipients', array(':recipients' => Num::format($topic->recipient_count, 0))) . '"></i>' : '<i class="fa fa-envelope text-muted" title="' . __('Personal message') . '"></i>';
     }
     // Stickyness
     if ($topic->sticky) {
         $prefix[] = '<i class="fa fa-thumb-tack text-warning" title="' . __('Pinned') . '"></i>';
     }
     // Status
     switch ($topic->status) {
         case Model_Forum_Topic::STATUS_LOCKED:
             $prefix[] = '<i class="fa fa-lock text-muted" title="' . __('Locked') . '"></i>';
             break;
         case Model_Forum_Topic::STATUS_SINK:
             $prefix[] = '<i class="fa fa-unlock text-muted" title="' . __('Sink') . '"></i>';
             break;
     }
     return implode(' ', $prefix) . ' ' . HTML::chars($topic->name);
 }
Beispiel #10
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function render()
    {
        ob_start();
        $rating = $this->count ? $this->total / $this->count : 0;
        ?>

<span class="rating">
	<?php 
        for ($r = 1; $r <= 5; $r++) {
            ?>
	<i class="<?php 
            echo $rating >= $r - 0.5 ? 'icon-star' : 'icon-star-empty';
            ?>
 icon-white" title="<?php 
            echo $r;
            ?>
"></i>
	<?php 
        }
        ?>
	<?php 
        if ($this->score) {
            ?>
	<var title="<?php 
            echo __($this->count == 1 ? ':rates rating' : ':rates ratings', array(':rates' => $this->count));
            ?>
"><?php 
            echo Num::format($rating, 2);
            ?>
</var>
	<?php 
        }
        ?>
</span>

<?php 
        return ob_get_clean();
    }
Beispiel #11
0
    $i = 1;
    foreach ($products as $product) {
        ?>
                            <tr>
                                <td><?php 
        echo $product->title;
        ?>
</td>
                                <td><strong class="text-highlighted"><?php 
        echo $products_data[$product->id_product]['customers'];
        ?>
</strong></td>
                                <td>
                                    <strong class="text-highlighted">
                                        <?php 
        echo $num_format == 'MONEY' ? i18n::format_currency($products_data[$product->id_product]['total']) : Num::format($products_data[$product->id_product]['total'], 0);
        ?>
                                    </strong>
                                </td>
                                <td class="col-xs-2">
                                    <div class="progress">
                                        <div class="progress-bar" style="width: <?php 
        echo $current_total > 0 ? number_format($products_data[$product->id_product]['total'] / $current_total * 100, 2) : 0;
        ?>
%;">
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        <?php 
    }
Beispiel #12
0
 /**
  * Action: index
  */
 public function action_index()
 {
     // Go to post?
     $topic_id = (int) $this->request->param('topic_id');
     if ($topic_id) {
         $post_id = (int) $this->request->param('id');
     } else {
         $topic_id = (int) $this->request->param('id');
     }
     // Load topic
     /** @var  Model_Forum_Private_Topic|Model_Forum_Topic  $topic */
     $topic = $this->private ? Model_Forum_Private_Topic::factory($topic_id) : Model_Forum_Topic::factory($topic_id);
     if (!$topic->loaded()) {
         throw new Model_Exception($topic, $topic_id);
     }
     Permission::required($topic, Model_Forum_Topic::PERMISSION_READ, self::$user);
     // Did we request single post with ajax?
     if (($this->ajax || $this->internal) && isset($post_id)) {
         $this->history = false;
         $post = $this->private ? Model_Forum_Private_Post::factory($post_id) : Model_Forum_Post::factory($post_id);
         if (!$post->loaded()) {
             throw new Model_Exception($topic, $topic_id);
         }
         // Permission is already checked by the topic, no need to check for post
         $this->response->body($this->section_post($topic, $post));
         return;
     }
     // Update counts
     if ($this->private) {
         $topic->mark_as_read(self::$user);
     }
     if (!self::$user || $topic->author_id != self::$user->id) {
         $topic->read_count++;
         $topic->save();
     }
     // Build page
     $this->view = new View_Page();
     $this->view->title_html = Forum::topic($topic);
     $this->view->subtitle = __($topic->post_count == 1 ? ':posts post' : ':posts posts', array(':posts' => Num::format($topic->post_count, 0)));
     $this->view->tab = 'topic';
     $this->page_actions['topic'] = array('link' => Route::model($topic), 'text' => '<i class="icon-comment icon-white"></i> ' . __('Topic'));
     // Public topic extras
     if (!$this->private) {
         // Quotes are supported only in public forum as we get notifications anyway in private
         if (self::$user) {
             $quotes = Model_Forum_Quote::factory()->find_by_user(self::$user);
             if (count($quotes)) {
                 foreach ($quotes as $quote) {
                     if ($topic->id == $quote->forum_topic_id) {
                         $quote->delete();
                         break;
                     }
                 }
             }
         }
         // Facebook
         if (Kohana::$config->load('site.facebook')) {
             Anqh::open_graph('title', $topic->name);
             Anqh::open_graph('url', URL::site(Route::url('forum_topic', array('id' => $topic->id, 'action' => '')), true));
         }
         Anqh::share(true);
         // Model binding
         $area = $topic->area();
         if ($area->type == Model_Forum_Area::TYPE_BIND && $topic->bind_id) {
             if ($bind = Model_Forum_Area::get_binds($area->bind)) {
                 $model = AutoModeler::factory($bind['model'], $topic->bind_id);
                 if ($model->loaded()) {
                     // Set actions
                     $this->page_actions[] = array('link' => Route::model($model), 'text' => $bind['link']);
                     // Set views
                     foreach ((array) $bind['view'] as $view) {
                         $this->view->add(View_Page::COLUMN_SIDE, View_Module::factory($view, array($bind['model'] => $model)), Widget::TOP);
                     }
                 }
             }
         }
     }
     // Public topic extras
     // Set actions
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_POST, self::$user)) {
         $this->view->actions[] = array('link' => Request::current_uri() . '#reply', 'text' => '<i class="icon-comment icon-white"></i> ' . __('Reply to topic'), 'class' => 'btn btn-primary topic-post');
     }
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_UPDATE, self::$user)) {
         $this->view->actions[] = array('link' => Route::model($topic, 'edit'), 'text' => '<i class="icon-edit icon-white"></i> ' . __('Edit topic'));
     }
     // Breadcrumbs
     $this->page_breadcrumbs[] = HTML::anchor(Route::url('forum_group'), __('Forum'));
     $this->page_breadcrumbs[] = HTML::anchor(Route::model($topic->area()), $topic->area()->name);
     // Pagination
     $this->view->add(View_Page::COLUMN_MAIN, $pagination = $this->section_pagination($topic));
     $this->view->subtitle .= ', ' . __($pagination->total_pages == 1 ? ':pages page' : ':pages pages', array(':pages' => Num::format($pagination->total_pages, 0)));
     $this->view->subtitle .= ', ' . __($topic->read_count == 1 ? ':views view' : ':views views', array(':views' => Num::format($topic->read_count, 0)));
     // Go to post?
     if (isset($post_id)) {
         $pagination->item($topic->get_post_number($post_id) + 1);
         // We need to set pagination urls manually if jumped to a post
         $pagination->base_url = Route::model($topic);
     }
     // Recipients
     if ($this->private) {
         $this->view->add(View_Page::COLUMN_MAIN, $this->section_recipients($topic));
         $this->view->add(View_Page::COLUMN_MAIN, '<hr />');
     }
     // Posts
     $this->view->add(View_Page::COLUMN_MAIN, $this->section_topic($topic, $pagination));
     // Reply
     if (Permission::has($topic, Model_Forum_Topic::PERMISSION_POST, self::$user)) {
         $section = $this->section_post_edit(View_Forum_PostEdit::REPLY, $this->private ? Model_Forum_Private_Post::factory() : Model_Forum_Post::factory());
         $section->forum_topic = $topic;
         $this->view->add(View_Page::COLUMN_MAIN, $section);
     }
     // Pagination
     $this->view->add(View_Page::COLUMN_MAIN, $pagination);
     $this->_side_views();
 }
Beispiel #13
0
 /**
  * @todo test locales
  * @test
  * @dataProvider provider_format
  * @param integer $number
  * @param integer $places
  * @param boolean $monetary
  * @param string $expected
  */
 public function test_format($number, $places, $monetary, $expected)
 {
     $this->assertSame($expected, Num::format($number, $places, $monetary));
 }
Beispiel #14
0
        <div class="statcard statcard-success">
            <a href="<?php 
echo Route::url('oc-panel', array('controller' => Request::current()->controller(), 'action' => 'tickets_closed'));
?>
?<?php 
echo http_build_query(['rel' => ''] + Request::current()->query());
?>
" class="display-block">
                <div class="p-a">
                    <span class="statcard-desc"><?php 
echo __('Tickets Closed');
?>
</span>
                    <h2 class="statcard-number">
                        <?php 
echo Num::format($tickets_closed_total, 0);
?>
                        <small class="delta-indicator <?php 
echo Num::percent_change($tickets_closed_total, $tickets_closed_total_past) < 0 ? 'delta-negative' : 'delta-positive';
?>
"><?php 
echo Num::percent_change($tickets_closed_total, $tickets_closed_total_past);
?>
</small> 
                        <small class="ago"><?php 
echo sprintf(__('%s days ago'), $days_ago);
?>
</small>
                    </h2>
                    <hr class="statcard-hr">
                </div>
Beispiel #15
0
	<form action="<?php 
    echo URL::site('acp/products/item/' . $product->id . '/' . Security::token());
    ?>
" method="post">
	<table>
		<tr>
			<th>Nosaukums</th>
			<td><input type="text" name="name" value="<?php 
    echo $product->name;
    ?>
" /></td>
		</tr>
		<tr>
			<th>Cena (Bez atlaides)</th>
			<td><input type="text" name="price" value="<?php 
    echo Num::format($product->price / 100, 2);
    ?>
" /></td>
		</tr>
<?php 
    if ($product->is_discount == 1) {
        ?>
		<tr>
			<th>Cena (Ar atlaidi)</th>
			<td><?php 
        echo Currency::pretty_format($product->price, $product->discount);
        ?>
</td>
		</tr>
		<tr>
			<th>Atlaide <input checked="checked" type="checkbox" name="is_discount" /></th>
Beispiel #16
0
 /**
  * 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];
     }
     if (is_numeric($value)) {
         // Format number
         $formatted = Num::format($value, 0);
         $plural = $plural ? $plural : $singular;
         $title = $singular && $plural ? ' title="' . __($value == 1 ? $singular : $plural, array($var => $formatted)) . '"' : '';
     } else {
         // Value is a string, no formatting
         $formatted = HTML::chars($singular);
         $title = '';
     }
     return '<var class="' . $class . '"' . $title . '>' . $formatted . '</var>';
 }
Beispiel #17
0
Datei: top.php Projekt: anqh/anqh
    /**
     * 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();
    }
Beispiel #18
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $areas = $this->group->areas();
        if (count($areas)) {
            ?>

<table class="table">
	<thead>
		<tr>
			<th class="span4"><h3><?php 
            echo HTML::anchor(Route::model($this->group), HTML::chars($this->group->name));
            ?>
</h3></th>
			<th class="span1"><?php 
            echo __('Topics');
            ?>
</th>
			<th class="span1"><?php 
            echo __('Posts');
            ?>
</th>
			<th class="span2"><?php 
            echo __('Latest post');
            ?>
</th>
		</tr>
	</thead>

	<tbody>

	<?php 
            foreach ($areas as $area) {
                ?>

		<?php 
                if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$_user)) {
                    ?>

		<tr>
			<td>
				<h4><?php 
                    echo HTML::anchor(Route::model($area), HTML::chars($area->name));
                    ?>
</h4>
				<?php 
                    echo $area->description;
                    ?>
			</td>
			<td><?php 
                    echo Num::format($area->topic_count, 0);
                    ?>
</td>
			<td><?php 
                    echo Num::format($area->post_count, 0);
                    ?>
</td>
			<td>

			<?php 
                    if ($area->topic_count > 0) {
                        $last_topic = $area->last_topic();
                        ?>

				<small class="ago"><?php 
                        echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
                        ?>
</small>
				<?php 
                        echo HTML::user($last_topic->last_post()->author_id, $last_topic->last_poster);
                        ?>
<br />
				<?php 
                        echo HTML::anchor(Route::model($last_topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
                        ?>
				<?php 
                        echo HTML::anchor(Route::model($last_topic, '?page=last#last'), HTML::chars($last_topic->name), array('title' => HTML::chars($last_topic->name)));
                        ?>

			<?php 
                    } else {
                        ?>

				<sup><?php 
                        echo __('No topics yet.');
                        ?>
</sup>

			<?php 
                    }
                    ?>

			</td>
		</tr>

		<?php 
                } elseif ($area->status != Model_Forum_Area::STATUS_HIDDEN) {
                    ?>

		<tr>
			<td colspan="4">
				<h4><?php 
                    echo HTML::chars($area->name);
                    ?>
</h4>
				<?php 
                    echo __('Members only');
                    ?>
			</td>
		</tr>

		<?php 
                }
                ?>

	<?php 
            }
            ?>

	</tbody>
</table>

<?php 
        } else {
            echo new View_Alert(__('No areas yet.'), null, View_Alert::INFO);
        }
        return ob_get_clean();
    }
Beispiel #19
0
	function display($paper)
	{
		return __('You owe me :money dollars', array(
			':money' => Num::format($paper, 2, TRUE),
		));
	}
Beispiel #20
0
    ?>
				<?php 
    echo HTML::avatar($author['avatar'], $author['username']);
    ?>

				<?php 
    echo HTML::user($author, $author['username']);
    ?>
<br />
				<small><?php 
    echo HTML::chars($author['title']);
    ?>
</small>
				<p>
					<small><?php 
    echo __('Posts: :posts', array(':posts' => '<var>' . Num::format($author_full->post_count, 0)));
    ?>
</small>
				</p>
			<?php 
} else {
    ?>
				<?php 
    echo HTML::avatar(false);
    ?>

				<?php 
    echo $post->author_name;
    ?>
<br />
				<small><?php 
Beispiel #21
0
    echo __('Latest post');
    ?>
</span>
</header>

	<?php 
    foreach ($topics as $topic) {
        ?>

<article>
	<header class="grid6 first topic">
		<?php 
        echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('class' => 'grid5 first'));
        ?>
		<span class="grid1 replies"><?php 
        echo Num::format($topic->post_count - 1, 0);
        ?>
</span>
	</header>

	<p class="grid2 latest">
		<small class="ago"><?php 
        echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
        ?>
</small>
		<?php 
        echo HTML::user($topic->last_poster, $topic->last_poster);
        ?>
	</p>
</article>
Beispiel #22
0
 /**
  * Var method for events.
  *
  * @return  array
  */
 protected function _events()
 {
     $events = array();
     if ($this->events) {
         foreach ($this->events as $_day => $_cities) {
             $day = array();
             foreach ($_cities as $_city => $_events) {
                 $city = array();
                 /** @var  Model_Event  $_event */
                 foreach ($_events as $_event) {
                     // Get venue
                     if ($_event->venue_hidden) {
                         $venue = __('Underground');
                     } else {
                         if ($venue = $_event->venue()) {
                             $venue = HTML::anchor(Route::model($venue), $venue->name);
                         } else {
                             if ($_event->venue_name) {
                                 $venue = HTML::chars($_event->venue_name);
                             } else {
                                 $venue = '';
                             }
                         }
                     }
                     // Get icon
                     if ($image = $_event->flyer_front()) {
                         $icon = $image->get_url($image::SIZE_ICON);
                     } else {
                         if ($image = $_event->flyer_back()) {
                             $icon = $image->get_url($image::SIZE_ICON);
                         } else {
                             if (count($flyers = $_event->flyers())) {
                                 $image = $flyers[0]->image();
                                 $icon = $image->get_url($image::SIZE_ICON);
                             } else {
                                 $icon = null;
                             }
                         }
                     }
                     $city[] = array('name' => $_event->name, 'url' => Route::model($_event), 'city' => $_event->city_name, 'price' => $_event->price !== null && $_event->price == 0 ? __('Free!') : ($_event->price > 0 ? Num::format($_event->price, 2, true) . '€' : ''), 'venue' => $venue, 'icon' => $icon ? HTML::image($icon, array('alt' => __('Flyer'))) : '', 'dj' => $_event->dj, 'music' => ($tags = $_event->tags()) ? implode(', ', $tags) : $_event->music);
                 }
                 $day[$_city] = $city;
             }
             $events[$_day] = array('date' => Date::split($_day), 'cities' => $day);
         }
     }
     return $events;
 }
Beispiel #23
0
 /**
  * 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>';
 }
Beispiel #24
0
    /**
     * 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')));
        ?>

			&bull;

			<?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')) . ' &bull; ';
        }
        ?>

			<?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')) . ' &bull; ';
        }
        ?>

			<?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')) . ' &bull; ';
        }
        ?>

			<?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>&ldquo;' . HTML::chars($this->author->title) . '&rdquo;</small>';
            }
        } else {
            echo $this->forum_post->author_name;
            echo ' <small>&ldquo;' . __('Guest') . '&rdquo;</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 
        echo $this->author && $this->author->signature ? BB::factory("\n--\n" . $this->author->signature)->render() : '';
        ?>

		<?php 
        if ($this->forum_post->modify_count > 0) {
            echo '<br /><br />' . __('Edited :ago', array(':ago' => HTML::time(Date::fuzzy_span($this->forum_post->modified), $this->forum_post->modified)));
        }
        ?>
	</footer>
</div>

<?php 
        return ob_get_clean();
    }
?>
                        </h2>
                    </div>
                </li>
                <li role="presentation">
                    <div class="p-a">
                        <span class="statcard-desc"><?php 
echo __('12 Months Ago');
?>
</span>
                        <h2 class="statcard-number">
                            <?php 
if ($six_months_ago_total !== NULL) {
    ?>
                                <?php 
    echo Num::format($twelve_months_ago_total, 0);
    ?>
                                <small class="delta-indicator <?php 
    echo Num::percent_change($twelve_months_ago_total, $twelve_six_months_ago_total) < 0 ? 'delta-negative' : 'delta-positive';
    ?>
"><?php 
    echo Num::percent_change($twelve_months_ago_total, $twelve_six_months_ago_total);
    ?>
</small>
                            <?php 
} else {
    ?>
                                --
                            <?php 
}
?>
Beispiel #26
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        if (count($this->topics)) {
            ?>

<table class="table">
	<thead>
		<tr>
			<th class="span1 from"><?php 
            echo __('From');
            ?>
</th>
			<th class="span5 topic"><?php 
            echo __('Topic');
            ?>
</th>
			<th class="span1 replies"><?php 
            echo __('Replies');
            ?>
</th>
			<th class="span2 latest"><?php 
            echo __('Latest post');
            ?>
</th>
		</tr>
	</thead>

	<tbody>

		<?php 
            foreach ($this->topics as $topic) {
                ?>

		<tr>
			<td class="from">
				<?php 
                echo HTML::user($topic->author_id, $topic->author_name);
                ?>
			</td>
			<td class="topic">
				<?php 
                echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="' . (($recipients = $topic->recipient_count) < 3 ? 'icon-envelope' : 'icon-comment') . ' icon-white"></i> ' . HTML::chars($topic->name), array('title' => $recipients < 3 ? __('Personal message') : __(':recipients recipients', array(':recipients' => Num::format($recipients, 0)))));
                ?>
			</td>
			<td class="replies">
				<?php 
                echo Num::format($topic->post_count - 1, 0);
                ?>
			</td>
			<td class="latest">
				<small class="ago"><?php 
                echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
                ?>
</small>
				<?php 
                echo HTML::user($topic->last_poster, $topic->last_poster);
                ?>
			</td>
		</tr>

		<?php 
            }
            ?>

	</tbody>
</table>

<?php 
        } else {
            // Empty area
            echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO);
        }
        return ob_get_clean();
    }
Beispiel #27
0
 /**
  * Print some render stats
  *
  * @return string
  */
 public static function render_stats()
 {
     $run = Profiler::application();
     $run = $run['current'];
     $queries = Profiler::groups();
     $queries = count($queries['database (default)']);
     return "Page rendered in " . Num::format($run['time'], 3) . " seconds using " . Num::format($run['memory'] / 1024 / 1024, 2) . "MB and " . $queries . " queries.";
 }
Beispiel #28
0
        </div>
    </div>
    <div class="col-sm-6 col-md-3">
        <div class="statcard statcard-success">
            <a href="<?php 
echo Route::url('oc-panel', array('controller' => Request::current()->controller(), 'action' => 'paid_orders'));
?>
" class="display-block">
                <div class="p-a">
                    <span class="statcard-desc"><?php 
echo __('Paid Orders');
?>
</span>
                    <h2 class="statcard-number">
                        <?php 
echo Num::format($paid_orders_total, 0);
?>
                        <small class="delta-indicator <?php 
echo Num::percent_change($paid_orders_total, $paid_orders_total_past) < 0 ? 'delta-negative' : 'delta-positive';
?>
"><?php 
echo Num::percent_change($paid_orders_total, $paid_orders_total_past);
?>
</small> 
                        <small class="ago"><?php 
echo sprintf(__('%s days ago'), $days_ago);
?>
</small>
                    </h2>
                    <hr class="statcard-hr">
                </div>
Beispiel #29
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        if (count($this->topics)) {
            ?>

<table class="table table-condensed table-striped">
	<tbody>

	<?php 
            foreach ($this->topics as $topic) {
                $last_poster = $topic->last_post()->author();
                $area = $this->area ? false : $topic->area();
                ?>

	<tr>

		<td>
			<h4 class="media-heading">
			<?php 
                if ($this->area || $topic->recipient_count) {
                    ?>
				<?php 
                    echo HTML::anchor(Route::model($topic), Forum::topic($topic));
                    ?>
				<small class="transparent"><?php 
                    echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="text-muted fa fa-level-down"></i>', array('title' => __('Last post')));
                    ?>
</small>
			<?php 
                } else {
                    ?>
				<?php 
                    echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic));
                    ?>
				<small class="transparent"><?php 
                    echo HTML::anchor(Route::model($topic), '<i class="text-muted fa fa-level-up"></i>', array('title' => __('First post')));
                    ?>
</small>
			<?php 
                }
                ?>
			</h4>

			<?php 
                if ($area) {
                    ?>
			<small class="muted">
				<?php 
                    echo HTML::anchor(Route::model($area), HTML::chars($area->name), array('class' => 'hoverable'));
                    ?>
			</small>
			<?php 
                }
                ?>

		</td>

		<td class="text-right muted nowrap">
			<small title="<?php 
                echo __('Replies');
                ?>
"><?php 
                echo Num::format($topic->post_count - 1, 0);
                ?>
 <i class="fa fa-comment"></i></small>
		</td>

		<td>
			<?php 
                echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, 'small');
                ?>
			<?php 
                echo $last_poster ? HTML::user($last_poster) : HTML::chars($topic->last_poster);
                ?>
		</td>

		<td>
			<small class="muted pull-right nowrap"><?php 
                echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
                ?>
</small>
		</td>

	</tr>

	<?php 
            }
            ?>

	</tbody>
</table>

<?php 
        } else {
            // Empty area
            echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO);
        }
        return ob_get_clean();
    }
Beispiel #30
0
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
$rating = $count ? $total / $count : 0;
?>
<ol class="rating">
	<?php 
for ($r = 1; $r <= 5; $r++) {
    ?>
	<li><var class="icon <?php 
    echo $rating >= $r - 0.25 ? 'rate' : ($rating >= $r - 0.75 ? 'rate-half' : 'rate-empty');
    ?>
"<?php 
    if ($rate) {
        echo ' title="', $r, '"';
    }
    ?>
></var></li>
	<?php 
}
?>
	<li class="total"><var title="<?php 
echo __($count == 1 ? ':rates rating' : ':rates ratings', array(':rates' => $count));
?>
"><?php 
echo Num::format($rating, 2);
?>
</var></li>
</ol>