Code

Updated registration dialog
[gosa.git] / gosa-core / plugins / generic / dashBoard / Register / class_RegisterGOsa.inc
1 <?php
5 /* Missing functions, validate registration
6  *
7  */
9 class GOsaRegistration extends plugin
10 {
11     protected $defaultRegistrationType = "registered";
12     protected $isRegistered = FALSE; 
14     function __construct(&$config)
15     {
16         $this->config = $config;    
17         $this->isRegistered = GOsaRegistration::isRegistered($this->config);
18     }
21    
22     function execute()
23     {
24         $smarty = get_smarty();
25         $smarty->assign("default", $this->defaultRegistrationType);
26         return($smarty->fetch(get_template_path("Register/register.tpl", TRUE))); 
27     } 
30     static function registerGOsa($config, $uuid, $type, $userData = array())
31     {
32         echo "<br>Register GOsa.";
33         print_a(func_get_args());
34     }
37     static function getRegistrationType($config)
38     {
39         return($config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus'));
40     }    
43     static function isRegistered($config, $uuid = NULL)
44     {
45         $status = $config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus');
46         if(!$uuid){
47             $uuid = $config->configRegistry->getPropertyValue('GOsaRegistration','registeredUUID');
48         }       
50         // Not yet registered 
51         if(!$status) return(FALSE);
52         
53         // Registered, but backend status not confirmed.
54         echo "<br>Validate registration";
55     }
58     public static function getRegisterStatusValues()
59     {
60         $ret= array();
61         $ret[''] = _("not registered");
62         $ret['anonymous'] = _("anonym");
63         $ret['registered'] = _("registered");
64         return($ret);
65     }
67    
68     public static function checkRegisteredUUID($message,$class,$name,$value, $type)
69     {
70         // Add check here later 
71         $valid = TRUE;
73         // Display the reason for failing this check.
74         if($message && !$valid){
75             msg_dialog::display(_("Warning"),
76                     sprintf(_("The given registration UUID '%s' specified for '%s:%s' is invalid!"),
77                         bold($value),bold($class),bold($name)),
78                     WARNING_DIALOG);
79         }
81         return($valid);
82     }
84  
85     static function plInfo()
86     {
87         return (array(
88                     "plProperties"  => array(
89                         array(
90                             "name"          => "registerStatus",
91                             "type"          => "switch",
92                             "default"       => "",
93                             "defaults"      => "GOsaRegistration::getRegisterStatusValues",
94                             "description"   => _("The GOsa registration status."),
95                             "check"         => "",
96                             "migrate"       => "",
97                             "group"         => "registerGOsa",
98                             "mandatory"     => FALSE),
99                         array(
100                             "name"          => "registeredUUID",
101                             "type"          => "string",
102                             "default"       => "",
103                             "description"   => _("The UUID of the current GOsa installation. This UUID is used to identify the installation, once you've registered GOsa."),
104                             "check"         => "GOsaRegistration::checkRegisteredUUID",
105                             "migrate"       => "",
106                             "group"         => "registerGOsa",
107                             "mandatory"     => FALSE)
108                         )));
109     }
111 ?>