Пример #1
0
 function setTheme($theme = '')
 {
     // Check available themes
     $themes = Flyspray::listThemes();
     if (in_array($theme, $themes)) {
         $this->_theme = $theme . '/';
     } else {
         $this->_theme = $themes[0] . '/';
     }
 }
Пример #2
0
 function Project($id)
 {
     global $db, $fs;
     // Get custom fields
     $fields = $db->x->getAll('SELECT f.*, l.list_type
                                        FROM {fields} f
                                   LEFT JOIN {lists} l ON f.list_id = l.list_id
                                       WHERE f.project_id IN (0, ?) ORDER BY field_name', null, array($id));
     foreach ($fields as $field) {
         $f = new Field($field);
         if ($f->id == $fs->prefs['color_field']) {
             $f->values = $this->get_list($f->prefs, $f->id);
         }
         $this->fields['field' . $field['field_id']] = $f;
     }
     $this->columns = array_combine($this->columns, array_map('L', $this->columns));
     foreach ($this->fields as $field) {
         $this->columns['field' . $field->id] = $field->prefs['field_name'];
     }
     if (is_numeric($id) && $id > 0) {
         $this->prefs = $db->x->getRow("SELECT p.*, c.content AS pm_instructions, c.last_updated AS cache_update\n                                 FROM {projects} p\n                            LEFT JOIN {cache} c ON c.topic = p.project_id AND c.type = 'msg'\n                                WHERE p.project_id = ?", null, array($id));
         if (is_array($this->prefs)) {
             $this->id = (int) $this->prefs['project_id'];
             $this->prefs['visible_columns'] = implode(' ', array_intersect(explode(' ', $this->prefs['visible_columns']), array_keys($this->columns)));
             $this->prefs['theme_style'] = Filters::enum($this->prefs['theme_style'], Flyspray::listThemes());
             return;
         }
     }
     $this->id = 0;
     $this->prefs = array();
     $this->prefs['project_title'] = L('allprojects');
     $this->prefs['feed_description'] = L('feedforall');
     $this->prefs['theme_style'] = $fs->prefs['global_theme'];
     $this->prefs['theme_style'] = Filters::enum($this->prefs['theme_style'], Flyspray::listThemes());
     $this->prefs['lang_code'] = $fs->prefs['lang_code'];
     $this->prefs['others_view'] = 1;
     $this->prefs['intro_message'] = '';
     $this->prefs['anon_open'] = $this->prefs['override_user_lang'] = 0;
     $this->prefs['feed_img_url'] = '';
     $this->prefs['default_entry'] = $fs->prefs['default_entry'];
     $this->prefs['notify_reply'] = '';
     $fs->prefs['visible_columns'] = implode(' ', array_intersect(explode(' ', $fs->prefs['visible_columns']), array_keys($this->columns)));
     return;
 }