public function index()
 {
     //$this->test();
     $user_rec = new Usr_Schm();
     $user_rec->username = $_POST['username'] ? $_POST['username'] : "";
     $user_rec->password = $_POST['password'] ? $_POST['password'] : "";
     $user_rec->alias = $_POST['alias'] ? $_POST['alias'] : "";
     $user_rec->email = $_POST['email'] ? $_POST['email'] : "";
     $usernfo_rec = new Usrnfo_Schm();
     $usernfo_rec->im = $_POST['im'] ? $_POST['im'] : "";
     $usernfo_rec->name = $_POST['name'] ? $_POST['name'] : "";
     $usernfo_rec->url = $_POST['url'] ? $_POST['url'] : "";
     if (strlen($_POST['add'])) {
         $this->add($user_rec);
     }
     if (strlen($_POST['edit'])) {
         $this->edit($_POST['uid'], $user_rec, $usernfo_rec);
     }
     if (Util::isal_num($this->get['delete']) && $this->get['delete'] !== "") {
         $this->delete($this->get['delete']);
         $msg[] = "Record has been deleted with id: {$this->get['delete']}";
     }
     if (isset($this->get['page'])) {
         $offset = ($this->get['page'] - 1) * DISPLAY_NUM;
         if ($this->get['page'] <= 0) {
             $offset = 0;
         }
     } else {
         $offset = 0;
     }
     $records = "";
     foreach ($this->getRecords(DISPLAY_NUM, $offset) as $row) {
         $records .= "<tr>" . "<td>{$row['uid']}</td>" . "<td>{$row['username']}</td>" . "<td>{$row['alias']}</td>" . "<td>{$row['email']}</td>" . "<td>{$row['im']}</td>" . "<td>{$row['name']}</td>" . "<td>{$row['url']}</td>" . "<td><a href=\"/Users/edit/{$row['uid']}\">edit</a></td>" . "<td><a href=\"/Users/delete/{$row['uid']}\">delete</a></td>" . "</tr>\n";
     }
     $rec = null;
     if (Util::isal_num($this->get['edit'])) {
         $rec = $this->getRecord($this->get['edit']);
     }
     $output['content'] = $records;
     $paginate = new Paginate();
     $paginate->filename("/Users")->bond_id("page")->total($this->getRecordCount())->page_num($this->get['page'] - 1)->total_devisor(DISPLAY_NUM)->query_arg_array($this->get)->build();
     $output['paginate'] = array('next' => $paginate->getNext(), 'prev' => $paginate->getPrev(), 'pages' => $paginate->getPages());
     if ($this->get['submit'] == "true") {
         echo "<pre>Submitting\n" . $this->outputText() . "</pre>";
         exit;
     }
     $controller = Util::tpl_content('public/controller', 'users_tpl.php', array('get' => $this->get, 'output' => $output, 'rec' => $rec, 'msg' => $msg));
     $index = Util::tpl_content('public/body', 'index_tpl.php', array('get' => $this->get, 'title' => "Users"));
     echo Util::tpl_body($controller, $index);
     if (SYSDEBUG) {
         echo $this->outputLogHTML();
     }
 }