本文整理汇总了PHP中HTML::script_source方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML::script_source方法的具体用法?PHP HTML::script_source怎么用?PHP HTML::script_source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML
的用法示例。
在下文中一共展示了HTML::script_source方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _event_subtitle
/**
* Add event subtitle.
*
* @param Model_Event $event
* @return string
*/
protected function _event_subtitle(Model_Event $event)
{
$subtitle = array();
// Date
$subtitle[] = '<i class="icon-calendar icon-white"></i> ' . HTML::time(Date('l', $event->stamp_begin) . ', ' . Date::format(Date::DMY_LONG, $event->stamp_begin), $event->stamp_begin, true);
// Time
if ($event->stamp_begin != $event->stamp_end) {
$subtitle[] = $event->stamp_end ? '<i class="icon-time icon-white"></i> ' . __(':from until :to', array(':from' => HTML::time(Date::format('HHMM', $event->stamp_begin), $event->stamp_begin), ':to' => HTML::time(Date::format('HHMM', $event->stamp_end), $event->stamp_end))) : '<i class="icon-time icon-white"></i> ' . __('From :from onwards', array(':from' => HTML::time(Date::format('HHMM', $event->stamp_begin), $event->stamp_begin)));
}
// 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[] = '<i class="icon-map-marker icon-white"></i> ' . $venue . ($address ? ', ' . $address : '');
if (isset($map)) {
$subtitle[] = HTML::anchor('#map', __('Show map'));
return implode(' ', $subtitle) . '<div id="map" style="display: none">' . __('Map loading') . '</div>';
}
return implode(' ', $subtitle);
}
示例2: textarea_editor
/**
* Creates a textarea form input with BBCode editor.
*
* @param string $name textarea name
* @param string $body textarea body
* @param array $attributes html attributes
* @param boolean $double_encode encode existing HTML characters
* @return string
*
* @uses HTML::attributes
* @uses HTML::chars
*/
public static function textarea_editor($name, $body = '', array $attributes = null, $double_encode = true)
{
// Get DOM element
if ($element = Arr::get($attributes, 'id')) {
$element = '#' . $element;
} else {
$element = 'textarea[name=' . $name . ']';
}
return new View_Generic_Smileys($element) . Form::textarea($name, $body, $attributes, $double_encode) . HTML::script_source('head.ready("vendor", function initMarkItUp() { $("' . $element . '").markItUp(bbCodeSettings); });');
}
示例3: function
echo HTML::script_source('
head.ready("anqh", function() {
$("a.post-edit").live("click", function(e) {
e.preventDefault();
var href = $(this).attr("href");
var post = href.match(/([0-9]*)\\/edit/);
$("#post-" + post[1] + " .actions").fadeOut();
$.get(href, function(data) {
$("#post-" + post[1] + " .post-content").html(data);
});
});
$("a.post-delete").each(function(i) {
var action = $(this);
action.data("action", function() {
var post = action.attr("href").match(/([0-9]*)\\/delete/);
if (post) {
$("#post-" + post[1]).slideUp();
$.get(action.attr("href"));
}
});
});
$("a.post-quote").live("click", function(e) {
e.preventDefault();
var href = $(this).attr("href");
var post = href.match(/([0-9]*)\\/quote/);
var article = $(this).closest("article");
$("#post-" + post[1] + " .actions").fadeOut();
$.get(href, function(data) {
article.append(data);
var quote = article.find("#quote");
if (quote.offset().top + quote.outerHeight() > $(window).scrollTop() + $(window).height()) {
window.scrollTo(0, quote.offset().top + quote.outerHeight() - $(window).height() );
}
});
});
$("section.post-content form").live("submit", function(e) {
e.preventDefault();
var post = $(this).closest("article");
post.loading();
$.post($(this).attr("action"), $(this).serialize(), function(data) {
post.replaceWith(data);
});
});
$("section.post-content form a").live("click", function(e) {
e.preventDefault();
var post = $(this).closest("article");
$.get($(this).attr("href"), function(data) {
post.replaceWith(data);
});
});
$("#quote form a").live("click", function(e) {
e.preventDefault();
var quote = $("#quote");
var article = quote.closest("article");
quote.slideUp(null, function() { quote.remove(); });
article.find(".actions").fadeIn();
});
});
');
示例4: after
/**
* Destroy controller
*/
public function after()
{
if ($this->ajax || $this->internal) {
// AJAX and HMVC requests
$this->response->body($this->response->body() . '');
} else {
if ($this->auto_render) {
// Normal requests
$session = Session::instance();
// Save current URI
/* Moved to Controller
if ($this->history && $this->response->status() < 400) {
$uri = $this->request->current_uri();
unset($this->breadcrumb[$uri]);
$this->breadcrumb = array_slice($this->breadcrumb, -9, 9, true);
$this->breadcrumb[$uri] = $this->page_title;
$session
->set('history', $uri . ($_GET ? URL::query($_GET) : ''))
->set('breadcrumb', $this->breadcrumb);
}
*/
// Controller name as the default page id if none set
empty($this->page_id) and $this->page_id = $this->request->controller();
// Stylesheets
$styles = array('ui/boot.css' => null, 'ui/typo.css' => null, 'ui/base.css' => null, 'ui/jquery-ui.css' => null, 'http://fonts.googleapis.com/css?family=Nobile:regular,bold' => null);
// Generic views
Widget::add('breadcrumb', View::factory('generic/breadcrumb', array('breadcrumb' => $this->breadcrumb, 'last' => !$this->history)));
Widget::add('actions', View::factory('generic/actions', array('actions' => $this->page_actions)));
Widget::add('navigation', View::factory('generic/navigation', array('items' => Kohana::$config->load('site.menu'), 'selected' => $this->page_id)));
if (!empty($this->tabs)) {
Widget::add('subnavigation', View::factory('generic/navigation', array('items' => $this->tabs, 'selected' => $this->tab_id)));
}
/*
Widget::add('tabs', View::factory('generic/tabs_top', array(
'tabs' => $this->tabs,
'selected' => $this->tab_id
)));
*/
// Footer
Widget::add('footer', View_Module::factory('events/event_list', array('mod_id' => 'footer-events-new', 'mod_class' => 'article grid4 first cut events', 'mod_title' => __('New events'), 'events' => Model_Event::factory()->find_new(10))));
Widget::add('footer', View_Module::factory('forum/topiclist', array('mod_id' => 'footer-topics-active', 'mod_class' => 'article grid4 cut topics', 'mod_title' => __('New posts'), 'topics' => Model_Forum_Topic::factory()->find_by_latest_post(10))));
Widget::add('footer', View_Module::factory('blog/entry_list', array('mod_id' => 'footer-blog-entries', 'mod_class' => 'article grid4 cut blogentries', 'mod_title' => __('New blogs'), 'entries' => Model_Blog_Entry::factory()->find_new(10))));
// Skin
$skins = Kohana::$config->load('site.skins');
$skin = 'dark';
//$session->get('skin', 'dark');
$skin_imports = array('ui/mixin.less', 'ui/grid.less', 'ui/layout.less', 'ui/widget.less', 'ui/custom.less');
// Dock
$classes = array();
foreach ($skins as $skin_name => &$skin_config) {
$skin_config['path'] = 'ui/' . $skin_name . '/skin.less';
$classes[] = HTML::anchor(Route::get('setting')->uri(array('action' => 'skin', 'value' => $skin_name)), $skin_config['name'], array('class' => 'theme', 'rel' => $skin_name));
}
//Widget::add('dock', __('Theme') . ': ' . implode(', ', $classes));
// Language selection
$available_languages = Kohana::$config->load('locale.languages');
if (count($available_languages)) {
$languages = array();
foreach ($available_languages as $lang => $locale) {
$languages[] = HTML::anchor('set/lang/' . $lang, HTML::chars($locale[2]));
}
// Widget::add('dock', ' | ' . __('Language: ') . implode(', ', $languages));
}
// Search
/*
Widget::add('search', View_Module::factory('generic/search', array(
'mod_id' => 'search'
)));
*/
// Visitor card
Widget::add('visitor', View::factory('generic/visitor', array('user' => self::$user)));
// Time & weather
Widget::add('dock', ' | ' . View::factory('generic/clock', array('user' => self::$user)));
// Pin
Widget::add('dock', ' | ' . HTML::anchor('#pin', '▲', array('title' => __('Lock menu'), 'class' => 'icon unlock', 'onclick' => '$("#header").toggleClass("pinned"); return false;')));
// End
Widget::add('end', View::factory('generic/end'));
// Analytics
if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
}
// Open Graph
$og = array();
foreach ((array) Anqh::open_graph() as $key => $value) {
$og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
}
if (!empty($og)) {
Widget::add('head', implode("\n", $og));
}
// Share
if (Anqh::share()) {
if ($share = Kohana::$config->load('site.share')) {
// 3rd party share
Widget::add('share', View_Module::factory('share/share', array('mod_class' => 'like', 'id' => $share)));
Widget::add('foot', View::factory('share/foot', array('id' => $share)));
} else {
if ($facebook = Kohana::$config->load('site.facebook')) {
//.........这里部分代码省略.........
示例5: function
echo HTML::script_source('
// Keyboard navigation
head.ready("jquery-ui", function() {
$(document).keyup(function(e) {
var key = e.keyCode || e.which;
if (e.target.type === undefined) {
switch (key) {
case 37: var link = $(".gallery-image a.prev").first().attr("href"); break;
case 39: var link = $(".gallery-image a.next").first().attr("href"); break;
}
if (link) {
window.location = link;
}
}
});
});
// Notes
head.ready("anqh", function() {
$("a.image").notes(' . json_encode($note_array) . ');
$("input[name=name]").autocompleteUser();
$("a.note-add").click(function() {
function updateForm(img, area) {
$("#form-note")
.css({
left: area.x1 + "px",
top: area.y1 + area.height + 5 + "px"
})
.show();
$("#form-note input[name=x]").val(area.x1);
$("#form-note input[name=y]").val(area.y1);
$("#form-note input[name=width]").val(area.width);
$("#form-note input[name=height]").val(area.height);
}
$("a.image img").imgAreaSelect({
onInit: updateForm,
onSelectChange: updateForm,
handles: true,
persistent: true,
minWidth: 50,
minHeight: 50,
maxWidth: 150,
maxHeight: 150,
x1: parseInt($("a.image").width() / 2) - 50,
y1: parseInt($("a.image").height() / 2) - 50,
x2: parseInt($("a.image").width() / 2) + 50,
y2: parseInt($("a.image").height() / 2) + 50
});
return false;
});
$("#form-note a.cancel").click(function() {
$("a.image img").imgAreaSelect({ hide: true });
$("#form-note").hide();
});
});
');
示例6: __
<div class="info"></div>
</div>
</div>
</div>
<a class="navi prev" title="<?php
echo __('Previous');
?>
">«</a>
<a class="navi next" title="<?php
echo __('Next');
?>
">»</a>
<a class="action close" title="<?php
echo __('Close');
?>
">✖</a>
</div>
<?php
echo HTML::script_source("\nhead.js(\n\t{ 'jquery': 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' },\n\t{ 'jquery-ui': 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js' },\n\t{ 'jquery-tools': '" . URL::base() . "js/jquery.tools.min.js' },\n\t{ 'jquery-form': '" . URL::base() . "js/jquery.form.js' },\n\t{ 'jquery-overflow': '" . URL::base() . "js/jquery.text-overflow.js' },\n\t{ 'jquery-imgarea': '" . URL::base() . "js/jquery.imgareaselect.js' },\n\t{ 'jquery-scroll': '" . URL::base() . "js/jquery-scrolltofixed-min.js' },\n\t{ 'jquery-markitup': '" . URL::base() . "js/jquery.markitup.pack.js' },\n\t{ 'jquery-bbcode': '" . URL::base() . "js/markitup.bbcode.js' },\n\t{ 'anqh': '" . URL::base() . "js/anqh.js?2' },\n\tfunction() {\n\t\tAnqh.geoNamesURL = '" . Kohana::$config->load('geo.base_url') . "';\n\t\tAnqh.geoNamesUser = '" . Kohana::$config->load('geo.username') . "';\n\t}\n);\n");
?>
<?php
echo Widget::get('foot');
?>
</body>
</html>
示例7: function
echo HTML::script_source('
head.ready("anqh", function() {
$("#field-name").autocompleteEvent({
"action": function(event, ui) {
window.location = "' . URL::site(Route::get('galleries')->uri(array('action' => 'upload'))) . '?from=" + ui.item.id;
},
});
return;
$("#field-name")
.autocomplete({
minLength: 3,
source: function(request, response) {
$.ajax({
url: "/api/v1/events/search",
dataType: "json",
data: {
q: request.term,
limit: 25,
filter: "past",
search: "name",
field: "id:name:city:stamp_begin",
order: "stamp_begin.desc"
},
success: function(data) {
response($.map(data.events, function(item) {
return {
label: item.name,
stamp: item.stamp_begin,
city: item.city,
value: item.name,
id: item.id
}
}))
}
});
},
select: function(event, ui) {
window.location = "' . URL::site(Route::get('galleries')->uri(array('action' => 'upload'))) . '?from=" + ui.item.id;
},
})
.data("autocomplete")._renderItem = function(ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + $.datepicker.formatDate("dd.mm.yy", new Date(item.stamp * 1000)) + " " + item.label + ", " + item.city + "</a>")
.appendTo(ul);
};
});
');
示例8: after
/**
* Destroy controller.
*/
public function after()
{
if ($this->_request_type !== Controller::REQUEST_INITIAL) {
// AJAX and HMVC requests
$this->response->body((string) $this->response->body());
} else {
if ($this->auto_render) {
// Normal requests
// Stylesheets
$styles = array('ui/jquery-ui.css', 'http://fonts.googleapis.com/css?family=Terminal+Dosis');
// Skins
$selected_skin = $this->session->get('skin', 'blue');
// Less files needed to build a skin
$less_imports = array('ui/mixin.less', 'ui/anqh.less');
$skins = array(HTML::style('static/css/bootstrap.css'), HTML::style('static/css/bootstrap-responsive.css'));
foreach (array('blue') as $skin) {
$skinsi[] = Less::style('ui/' . $skin . '.less', array('title' => $skin, 'rel' => $skin == $selected_skin ? 'stylesheet' : 'alternate stylesheet'), false, $less_imports);
}
// Footer
$section = new View_Events_List();
$section->class .= ' span4';
$section->title = __('New events');
$section->events = Model_Event::factory()->find_new(10);
Widget::add('footer', $section);
$section = new View_Topics_List();
$section->class .= ' span4';
$section->title = __('New posts');
$section->topics = Model_Forum_Topic::factory()->find_by_latest_post(10);
Widget::add('footer', $section);
$section = new View_Blogs_List();
$section->class .= ' span4';
$section->title = __('New blogs');
$section->blog_entries = Model_Blog_Entry::factory()->find_new(10);
Widget::add('footer', $section);
// Open Graph
$og = array();
foreach ((array) Anqh::open_graph() as $key => $value) {
$og[] = '<meta property="' . $key . '" content="' . HTML::chars($value) . '" />';
}
if (!empty($og)) {
Widget::add('head', implode("\n", $og));
}
// Analytics
if ($google_analytics = Kohana::$config->load('site.google_analytics')) {
Widget::add('head', HTML::script_source("\nvar tracker;\nhead.js(\n\t{ 'google-analytics': 'http://www.google-analytics.com/ga.js' },\n\tfunction() {\n\t\ttracker = _gat._getTracker('" . $google_analytics . "');\n\t\ttracker._trackPageview();\n\t}\n);\n"));
}
// Ads
/* $ads = Kohana::$config->load('site.ads');
if ($ads && $ads['enabled']) {
foreach ($ads['slots'] as $ad => $slot) {
if ($slot == 'side') {
$this->view->add(View_Page::COLUMN_SIDE, View::factory('ads/' . $ad));
} else {
Widget::add($slot, View::factory('ads/' . $ad), Widget::MIDDLE);
}
}
}*/
// Do some CSS magic to page class
$page_class = array_merge(array($this->language, $this->request->action(), self::$user ? 'authenticated' : 'unauthenticated'), explode(' ', $this->page_class));
$page_class = implode(' ', array_unique($page_class));
// Set the generic page variables
$this->view->styles = $styles;
$this->view->skins = $skins;
$this->view->language = $this->language;
$this->view->id = $this->page_id;
$this->view->class = $page_class;
if ($this->page_actions) {
$this->view->tabs = $this->page_actions;
}
if ($this->page_breadcrumbs) {
$this->view->breadcrumbs = $this->page_breadcrumbs;
}
// And finally the profiler stats
if (self::$user && self::$user->has_role('admin')) {
//in_array(Kohana::$environment, array(Kohana::DEVELOPMENT, Kohana::TESTING))) {
Widget::add('foot', View::factory('generic/debug'));
Widget::add('foot', View::factory('profiler/stats'));
}
}
}
parent::after();
}
示例9: action_settings
/**
* Action: settings
*/
public function action_settings()
{
$this->history = false;
$user = $this->_get_user();
Permission::required($user, Model_User::PERMISSION_UPDATE, self::$user);
// Set generic page parameters
$this->_set_page($user);
// Handle post
$errors = array();
if ($_POST && Security::csrf_valid()) {
$user->set(Arr::extract($_POST, Model_User::$editable_fields));
// GeoNames
if ($_POST['city_id'] && ($city = Geo::find_city((int) $_POST['city_id']))) {
$user->city = $city;
}
$user->modified = time();
try {
$user->save();
$this->request->redirect(URL::user($user));
} catch (Validate_Exception $e) {
$errors = $e->array->errors('validation');
}
}
// Build form
$form = array('values' => $user, 'errors' => $errors, 'cancel' => URL::user($user), 'hidden' => array('city_id' => $user->city ? $user->city->id : 0, 'latitude' => $user->latitude, 'longitude' => $user->longitude), 'groups' => array('basic' => array('header' => __('Basic information'), 'fields' => array('name' => array(), 'gender' => array('input' => 'radio'), 'dob' => array('pretty_format' => 'j.n.Y'), 'title' => array(), 'description' => array('attributes' => array('rows' => 5)))), 'contact' => array('header' => __('Contact information'), 'fields' => array('email' => array(), 'homepage' => array(), 'address_street' => array(), 'address_zip' => array(), 'address_city' => array())), 'forum' => array('header' => __('Forum settings'), 'fields' => array('signature' => array('attributes' => array('rows' => 5))))));
Widget::add('main', View_Module::factory('form/anqh', array('form' => $form)));
// Autocomplete
$this->autocomplete_city('address_city', 'city_id');
// Date picker
$options = array('changeMonth' => true, 'changeYear' => true, 'dateFormat' => 'd.m.yy', 'defaultDate' => date('j.n.Y', $user->dob), 'dayNames' => array(__('Sunday'), __('Monday'), __('Tuesday'), __('Wednesday'), __('Thursday'), __('Friday'), __('Saturday')), 'dayNamesMin' => array(__('Su'), __('Mo'), __('Tu'), __('We'), __('Th'), __('Fr'), __('Sa')), 'firstDay' => 1, 'monthNames' => array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'), __('September'), __('October'), __('November'), __('December')), 'monthNamesShort' => array(__('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'), __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec')), 'nextText' => __('»'), 'prevText' => __('«'), 'showWeek' => true, 'showOtherMonths' => true, 'weekHeader' => __('Wk'), 'yearRange' => '1900:+0');
Widget::add('foot', HTML::script_source('$("#field-dob").datepicker(' . json_encode($options) . ');'));
// Maps
Widget::add('foot', HTML::script_source('
$(function() {
$("#fields-contact ul").append("<li><div id=\\"map\\">' . __('Loading map..') . '</div></li>");
$("#map").googleMap(' . ($user->latitude ? json_encode(array('marker' => true, 'lat' => $user->latitude, 'long' => $user->longitude)) : '') . ');
$("input[name=address_street], input[name=address_city]").blur(function(event) {
var address = $("input[name=address_street]").val();
var city = $("input[name=address_city]").val();
if (address != "" && city != "") {
var geocode = address + ", " + city;
geocoder.geocode({ address: geocode }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
map.setCenter(results[0].geometry.location);
$("input[name=latitude]").val(results[0].geometry.location.lat());
$("input[name=longitude]").val(results[0].geometry.location.lng());
var marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map
});
}
});
}
});
});
'));
}
示例10: foreach
<section id="<?php
echo $id;
?>
" class="mod tabs">
<ul>
<?php
$t = 0;
$selected = 0;
foreach ($tabs as $tab) {
$selected = !empty($tab['selected']) ? $t : $selected;
$t++;
?>
<li><?php
echo HTML::anchor($tab['href'], $tab['title']);
?>
</li>
<?php
}
?>
</ul>
<?php
foreach ($tabs as $tab) {
echo $tab['tab'];
}
?>
</section>
<?php
// Initialize tabs immediately to aviod ugly jumping
echo HTML::script_source('$("#' . $id . '").tabs({ selected: ' . $selected . ', collapsible: true, fx: { height: "toggle", opacity: "toggle", duration: "fast" } });');
//echo html::script_source('$("#' . $id . ' > ul").tabs("#' . $id . ' .tab", { initialIndex: ' . $selected . ', effect: "fade" });');
示例11: foreach
$t++;
?>
<li><?php
echo HTML::anchor($tab['href'], $tab['title']);
?>
</li>
<?php
}
?>
</ul>
<?php
foreach ($tabs as $tab) {
echo $tab['tab'];
}
?>
</section>
<?php
echo HTML::script_source('
head.ready("jquery-ui", function() {
$("#' . $id . '")
.tabs({
"selected": ' . $selected . ',
"collapsible": true,
"fx": {
"height": "toggle",
"opacity": "toggle",
"duration": "fast"
}
})
.show();
});');
示例12: _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) . ' – ' . 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(' ', $subtitle) . (isset($map) ? '<div id="map" style="display: none">' . __('Map loading') . '</div>' : '');
}
示例13: autocomplete_city
/**
* Autocomplete for city
*
* @param string $name Form input name for city name
* @param string $id Form input name for city id
*/
public function autocomplete_city($name = 'city_name', $id = 'city_id')
{
Widget::add('foot', HTML::script_source('
$(function() {
$("input[name=' . $name . ']")
.autocomplete({
source: function(request, response) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
lang: "' . $this->language . '",
featureClass: "P",
countryBias: "FI",
style: "full",
maxRows: 10,
name_startsWith: request.term
},
success: function(data) {
response($.map(data.geonames, function(item) {
return {
id: item.geonameId,
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name,
lat: item.lat,
long: item.lng
}
}))
}
})
},
minLength: 2,
select: function(event, ui) {
$("input[name=' . $id . ']").val(ui.item.id);
if ($("input[name=address]") && $("input[name=address]").val() == "") {
$("input[name=latitude]").val(ui.item.lat);
$("input[name=longitude]").val(ui.item.long);
map && map.setCenter(new google.maps.LatLng(ui.item.lat, ui.item.long));
}
},
});
});
'));
}
示例14: function
<?php
}
?>
</ul>
<?php
if (!empty($tabs)) {
?>
</div>
</section>
<?php
echo HTML::script_source('
head("jquery-ui", function() {
$("#newsfeed-tabs").tabs({
selected: ' . (isset($tab) && $tab == 'friends' ? 1 : 0) . ',
fx: {
height: "toggle",
opacity: "toggle",
duration: "fast"
},
ajaxOptions: {
error: function(xhr, status, index, anchor) {
$(anchor.hash).html("' . __('Frak, error loading newsfeed :(') . '");
}
}
});
});
');
}
示例15: textarea_wrap
/**
* Creates a textarea form input.
*
* @param string $name textarea name
* @param string $body textarea body
* @param array $attributes html attributes
* @param boolean $double_encode encode existing HTML characters
*
* @param string $label
* @param string|array $error
* @param string|array $tip
* @param boolean $bbcode
* @return string
*/
public static function textarea_wrap($name, $body = '', array $attributes = null, $double_encode = true, $label = null, $error = null, $tip = null, $bbcode = null)
{
if (is_array($body)) {
$body = Arr::get($body, $name);
} else {
if (is_object($body)) {
$body = $body->{$name};
}
}
$attributes = (array) $attributes + array('id' => self::input_id($name));
$label = $label ? array($attributes['id'] => $label) : '';
$input = Form::textarea($name, $body, $attributes, $double_encode);
if ($bbcode) {
$input .= HTML::script_source('
head.ready("bbcode", function initMarkItUp() {
$("#' . $attributes['id'] . '").markItUp(bbCodeSettings);
});
');
}
return Form::wrap($input, $name, $label, $error, $tip);
}