当前位置: 首页>>代码示例>>PHP>>正文


PHP Num::currency方法代码示例

本文整理汇总了PHP中Num::currency方法的典型用法代码示例。如果您正苦于以下问题:PHP Num::currency方法的具体用法?PHP Num::currency怎么用?PHP Num::currency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Num的用法示例。


在下文中一共展示了Num::currency方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: price

 /**
  * Get event ticket price in event day's currency or Free!
  *
  * @return  string
  */
 public function price()
 {
     if ($this->price === 0) {
         return __('Free!');
     } elseif ($this->price > 0) {
         return Num::currency($this->price, $this->stamp_begin);
     } else {
         return null;
     }
 }
开发者ID:anqh,项目名称:events,代码行数:15,代码来源:event.php

示例2: content

 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     /*
     // Stamp
     if ($this->event->stamp_begin != $this->event->stamp_end):
     	echo ($this->event->stamp_end ?
     		'<i class="icon-time icon-white"></i> ' . __('From :from to :to', array(
     			':from' => HTML::time(Date::format('HHMM', $this->event->stamp_begin), $this->event->stamp_begin),
     			':to'   => HTML::time(Date::format('HHMM', $this->event->stamp_end), $this->event->stamp_end)
     		)) :
     		'<i class="icon-time icon-white"></i> ' . __('From :from onwards', array(
     			':from' => HTML::time(Date::format('HHMM', $this->event->stamp_begin), $this->event->stamp_begin),
     		))) . '<br />';
     endif;
     */
     // Price
     if ($this->event->price == 0) {
         echo '<i class="icon-shopping-cart icon-white"></i> ' . __('Free entry') . '<br />';
     } elseif ($this->event->price > 0) {
         echo '<i class="icon-shopping-cart icon-white"></i> ' . __('Tickets :price', array(':price' => '<var>' . Num::currency($this->event->price, $this->event->stamp_begin) . '</var>'));
         echo ($this->event->price2 !== null ? ', ' . __('presale :price', array(':price' => '<var>' . Num::currency($this->event->price2, $this->event->stamp_begin) . '</var>')) : '') . '<br />';
     }
     // Age limit
     if ($this->event->age > 0) {
         echo '<i class="icon-user icon-white"></i> ' . __('Age limit') . ': ' . __(':years years', array(':years' => '<var>' . $this->event->age . '</var>')) . '<br />';
     }
     // Homepage
     if (!empty($this->event->homepage)) {
         echo '<i class="icon-home icon-white"></i> ' . HTML::anchor($this->event->homepage, Text::limit_url($this->event->homepage, 25)) . '<br />';
     }
     // Tags
     if ($tags = $this->event->tags()) {
         echo '<i class="icon-music icon-white"></i> ' . implode(', ', $tags) . '<br />';
     } elseif (!empty($this->event->music)) {
         echo '<i class="icon-music icon-white"></i> ' . $this->event->music . '<br />';
     }
     /*
     // Venue
     if ($_venue = $this->event->venue()):
     
     	// Venue found from db
     	$venue   = HTML::anchor(Route::model($_venue), HTML::chars($_venue->name));
     	$address = $_venue->address
     	 ? HTML::chars($_venue->address) . ', ' . HTML::chars($_venue->city_name)
     	 : HTML::chars($_venue->city_name);
     
     	if ($_venue->latitude):
     		$map = array(
     			'marker'     => HTML::chars($_venue->name),
     			'infowindow' => HTML::chars($_venue->address) . '<br />' . HTML::chars($_venue->city_name),
     			'lat'        => $_venue->latitude,
     			'long'       => $_venue->longitude
     		);
     		Widget::add('foot', HTML::script_source('
     head.ready("anqh", function() {
     	$("#event-info a[href=#map]").on("click", function toggleMap(event) {
     $("#map").toggle("fast", function openMap() {
     	$("#map").googleMap(' .  json_encode($map) . ');
     });
     
     return false;
     	});
     });
     '));
     	endif;
     
     elseif ($this->event->venue_name):
     
     	// No venue in db
     	$venue   = $this->event->venue_url
     		? HTML::anchor($this->event->venue_url, HTML::chars($this->event->venue_name))
     		: HTML::chars($this->event->venue_name);
     	$address = HTML::chars($this->event->city_name);
     
     else:
     
     	// Venue not set
     	$venue   = $this->event->venue_hidden ? __('Underground') : __('(Unknown)');
     	$address = HTML::chars($this->event->city_name);
     
     endif;
     echo '<address><strong><i class="icon-map-marker icon-white"></i> ', $venue, '</strong>' . ($address ? ', ' . $address : '') . '<br />';
     if (isset($map)):
     	echo HTML::anchor('#map', __('Toggle map')) . '<br />';
     	echo '<div id="map" style="display: none">', __('Map loading') . '</div>';
     endif;
     echo '</address>';
     */
     // Meta
     echo '<br /><footer class="meta">';
     echo __('Added') . ' ' . HTML::time(Date::format(Date::DMY_SHORT, $this->event->created), $this->event->created);
     if ($this->event->modified) {
         echo ', ' . __('last modified') . ' ' . HTML::time(Date::short_span($this->event->modified, false), $this->event->modified);
     }
