예제 #1
0
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/Window.php';
include_once 'PhpExt/Form/FormPanel.php';
include_once 'PhpExt/Form/TextField.php';
include_once 'PhpExt/Form/TextArea.php';
include_once 'PhpExt/Button.php';
include_once 'PhpExt/Layout/FitLayout.php';
include_once 'PhpExt/Layout/AnchorLayoutData.php';
$form = new PhpExt_Form_FormPanel();
// Properties can be set by using the closures...
$form->setBaseCssClass("x-plain")->setLabelWidth(55)->setUrl("save-form.php")->setDefaultType("textfield");
// or in the traditional way.
$textfield1 = new PhpExt_Form_TextField();
$textfield1->setName("to");
$textfield1->setFieldLabel("Send To");
$form->addItem($textfield1, new PhpExt_Layout_AnchorLayoutData("100%"));
// anchor width by percentage
$textfield2 = PhpExt_Form_TextField::createTextField("subject", "Subject");
$form->addItem($textfield2, new PhpExt_Layout_AnchorLayoutData("100%"));
$textarea = PhpExt_Form_TextArea::createTextArea("msg")->setHideLabel(true);
$form->addItem($textarea, new PhpExt_Layout_AnchorLayoutData("100% -53"));
$window = new PhpExt_Window();
$window->setTitle("Resize Me")->setWidth(500)->setHeight(300)->setMinWidth(300)->setMinHeight(200)->setLayout(new PhpExt_Layout_FitLayout())->setPlain(true)->setBodyStyle("padding:5px")->setButtonAlign(PhpExt_Ext::HALIGN_CENTER);
$window->addButton(PhpExt_Button::createTextButton("Send"));
$window->addButton(PhpExt_Button::createTextButton("Cancel"));
$window->addItem($form);
echo PhpExt_Ext::onReady($form->getJavascript(false, "form"), $window->getJavascript(false, "window"), $window->show());
예제 #2
0
 public static function Render($dataModel, $object, $PageSize = 5, $Titulo = '')
 {
     include_once 'PhpExt/Ext.php';
     include_once 'PhpExt/Data/SimpleStore.php';
     include_once 'PhpExt/Data/ArrayReader.php';
     include_once 'PhpExt/Data/JsonReader.php';
     include_once 'PhpExt/Data/ScriptTagProxy.php';
     include_once 'PhpExt/Data/FieldConfigObject.php';
     include_once 'PhpExt/Data/StoreLoadOptions.php';
     include_once 'PhpExt/Data/HttpProxy.php';
     include_once 'PhpExt/Data/JsonStore.php';
     include_once 'PhpExt/Button.php';
     include_once 'PhpExt/Toolbar/PagingToolbar.php';
     include_once 'PhpExt/Grid/ColumnModel.php';
     include_once 'PhpExt/Grid/ColumnConfigObject.php';
     include_once 'PhpExt/Grid/GridPanel.php';
     include_once 'PhpExt/Window.php';
     include_once 'PhpExt/Form/FormPanel.php';
     include_once 'PhpExt/Ext.php';
     include_once 'PhpExt/Data/Store.php';
     include_once 'PhpExt/Data/ArrayReader.php';
     include_once 'PhpExt/Data/FieldConfigObject.php';
     include_once 'PhpExt/Grid/ColumnModel.php';
     include_once 'PhpExt/Grid/ColumnConfigObject.php';
     include_once 'PhpExt/Panel.php';
     include_once 'PhpExt/Grid/GridPanel.php';
     include_once 'PhpExt/Grid/RowSelectionModel.php';
     include_once 'PhpExt/Listener.php';
     include_once 'PhpExt/Config/ConfigObject.php';
     include_once 'PhpExt/Form/FormPanel.php';
     include_once 'PhpExt/Form/FieldSet.php';
     include_once 'PhpExt/Form/TextField.php';
     include_once 'PhpExt/QuickTips.php';
     include_once 'PhpExt/Layout/ColumnLayout.php';
     include_once 'PhpExt/Layout/ColumnLayoutData.php';
     include_once 'PhpExt/Layout/FitLayout.php';
     $reader = new PhpExt_Data_JsonReader();
     $reader->setRoot("topics")->setTotalProperty("totalCount")->setId("ID");
     foreach ($object->properties as $k => $v) {
         $reader->addField(new PhpExt_Data_FieldConfigObject($k));
     }
     $store = new PhpExt_Data_Store();
     $store->setUrl('action_main.php')->setReader($reader)->setBaseParams(array("limit" => $PageSize));
     $colModel = new PhpExt_Grid_ColumnModel();
     foreach ($object->properties as $k => $v) {
         if (strpos($k, "S_") !== 0) {
             $colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn($object->properties_desc[$k], $k, $k, null, null, null, true, true));
         }
     }
     readfile(dirname(__FILE__) . "/local/Tmpl/PhpExt.tmpl");
     $selModel = new PhpExt_Grid_RowSelectionModel();
     $selModel->setSingleSelect(true)->attachListener("rowselect", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "Ext.getCmp(\"idGrid\").getForm().loadRecord(rec);", array("sm", "row", "rec"))));
     // Grid
     $grid = new PhpExt_Grid_GridPanel("idGrid");
     $grid->setStore($store)->setColumnModel($colModel)->setStripeRows(true)->setWidth(500)->setHeight(350)->setTitle("Elementos");
     $grid->setSelectionModel($selModel);
     $paging = new PhpExt_Toolbar_PagingToolbar();
     $paging->setStore($store)->setPageSize($PageSize)->setDisplayInfo("Topics {0} - {1} of {2}")->setEmptyMessage("No topics to display");
     $grid->setBottomToolbar($paging);
     $window = new PhpExt_Window();
     $window->setTitle($Titulo)->setWidth(600)->setHeight(450)->setMinWidth(300)->setMinHeight(200)->setPlain(true)->setBodyStyle("padding:5px")->setButtonAlign(PhpExt_Ext::HALIGN_CENTER);
     $window->addButton(PhpExt_Button::createTextButton("Editar"));
     $window->addButton(PhpExt_Button::createTextButton("Borrar"));
     $window->addItem($grid);
     // Ext.OnReady -----------------------
     echo PhpExt_Ext::onReady(null, null, $store->getJavascript(false, "store"), $store->load(new PhpExt_Data_StoreLoadOptions(array("start" => 0, "limit" => $PageSize))), $grid->getJavascript(false, "grid"), $window->getJavascript(false, "window"), $window->show());
     echo "</script>";
 }
