本文整理汇总了PHP中Ajax::wrapJSasFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP Ajax::wrapJSasFunction方法的具体用法?PHP Ajax::wrapJSasFunction怎么用?PHP Ajax::wrapJSasFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ajax
的用法示例。
在下文中一共展示了Ajax::wrapJSasFunction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayNavigation
/**
* Display navigation
*/
protected function displayNavigation()
{
$Code = '<div id="ajax-navigation" class="panel">';
$Code .= '<div class="panel-heading">';
$Code .= '<h1>' . __('Multi editor') . '</h1>';
$Code .= '</div>';
$Code .= '<div class="panel-content">';
$Code .= '<table class="multi-edit-table fullwidth zebra-style"><tbody>';
foreach (self::$IDs as $i => $ID) {
$Preview = new Preview(new Activity\Object($this->fetchActivity($ID)));
$Code .= '<tr id="multi-edit-' . $ID . '" class="link ' . ($i == 0 ? ' highlight' : '') . ' show-on-hover-parent">';
$Code .= '<td class="multi-edit-sport-icon c"><span class="link show-on-hover multi-edit-remove-link">' . Icon::$CROSS_SMALL . '</span>' . $Preview->sportIcon() . '</td>';
$Code .= '<td>' . $Preview->dateAndSmallTime() . '<br><small>' . $Preview->durationAndDistance() . '</small></td>';
$Code .= '<td class="multi-edit-icon">' . $Preview->hrIcon() . '</td>';
$Code .= '<td class="multi-edit-icon">' . $Preview->splitsIcon() . '</td>';
$Code .= '<td class="multi-edit-icon">' . $Preview->mapIcon() . '</td>';
$Code .= '</tr>';
}
$Code .= '</tbody></table>';
$Code .= '</div>';
$Code .= '</div>';
echo Ajax::wrapJS('$(\'#ajax-navigation\').remove();$(\'#ajax-outer\').append(\'' . $Code . '\')');
echo Ajax::wrapJSasFunction('$("#ajax-navigation tr.link").click(function(e){
$("#ajax-navigation tr.link.highlight").removeClass("highlight").addClass("edited");
$(this).removeClass("edited").addClass("highlight");
Runalyze.Overlay.load( "' . Linker::EDITOR_URL . '?mode=multi&id=" + $(this).attr("id").substr(11) );
});');
echo Ajax::wrapJSasFunction('$("#ajax-navigation .multi-edit-remove-link").click(function(e){
$(this).parent().parent().remove();
e.stopPropagation();
});');
}
示例2: displayFormular
/**
* Display formular
*/
protected function displayFormular()
{
$this->Formular->display();
echo Ajax::wrapJSasFunction('$(\'#prognosis-calculator .hide-on-model-change:not(.only-' . $_POST['model'] . ')\').closest(\'div\').hide();');
}
示例3: displayImportUploader
/**
* Display uploader
*/
protected function displayImportUploader()
{
$JScode = '
new qq.FineUploaderBasic({
button: $("#file-upload")[0],
request: {
endpoint: \'' . $_SERVER['SCRIPT_NAME'] . '?hideHtmlHeader=true&id=' . $this->id() . '&json=true\'
},
callbacks: {
onError: function(id, name, errorReason, xhr) {
$("#upload-container").append(\'<p class="error appended-by-uploader">\'+errorReason+\'</p>\').removeClass("loading");
},
onSubmit: function(id, fileName) {
$("#upload-container").addClass("loading");
},
onComplete: function(id, fileName, responseJSON) {
$(".appended-by-uploader").remove();
$("#pluginTool").loadDiv(\'' . $_SERVER['SCRIPT_NAME'] . '?id=' . $this->id() . '&file=\'+encodeURIComponent(fileName));
if (!responseJSON.success) {
if (responseJSON.error == "")
responseJSON.error = \'An unknown error occured.\';
$("#pluginTool").append(\'<p class="error appended-by-uploader">\'+fileName+\': \'+responseJSON.error+\'</p>\');
$("#upload-container").removeClass("loading");
}
}
}
});';
$Text = '<div id="upload-container" style="margin-bottom:5px;"><div class="c button" id="file-upload">' . __('Upload file') . '</div></div>';
$Text .= Ajax::wrapJSasFunction($JScode);
$Text .= HTML::info(__('Allowed file extension: *.json.gz'));
$Text .= HTML::warning(__('All shared links will be invalid if you (re-)import activities and overwrite all existing activities!'));
$Text .= HTML::warning(__('The file has to be created with the same version of Runalyze!<br>' . 'You won\'t be able to import a file from an older version.'));
$Text .= HTML::warning(__('The importer will not change existing data for equipment, sport types or activity types.<br>' . 'You have to make these changes by hand or delete the existing data in advance.'));
$Fieldset = new FormularFieldset(__('Import data'));
$Fieldset->setCollapsed();
$Fieldset->addBlock($Text);
$Formular = new Formular();
$Formular->setId('backup-import');
$Formular->addFieldset($Fieldset);
$Formular->display();
}
示例4: getJS
/**
* @return string
*/
protected function getJS()
{
return Ajax::wrapJSasFunction('$("input.delete-checkbox").change(function(){$(this).parent().parent().toggleClass("ERROR unimportant")});');
}
示例5: _e
echo Icon::$REFRESH;
?>
</span>
</small>
<?php
if (!$this->visible) {
?>
<div id="iframe-spacer" style="width:490px;height:310px;">
<em><?php
_e('Move your mouse here to start loading the communicator.');
?>
</em>
</div>
<?php
echo Ajax::wrapJSasFunction('$("#iframe-spacer").hover(function(){
$(\'<iframe src="call/call.garminCommunicator.php" id="GCapi" name="GCapi" width="490px" height="310px"></iframe>\').insertAfter($("#iframe-spacer"));
$("#iframe-spacer").remove();
});');
} else {
?>
<iframe src="call/call.garminCommunicator.php" id="GCapi" name="GCapi" width="490px" height="310px"></iframe>
<?php
}
?>
</div>
<p class="info"><?php
printf(__('Due to security reasons browser manufacturers will drop support for plugins like the Garmin Communicator. A <a href="%s">reinstall</a> may work, but we have documented an alternative way to import the original files at %s. '), 'http://help.runalyze.com/en/latest/knowledge-base.html#get-the-garmin-communicator-running-in-firefox-version-43', '<a href="http://help.runalyze.com/en/latest/starting-guide/import.html#garmin">help.runalyze.com</a>');
?>
</p>