• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List

E:/E/GEAMP/www/openbiz/openbiz/bin/service/profileService.php

00001 <?php
00025 class profileService
00026 {
00027     public $role;
00028     public $roleId;
00029     public $group;
00030     public $groupId;
00031     public $position;
00032     public $positionId;
00033     public $division;
00034     public $divisionId;
00035     public $org;
00036     public $orgId;
00037 
00043     public function __construct()
00044     {
00045 
00046     }
00047 
00054     public function getProfile($userId=null)
00055     {
00056         // with the userid, query for role, group, position, division, org
00057         if (!$userId) return null;
00058 
00059         $profile['USERID'] = $userId;
00060         
00061         // just make up something for test. must be replace in real application
00062         if ($userId == "admin")
00063             $profile['ROLE'] = 'admin';
00064         else if ($userId == "member")
00065             $profile['ROLE'] = 'member';
00066 
00067         $profile['ROLEID'] = 'RLE_2';
00068         $profile['GROUP'] = 'Member';
00069         $profile['GROUPID'] = 'GRP_3';
00070         $profile['POSITION'] = 'Marketing - France';
00071         $profile['POSITIONID'] = 'PSN_10';
00072         $profile['DIVISION'] = 'Marketing - Europe';
00073         $profile['DIVISIONID'] = 'DVN_5';
00074         $profile['ORG'] = 'IBM';
00075         $profile['ORGID'] = 'ORG_101';
00076 
00077         return $profile;
00078     }
00079 
00087     protected function getDBProfile($userId, $password)
00088     {
00089         // CASE 1: simple one table query
00090         // SELECT role, group, pstn, divn, org FROm user_table AS t1
00091         // WHERE t1.userid='$userid'
00092 
00093         // CASE 2: intersection table user_pstn (user_role, user_divn, user_org ...), need to query multiple times
00094         // SELECT t1.pstnid, t2.name FROM user_pstn_table AS t1
00095         // JOIN pstn_table AS t2 ON t1.pstnid=t2.id
00096         // WHERE t1.userid='$userid'
00097 
00098         // CASE 3: all hierarchy info contained in one big party table, do query once, then filter on type column
00099         // SELECT t1.partyid, t2.name, t2.type FROM user_party_table AS t1
00100         // JOIN party_table AS t2 ON t1.partyid=t2.id
00101         // WHERE t1.userid='$userid'
00102 
00103         $db = BizSystem::dbConnection();
00104         $resultSet = $db->execute($sql);
00105         $sqlArr = $resultSet->fetchRow();
00106         // process the result
00107     }
00108 
00117     public function getAttribute($userId, $attribut)
00118     {
00119     }
00120 }
00121 
00122 ?>

Generated on Thu Apr 19 2012 17:09:13 for openbiz by  doxygen 1.7.2