當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserRole::GetUserRole方法代碼示例

本文整理匯總了PHP中UserRole::GetUserRole方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRole::GetUserRole方法的具體用法?PHP UserRole::GetUserRole怎麽用?PHP UserRole::GetUserRole使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserRole的用法示例。


在下文中一共展示了UserRole::GetUserRole方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($FacilityID, $ElementID = 0, $DeputyID = "", $ModuleID = "")
 {
     $db = parent::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
     if ($DeputyID != "" && $ModuleID != "") {
         $this->DeputyID = $DeputyID;
         $this->ModuleID = $ModuleID;
         $this->ElementID = $ElementID;
     } else {
         if (!empty($FacilityID)) {
             $query = "select * from SystemFacilities where FacilityID=?";
             $dt = parent::runquery($query, array($FacilityID), $db);
             if (parent::GetExceptionCount() != 0) {
                 return;
             }
             if (count($dt) == 0) {
                 return;
             }
             $this->DeputyID = $dt[0]["DeputyID"];
             $this->ModuleID = $dt[0]["ModuleID"];
             $this->ElementID = $ElementID;
         } else {
             return;
         }
     }
     $this->UserID = $_SESSION["User"]->UserID;
     $this->Roles = UserRole::GetUserRole($this->DeputyID, $this->UserID);
     if (parent::GetExceptionCount() != 0) {
         return;
     }
     $rolesStr = "-1";
     if (count($this->Roles) != 0) {
         for ($i = 0; $i < count($this->Roles); $i++) {
             $rolesStr .= "," . $this->Roles[$i]->UserRole;
         }
     }
     $query = "select DeputyID,ModuleID,ElementID,\r\n\t\t\t\t\t\tmax(AcInsert) as AcInsert,\r\n\t\t\t\t\t\tmax(AcFullUpdate) as AcFullUpdate,\r\n\t\t\t\t\t\tmax(AcUpdate) as AcUpdate,\r\n\t\t\t\t\t\tmax(AcFullDelete) as AcFullDelete,\r\n\t\t\t\t\t\tmax(AcDelete) as AcDelete\r\n\t\t\t\tfrom ModuleAccess\r\n\t\t\t\twhere (RoleID in({$rolesStr}) OR UserID=:uid)\r\n\t\t\t\t\tAND DeputyID=:did AND ModuleID=:mid AND ElementID=:eid\r\n\t\t\t\tgroup by DeputyID,ModuleID,ElementID";
     $dt = parent::runquery($query, array(":uid" => $this->UserID, ":did" => $this->DeputyID, ":mid" => $this->ModuleID, ":eid" => $this->ElementID), $db);
     if (parent::GetExceptionCount() != 0 || count($dt) == 0) {
         return;
     }
     $this->AcInsert = $dt[0]["AcInsert"] == 0 ? false : true;
     $this->AcFullUpdate = $dt[0]["AcFullUpdate"] == 0 ? false : true;
     $this->AcUpdate = $dt[0]["AcUpdate"] == 0 ? false : true;
     $this->AcFullDelete = $dt[0]["AcFullDelete"] == 0 ? false : true;
     $this->AcDelete = $dt[0]["AcDelete"] == 0 ? false : true;
 }
開發者ID:jafarkhani,項目名稱:rtfund,代碼行數:46,代碼來源:ModuleAccess.class.php


注:本文中的UserRole::GetUserRole方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。