view app/controllers/pages_controller.php @ 0:261e66bd5a0c

hg init
author Shoshi TAMAKI <shoshi@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Jul 2011 21:08:31 +0900
parents
children eb4fee3d9bb8
line wrap: on
line source

<?php

class PagesController extends AppController
{
	public $name = "Pages";
	public $uses = null;
	public $autoRender = true;

	public function display()
	{
		$con = WebVirtUtil::GetConnection();
		if($con == false){
			trigger_error(libvirt_get_last_error($con));
			die();
		}

		$this->set("title_for_laytout",WebVirtUtil::$wvirt_config["APP_NAME"]." - ".WebVirtUtil::$wvirt_config["APP_VERSION"]);

		$hostname = libvirt_get_hostname($con);
		$this->set("hostname",$hostname);
		$nodeinfo = libvirt_node_get_info($con);
		$this->set("nodeinfo",$nodeinfo);
		$this->set("actions",WebVirtUtil::$node_actions);

		$domains = libvirt_list_domains($con);

		$vmlist = array();
		foreach($domains as $dom){
			$name = libvirt_domain_get_name($dom);
			$info = libvirt_domain_get_info($dom);
			$actions = array();
			array_push($vmlist,array("name" => $name,
				"memory" => $info["memory"],
				"nrVirtCpu" => $info["nrVirtCpu"],
				"actions" => WebVirtUtil::$domain_actions,
				"uuid" => libvirt_domain_get_uuid_string($dom),
			));
		}

		$this->set("domains",$vmlist);
	}
}

?>