本文整理汇总了PHP中Layout::addJSHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::addJSHeader方法的具体用法?PHP Layout::addJSHeader怎么用?PHP Layout::addJSHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::addJSHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select2Script
/**
*
* @author Matthew McNaney <mcnaney at gmail dot com>
* @package Global
* @license http://opensource.org/licenses/lgpl-3.0.html
*/
function select2Script()
{
$script = '<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'javascript/select2/select2.min.js"></script>';
\Layout::addJSHeader($script);
\Layout::addToStyleList('javascript/select2/select2.min.css');
\Layout::addToStyleList('javascript/select2/select2-bootstrap.css');
}
示例2: show
public function show()
{
javascript('jquery');
$home_http = PHPWS_SOURCE_HTTP;
/**
* Uncomment below for DEVELOPMENT
* Comment out for PRODUCTION
*/
// Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.js'></script>");
// Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/JSXTransformer.js'></script>");
// Layout::addJSHeader("<script type='text/jsx' src='{$home_http}mod/hms/javascript/AssignByFloor/src/AssignByFloor.jsx'></script>");
/**
* Uncomment below for PRODUCTION
* Comment out for DEVELOPMENT
*/
Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.min.js'></script>");
Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/AssignByFloor/build/AssignByFloor.js'></script>");
/**
* Remainder of code is untouched regardless of development status
*/
Layout::addJSHeader("<script type='text/javascript'>var sourceHttp = '{$home_http}';</script>");
ob_start();
include PHPWS_HOME_HTTP . 'mod/hms/templates/admin/AssignByFloor.html';
return ob_get_clean();
}
示例3: form
public static function form(\Request $request, $active_tab)
{
javascript('jquery');
\Form::requiredScript();
if (!in_array($active_tab, array('contact-info', 'map', 'social'))) {
$active_tab = 'contact-info';
}
$thumbnail_map = \Settings::get('contact', 'thumbnail_map');
$contact_info = self::load();
$values = self::getValues($contact_info);
require PHPWS_SOURCE_DIR . 'mod/contact/config/states.php';
$values['states'] =& $states;
if (!empty($thumbnail_map)) {
$values['thumbnail_map'] = "<img src='{$thumbnail_map}' />";
} else {
$values['thumbnail_map'] = null;
}
$js_social_links = ContactInfo\Social::getLinksAsJavascriptObject($values['social']);
$js_string = <<<EOF
<script type='text/javascript'>var active_tab = '{$active_tab}';var thumbnail_map = '{$thumbnail_map}';var social_urls = {$js_social_links};</script>
EOF;
\Layout::addJSHeader($js_string);
$script = PHPWS_SOURCE_HTTP . 'mod/contact/javascript/contact.js';
\Layout::addJSHeader("<script type='text/javascript' src='{$script}'></script>");
\Layout::addJSHeader('<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>');
$template = new \Template($values);
$template->setModuleTemplate('contact', 'Contact_Info_Form.html');
return $template->get();
}
示例4: loadJavascript
protected function loadJavascript()
{
javascript('jquery');
javascript('dropzone');
javascript('authkey', null, null, true);
$accepted_files = $this->getAllowedFileTypes();
$included_script = "<script type='text/javascript'>Dropzone.autoDiscover = false;</script>" . "<script type='text/javascript'>var accepted_files='{$accepted_files}';var ftype={$this->ftype};</script>";
\Layout::addJSHeader($included_script, 'fc_accepted_files');
$source = PHPWS_SOURCE_HTTP . 'mod/filecabinet/javascript/fc_folders/folder.js';
$script = "<script type='text/javascript' src='{$source}'></script>";
\Layout::addJSHeader($script, 'fc_folder');
}
示例5: show
public function show()
{
$residentStudents = $this->room->get_assignees();
$home_http = PHPWS_SOURCE_HTTP;
$residents = array();
foreach ($residentStudents as $s) {
$residents[] = array('studentId' => $s->getBannerId(), 'name' => $s->getName());
}
$vars = array();
javascript('jquery');
// Load header for Angular Frontend
/**
* Uncomment below for DEVELOPMENT
* Comment out for PRODUCTION
*/
//Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.js'></script>");
//Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/JSXTransformer.js'></script>");
//Layout::addJSHeader("<script type='text/jsx' src='{$home_http}mod/hms/javascript/CheckOut/src/CheckOut.jsx'></script>");
/**
* Uncomment below for PRODUCTION
* Comment out for DEVELOPMENT
*/
Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/react/build/react.min.js'></script>");
Layout::addJSHeader("<script src='{$home_http}mod/hms/javascript/CheckOut/build/CheckOut.js'></script>");
/**
* Remainder of code is untouched regardless of development status
*/
Layout::addJSHeader("<script type='text/javascript'>var sourceHttp = '{$home_http}';</script>");
$vars['student'] = $this->student->getFullName();
$vars['banner_id'] = $this->student->getBannerId();
$vars['hall_name'] = $this->hall->getHallName();
$vars['room_number'] = $this->room->getRoomNumber();
$vars['residents'] = json_encode($residents);
$vars['checkin_id'] = $this->checkin->id;
$vars['previous_key_code'] = $this->checkin->key_code;
$vars['room_pid'] = $this->room->persistent_id;
$damage_types = DamageTypeFactory::getDamageTypeAssoc();
$damage_options = array();
foreach ($damage_types as $dt) {
$damage_options[$dt['category']][] = array('id' => $dt['id'], 'description' => $dt['description']);
}
$vars['damage_types'] = json_encode($damage_types);
if (empty($this->damages)) {
$vars['existing_damage'] = '[]';
} else {
$this->addResponsible($residents);
$vars['existing_damage'] = json_encode($this->damages);
}
$tpl = new \Template($vars);
$tpl->setModuleTemplate('hms', 'admin/CheckOut.html');
return $tpl->get();
}
示例6: loadReact
function loadReact($data)
{
javascript('jquery');
$home_http = PHPWS_SOURCE_HTTP;
if (isset($data['development']) && $data['development']) {
if (isset($data['addons']) && $data['addons']) {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-with-addons.js'></script>");
} else {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react.js'></script>");
}
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/JSXTransformer.js'></script>");
} else {
if (isset($data['addons']) && $data['addons']) {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-with-addons.min.js'></script>");
} else {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react.min.js'></script>");
}
}
}
示例7: getJavascript
protected function getJavascript()
{
$source_http = PHPWS_SOURCE_HTTP;
\Layout::addJSHeader("<script type='text/javascript' src='{$source_http}Global/Templates/Pager/pager.js'></script>");
}
示例8:
}
if (isset($GLOBALS['reactDevAddOnLoaded'])) {
return;
}
if (isset($data['addons']) && $data['addons']) {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-with-addons.js'></script>", 'reactload');
// onload normal react, let addon have precedence
$GLOBALS['reactDevAddOnLoaded'] = true;
} else {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react.js'></script>", 'reactload');
}
$GLOBALS['reactDevLoaded'] = true;
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-dom.js'></script>", 'react-dom');
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/JSXTransformer.js'></script>", 'jsxtrans');
} else {
// if dev or minified addon react have loaded, don't load again
if (isset($GLOBALS['reactDevLoaded'])) {
return;
}
if (isset($GLOBALS['reactAddOnLoaded'])) {
return;
}
if (isset($data['addons']) && $data['addons']) {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-with-addons.min.js'></script>", 'reactload');
// onload normal react, let addon have precedence
$GLOBALS['reactAddOnLoaded'] = true;
} else {
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react.min.js'></script>", 'reactload');
}
Layout::addJSHeader("<script src='{$home_http}javascript/react/build/react-dom.min.js'></script>", 'react-dom');
}
示例9: post
/**
* Handle the submit from the search form.
*
* @param \Request $request
* @return \Response
*/
public function post(\Request $request)
{
$script = PHPWS_SOURCE_HTTP . 'mod/systemsinventory/javascript/sys_pager.js';
$source_http = PHPWS_SOURCE_HTTP;
\Layout::addJSHeader("<script type='text/javascript'>var source_http = '{$source_http}';</script>");
\Layout::addLink("<script type='text/javascript' src='{$script}'></script>");
$factory = new Factory();
$search_vars = $request->getVars();
$_SESSION['system_search_vars'] = $search_vars['vars'];
\Pager::prepare();
$template = new \Template();
$template->setModuleTemplate('systemsinventory', 'search_results.html');
$view = new \View\HtmlView($template->get());
$response = new \Response($view);
return $response;
}
示例10: menuList
private function menuList()
{
\Layout::addStyle('menu', 'admin.css');
javascript('jquery');
javascript('jquery_ui');
//commenting out for now. problem clearing select dropdown
//javascript('select2');
$template = new \Template();
$template->setModuleTemplate('menu', 'admin/administrate.html');
$first_menu_pin_all = 0;
$first_menu_template = null;
$db = new PHPWS_DB('menus');
$db->addOrder('queue');
$result = $db->getObjects('Menu_Item');
$first_menu = null;
if (!empty($result)) {
foreach ($result as $menu) {
$menu->_show_all = true;
if (empty($first_menu)) {
$first_menu = $menu;
$active = 'active';
} else {
$active = null;
}
$tpl['menus'][] = array('title' => $menu->title, 'id' => $menu->id, 'active' => $active);
}
$first_menu_template = $first_menu->template;
// for display, use the admin template
$first_menu->template = 'admin';
$tpl['first_menu'] = $first_menu->view(true);
$first_menu_pin_all = $first_menu->pin_all;
$first_menu_id = $first_menu->id;
} else {
$first_menu_id = 0;
$tpl['first_menu'] = null;
}
$vars['delete'] = t('Delete');
$vars['confirm_delete'] = t('Confirm deletion');
$vars['first_menu_id'] = $first_menu_id;
$vars['authkey'] = \Current_User::getAuthKey();
$vars['blank_title'] = t('Title must not be blank');
$vars['title_error'] = t('Make sure you have filled in the required inputs.');
$vars['url_error'] = t('Please enter a url or choose a PageSmith page.');
$vars['delete_menu_message'] = t('Are you sure you want to delete this menu and links?');
$vars['edit'] = t('Edit');
$vars['title_error'] = t('Please enter a menu title');
if (PHPWS_Settings::get('menu', 'display_type')) {
$vars['pin_all'] = null;
$vars['pin_some'] = null;
} else {
$vars['pin_all'] = t('Shown on all pages');
$vars['pin_some'] = t('Shown on some pages');
}
$jvar = json_encode($vars);
$script = <<<EOF
<script type="text/javascript">var translate = {$jvar}; var fmp={$first_menu_pin_all};</script>
EOF;
\Layout::addJSHeader($script);
\Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/menu/javascript/administrate/script.js"></script>');
$main_menu_templates = PHPWS_File::listDirectories(PHPWS_Template::getTemplateDirectory('menu') . 'menu_layout/');
$theme_menu_templates = PHPWS_File::listDirectories(PHPWS_Template::getTplDir('menu') . 'menu_layout/');
$menu_tpls[] = '<optgroup label="' . t('Menu module templates') . '">';
foreach ($main_menu_templates as $menu_tpl) {
if ($first_menu_template == $menu_tpl) {
$selected = ' selected="selected"';
} else {
$selected = null;
}
$menu_tpls[] = "<option value='{$menu_tpl}'{$selected}>{$menu_tpl}</option>";
}
$menu_tpls[] = '</optgroup>';
if (!empty($theme_menu_templates)) {
$menu_tpls[] = '<optgroup label="' . t('Theme templates') . '">';
foreach ($theme_menu_templates as $menu_tpl) {
if ($first_menu_template == $menu_tpl) {
$selected = ' selected="selected"';
} else {
$selected = null;
}
$menu_tpls[] = "<option value='{$menu_tpl}'{$selected}>{$menu_tpl}</option>";
}
$menu_tpls[] = '</optgroup>';
}
$tpl['templates'] = implode('', $menu_tpls);
$tpl['display_type'] = \PHPWS_Settings::get('menu', 'display_type');
if (isset($first_menu) && $first_menu->pin_all) {
$tpl['pin_all'] = $vars['pin_all'];
$tpl['pin_button_class'] = 'btn-primary';
} else {
$tpl['pin_all'] = $vars['pin_some'];
$tpl['pin_button_class'] = 'btn-default';
}
if (\Current_User::isDeity()) {
$tpl['reset_menu_link'] = PHPWS_Text::linkAddress('menu', array('command' => 'reset_menu'), true);
} else {
$tpl['reset_menu_link'] = '#';
}
$tpl['link_limit'] = \PHPWS_Settings::get('menu', 'max_link_characters');
if (\PHPWS_Core::moduleExists('carousel')) {
$tpl['carousel'] = $this->carouselSlidesForm();
//.........这里部分代码省略.........
示例11: javascript
<?php
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
Block::show();
if (Current_User::allow('block')) {
$key = Key::getCurrent();
if (Key::checkKey($key) && javascriptEnabled()) {
javascript('jquery');
javascript('ckeditor');
$js_address = PHPWS_SOURCE_HTTP . 'mod/block/javascript/addblock/script.js';
Layout::addJSHeader('<script src="' . $js_address . '" type="text/javascript"></script>', 'addblock');
$modal = new \Modal('block-form-modal', '<div id="block-form-dialog"></div>', 'Add block here');
$modal->sizeLarge();
$save_button = '<button class="btn btn-success" id="save-block">Save</button>';
$modal->addButton($save_button);
Layout::add((string) $modal);
MiniAdmin::add('block', '<a style="cursor:pointer" data-auth-key="' . Current_User::getAuthKey() . '" data-key-id="' . $key->id . '" id="add-block"><i class="fa fa-plus"></i> Add block here</a>');
}
}
示例12: javascript
<?php
/**
*
* @author Matthew McNaney <mcnaney at gmail dot com>
* @package Global
* @license http://opensource.org/licenses/lgpl-3.0.html
*/
javascript('jquery');
$wrap_header = $wrap_body = true;
$style = '<link rel="stylesheet" type="text/css" href="' . PHPWS_SOURCE_HTTP . 'javascript/datetimepicker/jquery.datetimepicker.css" / >';
\Layout::addJSHeader($style);
\Layout::addJSHeader('<script src="' . PHPWS_SOURCE_HTTP . 'javascript/datetimepicker/jquery.datetimepicker.js"></script>');
$default['format'] = null;
$options = array();
if (!empty($data['format'])) {
$format = $data['format'];
$options[] = "format:'{$format}'";
}
if (isset($data['timepicker'])) {
$options[] = 'timepicker: ' . ($data['timepicker'] ? 'true' : 'false');
}
if (isset($data['datepicker'])) {
$options[] = 'datepicker: ' . ($data['datepicker'] ? 'true' : 'false');
}
if (isset($data['format'])) {
$options[] = "format: '" . $data['format'] . "'";
}
if (!isset($data['selector'])) {
$data['selector'] = '.datetimepicker';
}
示例13: pageLayout
/**
* Displays the page layout and lets user enter text fields, blocks, etc.
*/
public function pageLayout()
{
javascript('jquery');
javascript('jquery_ui');
javascript('ckeditor');
Layout::addStyle('pagesmith', 'admin.css');
Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'mod/pagesmith/javascript/pageedit/script.js"></script>', 'pageedit');
Layout::addStyle('pagesmith');
$page = $this->ps->page;
$pg_tpl_name =& $page->_tpl->name;
$this->ps->killSaved($page->id);
if (!empty($page->_content)) {
foreach ($page->_content as $key => $cnt) {
if (!PageSmith::checkLorum($cnt)) {
$_SESSION['PS_Page'][$page->id][$key] = $cnt;
}
}
}
$form = new PHPWS_Form('pagesmith');
$form->addHidden('module', 'pagesmith');
$form->addHidden('aop', 'post_page');
$form->addHidden('tpl', $page->template);
$form->addHidden('pid', $page->parent_page);
$template_list = $this->ps->getTemplateList();
$form->addSelect('template_list', $template_list);
$form->setMatch('template_list', $page->template);
$form->addSubmit('change_tpl', dgettext('pagesmith', 'Change template'));
if ($page->id) {
$form->addHidden('id', $page->id);
}
if (empty($page->_tpl) || $page->_tpl->error) {
$this->ps->content = dgettext('pagesmith', 'Unable to load page template.');
return;
}
$form->addSubmit('submit', dgettext('pagesmith', 'Save page'));
$form->setClass('submit', 'btn btn-success');
$page->loadKey();
if ($page->_key->id && $page->_key->show_after) {
$publish_date = $page->_key->show_after;
} else {
$publish_date = time();
}
$this->pageTemplateForm($form);
$tpl = $form->getTemplate();
$tpl['PUBLISH_DATE_LABEL'] = 'Show page after this date and time';
$tpl['PUBLISH_VALUE'] = strftime('%Y-%m-%dT%H:%M:%S', $publish_date);
$tpl['PAGE_TITLE'] = $page->title;
$jsvars['page_title_input'] = 'pagesmith_title';
$jsvars['page_title_id'] = sprintf('%s-page-title', $pg_tpl_name);
javascriptMod('pagesmith', 'pagetitle', $jsvars);
$tpl['HIDE_CHECK'] = $page->hide_title ? 'checked="checked"' : null;
if (!empty($page->_orphans)) {
$tpl['ORPHAN_LINK'] = sprintf('<a href="%s#orphans">%s</a>', PHPWS_Core::getCurrentUrl(), dgettext('pagesmith', 'Orphans'));
$tpl['ORPHANS'] = $this->listOrphans($page->_orphans);
}
// We wrap the textarea in a form just so ckeditor will allow use of the "Save" button.
$modal = new \Modal('edit-section', '<form><textarea id="block-edit-textarea"></textarea></form>', dgettext('pagesmith', 'Edit text area'));
$modal->addButton('<button id="save-page" class="btn btn-success">' . dgettext('pagesmith', 'Save') . '</button>');
$modal->setWidthPercentage(90);
$tpl['CONTENT_MODAL'] = $modal->__toString();
$title_modal = new \Modal('edit-title', '<input class="form-control" type="text" id="page-title-input" name="page_title" value="" />', dgettext('pagesmith', 'Edit page title'));
$title_modal->addButton('<button id="save-title" class="btn btn-success">' . dgettext('pagesmith', 'Save') . '</button>');
$tpl['TITLE_MODAL'] = $title_modal->__toString();
$this->ps->content = PHPWS_Template::process($tpl, 'pagesmith', 'page_form.tpl');
}
示例14: requiredScript
/**
* Loads the javascript file that helps enforce required fields. This may
* eventually be incorporated into __toString or getInputStringArray.
*/
public static function requiredScript()
{
javascript('jquery');
\Layout::addJSHeader("<script type='text/javascript' src='" . PHPWS_SOURCE_HTTP . "Global/Templates/Form/required.js'></script>");
}
示例15: javascript
<?php
javascript('jquery');
Layout::plug(Layout::getPageTitle(TRUE), 'SITE_TITLE');
Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/js/bootstrap.min.js"></script>', 'bootstrap');
Layout::addJSHeader('<script type="text/javascript" src="' . PHPWS_SOURCE_HTTP . 'themes/bootstrap/js/modal_fix.js"></script>', 'fix');
$key = Key::getCurrent();
if (!is_null($key)) {
Layout::plug('active', 'CONTENT_PAGE');
}