コード例 #1
0
ファイル: TreeEditor.php プロジェクト: pablius/oob-n1
 public function getJavascript($lazy = false, $varName = null)
 {
     if ($this->_varName == null) {
         $configParams = $this->getConfigParams($lazy);
         $className = $this->_extClassName;
         $configObj = "{" . implode(",", $configParams) . "}";
         $tree = $this->_tree->getJavascript(false);
         if ($this->_field !== null) {
             $field = "," . $this->_field->getJavascript(false);
         } else {
             $field = "";
         }
         if ($lazy) {
             return $configObj;
         } else {
             $js = "new {$className}({$tree} {$field}, {$configObj})";
             if ($varName != null) {
                 $this->_varName = $varName;
                 $js = "var {$varName} = {$js};";
             }
             return $js;
         }
     } else {
         return $this->_varName;
     }
 }
コード例 #2
0
ファイル: reorder.php プロジェクト: beodob/php-ext
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . realpath('../../library'));
include_once 'PhpExt/Javascript.php';
PhpExt_Javascript::sendContentType();
include_once 'PhpExt/Ext.php';
include_once 'PhpExt/Tree/TreePanel.php';
include_once 'PhpExt/Tree/TreeLoader.php';
include_once 'PhpExt/Tree/AsyncTreeNode.php';
$loader = new PhpExt_Tree_TreeLoader();
$loader->setDataUrl("examples/tree/get-nodes.php");
$tree = new PhpExt_Tree_TreePanel();
$tree->setUseArrows(true)->setAnimate(true)->setEnableDd(true)->setContainerScroll(true)->setLoader($loader)->setAutoScroll(true);
$root = new PhpExt_Tree_AsyncTreeNode();
$root->setText("PHP-Ext Examples")->setDraggable(false)->setId("examples");
echo PhpExt_Ext::OnReady($tree->getJavascript(false, "tree"), $root->getJavascript(false, "root"), $tree->setRootNode($root), $tree->render("tree-div"), $root->expand());