Code

Updated the registration process.
[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     function save_object()
31     {
32        if(isset($_POST['registrationType']))  $this->defaultRegistrationType = get_post('registrationType');
33     }
34     
37     static function registerGOsa($config, $uuid, $type, $userData = array())
38     {
39         echo "<br>Register GOsa.";
40         print_a(func_get_args());
41     }
44     static function getRegistrationType($config)
45     {
46         return($config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus'));
47     }    
50     static function isRegistered($config, $uuid = NULL)
51     {
52         $status = $config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus');
53         if(!$uuid){
54             $uuid = $config->configRegistry->getPropertyValue('GOsaRegistration','registeredUUID');
55         }       
57         // Not yet registered 
58         if(!$status) return(FALSE);
59         
60         // Registered, but backend status not confirmed.
61         echo "<br>Validate registration";
62     }
65     public static function getRegisterStatusValues()
66     {
67         $ret= array();
68         $ret[''] = _("not registered");
69         $ret['anonymous'] = _("anonym");
70         $ret['registered'] = _("registered");
71         return($ret);
72     }
74    
75     public static function checkRegisteredUUID($message,$class,$name,$value, $type)
76     {
77         // Add check here later 
78         $valid = TRUE;
80         // Display the reason for failing this check.
81         if($message && !$valid){
82             msg_dialog::display(_("Warning"),
83                     sprintf(_("The given registration UUID '%s' specified for '%s:%s' is invalid!"),
84                         bold($value),bold($class),bold($name)),
85                     WARNING_DIALOG);
86         }
88         return($valid);
89     }
91  
92     static function plInfo()
93     {
94         return (array(
95                     "plProperties"  => array(
96                         array(
97                             "name"          => "registerStatus",
98                             "type"          => "switch",
99                             "default"       => "",
100                             "defaults"      => "GOsaRegistration::getRegisterStatusValues",
101                             "description"   => _("The GOsa registration status."),
102                             "check"         => "",
103                             "migrate"       => "",
104                             "group"         => "registerGOsa",
105                             "mandatory"     => FALSE),
106                         array(
107                             "name"          => "registeredUUID",
108                             "type"          => "string",
109                             "default"       => "",
110                             "description"   => _("The UUID of the current GOsa installation. This UUID is used to identify the installation, once you've registered GOsa."),
111                             "check"         => "GOsaRegistration::checkRegisteredUUID",
112                             "migrate"       => "",
113                             "group"         => "registerGOsa",
114                             "mandatory"     => FALSE)
115                         )));
116     }
118 ?>