//.........这里部分代码省略.........
开发者ID:anqh,项目名称:events,代码行数:101,代码来源:info.php

示例3: change

 /**
  * Update price and availability
  *
  * @param	boolean		$cached		Update from already downloaded files
  * @return	boolean 				All products have been processed
  */
 public function change($cached = false)
 {
     // Get data from supplier
     if (!($products = $this->_change($cached))) {
         return true;
     }
     // Get current prices from supplier
     $price = \DB::select('external_id', 'price', 'available')->from(Model_Price::table())->where('supplier_id', $this->model->id)->execute()->as_array('external_id');
     // Cast values to the appropriate data type
     array_walk($price, function (&$product, $id) use(&$price) {
         $product['price'] = \Num::currency($product['price']);
         $product['available'] = intval($product['available']);
         unset($price[$id]['external_id']);
     });
     $count = array(0);
     $available = array();
     foreach ($products as $id => $product) {
         // Are we sure that it exists?
         if (!array_key_exists($id, $price)) {
             continue;
         }
         // Default data casting and values
         $product['price'] = \Arr::get($product, 'price');
         is_null($product['price']) or $product['price'] = \Num::currency($product['price']);
         $a = \Arr::get($product, 'available');
         // Check if product's price has been changed, or just became (un)available
         if (!is_null($product['price'])) {
             // Foolproofness: set the update array manually
             $product = array('price' => $product['price'], 'external_id' => $id, 'supplier_id' => $this->model->id);
             // Update availability if changed
             is_null($a) or $product['available'] = $a;
             // Get job and queue
             $job = $this->get_config('change.job', 'Indigo\\Erp\\Stock\\Job_Supplier_Change');
             $queue = $this->get_config('change.queue', 'update');
             // Use Queue if available (greater performance)
             if (\Package::loaded('queue')) {
                 $count[0] += \Queue::push($queue, $job, array($product, $price[$id])) ? 1 : 0;
             } else {
                 try {
                     $job = new $job();
                     $count[0] += $job->execute(null, $product);
                 } catch (\Exception $e) {
                 }
             }
         } elseif (!is_null($a)) {
             $available[$a][] = $id;
         }
     }
     // Update availability information
     $available = $this->_available($available);
     $count[1] = $available[0];
     $count[2] = $available[1];
     // Set the last updated time for supplier prices
     $this->model->set('last_update', time())->save();
     // Log success
     \Log::info($this->model->name . ' frissítve: ' . $count[0] . ' frissítés, ' . $count[1] . ' lett elérhetetlen, ' . $count[2] . ' lett elérhető.');
     // All product have been processed
     return array_sum($count) == count($products);
 }
开发者ID:indigophp,项目名称:erp-stock-extra,代码行数:65,代码来源:driver.php

