本文整理汇总了PHP中Dept::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::delete方法的具体用法?PHP Dept::delete怎么用?PHP Dept::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dept
的用法示例。
在下文中一共展示了Dept::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDeleteDept
/**
* Handler for delete dept
*/
public function actionDeleteDept()
{
if (isset($_REQUEST['id'])) {
Dept::delete($_REQUEST['id']);
}
$this->showResponse(array('status' => true));
}
示例2: doDelete
function doDelete()
{
@($id = $_POST['selector']);
$key = count($id);
//multi delete using checkbox as a selector
for ($i = 0; $i < $key; $i++) {
$dept = new Dept();
$dept->delete($id[$i]);
}
message("Department name(s) already Deleted!", "info");
redirect('index.php');
}
示例3: count
}elseif($_POST['delete']){
//Deny all deletes if one of the selections has members in it.
$sql='SELECT count(staff_id) FROM '.STAFF_TABLE.' WHERE dept_id IN ('.$ids.')';
list($members)=db_fetch_row(db_query($sql));
$sql='SELECT count(topic_id) FROM '.TOPIC_TABLE.' WHERE dept_id IN ('.$ids.')';
list($topics)=db_fetch_row(db_query($sql));
if($members){
$errors['err']='Can not delete Dept. with members. Move staff first.';
}elseif($topic){
$errors['err']='Can not delete Dept. associated with a help topics. Remove association first.';
}else{
//We have to deal with individual selection because of associated tickets and users.
$i=0;
foreach($_POST['ids'] as $k=>$v) {
if($v==$cfg->getDefaultDeptId()) continue; //Don't delete default dept. Triple checking!!!!!
if(Dept::delete($v)) $i++;
}
if($i>0){
$warn="$i of $count selected departments deleted";
}else{
$errors['err']='Unable to delete selected departments.';
}
}
}
}
break;
default:
$errors['err']='Unknown Dept action';
}
break;
default:
示例4: list
list($members) = db_fetch_row(db_query($sql));
$sql = 'SELECT count(topic_id) FROM ' . TOPIC_TABLE . ' WHERE dept_id IN (' . $ids . ')';
list($topics) = db_fetch_row(db_query($sql));
if ($members) {
$errors['err'] = 'Can not delete Dept. with members. Move staff first.';
} elseif ($topic) {
$errors['err'] = 'Can not delete Dept. associated with a help topics. Remove association first.';
} else {
//We have to deal with individual selection because of associated tickets and users.
$i = 0;
foreach ($_POST['ids'] as $k => $v) {
if ($v == $cfg->getDefaultDeptId()) {
continue;
}
//Don't delete default dept. Triple checking!!!!!
if (Dept::delete($v)) {
$i++;
}
}
if ($i > 0) {
$warn = "{$i} of {$count} selected departments deleted";
} else {
$errors['err'] = 'Unable to delete selected departments.';
}
}
}
}
break;
default:
$errors['err'] = 'Unknown Dept action';
}