<?php

 

$basePath = "";

 

require_once ("config.php");

require_once (XPHP_BASE_PATH."module.php");

require_once (DATAACCESS_BASE_PATH."module.php");

 

class Test2 extends XPhpPage

{

      public function __construct()

      {

            parent::__construct();

      }

     

      function load()

      {

            if (!$_POST)

            {

                  $data = $this->findControl("data1");

                  $data->setData($this->getUsers());

                  $data->setCurrentRowIndex(0);

            }

            parent::load();

      }

     

      function userTable_onCommand($sender, $args)

      {

            $data = $this->findControl("data1");

            $data->setCurrentRowIndex($args["rowIndex"]);

      }

     

      function save()

      {

            $data = $this->findControl("data1");

            $data->update();

      }

     

      function getUsers()

      {

            $users = array();

            $users[0]["Username"] = "admin";

            $users[0]["FullName"] = "Amministratore";

            $users[0]["Password"] = "123";

            $users[0]["Enabled"] = true;

            $users[0]["Type"] = 1;

            $users[0]["Picture"] = "media/Inverno.jpg";

           

            $users[1]["Username"] = "andrea";

            $users[1]["FullName"] = "Andrea Guerrieri";

            $users[1]["Password"] = "123";

            $users[1]["Enabled"] = false;

            $users[1]["Type"] = 2;

            $users[1]["Picture"] = "media/Ninfee.jpg";

            return $users;

      }

}

 

session_start();

 

XPhp_load("Test2");

 

?>