本文整理汇总了PHP中Dept::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::create方法的具体用法?PHP Dept::create怎么用?PHP Dept::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dept
的用法示例。
在下文中一共展示了Dept::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doInsert
function doInsert()
{
if (isset($_POST['save'])) {
if ($_POST['deptname'] == "" or $_POST['deptdesc'] == "") {
message("All field is required!", "error");
redirect('index.php?view=add');
} else {
$dept = new Dept();
$deptid = $_POST['deptid'];
$deptname = $_POST['deptname'];
$dept_desc = $_POST['deptdesc'];
$res = $dept->find_all_dept($deptname);
if ($res >= 1) {
message("Department name already exist!", "error");
redirect('index.php?view=add');
} else {
$dept->DEPARTMENT_NAME = $deptname;
$dept->DEPARTMENT_DESC = $dept_desc;
$istrue = $dept->create();
if ($istrue == 1) {
message("New [" . $deptname . "] Department created successfully!", "success");
redirect('index.php');
}
}
}
}
}
示例2: include_once
include_once(INCLUDE_DIR.'class.dept.php');
$do=strtolower($_POST['do']);
switch($do){
case 'update':
$dept = new Dept($_POST['dept_id']);
if($dept && $dept->getId()) {
if($dept->update($_POST,$errors))
$msg='Dept updated successfully';
elseif(!$errors['err'])
$errors['err']='Error updating the department';
}else{
$errors['err']='Internal error';
}
break;
case 'create':
if(($deptID=Dept::create($_POST,$errors)))
$msg=Format::htmlchars($_POST['dept_name']).' added successfully';
elseif(!$errors['err'])
$errors['err']='Unable to add department. Internal error';
break;
case 'mass_process':
if(!$_POST['ids'] || !is_array($_POST['ids'])) {
$errors['err']='You must select at least one department';
}elseif(!$_POST['public'] && in_array($cfg->getDefaultDeptId(),$_POST['ids'])) {
$errors['err']='You can not disable/delete a default department. Remove default Dept and try again.';
}else{
$count=count($_POST['ids']);
$ids=implode(',',$_POST['ids']);
if($_POST['public']){
$sql='UPDATE '.DEPT_TABLE.' SET ispublic=1 WHERE dept_id IN ('.$ids.')';
if(db_query($sql) && ($num=db_affected_rows()))
示例3: sprintf
if ($_REQUEST['id'] && !($dept = Dept::lookup($_REQUEST['id']))) {
$errors['err'] = sprintf(__('%s: Unknown or invalid ID.'), __('department'));
}
if ($_POST) {
switch (strtolower($_POST['do'])) {
case 'update':
if (!$dept) {
$errors['err'] = sprintf(__('%s: Unknown or invalid'), __('department'));
} elseif ($dept->update($_POST, $errors)) {
$msg = sprintf(__('Successfully updated %s'), __('this department'));
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Error updating %s. Try again!'), __('this department'));
}
break;
case 'create':
if ($id = Dept::create($_POST, $errors)) {
$msg = sprintf(__('Successfully added "%s"'), Format::htmlchars($_POST['name']));
$_REQUEST['a'] = null;
} elseif (!$errors['err']) {
$errors['err'] = sprintf(__('Unable to add %s. Correct error(s) below and try again.'), __('this department'));
}
break;
case 'mass_process':
if (!$_POST['ids'] || !is_array($_POST['ids']) || !count($_POST['ids'])) {
$errors['err'] = sprintf(__('You must select at least %s'), __('one department'));
} elseif (in_array($cfg->getDefaultDeptId(), $_POST['ids'])) {
$errors['err'] = __('You cannot disable/delete a default department. Select a new default department and try again.');
} else {
$count = count($_POST['ids']);
switch (strtolower($_POST['a'])) {
case 'make_public':