Example #1
0
if (!seguridad::isAllowed(seguridad_action::nameConstructor('new', 'role', 'seguridad'))) {
    throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true);
}
PhpExt_Javascript::sendContentType();
global $ari;
$ari->popup = 1;
// no mostrar el main_frame
$field_width = 180;
//ancho de los controles
$grid_id = '';
if (isset($_POST['gid'])) {
    $grid_id = $_POST['gid'];
}
//creacion de controles
$txt_nombre = PhpExt_Form_TextField::createTextField("txt_nombre", "Nombre")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
$txt_descripcion = PhpExt_Form_TextArea::createTextArea("txt_descripcion", "Descripción")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
$chk_anonimo = PhpExt_Form_Checkbox::createCheckbox("chk_anonimo", "Anónimo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
$chk_confiados = PhpExt_Form_Checkbox::createCheckbox("chk_confiados", "Confiado")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width);
//Boton grabar OnClick
$handler_grabar = " \nfunction(){\nthis.findParentByType('form').getForm().submit(\n\t{    \t       \n\t\t\t\t\t\t reset : true,\n\t\t\t\t\t   waitMsg : 'Enviando Datos',\n\t\t\t\t\t waitTitle : 'Emporika',\t\t\t\t   \n\t\t\t   grid_reload_id  : '{$grid_id}',\n\t\t\t\t   new_tab_dir : '/seguridad/role/update',\n\t\t\t\t new_tab_title : 'Modificar Rol',\n  new_tab_pass_response_params : { id : 'id'},  \n\t\t\t\t load_tab_here : true\t   \n\t}\n\t\n\t);\t\t\t\t\n\t\n}";
$btn_grabar = PhpExt_Button::createTextButton("Grabar", new PhpExt_JavascriptStm($handler_grabar));
//Data_Reader para leer los resultados devueltos
$error_reader = new PhpExt_Data_JsonReader();
$error_reader->setRoot("errors");
$error_reader->setSuccessProperty("success");
$error_reader->addField(new PhpExt_Data_FieldConfigObject("id"));
$error_reader->addField(new PhpExt_Data_FieldConfigObject("msg"));
//formulario que contiene todos los controles
$frm_nuevo_rol = new PhpExt_Form_FormPanel();
$frm_nuevo_rol->setErrorReader($error_reader)->setUrl("/seguridad/role/new_process")->setFrame(true)->setWidth(350)->setAutoHeight(true)->setTitle("Datos del Rol")->setMethod(PhpExt_Form_FormPanel::METHOD_POST);
//marco para poner los controles
Example #2
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());