本文整理汇总了PHP中javascript::codeBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP javascript::codeBlock方法的具体用法?PHP javascript::codeBlock怎么用?PHP javascript::codeBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javascript
的用法示例。
在下文中一共展示了javascript::codeBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qtipAjaxReturn
public function qtipAjaxReturn($data)
{
if (!empty($data->user_id)) {
$fullName = $data->first_name . ' ' . $data->last_name;
javascript::codeBlock('$(\'.users_dropdown\').append(\'<option value="' . $data->user_id . '" selected="selected">' . $fullName . '</option>\');');
}
parent::qtipAjaxReturn($data);
}
示例2: updateOnPageObjects
public static function updateOnPageObjects()
{
$update = Event::$data;
if (empty($update['numbermanager'])) {
return;
}
$update = $update['numbermanager'];
$objectTemplate = new View('numbermanager/targetObject.mus', $update);
$objectTemplate->mustache_escape_apostrophes = TRUE;
javascript::codeBlock("\$('.number_target_objects.{$update['short_name']}').append('{$objectTemplate}');");
javascript::codeBlock("selectDestination('{$update['object_number_type']}', {$update['object_id']});");
}
示例3: qtipAjaxReturn
public function qtipAjaxReturn($data)
{
if (!empty($data) and $data instanceof Number) {
$number = $data->toArray();
if (!empty($_REQUEST['create_class_type'])) {
$number['class_type'] = $_REQUEST['create_class_type'];
}
$template = new View('numbermanager/avaliableNumber.mus', $number);
$newObject = str_replace(array("\n", ' '), '', (string) $template);
javascript::codeBlock('$(\'#number_inventory .avaliable_numbers\').append(\'' . $newObject . '\');');
javascript::codeBlock('$(\'#avaliable_number_' . $data['number_id'] . '\').trigger(\'click\');');
javascript::codeBlock('$(\'#number_inventory\').tabs("option", "selected", 0); ');
}
parent::qtipAjaxReturn($data);
}
示例4: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
javascript::codeBlock(NULL, array('scriptname' => 'updateAgentsQueues'));
?>
$.ajaxSetup( {cache : false});
<?php
javascript::blockEnd();
?>
<script language="javascript">
function updateAgentsQueues(locid) {
$.get('<?php
echo url::base();
?>
index.php/callcenter_tiers/updateagentdropdownbylocation/'+locid, function(data) {$('#callcenter_tier_cct_cca_id').html(data);});
$.get('<?php
echo url::base();
?>
index.php/callcenter_tiers/updatequeuedropdownbylocation/'+locid, function(data) {$('#callcenter_tier_cct_ccq_id').html(data);});
}
</script>
<div id="callcenter_update_header" class="txt-center update callcenter module_header">
<h2><?php
echo $mode == 'create' ? 'Create' : 'Edit';
?>
Tier</h2>
</div>
<div id="callcenter_update_form" class="update callcenter">
<?php
示例5: array
</ul>
</div>
</div>
</div>
<?php echo form::close_section(); ?>
<?php jquery::addPlugin(array('tabs', 'scrollTo')); ?>
<?php javascript::add('mustache'); ?>
<?php javascript::codeBlock(NULL, array('scriptname' => 'listNumbers')); ?>
var avaliableNumberTemplate = <?php echo $avaliableNumberTemplate; ?>;
var assignedNumberTemplate = <?php echo $assignedNumberTemplate; ?>;
function unassignNumberClickHandler(ev) {
ev.preventDefault();
panelId = '#' + $(this).parents('.assign_number_tab').attr('id');
number = {
number_id: $(panelId).find('.number_id_datastore').val(),
number: $(panelId).find('.number_datastore').val(),
class_type: $(panelId).find('.number_class_datastore').val()
示例6: qtipAjaxReturn
public function qtipAjaxReturn($data)
{
if ($data instanceof MediaFile) {
$hide_rate = kohana::config('mediafile.hide_rate_folders');
$id = $data->filepath(TRUE, !$hide_rate);
$catalog = MediaFile::catalog();
$value = $catalog[$id];
jquery::addPlugin('growl');
Session::instance()->get_once('bluebox_message', array());
javascript::codeBlock('
$(\'#media_widget_file_list\')
.prepend($("<option></option>")
.attr("selected", "selected")
.attr("value", "' . $id . '")
.text("' . $value . '"))
.trigger("change");
');
}
parent::qtipAjaxReturn($data);
}
示例7: qtipAjaxReturn
public function qtipAjaxReturn($data)
{
javascript::codeBlock('$(\'.jqgrid_instance\').trigger("reloadGrid");');
}
示例8: array
echo subview::renderAsSections($views);
}
?>
<?php
echo form::close(TRUE);
?>
</div>
<?php
jquery::addPlugin(array('dependent', 'spinner'));
?>
<?php
javascript::codeBlock(NULL, array('scriptname' => 'update_autoattendant'));
?>
$('.type').bind('change', function () {
$('.prompt').hide();
var type = $('#autoattendant_registry_type').val();
if (type != '') {
$('#' + type + '_prompt').slideDown();
}
}).trigger('change');
示例9: if
</div>
<?php echo form::close_section(); ?>
<?php
if (isset($views))
{
echo subview::renderAsSections($views);
}
?>
<?php echo form::close(TRUE); ?>
</div>
<?php javascript::codeBlock(); ?>
$('#externalxfer_route_type').change(function() {
if ($('#externalxfer_route_type').val() == 1)
{
$('#via_uri').hide();
$('#via_xmpp').hide();
$('#via_trunk').fadeIn();
}
else if($('#externalxfer_route_type').val() == 2)
{
$('#via_trunk').hide();
$('#via_xmpp').hide();
$('#via_uri').fadeIn();
示例10:
<span><?php
echo $mediafile['type'] . ' (' . $mediafile['bits'] . ' bit)';
?>
</span>
</div>
<div class="field">
<label class="label">Channels: </label>
<span><?php
echo $mediafile['channels'];
?>
</span>
</div>
</div>
<?php
}
?>
</div>
<?php
echo form::close_section();
?>
<?php
if (count($mediafiles) > 1) {
jquery::addPlugin('tabs');
javascript::codeBlock('$("#media_files_tabs").tabs();');
}
示例11:
if (users::getAttr('user_type') == User::TYPE_SYSTEM_ADMIN) {
?>
<?php
jquery::addPlugin('spinner');
?>
<?php
echo form::open_section('Debug');
?>
<div class="field">
<?php
echo form::label('user[debug_level]', 'UI Level:');
echo form::input('user[debug_level]');
javascript::codeBlock('$("#user_debug_level").spinner({max: 4, min: 0});');
?>
</div>
<?php
echo form::close_section();
?>
<?php
}
?>
<?php
echo form::close(TRUE);
?>
</div>
示例12: nextAvaliableLink
public static function nextAvaliableLink($bindTo, $title = NULL, $attributes = array(), $javascript = TRUE)
{
if (empty($bindTo)) {
return FALSE;
}
// standardize the $data as an array, strings default to the class_type
if (!is_array($attributes)) {
$attributes = array('id' => $attributes);
}
// add in all the defaults if they are not provided
$attributes += array('id' => 'next' . $bindTo . 'Link', 'translate' => TRUE, 'jgrowl' => TRUE);
// ensure we have our distint class
$attributes = arr::update($attributes, 'class', ' nxt_aval_link');
// if there is no title then use the default
if (empty($title)) {
$title = 'Next Avaliable Number';
}
// unless instructed otherwise translate this title
if ($attributes['translate']) {
$title = __($title);
}
// if the user is not going to roll their own js do it for them
if ($javascript) {
// if the user wants to use jgrowl make sure it will be avaliable
if ($attributes['jgrowl']) {
jquery::addPlugin('growl');
}
// generate a js script to select the next avaliable number
$script = ' $("#' . $attributes['id'] . '").bind("click", function(e) {
e.preventDefault();
numberDrop = $("#' . $bindTo . '");
selected = [];
$(numberDrop).find("option:selected").each( function() {
selected[selected.length] = $(this).text();
});
success = false;
$(numberDrop).find("option").each(function () {
text = $(this).text();
if (jQuery.inArray(text, selected) == -1) {
$(this).attr("selected", "selected");
$(numberDrop).trigger("change");
';
// if the user wants to use jgrowl add it to our js script
if ($attributes['jgrowl']) {
$script .= '$.jGrowl("' . __('Assigned number') . ' " + text, { theme: "success", life: 5000 });
';
}
$script .= 'success = true;
return false;
}
});
';
// if the user wants to use jgrowl add it to our js script
if ($attributes['jgrowl']) {
$script .= 'if (!success) $.jGrowl("' . __('Unable to find an avaliable number!') . '", { theme: "error", life: 5000 });';
}
$script .= "\n" . ' });' . "\n";
// put our script in the render stream
javascript::codeBlock($script);
}
// dont inlcude the tranlaste in the html attributes
unset($attributes['translate'], $attributes['jgrowl']);
// Parsed URL
return '<a href="#" ' . html::attributes($attributes) . '><span>' . $title . '</span></a>';
}
示例13: dualListBox
//.........这里部分代码省略.........
}
}
if (isset($data['translate'])) {
unset($data['translate']);
}
if (is_array($selected)) {
// Multi-select box
$data['multiple'] = 'multiple';
} else {
// Single selection (but converted to an array)
$selected = array($selected);
}
$box2id = $box1id = trim(preg_replace('/[^a-zA-Z0-9_{}]+/imx', '_', $data['name']), '_');
jquery::addPlugin('dualListBox');
$input = '<div id="dlbmainwrapper" class="dlbwrapper">';
$configjs = '$.configureBoxes({';
$unselectedlist = '<div id="dlbunwrapper" class="dlbwrapper">';
$selectedlist = '<div id="dlbselwrapper" class="dlbwrapper">';
if ($data['useFilters']) {
if ($data['filterUnselected']) {
$unselectedlist .= '<div id="' . $box1id . '_box1FilterWrapper" class="searchwrapper wrapper">Filter:<input type="text" id="' . $box1id . '_box1Filter" class="filterInput input"/><button type="button" class="actionbutton bluebutton" id="' . $box1id . '_box1Clear">X</button><select id="' . $box1id . '_box1Storage"></select></div>';
$configjs .= 'box1Storage: \'' . $box1id . '_box1Storage\', box1Filter: \'' . $box1id . '_box1Filter\', box1Clear: \'' . $box1id . '_box1Clear\', ';
}
if ($data['filterSelected']) {
$selectedlist .= '<div id="' . $box2id . '_box2FilterWrapper" class="searchwrapper wrapper">Filter:<input type="text" id="' . $box2id . '_box2Filter" class="filterInput input"/><button type="button" class="actionbutton bluebutton" id="' . $box2id . '_box2Clear">X</button><select id="' . $box2id . '_box2Storage"></select></div>';
$configjs .= 'box2Storage: \'' . $box2id . '_box2Storage\', box2Filter: \'' . $box2id . '_box2Filter\', box2Clear: \'' . $box2id . '_box2Clear\', ';
}
$configjs .= 'useFilters: true, ';
} else {
$configjs .= 'useFilters: false, ';
}
$unselectedlist .= '<div id="' . $box1id . '_box1ListboxWrapper" class="listboxwrapper wrapper"><select id="' . $box1id . '_box1View" name="' . $data['name'] . '_unsel[]" class="unsellistbox duallistbox" multiple="multiple" ' . $data['extra'];
$selectedlist .= '<div id="' . $box2id . '_box2ListboxWrapper" class="listboxwrapper wrapper"><select id="' . $box2id . '_box2View" name="' . $data['name'] . '[]" class="sellistbox duallistbox" multiple="multiple" ' . $data['extra'];
$configjs .= 'box1View: \'' . $box1id . '_box1View\', box2View: \'' . $box2id . '_box2View\', ';
if (isset($data['height'])) {
$unselectedlist .= ' height="' . $data['height'] . '"';
$selectedlist .= ' height="' . $data['height'] . '"';
}
if (isset($data['width'])) {
$unselectedlist .= ' width="' . $data['width'] . '"';
$selectedlist .= ' width="' . $data['width'] . '"';
}
if (isset($data['size'])) {
$unselectedlist .= ' size="' . $data['size'] . '"';
$selectedlist .= ' size="' . $data['size'] . '"';
}
$unselectedlist .= '>';
$selectedlist .= '>';
foreach ($options as $key => $value) {
if (in_array($key, $selected)) {
$selectedlist .= '<option value="' . $key . '">' . $value . '</option>';
} else {
$unselectedlist .= '<option value="' . $key . '">' . $value . '</option>';
}
}
$unselectedlist .= '</select></div>';
$selectedlist .= '</select></div>';
if ($data['useCounters'] = true) {
$unselectedlist .= '<div class="counterwrapper" id="' . $box1id . '_box1CounterWrapper"><span id="' . $box1id . '_box1Counter" class="countLabel"></span></div>';
$selectedlist .= '<div class="counterwrapper" id="' . $box2id . '_box2CounterWrapper"><span id="' . $box2id . '_box2Counter" class="countLabel"></span></div>';
$configjs .= 'useCounters: true, box1Counter: \'' . $box1id . '_box1Counter\', box2Counter: \'' . $box2id . '_box2Counter\', ';
} else {
$configjs .= 'useCounters: false, ';
}
$unselectedlist .= '</div>';
$selectedlist .= '</div>';
$actbuttons = '<div id="dlbactbutwrapper" class="dlbwrapper">';
$actbuttons .= '<button id="' . $box2id . '_toright" type="button"> > </button><br>';
$actbuttons .= '<button id="' . $box2id . '_alltoright" type="button">>></button><br>';
$actbuttons .= '<button id="' . $box1id . '_alltoleft" type="button"><<</button><br>';
$actbuttons .= '<button id="' . $box1id . '_toleft" type="button"> < </button>';
$actbuttons .= '</div>';
if ($data['layout'] == 'lefttoright') {
$input .= $unselectedlist . $actbuttons . $selectedlist;
$configjs .= 'to1: \'' . $box1id . '_toleft\', ';
$configjs .= 'to2: \'' . $box2id . '_toright\', ';
$configjs .= 'allTo1: \'' . $box1id . '_alltoleft\', ';
$configjs .= 'allTo2: \'' . $box2id . '_alltoright\', ';
} else {
$input .= $unselectedlist . $actbuttons . $selectedlist;
$configjs .= 'to2: \'' . $box1id . '_toleft\', ';
$configjs .= 'to1: \'' . $box2id . '_toright\', ';
$configjs .= 'allTo2: \'' . $box1id . '_alltoleft\', ';
$configjs .= 'allTo1: \'' . $box2id . '_alltoright\', ';
}
$configjs .= 'transferMode: \'' . $data['transferMode'] . '\', ';
$configjs .= 'sortBy: \'' . $data['sortBy'] . '\', ';
if ($data['useSorting']) {
$configjs .= 'useSorting: true, ';
} else {
$configjs .= 'useSorting: false, ';
}
if ($data['selectOnSubmit']) {
$configjs .= 'selectOnSubmit: true });';
} else {
$configjs .= 'selectOnSubmit: false });';
}
$input .= "\n" . javascript::codeBlock($configjs, array('inline' => true));
return $input;
}
示例14: count
?>
<?php
if (isset($views)) {
echo subview::renderAsSections($views);
}
?>
<?php
echo form::close(TRUE);
?>
</div>
<?php
javascript::codeBlock();
?>
var patternCount = <?php
echo count($simpleroute['patterns']);
?>
$('#new_simple_route_pattern').click(function (ev){
ev.preventDefault();
patternCount += 1;
var data = {
displayCount: $('.remove_pattern').length + 1,
patternCount: patternCount
示例15: buildResponse
/**
* This function is used to populate the JSON response to
* jquery.php.js
*
* @return void|string
* @param bool $inline[optional] If false the json wrapped in a script tag is returned, otherwise it is echo'ed
*/
public static function buildResponse($inline = true)
{
$script = '';
if (!empty(jquery::$jquery)) {
$script = javascript::codeBlock(' php.success(' . jquery::getResponse() . ', true);', array('inline' => $inline));
}
if ($inline) {
echo $script;
} else {
return $script;
}
}