1 <?php
5 /* Missing functions, validate registration
6 *
7 */
9 class GOsaRegistration extends plugin
10 {
11 protected $defaultRegistrationType = "registered";
12 protected $isRegistered = FALSE;
13 protected $step = 0;
15 function __construct(&$config)
16 {
17 $this->config = $config;
18 $this->isRegistered = GOsaRegistration::isRegistered($this->config);
19 }
23 function execute()
24 {
25 $smarty = get_smarty();
26 $smarty->assign("default", $this->defaultRegistrationType);
27 $smarty->assign("step", $this->step);
28 return($smarty->fetch(get_template_path("Register/register.tpl", TRUE)));
29 }
32 function save_object()
33 {
34 if(isset($_POST['registrationType'])) $this->defaultRegistrationType = get_post('registrationType');
35 if(isset($_POST['startRegistration'])) $this->step = 1;
37 if(isset($_POST['stepBack'])) $this->step -= 1;
38 }
42 static function registerGOsa($config, $uuid, $type, $userData = array())
43 {
44 echo "<br>Register GOsa.";
45 print_a(func_get_args());
46 }
49 static function getRegistrationType($config)
50 {
51 return($config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus'));
52 }
55 static function isRegistered($config, $uuid = NULL)
56 {
57 $status = $config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus');
58 if(!$uuid){
59 $uuid = $config->configRegistry->getPropertyValue('GOsaRegistration','registeredUUID');
60 }
62 // Not yet registered
63 if(!$status) return(FALSE);
65 // Registered, but backend status not confirmed.
66 echo "<br>Validate registration";
67 }
70 public static function getRegisterStatusValues()
71 {
72 $ret= array();
73 $ret[''] = _("not registered");
74 $ret['anonymous'] = _("anonym");
75 $ret['registered'] = _("registered");
76 return($ret);
77 }
80 public static function checkRegisteredUUID($message,$class,$name,$value, $type)
81 {
82 // Add check here later
83 $valid = TRUE;
85 // Display the reason for failing this check.
86 if($message && !$valid){
87 msg_dialog::display(_("Warning"),
88 sprintf(_("The given registration UUID '%s' specified for '%s:%s' is invalid!"),
89 bold($value),bold($class),bold($name)),
90 WARNING_DIALOG);
91 }
93 return($valid);
94 }
97 static function plInfo()
98 {
99 return (array(
100 "plProperties" => array(
101 array(
102 "name" => "registerStatus",
103 "type" => "switch",
104 "default" => "",
105 "defaults" => "GOsaRegistration::getRegisterStatusValues",
106 "description" => _("The GOsa registration status."),
107 "check" => "",
108 "migrate" => "",
109 "group" => "registerGOsa",
110 "mandatory" => FALSE),
111 array(
112 "name" => "registeredUUID",
113 "type" => "string",
114 "default" => "",
115 "description" => _("The UUID of the current GOsa installation. This UUID is used to identify the installation, once you've registered GOsa."),
116 "check" => "GOsaRegistration::checkRegisteredUUID",
117 "migrate" => "",
118 "group" => "registerGOsa",
119 "mandatory" => FALSE)
120 )));
121 }
122 }
123 ?>