Search:

# CWIS Developers Documentation

- Main Page
- Classes
- Files

- Search for |

- File List
- File Members

# SPTUser.php

Go to the documentation of this file.

    00001 <?PHP
    00002
    00003 #
    00004 #   FILE:  SPT--SPTUser.php
    00005 #
    00006 #   METHODS PROVIDED:
    00007 #       SPTUser()
    00008 #           - constructor
    00009 #       SomeMethod($SomeParameter, $AnotherParameter)
    00010 #           - short description of method
    00011 #
    00012 #   AUTHOR:
    00013 #
    00014 #   Part of the Scout Portal Toolkit
    00015 #   Copyright 2004 Internet Scout Project
    00016 #   http://scout.wisc.edu
    00017 #
    00018
    00019 class SPTUser extends User {
    00020     # ---- PUBLIC INTERFACE --------------------------------------------------
    00021     # ---- user interface preference mnemonics
    00022     # color avoidance flags
    00023     const UIPREF_AVOID_RED =           1;
    00024     const UIPREF_AVOID_REDGREEN =      2;
    00025     const UIPREF_AVOID_BLUEYELLOW =    4;
    00026     const UIPREF_AVOID_GREENYELLOW =   8;
    00027     const UIPREF_AVOID_ORANGE =        16;
    00028     const UIPREF_AVOID_REDBLACK =      32;
    00029     const UIPREF_AVOID_PURPLEGREY =    64;
    00030     const UIPREF_AVOID_USEMAXMONOCHR = 128;
    00031
    00032     # content display options
    00033     const UIPREF_CONTENTDENSITY_NOPREFERENCE =  0;
    00034     const UIPREF_CONTENTDENSITY_DETAILED =  1;
    00035     const UIPREF_CONTENTDENSITY_OVERVIEW =  2;
    00036
    00037     # content view options
    00038     const UIPREF_CONTENTVIEW_NOPREFERENCE =  0;
    00039     const UIPREF_CONTENTVIEW_TEXTINTENSIVE =  1;
    00040     const UIPREF_CONTENTVIEW_IMAGEINTENSIVE =  2;
    00041
    00042     # audio description options
    00043     const UIPREF_AUDIODESCRIPTION_NONE =  0;
    00044     const UIPREF_AUDIODESCRIPTION_STANDARD =  1;
    00045     const UIPREF_AUDIODESCRIPTION_EXPANDED =  2;
    00046
    00047     # caption type options
    00048     const UIPREF_CAPTIONTYPE_NONE =  0;
    00049     const UIPREF_CAPTIONTYPE_VERBATIM =  1;
    00050     const UIPREF_CAPTIONTYPE_REDUCEDREADINGLEVEL =  2;
    00051
    00052     # object constructor
    00053     function SPTUser($UserInfo = NULL)
    00054     {
    00055         global $Session;
    00056
    00057         # create database handle for parent and local use
    00058         $DB = new SPTDatabase();
    00059         $this->DB = $DB;
    00060
    00061         # if no user info supplied
    00062         if ($UserInfo == NULL)
    00063         {
    00064             # if session is available in global context
    00065             if (isset($Session))
    00066             {
    00067                 # call parent constructor with global session
    00068                 $this->User($Session);
    00069             }
    00070             else
    00071             {
    00072                 # call parent constructor with our own session
    00073                 $OurSession = new Session($this->DB);
    00074                 $this->User($OurSession);
    00075             }
    00076         }
    00077         else
    00078         {
    00079             # call parent constructor with our DB handle
    00080             $this->User($this->DB, $UserInfo);
    00081         }
    00082
    00083         # if user is logged in
    00084         if ($this->IsLoggedIn())
    00085         {
    00086             # if user already has a UI preferences record in DB
    00087             $DB->Query("SELECT * FROM UserUIPreferences WHERE UserId = '".$this->Id()."'");
    00088             if ($DB->NumRowsSelected())
    00089             {
    00090                 # load in UI preferences
    00091                 $this->UserUIPreferencesCache = $DB->FetchRow();
    00092             }
    00093             else
    00094             {
    00095                 # add UI preferences record to DB for user
    00096                 $DB->Query("INSERT INTO UserUIPreferences (UserId) VALUES (".$this->Id().")");
    00097             }
    00098         }
    00099     }
    00100
    00101     # user interface / accessibility preferences
    00102     function PrefFontSize($NewValue = DB_NOVALUE)
    00103             {  return $this->UUPUpdateValue("FontSize", $NewValue);  }
    00104     function PrefFontTypeFace($NewValue = DB_NOVALUE)
    00105             {  return $this->UUPUpdateValue("FontTypeFace", $NewValue);  }
    00106     function PrefFontColor($NewValue = DB_NOVALUE)
    00107             {  return $this->UUPUpdateValue("FontColor", $NewValue);  }
    00108     function PrefBackgroundColor($NewValue = DB_NOVALUE)
    00109             {  return $this->UUPUpdateValue("BackgroundColor", $NewValue);  }
    00110     function PrefColorAvoidanceFlags($NewValue = DB_NOVALUE)
    00111             {  return $this->UUPUpdateValue("ColorAvoidanceFlags", $NewValue);  }
    00112     function PrefContentDensity($NewValue = DB_NOVALUE)
    00113             {  return $this->UUPUpdateValue("ContentDensity", $NewValue);  }
    00114     function PrefContentView($NewValue = DB_NOVALUE)
    00115             {  return $this->UUPUpdateValue("ContentView", $NewValue);  }
    00116     function PrefAudioDescriptionLevel($NewValue = DB_NOVALUE)
    00117             {  return $this->UUPUpdateValue("AudioDescriptionLevel", $NewValue);  }
    00118     function PrefAudioDescriptionLanguage($NewValue = DB_NOVALUE)
    00119             {  return $this->UUPUpdateValue("AudioDescriptionLanguage", $NewValue);  }
    00120     function PrefVisualDescriptionLanguage($NewValue = DB_NOVALUE)
    00121             {  return $this->UUPUpdateValue("VisualDescriptionLanguage", $NewValue);  }
    00122     function PrefImageDescriptionLanguage($NewValue = DB_NOVALUE)
    00123             {  return $this->UUPUpdateValue("ImageDescriptionLanguage", $NewValue);  }
    00124     function PrefUseGraphicAlternatives($NewValue = DB_NOVALUE)
    00125             {  return $this->UUPUpdateValue("UseGraphicAlternatives", $NewValue);  }
    00126     function PrefSignLanguage($NewValue = DB_NOVALUE)
    00127             {  return $this->UUPUpdateValue("SignLanguage", $NewValue);  }
    00128     function PrefCaptionType($NewValue = DB_NOVALUE)
    00129             {  return $this->UUPUpdateValue("CaptionType", $NewValue);  }
    00130     function PrefCaptionRate($NewValue = DB_NOVALUE)
    00131             {  return $this->UUPUpdateValue("CaptionRate", $NewValue);  }
    00132
    00133
    00134     # ---- PRIVATE INTERFACE -------------------------------------------------
    00135
    00136     var $DB;
    00137     var $UserUIPreferencesCache;
    00138
    00139     function UUPUpdateValue($FieldName, $NewValue)
    00140     {
    00141         return $this->DB->UpdateValue("UserUIPreferences", $FieldName,
    00142                 $NewValue, "UserId = '".$this->Id()."'",
    00143                 $this->UserUIPreferencesCache);
    00144     }
    00145 }
    00146
    00147 ?>

Copyright 2009 Internet Scout