changed git call from https to git readonly
[atutor.git] / mods / social / html / application_settings.tmpl.php
1 <form method="post" action="<?php echo url_rewrite(AT_SOCIAL_BASENAME.'applications.php');?>">
2 <?php
3   $html = '';
4   if (! empty($this->settings)) {
5     $settings = $this->settings;
6     foreach ($settings as $key => $setting) {
7       $name = ! empty($setting->displayName) ? $setting->displayName : $key;
8       $default = isset($setting->default) ? $setting->default : '';
9 //      $value = isset($vars['application']['user_prefs'][$key]) ? $vars['application']['user_prefs'][$key] : $default;
10       $html .= "<div><div class=\"settings_label\">$name</div>";
11       switch ($setting->type) {
12         case 'ENUM':
13           $html .= "<select name=\"$key\">\n";
14           foreach ($setting->enumValues as $k => $v) {
15             $sel = ($k == $value) ? ' SELECTED' : '';
16             $html .= "<option value=\"$k\" $sel>$v</option>\n";
17           }
18           $html .= "</select>\n";
19           break;
20         case 'STRING':
21                         if (isset($this->user_settings[$key]) && $this->user_settings[$key]!=''){
22                                 $default=$this->user_settings[$key];
23                         }
24                         $html .= "<input type=\"text\" name=\"$key\" value=\"$default\" />\n";
25                         break;
26                 case 'HIDDEN':
27                         //hide these for now so that they don't get saved?
28                         //echo "<input type=\"hidden\" name=\"$key\" value=\"$default\" />\n";
29                         $html = '';     //do not display anything
30                         break;
31         case 'BOOL':
32                         //TODO add radio boxes here, should they be yes / no?
33                         $yes = '';
34                         $no = '';
35                         if ($default=='true'){
36                                 $yes = ' checked="checked"';
37                         } else {
38                                 $no = ' checked="checked"';
39                         }
40                         $html .= '<label for="'.$key.'_yes"/>'._AT('yes').'</label>';
41                         $html .= '<input id="'.$key.'_yes" type="radio" name="'.$key.'" value="true" '.$yes.' />';
42                         $html .= '<label for="'.$key.'_no"/>'._AT('no').'</label>';
43                         $html .= '<input id="'.$key.'_no" type="radio" name="'.$key.'" value="false" '.$no.' />';                       
44                         break;
45         case 'LIST':
46                         //TODO not sure what to do with this one yet
47                         break;
48         case 'NUMBER':
49                         $html .= "<input type=\"text\" name=\"$key\" value=\"$default\" />\n";
50                         break;
51       }
52     }
53   }
54   if ($html != '') : 
55           echo $html . "</div>";
56   ?>
57   <input type="hidden" name="app_id" value="<?php echo $this->app_id; ?>" />
58   <input type="hidden" name="app_settings" value="1" />
59   <input type="submit" value="<?php echo _AT('save');?>"/>
60   <?php else: ?>
61   <?php echo _AT('no_settings'); ?>
62   <?php endif; ?>
63 </form>