Ejemplo n.º 1
0
{
    // CamelCase => camel_case
    if (0 == strncmp($class_name, 'Ext_', 4)) {
        $name = str_replace('_Config', '', $class_name);
        $name = str_replace('_', '.', $name);
        include_once "libs/extphp/{$name}.php";
    }
}
require 'libs/extphp/main.php';
if (isset($_GET['content1'])) {
    print "Welcome to a remotely loaded page.";
    exit;
}
// **************************** First, a poor lonely button
$cfg = new Ext_Button_Config();
$button = new Ext_Button($cfg->renderTo('button1-div')->text('Button 1')->handler(new JsFunction(null, "alert('You clicked the button');")));
$button->jsrender();
// **************************** A grid panel
// Data Display
$cm = array(array('header' => '', 'width' => 30, 'sortable' => false, 'dataIndex' => 'status', 'id' => 'status'), array('header' => 'Name', 'width' => 160, 'sortable' => false, 'dataIndex' => 'report', 'id' => 'report'), array('header' => 'Duration', 'width' => 70, 'sortable' => false, 'dataIndex' => 'duration', 'id' => 'duration'));
// Reader
$jsonreader_config = new Ext_data_JsonReader_Config();
$jsonreader_config->root('rows')->totalProperty('totalCount');
// Store Config
$dscfg = new Ext_Data_Store_Config();
$dscfg->autoLoad(true)->proxy(new Ext_data_HttpProxy(array('url' => 'docs/samples/data.txt', 'method' => 'GET')))->reader(new Ext_data_JsonReader($jsonreader_config, array(array('name' => 'status', 'mapping' => 'status', 'type' => 'string'), array('name' => 'report', 'mapping' => 'report', 'type' => 'string'), array('name' => 'duration', 'mapping' => 'duration', 'type' => 'int'))));
// Store
$ds = new Ext_data_Store($dscfg);
// And finally the grid panel and its config class themselves:
$cfg = new Ext_grid_GridPanel_Config();
$gp = new Ext_grid_GridPanel($cfg->renderTo('grid1-div')->title('My Grid')->width(320)->height(200)->frame(true)->columns($cm)->store($ds));
 public function pressLogin()
 {
     $label = $this->getSelenium()->getEval("window._('Login')");
     $proxy = new Ext_Button($this, $label);
     $proxy->click();
 }