[ PHPXref.com ] [ Generated: Sun Jul 20 21:17:54 2008 ] [ Zoph 0.5.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/php/ -> prefs.inc.php (source)

   1  <?php
   2  
   3  /*
   4   * A class corresponding to the prefs table.  A row of prefs is mapped
   5   * to a user_id.
   6   *
   7   * This file is part of Zoph.
   8   *
   9   * Zoph is free software; you can redistribute it and/or modify
  10   * it under the terms of the GNU General Public License as published by
  11   * the Free Software Foundation; either version 2 of the License, or
  12   * (at your option) any later version.
  13   * 
  14   * Zoph is distributed in the hope that it will be useful,
  15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17   * GNU General Public License for more details.
  18   * You should have received a copy of the GNU General Public License
  19   * along with Zoph; if not, write to the Free Software
  20   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  21   */
  22  
  23  class prefs extends zoph_table {
  24  
  25      var $color_scheme;
  26  
  27      function prefs($id = 0) {
  28          parent::zoph_table("prefs", array("user_id"), array(""));
  29          $this->set("user_id", $id);
  30      }
  31  
  32      function insert() {
  33          parent::insert(1); // insert user_id primary key
  34      }
  35  
  36      function lookup_color_scheme($force = 0) {
  37  
  38          // avoid unnecessary lookups
  39          if ($this->color_scheme && $this->color_scheme->get("name") != null
  40              && !$force) {
  41  
  42              return $this->color_scheme;
  43          }
  44  
  45          if ($this->get("color_scheme_id")) {
  46              $this->color_scheme =
  47                  new color_scheme($this->get("color_scheme_id"));
  48              $this->color_scheme->lookup();
  49  
  50              // make sure it was actually found
  51              if ($this->color_scheme->get("name") != null) {
  52                  return $this->color_scheme;
  53              }
  54          }
  55  
  56          return 0;
  57      }
  58  
  59      function load($force = 0) {
  60  
  61          // these are global vars because originally they were set in
  62          // config.inc.php instead of stored in the db
  63          global $SHOW_BREADCRUMBS;
  64          global $MAX_CRUMBS_TO_SHOW;
  65          global $DEFAULT_ROWS;
  66          global $DEFAULT_COLS;
  67          global $MAX_PAGER_SIZE;
  68          global $RANDOM_PHOTO_MIN_RATING;
  69          global $TOP_N;
  70          global $SLIDESHOW_TIME;
  71          global $FULLSIZE_NEW_WIN;
  72          global $PEOPLE_SLOTS;
  73  
  74          global $PAGE_BG_COLOR;
  75          global $TEXT_COLOR;
  76          global $LINK_COLOR;
  77          global $VLINK_COLOR;
  78          global $TABLE_BG_COLOR;
  79          global $TABLE_BORDER_COLOR;
  80          global $BREADCRUMB_BG_COLOR;
  81          global $TITLE_BG_COLOR;
  82          global $TITLE_FONT_COLOR;
  83          global $TAB_BG_COLOR;
  84          global $TAB_FONT_COLOR;
  85          global $SELECTED_TAB_BG_COLOR;
  86          global $SELECTED_TAB_FONT_COLOR;
  87  
  88          $SHOW_BREADCRUMBS = $this->get("show_breadcrumbs");
  89          $MAX_CRUMBS_TO_SHOW = $this->get("num_breadcrumbs");
  90          $DEFAULT_ROWS = $this->get("num_rows");
  91          $DEFAULT_COLS = $this->get("num_cols");
  92          $MAX_PAGER_SIZE = $this->get("max_pager_size");
  93          $RANDOM_PHOTO_MIN_RATING = $this->get("random_photo_min_rating");
  94          $TOP_N = $this->get("reports_top_n");
  95          $SLIDESHOW_TIME = $this->get("slideshow_time");
  96          $FULLSIZE_NEW_WIN = $this->get("fullsize_new_win");
  97          $PEOPLE_SLOTS = $this->get("people_slots");
  98          if ($PEOPLE_SLOTS > MAX_PEOPLE_SLOTS) {
  99              $PEOPLE_SLOTS = MAX_PEOPLE_SLOTS;
 100          }
 101  
 102          if ($this->lookup_color_scheme($force)) {
 103              $cs = $this->color_scheme;
 104              $PAGE_BG_COLOR = "#" . $cs->get("page_bg_color");
 105              $TEXT_COLOR = "#" . $cs->get("text_color");
 106              $LINK_COLOR = "#" . $cs->get("link_color");
 107              $VLINK_COLOR = "#" . $cs->get("vlink_color");
 108              $TABLE_BG_COLOR = "#" . $cs->get("table_bg_color");
 109              $TABLE_BORDER_COLOR = "#" . $cs->get("table_border_color");
 110              $BREADCRUMB_BG_COLOR = "#" . $cs->get("breadcrumb_bg_color");
 111              $TITLE_BG_COLOR = "#" . $cs->get("title_bg_color");
 112              $TITLE_FONT_COLOR = "#" . $cs->get("title_font_color");
 113              $TAB_BG_COLOR = "#" . $cs->get("tab_bg_color");
 114              $TAB_FONT_COLOR = "#" . $cs->get("tab_font_color");
 115              $SELECTED_TAB_BG_COLOR = "#" . $cs->get("selected_tab_bg_color");
 116              $SELECTED_TAB_FONT_COLOR = "#" . $cs->get("selected_tab_font_color");
 117          }
 118      }
 119  
 120  }
 121  
 122  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]