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