Code

Updated registriation process.
[gosa.git] / gosa-core / plugins / generic / dashBoard / Register / class_RegisterGOsa.inc
index 045603e2865c5c48350181918cd70dd2839fb1f0..86da0d32be02368343e8310da4ca015e42f49ad9 100644 (file)
@@ -8,34 +8,78 @@
 
 class GOsaRegistration extends plugin
 {
-
+    protected $defaultRegistrationType = "registered";
     protected $isRegistered = FALSE; 
+    protected $step = 0;
+
+    public $attrs = array('mailAddress','surname','givenName', 'company', 'clients', 'knownFrom');
+    protected $values = array();
 
     function __construct(&$config)
     {
         $this->config = $config;    
         $this->isRegistered = GOsaRegistration::isRegistered($this->config);
+
+        foreach($this->attrs as $attr) $this->values[$attr] = "";
     }
 
 
+    function registerNow()
+    {
+        $this->step = 200; // Awaiting verification
+    }
+
    
     function execute()
     {
+        // Registration request.
+        if(isset($_POST['registerNow'])){
+            $msgs = $this->check();
+            if(count($msgs)){
+                msg_dialog::displayChecks($msgs); 
+            }else{
+                $this->registerNow();
+            }
+        }
+
+
         $smarty = get_smarty();
+        $smarty->assign("default", $this->defaultRegistrationType);
+        $smarty->assign("step", $this->step);
+
+        foreach($this->attrs as $attr) $smarty->assign($attr, set_post($this->values[$attr]));
+
 
         return($smarty->fetch(get_template_path("Register/register.tpl", TRUE))); 
     } 
 
 
-    static function registerGOsa($config, $uuid, $type, $userData = array())
+    function save_object()
     {
+        if(isset($_POST['registrationType']))  $this->defaultRegistrationType = get_post('registrationType');
+        if(isset($_POST['startRegistration'])) $this->step = 1;
+        if(isset($_POST['stepBack'])) $this->step -= 1;
+
+        foreach($this->attrs as $attr){
+            if(isset($_POST[$attr])) $this->values[$attr] = get_post($attr);
+        }
+    }
+    
+
 
+    static function registerGOsa($config, $uuid, $type, $userData = array())
+    {
         echo "<br>Register GOsa.";
         print_a(func_get_args());
-        
     }
 
 
+    static function getRegistrationType($config)
+    {
+        return($config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus'));
+    }    
+
+
     static function isRegistered($config, $uuid = NULL)
     {
         $status = $config->configRegistry->getPropertyValue('GOsaRegistration','registerStatus');