Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created January 3, 2010 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheresalice/268097 to your computer and use it in GitHub Desktop.
Save wheresalice/268097 to your computer and use it in GitHub Desktop.
<?php
$couch_dsn = "http://localhost:5984/";
$couch_db = "inout";
require_once "../lib/couch.php";
require_once "../lib/couchClient.php";
require_once "../lib/couchDocument.php";
$client = new couchClient($couch_dsn,$couch_db);
$window = new GtkWindow();
$window->set_size_request(420, 175);
$window->connect_simple('destroy', array('Gtk','main_quit'));
$vbox = new GtkVBox();
$window->add($vbox);
$label = new GtkLabel();
$label->set_markup('<span color="blue" font_desc="Times New Roman Italic 12">
In/Out Status of Computer Gentle Staff</span>');
$vbox->pack_start($label);
$table = new GtkTable();
$vbox->pack_start($table);
$data = $client->getView('users','all');
$data = $data->rows;
print_r($data);
display_table($table, $data);
$window->show_all();
Gtk::main();
function display_table($table, $data) {
$row = 0;
foreach($data as $item) {
$key = new GtkLabel();
$key->set_markup("<b>$item->id</b>");
$key->set_alignment(0,0);
$table->attach($key, 0, 1, $row, $row+1, Gtk::FILL, Gtk::SHRINK);
//$table->attach($key, 0, 1, $row, $row+1, Gtk::FILL, Gtk::SHRINK);
$value = new GtkLabel($item->value->Status);
$value->set_alignment(0,0);
$table->attach($value, 1, 2, $row, $row+1, Gtk::FILL, Gtk::SHRINK);
++$row;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment