Code

Fixed Translation Strings.
[gosa.git] / plugins / admin / systems / class_glpiManufacturer.inc
1 <?php
3 class glpiManufacturer extends plugin
4 {
5   /* CLI vars */
6   var $cli_summary= "Manage server basic objects";
7   var $cli_description= "Some longer text\nfor help";
8   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10   /* attribute list for save action */
11   var $ignore_account= TRUE;
12   var $attributes= array("name","type","address","website","phonenumber","comments","deleted","fax","email");
13   var $objectclasses= array("whatever");
15   var $ui;
17   var $editMode = false;
18   var $Edit_Add = "edit";
20   var $name       ="";
21   var $type       ="";
22   var $address    ="";
23   var $website    ="";
24   var $phonenumber="";
25   var $comments   ="";
26   var $deleted    ="";
27   var $fax        ="";
28   var $email      ="";
29   var $ID         =-1;
31   function glpiManufacturer($config, $dn= NULL)
32   {
33     plugin::plugin ($config, $dn);
34     $this->ui = get_userinfo();  
35   }
37   function execute()
38   {
39     $smarty  = get_smarty();
40     $display = "";
42     if((isset($_POST['remove_manu']))&&(isset($_POST['manufacturer']))){
43       $this->parent->handle->removeEnterprisesType($_POST['manufacturer']);
44     }
46     if(isset($_POST['add_manu'])){
47       $this->editMode = true;
48       $this->Edit_Add = "add";
49       foreach($this->attributes as $atr){
50         $this->$atr = "";
51       }
52     }
54     if((isset($_POST['edit_manu']))&&(isset($_POST['manufacturer']))){
55       $this->editMode = true;
56       $this->Edit_Add = "edit";
57       $tmp = $this->parent->handle->getEnterprise($_POST['manufacturer']);
58       $tmp = $tmp[0];
59       foreach($this->attributes as $atr){
60         $this->$atr = "";
61       }
62       foreach($this->attributes as $atr){
63         if(isset($tmp[$atr])){
64           $this->$atr = $tmp[$atr];
65         }
66       }
67       $this->ID = $_POST['manufacturer'];
68     }
70     if(isset($_POST['close_manufacturer'])){
71       $this->editMode=false;
72     }
74     if(isset($_POST['save_manufacturer'])){
76       $tmp = array();
77       foreach($this->attributes as $attrs){
78         $tmp[$attrs]=$this->$attrs;
79       }
81       if($this->Edit_Add == "add"){
82         $this->parent->handle->addEnterprisesType($tmp);
83       }else{
84         $this->parent->handle->updateEnterprisesType($tmp,$this->ID);
85       }
87       $this->editMode=false;
88     }
90     if($this->editMode == true){
91       $this->save_object();
92       foreach($this->attributes as $attrs){
93         $smarty->assign($attrs,$this->$attrs);
94       }
96       $display.= $smarty->fetch(get_template_path('glpiManufacturerAdd.tpl', TRUE));
97       return($display);
98     }
101     $smarty->assign("Manus",    $this->parent->handle->getEnterprisesTypes());
102     $smarty->assign("ManuKeys", array_flip($this->parent->handle->getEnterprisesTypes()));
103     $display.= $smarty->fetch(get_template_path('glpiManufacturer.tpl', TRUE));
104     return($display);
105   }
107   /* Save to LDAP */
108   function save()
109   {
110   }
112   function save_object()
113   {
114     foreach($this->attributes as $attr){
115       if(isset($_POST[$attr])){
116         $this->$attr = $_POST[$attr];
117       }
118     }
119   }
123 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
124 ?>