Code

Updated opsi Pruduct Property editor to use ACLs
[gosa.git] / gosa-plugins / opsi / admin / opsi / class_opsiware.inc
1 <?php
3 class opsiSoftware extends opsiWare
4 {
5   protected $type = 0;
6 }
8 class opsiHardware extends opsiWare
9 {
10   protected $type = 1;
11 }
14 class opsiWare extends plugin
15 {
16   private $opsi;
17   private $hostId;
18   private $init_failed = FALSE;
19   private $info;
20   protected $type = 0;
22   public function __construct($config,$hostId)
23   {
24     $this->config = $config;
25     $this->opsi   = new opsi($config);
26     $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId);
27     $this->init();
28   }
30   private function init()
31   {
32     if($this->type == 0){
33       $this->info = $this->opsi->get_client_hardware($this->hostId);
34       $err = $this->opsi->is_error(); 
35     }else{
36       $this->info = $this->opsi->get_client_software($this->hostId);
37       $err = $this->opsi->is_error(); 
38     }
39     $this->init_failed = $err;
40   }
43   public function execute()
44   {
45     if(isset($_POST['reinit']) && $this->init_failed){
46       $this->init();
47     }
48     $smarty = get_smarty();
49     $smarty->assign("init_failed",$this->init_failed);
50     if($this->init_failed){
51       $smarty->assign("type", $this->type);
52       $smarty->assign("message",$this->opsi->get_error());
53       return($smarty->fetch(get_template_path("opsiware.tpl",TRUE,dirname(__FILE__))));
54     }  
55     $smarty->assign("type", $this->type);
56     $smarty->assign("info", $this->info);
57     return($smarty->fetch(get_template_path("opsiware.tpl",TRUE,dirname(__FILE__))));
58   }
59 }
60 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
61 ?>