diff --git a/gosa-plugins/opsi/admin/opsi/class_opsiware.inc b/gosa-plugins/opsi/admin/opsi/class_opsiware.inc
index d192ea63f050c6876d1e46a30ebd0711084acf97..75909c44116618699c7a1cc2b11f88eb02d19024 100644 (file)
<?php
-class opsiware extends plugin
+class opsiSoftware extends opsiWare
+{
+ protected $type = 0;
+}
+
+class opsiHardware extends opsiWare
+{
+ protected $type = 1;
+}
+
+
+class opsiWare extends plugin
{
private $opsi;
- private $SW_info;
- private $HW_info;
private $hostId;
- private $type = 0;
private $init_failed = FALSE;
+ private $info;
+ protected $type = 0;
public function __construct($config,$hostId)
{
private function init()
{
- $err = FALSE;
- if(!$err){
- $this->HW_info = $this->opsi->get_client_hardware($this->hostId);
- $err |= $this->opsi->is_error();
- }
- if(!$err){
- $this->SW_info = $this->opsi->get_client_software($this->hostId);
- $err |= $this->opsi->is_error();
+ if($this->type == 0){
+ $this->info = $this->opsi->get_client_hardware($this->hostId);
+ $err = $this->opsi->is_error();
+ }else{
+ $this->info = $this->opsi->get_client_software($this->hostId);
+ $err = $this->opsi->is_error();
}
$this->init_failed = $err;
}
+
public function execute()
{
if(isset($_POST['reinit']) && $this->init_failed){
$this->init();
}
- if(isset($_GET['type'])) $this->type = $_GET['type'];
-
$smarty = get_smarty();
$smarty->assign("init_failed",$this->init_failed);
if($this->init_failed){
$smarty->assign("message",$this->opsi->get_error());
return($smarty->fetch(get_template_path("opsiware.tpl",TRUE,dirname(__FILE__))));
}
-
$smarty->assign("type", $this->type);
-
- if($this->type == 1){
- $smarty->assign("info", $this->HW_info);
- }else{
- $smarty->assign("info", $this->SW_info);
- }
+ $smarty->assign("info", $this->info);
return($smarty->fetch(get_template_path("opsiware.tpl",TRUE,dirname(__FILE__))));
}
}