当前位置: 首页>>代码示例>>PHP>>正文


PHP Dept::create方法代码示例

本文整理汇总了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');
                }
            }
        }
    }
}
开发者ID:allybitebo,项目名称:CCECourseCatalogue,代码行数:27,代码来源:controller.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()))
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:admin.php

示例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':
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:31,代码来源:departments.php


注:本文中的Dept::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。