本文整理汇总了PHP中javascript_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP javascript_tag函数的具体用法?PHP javascript_tag怎么用?PHP javascript_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了javascript_tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_media_library
function init_media_library()
{
sfContext::getInstance()->getResponse()->addJavascript('/sfMediaLibraryPlugin/js/main', 'last');
$url = url_for('sfMediaLibrary/choice');
$js = 'sfMediaLibrary.init(\'' . $url . '\')';
return javascript_tag($js);
}
示例2: stop_remote_pager
function stop_remote_pager()
{
use_helper('Javascript');
// until prototype implements a stop() method for the PeriodicalExecuter,
// the following (almost a hack) is the only simple way to stop it
return javascript_tag("pager_watch.callback = function () {};");
}
示例3: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript('/sfExtraWidgetsPlugin/js/spinbutton.js');
$response->addStylesheet('/sfExtraWidgetsPlugin/css/spinbutton.css');
return parent::render($name, $value, $attributes, $errors) . javascript_tag("new SpinButton(\$('" . $this->generateId($name) . "'),{min:" . $this->getOption('min') . ", max:" . $this->getOption('max') . "}); \$('" . $this->generateId($name) . "').addClassName('spin-button');");
}
示例4: getMp3PlayerConfig
/** Returns appropriate JS code for mp3 player config.
* @param $files Array of Filedesc instances
* @param $aSegmSearch Array with segmentation information
*
*/
public static function getMp3PlayerConfig($files = array(), $aSegmSearch = array())
{
//needed for javascript_tag
use_helper('JavascriptBase');
$player = sfConfig::get('app_mp3player_defaultplayer', 'worldpress');
switch ($player) {
case 'flash-mp3-player':
return '';
break;
case 'worldpress':
$playerConfig = sfConfig::get('app_mp3player_worldpress');
$autostart = isset($playerConfig['autostart']) ? $playerConfig['autostart'] : 'yes';
$width = isset($playerConfig['width']) ? $playerConfig['width'] : '200';
$skin = $playerConfig['skin'];
return javascript_tag("AudioPlayer.setup('" . public_path('audio-player/player.swf') . "', \n {\n width: '{$width}', \n autostart: '{$autostart}', \n animation: 'no', \n {$skin},\n });");
break;
case 'smintplayer':
default:
// get configuration
$playerConfig = sfConfig::get('app_mp3player_smintplayer');
// build options array of array. First dimension is list of files, second is assoc array with values for the player
$options = array();
if (!isset($aSegmSearch['enabled'])) {
$aSegmSearch['enabled'] = false;
}
foreach ($files as $i => $filedesc) {
$filerec = FilePeer::getFileByExternalKey($filedesc->getTracknr());
if (!isset($filerec)) {
// no recrod returned - maybe no metadata in the db?
$tmparray = array('text' => "(No metadata available)", 'audiofile_mp3' => url_for("getAudioFile/download", true) . "?fileid=" . rawurlencode($filedesc->getTracknr()) . "&format=mp3", 'audiofile_ogg' => url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($filedesc->getTracknr()) . "&format=ogg", 'waveformfile' => url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($filedesc->getTracknr()) . "&format=waveform", 'duration' => isset($iDurationMs) ? $iDurationMs : 0, 'segments' => $aSegmSearch['enabled'] ? $aSegmSearch['resultsegments'][$i] : array(), 'searchsimilarfunc' => 'smint_' . smintTools::generateHtmlId($filedesc->getTracknr()) . '()', 'backlinktext' => "License track from gettyimages music", 'backlinkurl' => url_for("search/redirect") . "?url=" . rawurlencode("http://www.gettyimages.at/music/download-songs/" . $filedesc->getTracknr() . "?ref=spec"));
} else {
$iBitrate = $filerec->getBitrate();
$sUri = $filerec->getUri();
// estimate duration
if (file_exists($sUri)) {
$iSize = filesize($sUri);
if ($iSize) {
// file size divided by bytes per second, times 1000 to get ms.
// bitrate is k bits per second, so multiply by 1024 to get bits, and divide by 8 to get bytes
$iDurationMs = intval($iSize / ($iBitrate * 1024 / 8) * 1000);
} else {
mysfLog::log($this, "DEBUG Could not read file size: {$sUri}");
$iDurationMs = 0;
}
} else {
mysfLog::log($this, "WARNING File does not exist: {$sUri}");
$iDurationMs = 0;
}
$tmparray = array('text' => $filedesc->getTitle() . ' | ' . $filedesc->getPerformers() . ' | ' . $filedesc->getGenre(), 'audiofile_mp3' => smintUploadFileHelper::getDirectFileUrl($filerec->getUri()), 'audiofile_ogg' => url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($filedesc->getTracknr()) . "&format=ogg", 'waveformfile' => url_for("getAudioFile/download", true) . "?tracknr=" . rawurlencode($filedesc->getTracknr()) . "&format=waveform", 'duration' => isset($iDurationMs) ? $iDurationMs : 0, 'segments' => $aSegmSearch['enabled'] ? $aSegmSearch['resultsegments'][$i] : array(), 'searchsimilarfunc' => 'smint_' . smintTools::generateHtmlId($filedesc->getTracknr()) . '()', 'backlinktext' => "License track from gettyimages music", 'backlinkurl' => url_for("search/redirect") . "?url=" . rawurlencode("http://www.gettyimages.at/music/download-songs/" . $filedesc->getTracknr() . "?ref=spec"));
}
$options[] = $tmparray;
}
// we cannot put all these fields into one array since the output format must be like
// , A: XXXX, B: XXX
// and not
//, {A: XXXX, B: XXX}
return ", playlist: " . smintTools::my_options_for_javascript($options) . ", waveform_resolution: " . intval(sfConfig::get('app_defaults_waveform_resolution')) . ', waveform_factor: ' . doubleval(sfConfig::get('app_defaults_waveform_factor'));
break;
}
}
示例5: renderMenu
function renderMenu()
{
echo javascript_include_tag('sfShowHideMenu/ClickShowHideMenu.js');
echo stylesheet_tag('sfShowHideMenu/ClickShowHideMenu.css');
echo $this->buildMenuData();
$menu_js = "var clickMenu1 = new ClickShowHideMenu('click-menu1');\n clickMenu1.init();\n";
echo javascript_tag($menu_js);
}
示例6: javascript_queue
function javascript_queue($js)
{
if (sfContext::getInstance()->getRequest()->isXmlHttpRequest()) {
return javascript_tag('(function(C2C){' . $js . '})(window.C2C=window.C2C||{});');
} else {
return javascript_tag('(function(w,c){w[c]=w[c]||{};(w[c]._q=w[c]._q||[]).push(function(){' . $js . "});})(window,'C2C');");
}
}
示例7: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript('/sfExtraWidgetsPlugin/js/tinymce/plugins/tinybrowser/tb_tinymce.js.php');
$response->addJavascript('/sfExtraWidgetsPlugin/js/tinymce/tiny_mce.js');
$js = "\n tinyMCE.init({\n // General options\n mode : 'exact',\n elements: '" . $this->generateId($name) . "',\n skin : '" . sfConfig::get('app_tinymce_skin', 'o2k7') . "',\n language: '" . substr(sfContext::getInstance()->getUser()->getCulture(), 0, 2) . "',\n theme : 'advanced',\n height: " . $this->getOption('height') . ",\n width: " . $this->getOption('width') . ",\n dialog_type: '" . sfConfig::get('app_tinymce_dialog_type', 'window') . "',\n editor_selector : 'mceEditor',\n editor_deselector : 'mceNoEditor',\n relative_urls : " . sfConfig::get('app_tinymce_relative_urls', 'false') . ",\n gecko_spellcheck: " . sfConfig::get('app_tinymce_gecko_spellcheck', 'true') . ",\n entity_encoding : '" . sfConfig::get('app_tinymce_entity_encoding', 'raw') . "',\n plugins : '" . sfConfig::get('app_tinymce_plugins') . "',\n\n // Theme options\n theme_advanced_buttons1 : '" . sfConfig::get('app_tinymce_theme_advanced_buttons1') . "',\n theme_advanced_buttons2 : '" . sfConfig::get('app_tinymce_theme_advanced_buttons2') . "',\n theme_advanced_buttons3 : '" . sfConfig::get('app_tinymce_theme_advanced_buttons3') . "',\n theme_advanced_toolbar_location : '" . sfConfig::get('app_tinymce_theme_advanced_toolbar_location') . "',\n theme_advanced_toolbar_align : '" . sfConfig::get('app_tinymce_theme_advanced_toolbar_align') . "',\n theme_advanced_statusbar_location : '" . sfConfig::get('app_tinymce_theme_advanced_statusbar_location') . "',\n theme_advanced_resizing : " . sfConfig::get('app_tinymce_theme_advanced_resizing') . ",\n \n file_browser_callback : '" . sfConfig::get('app_tinymce_file_browser_callback') . "'\n });\n ";
return javascript_tag($js) . parent::render($name, $value, $attributes, $errors);
}
示例8: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$response = sfContext::getInstance()->getResponse();
$response->addStylesheet('/sfExtraWidgetsPlugin/css/autocompleter.css');
$autocompleteDiv = content_tag('div', '', array('id' => $this->generateId($name) . '_autocomplete', 'class' => 'autocomplete'));
$autocompleteJs = javascript_tag("\n function ac_update_" . $this->generateId($name) . "(text, li)\n {\n \$('" . $this->generateId($name) . "').value = li.id;\n }\n \n new Ajax.Autocompleter(\n '" . $this->generateId($name) . "',\n '" . $this->generateId($name) . '_autocomplete' . "',\n '" . url_for($this->getOption('url')) . "',\n {\n paramName: '" . $this->getOption('param') . "',\n indicator: 'indicator-" . $this->generateId($name) . "',\n minChars: " . $this->getOption('min_chars') . ",\n afterUpdateElement: ac_update_" . $this->generateId($name) . "\n });");
return parent::render($name, $value, $attributes, $errors) . '<span id="indicator-' . $this->generateId($name) . '" style="display: none;"> <img src="/sfExtraWidgetsPlugin/img/ajax-loader.gif" align="absmiddle" alt="Loading" /></span>' . $autocompleteDiv . $autocompleteJs;
}
示例9: renderHtml
function renderHtml()
{
echo stylesheet_tag('sfToolbar/dhtmlXToolbar.css');
echo javascript_include_tag('sfToolbar/dhtmlXProtobar.js');
echo javascript_include_tag('sfToolbar/dhtmlXToolbar.js');
echo javascript_include_tag('sfToolbar/dhtmlXCommon.js');
echo $this->renderTable();
echo javascript_tag($this->buildData());
}
示例10: fancy_assets
function fancy_assets()
{
foreach (sfConfig::get('app_csFormTransformPlugin_javascripts') as $javascript) {
sfContext::getInstance()->getResponse()->addJavascript($javascript, 'last');
}
foreach (sfConfig::get('app_csFormTransformPlugin_stylesheets') as $stylesheet) {
sfContext::getInstance()->getResponse()->addStylesheet($stylesheet, 'last');
}
echo javascript_tag('$(function() { $("form.jqtransform").jqTransform();});');
}
示例11: getCollapseSnippet
public function getCollapseSnippet($name, $count)
{
if (is_null($this->getOption('collapse')) || !$this->getOption('collapse')) {
return null;
}
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Javascript'));
$id = $this->generateId($name);
$snippet = link_to_function($this->getCollapseText($count), sprintf("document.getElementById('%s').style.display = (document.getElementById('%s').style.display == 'none' ? 'block' : 'none'); this.style.display = 'none';", $id, $id));
$snippet .= javascript_tag(sprintf("document.getElementById('%s').style.display = 'none'", $id));
return $snippet;
}
示例12: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
sfContext::getInstance()->getConfiguration()->loadHelpers(array("JavascriptBase"));
if (preg_match('/\\d+-\\d+-\\d+/', $value)) {
$value = strtotime($value);
if ($value !== false) {
$value = date('d/m/Y', $value);
}
}
return javascript_tag($this->getJavascriptCode($this->generateId($name))) . $this->renderTag('input', array_merge(array('type' => $this->getOption('type'), 'name' => $name, 'style' => "width: 10em; text-align: right", 'value' => $value), $attributes)) . $this->renderOwnHelp();
}
示例13: renderMenu
/**
* @author John.meng
*
*/
public function renderMenu($items = null)
{
$response = sfContext::getInstance()->getResponse();
$response->addJavascript('/sfdojo/dojo');
$header_js = "dojo.require(\"dojo.widget.Menu2\");\n dojo.hostenv.writeIncludes();\n";
$js_data = javascript_tag($header_js);
// $menu_data = $items;
$this->renderMainContianer();
$menu_data = $this->renderMainItem() . $this->item_html;
return $js_data . $menu_data;
}
示例14: render
/**
* @see sfWidgetForm
*/
public function render($name, $value = null, $attributes = array(), $errors = array())
{
$server = $this->getServerUrl();
$key = $this->getOption('public_key');
if (array_key_exists('context', $attributes) && $attributes['context'] == 'ajax') {
// Arbitrary flag, unset it
unset($attributes['context']);
return '<div id="captchaWrap"></div>' . javascript_tag("\n Recaptcha.create('" . $key . "', 'captchaWrap', {" . "theme:'" . $this->getOption('theme') . "'," . " lang:'" . $this->getOption('culture') . "'" . "});");
}
parent::render($name, $value, $attributes, $errors);
}
示例15: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
is_null($value) ? $value = 1 : ($value = $value);
$response = sfContext::getInstance()->getResponse();
$response->addStylesheet('/sfExtraWidgetsPlugin/css/rating.css');
$response->addJavascript('/sfExtraWidgetsPlugin/js/livepipe.js');
$response->addJavascript('/sfExtraWidgetsPlugin/js/rating/rating.js');
$ret = tag('input', array('name' => $name, 'id' => $this->generateId($name), 'value' => $value, 'type' => 'hidden'));
$ret .= content_tag('div', '', array('id' => $this->generateId($name) . '_container', 'class' => 'rating_container'));
$ret .= javascript_tag("var rating_eight = new Control.Rating('" . $this->generateId($name) . '_container' . "',{ input: '" . $this->generateId($name) . "', multiple: true, max: " . $this->getOption('max') . " });");
return $ret;
}