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