示例4: _event_subtitle

    /**
     * Add event subtitle.
     *
     * @param   Model_Event  $event
     * @return  string
     */
    public static function _event_subtitle(Model_Event $event)
    {
        $subtitle = array();
        // Date
        if ($event->stamp_end - $event->stamp_begin > Date::DAY) {
            // Multi day event
            $subtitle[] = '<i class="fa fa-calendar"></i> ' . HTML::time(Date('l', $event->stamp_begin) . ', <strong>' . Date::format(Date::DM_LONG, $event->stamp_begin) . ' &ndash; ' . Date::format(Date::DMY_LONG, $event->stamp_end) . '</strong>', $event->stamp_begin, true);
        } else {
            // Single day event
            $subtitle[] = '<i class="fa fa-calendar"></i> ' . HTML::time(Date('l', $event->stamp_begin) . ', <strong>' . Date::format(Date::DMY_LONG, $event->stamp_begin) . '</strong>', $event->stamp_begin, true);
        }
        // Time
        if ($event->stamp_begin != $event->stamp_end) {
            $subtitle[] = $event->stamp_end ? '<i class="fa fa-clock-o"></i> ' . __('From :from until :to', array(':from' => '<strong>' . HTML::time(Date::format('HHMM', $event->stamp_begin), $event->stamp_begin) . '</strong>', ':to' => '<strong>' . HTML::time(Date::format('HHMM', $event->stamp_end), $event->stamp_end) . '</strong>')) : '<i class="fa fa-clock-o"></i> ' . __('From :from onwards', array(':from' => HTML::time(Date::format('HHMM', $event->stamp_begin), $event->stamp_begin)));
        }
        // Tickets
        $tickets = '';
        if ($event->price === 0 || $event->price > 0 || $event->ticket_url) {
            $tickets = '<i class="fa fa-ticket"></i> ';
        }
        if ($event->price === 0) {
            $tickets .= '<strong>' . __('Free entry') . '</strong> ';
        } else {
            if ($event->price > 0) {
                $tickets .= __('Tickets :price', array(':price' => '<strong>' . Num::currency($event->price, $event->stamp_begin) . '</strong>')) . ' ';
            }
        }
        if ($event->ticket_url) {
            $tickets .= HTML::anchor($event->ticket_url, __('Buy tickets'), array('target' => '_blank'));
        }
        if ($tickets) {
            $subtitle[] = $tickets;
        }
        // Age limit
        if ($event->age > 0) {
            $subtitle[] = '<i class="fa fa-user"></i> ' . __('Age limit') . ': <strong>' . $event->age . '</strong>';
        }
        // Homepage
        if (!empty($event->url)) {
            $subtitle[] = '<i class="fa fa-link"></i> ' . HTML::anchor($event->url, Text::limit_url($event->url, 25));
        }
        // Venue
        if ($_venue = $event->venue()) {
            // Venue found from db
            $venue = HTML::anchor(Route::model($_venue), HTML::chars($_venue->name));
            $address = HTML::chars($_venue->city_name);
            if ($_venue->latitude) {
                $map = array('marker' => HTML::chars($_venue->name), 'infowindow' => HTML::chars($_venue->address) . '<br />' . HTML::chars($_venue->city_name), 'lat' => $_venue->latitude, 'long' => $_venue->longitude);
                Widget::add('foot', HTML::script_source('
head.ready("anqh", function() {
	$("a[href=#map]").on("click", function toggleMap(event) {
		$("#map").toggle("fast", function openMap() {
			$("#map").googleMap(' . json_encode($map) . ');
		});

		return false;
	});
});
'));
            }
        } else {
            if ($event->venue_name) {
                // No venue in db
                $venue = $event->venue_url ? HTML::anchor($event->venue_url, HTML::chars($event->venue_name)) : HTML::chars($event->venue_name);
                $address = HTML::chars($event->city_name);
            } else {
                // Venue not set
                $venue = $event->venue_hidden ? __('Underground') : __('(Unknown)');
                $address = HTML::chars($event->city_name);
            }
        }
        $subtitle[] = '<br /><i class="fa fa-map-marker"></i> <strong>' . $venue . '</strong>' . ($address ? ', ' . $address : '');
        if (isset($map)) {
            $subtitle[] = HTML::anchor('#map', __('Show map'));
        }
        // Tags
        if ($tags = $event->tags()) {
            $subtitle[] = '<br /><i class="fa fa-music"></i> <em>' . implode(', ', $tags) . '</em>';
        } else {
            if (!empty($event->music)) {
                $subtitle[] = '<br /><i class="fa fa-music"></i> <em>' . $event->music . '</em>';
            }
        }
        return implode(' &nbsp; ', $subtitle) . (isset($map) ? '<div id="map" style="display: none">' . __('Map loading') . '</div>' : '');
    }
开发者ID:anqh,项目名称:anqh,代码行数:91,代码来源:events.php


注:本文中的Num::currency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。