当前位置: 首页>>代码示例>>PHP>>正文


PHP JavaScriptHelper::object方法代码示例

本文整理汇总了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);
 }
开发者ID:geethuann,项目名称:assignment3,代码行数:36,代码来源:ajax.php

示例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);
	}
开发者ID:robksawyer,项目名称:FIND---GET---MAKE,代码行数:53,代码来源:ajax.php


注:本文中的JavaScriptHelper::object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。