Ejemplo n.º 1
0
$if_leaf_html = PhpExt_Javascript::functionNoDef("if", $add_tab_invoke_html, array("n.leaf"));
$add_tab_onclick = PhpExt_Javascript::functionDef(null, $if_leaf, array("n"));
$add_tab_oncontextmenu = PhpExt_Javascript::functionDef(null, $if_leaf_html, array("n"));
$output_add_tab_onclick = $get_tree_panel->on("click", $add_tab_onclick);
$output_add_tab_oncontextmenu = $get_tree_panel->on("contextmenu", $add_tab_oncontextmenu);
$output_add_tab_function = new PhpExt_JavascriptStm($add_tab_function);
//-----------------------------------------------------------BARRA DE ESTADO--------------------------------------------------------------------------------------------
$function_win_open = PhpExt_Javascript::callfunction("window.open", array("'http://www.nutus.com.ar'"));
$handler_abrir_pagina = PhpExt_Javascript::functionDef("", $function_win_open, array("e"));
$function_win_open2 = PhpExt_Javascript::callfunction("window.open", array("'http://soporte.nutus.info'"));
$handler_abrir_pagina2 = PhpExt_Javascript::functionDef("", $function_win_open2, array("e"));
$barra_estado = new PhpExt_Toolbar_StatusBar();
$barra_estado->setId("status_bar");
$barra_estado->setDefaultText("Terminado");
$barra_estado->addButton("ayuda", "Ayuda on-line", null, $handler_abrir_pagina2);
$barra_estado->addButton("Pagina", "© Nutus 2009", null, $handler_abrir_pagina);
$status_bar = new PhpExt_Panel();
$status_bar->setBottomToolbar($barra_estado);
//USO UN VIEWPORT YA QUE SE ADAPTA AL ANCHO DE LA PAGINA
//creo uno nuevo y le agrego todos los items setando el area
$contenedor = new PhpExt_Viewport();
$contenedor->setLayout(new PhpExt_Layout_BorderLayout());
$contenedor->addItem($menu_top, PhpExt_Layout_BorderLayoutData::createNorthRegion());
$contenedor->addItem($menu_acordion, PhpExt_Layout_BorderLayoutData::createWestRegion());
$contenedor->addItem($principal, PhpExt_Layout_BorderLayoutData::createCenterRegion());
$contenedor->addItem($status_bar, PhpExt_Layout_BorderLayoutData::createSouthRegion());
//FUNCTIONS DE USO GENERAL
$format_money = "\t\nfunction FormatMoney(v,sign){\t\t\t\t\n    v = (Math.round((v-0)*100))/100;\n    v = (v == Math.floor(v)) ? v + '.00' : ((v*10 == Math.floor(v*10)) ? v + '0' : v);\n    v = String(v);        \n        if(v.charAt(0) == '-'){\n            return '-' + sign + v.substr(1).replace('.',',');\n        }\n    return sign +  v.replace('.',',');\n}\n";
$unformat_money = "\nfunction unformatMoney(num) {\n\tvar value = num.replace(',','.');\t\t\n\treturn value.replace(/([^0-9\\.\\-])/g,'')*1;\t\n}\n";
echo PhpExt_Ext::OnReady(PhpExt_QuickTips::init(), $contenedor->getJavascript(false, "Contenedor"), $contenedor->render(PhpExt_Javascript::inlineStm("document.body")), $output_add_tab_function->output(), $output_add_tab_onclick, $output_add_tab_oncontextmenu, $unformat_money, $format_money);
Ejemplo n.º 2
0
<?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/Panel.php';
$p = new PhpExt_Panel();
$p->setTitle("My Panel")->setCollapsible(true)->setRenderTo(PhpExt_Javascript::variable("Ext.get('centercolumn')"))->setWidth(400)->setHtml(PhpExt_Javascript::variable("Ext.example.bogusMarkup"));
echo PhpExt_Ext::OnReady($p->getJavascript(false, "p"));
Ejemplo n.º 3
0
$viewport->addItem($east, PhpExt_Layout_BorderLayoutData::createEastRegion()->setSplit(true)->setMinSize(175)->setMaxSize(400)->setMargins("0 5 0 0"));
// West Region
$west = new PhpExt_Panel();
$west->setTitle("West")->setCollapsible(true)->setWidth(200)->setId("west-panel");
$accordion = new PhpExt_Layout_AccordionLayout();
$accordion->setAnimate(true);
$west->setLayout($accordion);
// panel 1
$p1 = new PhpExt_Panel();
$p1->setContentElement("west")->setTitle("Navigation")->setBorder(false)->setIconCssClass("nav");
$west->addItem($p1);
// panel 2
$p2 = new PhpExt_Panel();
$p2->setHtml('<p>Some settings in here.</p>')->setTitle("Settings")->setBorder(false)->setIconCssClass("settings");
$west->addItem($p2);
$viewport->addItem($west, PhpExt_Layout_BorderLayoutData::createWestRegion()->setSplit(true)->setMinSize(175)->setMaxSize(400)->setMargins("0 0 0 5"));
// Center Region
$center = new PhpExt_TabPanel();
$center->setActiveTab(0);
$tabLayout = new PhpExt_Layout_TabLayout();
$tabLayout->setDeferredRender(true);
$center->setLayout($tabLayout);
$c1 = new PhpExt_Panel();
$c1->setContentElement("center1")->setTitle("Close Me")->setAutoScroll(true);
$center->addItem($c1, new PhpExt_Layout_TabLayoutData(true));
$c2 = new PhpExt_Panel();
$c2->setContentElement("center2")->setTitle("Center Panel")->setAutoScroll(true);
$center->addItem($c2);
$viewport->addItem($center, PhpExt_Layout_BorderLayoutData::createCenterRegion());
echo PhpExt_Ext::OnReady($viewport->getJavascript(false, "v"), $viewport->render("viewport"));
Ejemplo n.º 4
0
include_once 'PhpExt/MessageBox.php';
include_once 'PhpExt/MessageBoxOptions.php';
include_once 'PhpExt/ProgressBarWaitConfig.php';
$mb1Element = PhpExt_Element::getById('mb1');
$mb1Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::confirm("Confirm", "Are you sure you want to do that", PhpExt_Javascript::variable('showResult')), array("e"));
$mb2Element = PhpExt_Element::getById('mb2');
$mb2Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::prompt("Name", "Please enter your name:", PhpExt_Javascript::variable('showResultText')), array("e"));
$mb3Element = PhpExt_Element::getById('mb3');
$mb3Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Address')->setMsg('Please enter your address:')->setWidth(300)->setButtons(PhpExt_MessageBox::OKCANCEL())->setMultiline(true)->setFn(PhpExt_Javascript::variable('showResultText'))->setAnimEl('mb3');
$mb3Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb3Options));
$mb4Element = PhpExt_Element::getById('mb4');
$mb4Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Save Changes?')->setMsg('You are closing a tab that has unsaved changes. <br />Would you like to save your changes?')->setButtons(PhpExt_MessageBox::YESNOCANCEL())->setFn(PhpExt_Javascript::variable('showResult'))->setAnimEl('mb4')->setIcon(PhpExt_MessageBox::QUESTION());
$mb4Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb4Options));
$mb6Element = PhpExt_Element::getById('mb6');
$mb6Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Please wait')->setMsg('Loading items...')->setProgressText('Initializing...')->setWidth(300)->setProgress(true)->setClosable(false)->setAnimEl('mb6');
$mb6Hide = PhpExt_MessageBox::hide()->output();
$mb6Progress = PhpExt_MessageBox::updateProgress(PhpExt_Javascript::variable("i"), PhpExt_Javascript::inlineStm("Math.round(100*i)+'% completed'"))->output();
$mb6Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb6Options)->output() . "\r\n\t\t// this hideous block creates the bogus progress\r\n       var f = function(v){\r\n            return function(){\r\n                if(v == 12){\r\n                    " . $mb6Hide . ";\r\n                    Ext.example.msg('Done', 'Your fake items were loaded!');\r\n                }else{\r\n                    var i = v/11;\r\n\t\t\t\t\t" . $mb6Progress . ";                    \r\n                }\r\n           };\r\n       };\r\n       for(var i = 1; i < 13; i++){\r\n           setTimeout(f(i), i*500);\r\n       }");
$mb7Element = PhpExt_Element::getById('mb7');
$mb7Options = PhpExt_MessageBoxOptions::createMsgOptions()->setMsg('Saving your data, please wait...')->setProgressText('Saving...')->setWait(true)->setWaitConfig(PhpExt_ProgressBarWaitConfig::createWaitConfig()->setInterval(200))->setIcon('ext-mb-download')->setAnimEl('mb7');
$mb7Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb7Options)->output() . "\r\n\t\tsetTimeout(function(){\r\n            //This simulates a long-running operation like a database save or XHR call.\r\n            //In real code, this would be in a callback function.\r\n            " . PhpExt_MessageBox::hide()->output() . ";\r\n            Ext.example.msg('Done', 'Your fake data was saved!');\r\n        }, 8000);");
$mb8Element = PhpExt_Element::getById('mb8');
$mb8Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::alert("Status", "Changes saved successfully.", PhpExt_Javascript::variable('showResult')));
$comboValues = PhpExt_Javascript::stm("\r\n\t//Add these values dynamically so they aren't hard-coded in the html\r\n    Ext.fly('info').dom.value = Ext.MessageBox.INFO;\r\n    Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;\r\n    Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;\r\n    Ext.fly('error').dom.value = Ext.MessageBox.ERROR;\r\n");
$mb9Element = PhpExt_Element::getById('mb9');
$mb9Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Icon Support')->setMsg('Here is a message with an icon!')->setButtons(PhpExt_MessageBox::OK())->setFn(PhpExt_Javascript::variable('showResult'))->setAnimEl('mb9')->setIcon(PhpExt_Javascript::variable("Ext.get('icons').dom.value"));
$mb9Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb9Options));
$showResult = PhpExt_Javascript::stm("function showResult(btn){\r\n        Ext.example.msg('Button Click', 'You clicked the {0} button', btn);\r\n    };");
$showResultText = PhpExt_Javascript::stm("function showResultText(btn, text){\r\n        Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text \"{1}\".', btn, text);\r\n    };");
echo PhpExt_Ext::OnReady($mb1Element->on("click", $mb1Handler), $mb2Element->on("click", $mb2Handler), $mb3Element->on("click", $mb3Handler), $mb4Element->on("click", $mb4Handler), $mb6Element->on("click", $mb6Handler), $mb7Element->on("click", $mb7Handler), $mb8Element->on("click", $mb8Handler), $comboValues, $mb9Element->on("click", $mb9Handler), $showResult, $showResultText);
Ejemplo n.º 5
0
<?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());