예제 #3
0
파일: index.php 프로젝트: beodob/php-ext
$docRoot = str_replace("\\", "/", realpath($_SERVER['DOCUMENT_ROOT']));
$dir = str_replace("\\", "/", realpath(dirname(__FILE__) . "/.."));
$baseUrl = str_replace($docRoot, $httpHost, $dir);
$extjsCheck = realpath(dirname(__FILE__) . "/../resources/ext-2.0.2/ext-core.js");
if ($extjsCheck !== false) {
    set_include_path(get_include_path() . PATH_SEPARATOR . realpath("../library"));
    include_once 'PhpExt/Ext.php';
    include_once 'PhpExt/Window.php';
    include_once 'PhpExt/AutoLoadConfigObject.php';
    include_once 'PhpExt/Layout/FitLayout.php';
    include_once 'PhpExt/TabPanel.php';
    include_once 'PhpExt/Panel.php';
    $example_id = @$_GET['eid'];
    $file = $example_id . ".php";
    $win = new PhpExt_Window();
    $win->setTitle("Sample Source: " . $file)->setWidth(500)->setHeight(500)->setLayout(new PhpExt_Layout_FitLayout())->setResizable(false)->setCloseAction(PhpExt_Window::CLOSE_ACTION_HIDE)->setBodyBorder(false)->setPlain(true);
    // PHP Source
    $phpTab = new PhpExt_Panel();
    $phpTab->setTitle("PHP Source")->setLayout(new PhpExt_Layout_FitLayout())->setAutoLoad(new PhpExt_AutoLoadConfigObject($baseUrl . "/examples/viewsource.php", array("file" => $file)))->getAutoLoad()->setScripts(true)->setMethod(PhpExt_AutoLoadConfigObject::AUTO_LOAD_METHOD_GET);
    // Generated JS
    $jsTab = new PhpExt_Panel();
    $jsTab->setTitle("Generated JS")->setLayout(new PhpExt_Layout_FitLayout())->setAutoLoad(new PhpExt_AutoLoadConfigObject($baseUrl . "/examples/viewjs.php", array("file" => $file)))->getAutoLoad()->setScripts(true)->setMethod(PhpExt_AutoLoadConfigObject::AUTO_LOAD_METHOD_GET);
    $tabs = new PhpExt_TabPanel();
    $tabs->setActiveTab(0)->setPlain(true)->setFrame(false)->addItem($phpTab)->addItem($jsTab);
    $win->addItem($tabs);
    $customHeaders = '
	    <link rel="stylesheet" type="text/css" href="resources/ext-2.0.2/resources/css/ext-all.css" />
	
	    <!-- GC -->
	 	<!-- LIBS -->
	 	<script type="text/javascript" src="resources/ext-2.0.2/adapter/ext/ext-base.js"></script>