changed git call from https to git readonly
[atutor.git] / mods / wiki / plugins / module / collectuserdata.php
1 <?php
2
3 /*
4 The user data collector is a handler that displays a request for user data rather
5 than the requested page.  I recommend and have configured the default for this 
6 plugin to use the lib/delegator plugin.  A user data plugin and the UserInfo page
7 (in module/uservars_gui) are required for this feature.
8
9 Written By:  Andy Fundinger (Andy@burgiss.com)
10 */
11
12 $ewiki_plugins["delegator"]["LoginDelegator"][]="ewiki_uservar_collect";
13
14 $ewiki_config["CollectedUserData"]=  array("First Name" => "","Last Name" => "",
15   "Company" => "","E-Mail Address" => "", "Phone Number" => "",
16   );
17
18 function ewiki_uservar_collect($id, $data, $action){
19   global $ewiki_plugins, $ewiki_config;
20
21   if(!isset($GLOBALS['ewiki_auth_user'])){
22     return;
23   }
24   
25   //Authenticate on the UserInfo page that we will be submitting to.
26   if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth('UserInfo', $uu, "view")) {
27     return;
28   } 
29
30   foreach($ewiki_config["CollectedUserData"] as $checkVar=>$uu){    
31     if(strlen(ewiki_get_uservar($checkVar))==0){
32       $currVar=$checkVar;
33       break;
34     }
35   }
36
37   if(isset($currVar)){        
38     $o = ewiki_make_title($id, "User data update", 2); 
39     $o .= "Our database does not include your $currVar, please enter it below:";
40     $o .= '<p><form method="post" action="'.ewiki_script('UserInfo').'"><table border="1" cellpadding="1">';
41     $o .= '<tr><th>'.$currVar.'</th><td><input name="text_'.$currVar.'" type="text"></td></tr>';
42     $o .= '<tr><td></td><td><input value="Submit Changes" type="submit" name="submit_changeaccount" /></td></tr>';
43     $o .= '</table></form>';  
44     return($o);
45   }
46 }
47
48 ?>