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