本文整理汇总了PHP中JavaScriptHelper::object方法的典型用法代码示例。如果您正苦于以下问题:PHP JavaScriptHelper::object方法的具体用法?PHP JavaScriptHelper::object怎么用?PHP JavaScriptHelper::object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JavaScriptHelper
的用法示例。
在下文中一共展示了JavaScriptHelper::object方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editor
/**
* Makes an Ajax In Place editor control.
*
* @param string $id DOM ID of input element
* @param string $url Postback URL of saved data
* @param array $options Array of options to control the editor, including ajaxOptions (see link).
* @link http://github.com/madrobby/scriptaculous/wikis/ajax-inplaceeditor
* @link http://book.cakephp.org/1.3/en/The-Manual/Core-Helpers/AJAX.html#editor
*/
function editor($id, $url, $options = array())
{
$url = $this->url($url);
$options['ajaxOptions'] = $this->__optionsForAjax($options);
foreach ($this->ajaxOptions as $opt) {
if (isset($options[$opt])) {
unset($options[$opt]);
}
}
if (isset($options['callback'])) {
$options['callback'] = 'function(form, value) {' . $options['callback'] . '}';
}
$type = 'InPlaceEditor';
if (isset($options['collection']) && is_array($options['collection'])) {
$options['collection'] = $this->Javascript->object($options['collection']);
$type = 'InPlaceCollectionEditor';
}
$var = '';
if (isset($options['var'])) {
$var = 'var ' . $options['var'] . ' = ';
unset($options['var']);
}
$options = $this->_optionsToString($options, array('okText', 'cancelText', 'savingText', 'formId', 'externalControl', 'highlightcolor', 'highlightendcolor', 'savingClassName', 'formClassName', 'loadTextURL', 'loadingText', 'clickToEditText', 'okControl', 'cancelControl'));
$options = $this->_buildOptions($options, $this->editorOptions);
$script = "{$var}new Ajax.{$type}('{$id}', '{$url}', {$options});";
return $this->Javascript->codeBlock($script);
}
示例2: sortable
/**
* Makes a list or group of floated objects sortable.
*
* @param string $id DOM ID of parent
* @param array $options Array of options to control sort.
* @link http://docs.jquery.com/UI/Sortable
*/
function sortable($id, $options = array()) {
if (isset($options['var'])) {
$var = 'var ' . $options['var'] . ' = ';
unset($options['var']);
} else {
$var = 'var ' . $id . ' = ';
}
if (!empty($options['url'])) {
if (empty($options['with'])) {
$options['with'] = "$('#$id').sortable('serialize')";
}
$upd = '';
if (isset($options['update'])){
$upd = $options['update'];
unset($options['update']);
}
$options['update'] = $this->remoteFunction($options) . '; ' . $upd;
}
$block = true;
if (isset($options['block'])) {
$block = $options['block'];
unset($options['block']);
}
$strings = array(
'appendTo', 'axis', 'cancel', 'connectWith', 'containment', 'cursor', 'cursorAt',
'handle', 'helper', 'items', 'placeholder', 'tolerance',
);
if (isset($options['grid']) && is_array($options['grid'])) {
$options['grid'] = $this->Javascript->object($options['grid']);
}
$callbacks = array('start', 'sort', 'change', 'beforeStop', 'stop', 'update',
'receive', 'remove', 'over', 'out', 'activate', 'deactivate');
$options = $this->_optionsToString($options, $strings);
$options = array_merge($options, $this->_buildUICallbacks($options, $callbacks));
$options = $this->_buildOptions($options, $this->sortOptions);
$result = "{$var} $('#$id').sortable($options);";
if (!$block) {
return $result;
}
return $this->Javascript->codeBlock($result);
}