当前位置: 首页>>代码示例>>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;未经允许,请勿转载。