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


PHP DbConn::commit方法代碼示例

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


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

示例1: foreach

 function add_row($row, $pk)
 {
     foreach ($pk as $key => $val) {
         $pk[$key] = addslashes(trim($val));
     }
     foreach ($row as $key => $val) {
         $row[$key] = addslashes(trim($val));
     }
     $user = $this->aclm->getUser(false, $pk['username']);
     if ($user != false) {
         // admin type and profile ?
         switch ($row['admin_type']) {
             case 'admin':
                 $level = $this->levels[ADMIN_GROUP_ADMIN];
                 if (!isset($this->admin_profiles[$row['profile']])) {
                     $this->last_error = 'Profile not found : ' . $row['profile'] . '<br />';
                     return false;
                 }
                 $this->db->start_transaction();
                 //remove from the user group
                 $this->aclm->removeFromGroup($this->levels[ADMIN_GROUP_USER], $user[ACL_INFO_IDST]);
                 //add to the correct admin group
                 $this->aclm->addToGroup($level, $user[ACL_INFO_IDST]);
                 $idst_profile = $this->admin_profiles[$row['profile']];
                 $this->m_ar->saveSingleAdminAssociation($idst_profile, $user[ACL_INFO_IDST]);
                 break;
             case 'public':
                 $level = $this->levels[ADMIN_GROUP_PUBLICADMIN];
                 if (!isset($this->public_profiles[$row['profile']])) {
                     $this->last_error = 'Profile not found : ' . $row['profile'] . '<br />';
                     return false;
                 }
                 $this->db->start_transaction();
                 //remove from the user group
                 $this->aclm->removeFromGroup($this->levels[ADMIN_GROUP_USER], $user[ACL_INFO_IDST]);
                 //add to the correct admin group
                 $this->aclm->addToGroup($level, $user[ACL_INFO_IDST]);
                 $idst_profile = $this->public_profiles[$row['profile']];
                 $this->m_ap->saveSingleAdminAssociation($idst_profile, $user[ACL_INFO_IDST]);
                 break;
         }
         // associated org_chart ?
         if ($row['folder_name'] == 'root' && isset($this->root_ocd)) {
             $this->preference->saveAdminTree($user[ACL_INFO_IDST], array($this->root_ocd));
         } elseif (isset($this->org_chart[strtolower($row['folder_name'])])) {
             $oc = $this->org_chart[strtolower($row['folder_name'])];
             $this->preference->saveAdminTree($user[ACL_INFO_IDST], array($oc->idst_ocd));
         } else {
             $this->last_error = 'Users to manage not found <br />';
         }
         // associated courses ?
         if ($row['courses'] == 'root') {
             $this->preference->saveAdminCourse($user[ACL_INFO_IDST], array(0), array(), array());
         } else {
             $this->last_error = 'Course association not found <br />';
         }
         $this->db->commit();
         return true;
     } else {
         $this->last_error = 'User not found : ' . $pk['username'] . '<br />';
         return false;
     }
 }
開發者ID:abhinay100,項目名稱:forma_app,代碼行數:63,代碼來源:connector.doceboadmin.php


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