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


PHP Admin::add方法代码示例

本文整理汇总了PHP中Admin::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Admin::add方法的具体用法?PHP Admin::add怎么用?PHP Admin::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Admin的用法示例。


在下文中一共展示了Admin::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

        //Validate the POST variables and add up to error message if empty
        foreach ($postVars as $postVar) {
            switch ($postVar) {
                case 'confirmPassword':
                    if (filter_input(INPUT_POST, $postVar) !== filter_input(INPUT_POST, "passWord")) {
                        array_push($errorArr, "Password Mismatch !!! ");
                        if (filter_input(INPUT_POST, $postVar) == "") {
                            array_push($errorArr, " confirm your password. ");
                        }
                    }
                    break;
                default:
                    $adminObj->{$postVar} = filter_input(INPUT_POST, $postVar) ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, $postVar)) : '';
                    if ($adminObj->{$postVar} === "") {
                        array_push($errorArr, "Please enter {$postVar} ");
                    }
                    break;
            }
        }
        //If validated and not empty submit it to database
        if (count($errorArr) < 1) {
            echo $adminObj->add();
        } else {
            $json = array("status" => 0, "msg" => $errorArr);
            $dbObj->close();
            //Close Database Connection
            header('Content-type: application/json');
            echo json_encode($json);
        }
    }
}
开发者ID:Mojolagbe2014,项目名称:mojokalokalo,代码行数:31,代码来源:add-admin.php

示例2: Admin

    }
}
//OBJECT OF adminusercontroller
$admin = new Admin();
//IF m IS SET, SET IT TO $method, ELSE DEFAULT IT TO index
if (isset($_GET['m'])) {
    $method = $_GET['m'];
} else {
    $method = "index";
}
switch ($method) {
    case "index":
        $admin->index();
        break;
    case "add":
        $admin->add();
        break;
    case "edit":
        $admin->edit();
        break;
    case "delete":
        $admin->delete();
        break;
    case "check":
        $admin->check();
        break;
    case "logout":
        $admin->logout();
    default:
        $admin->index();
}
开发者ID:pratishshr,项目名称:Aawaaj,代码行数:31,代码来源:Admin.php

示例3: handleRequest

 public function handleRequest()
 {
     /* Check if it is time to insert more terms into DB */
     if (Term::isTimeToUpdate()) {
         Term::doTermUpdate();
     }
     // Fetch the action from the REQUEST.
     if (!isset($_REQUEST['action'])) {
         $req = "";
     } else {
         $req = $_REQUEST['action'];
     }
     // Show requested page.
     switch ($req) {
         case 'example_form':
             header('Content-type: application/pdf');
             readfile(PHPWS_SOURCE_DIR . 'mod/intern/pdf/Internship_Example.pdf');
             exit;
             break;
         case 'edit_internship':
             PHPWS_Core::initModClass('intern', 'UI/InternshipUI.php');
             $view = new InternshipUI();
             $this->content = $view->display();
             break;
         case 'add_internship':
             PHPWS_Core::initModClass('intern', 'command/SaveInternship.php');
             $ctrl = new SaveInternship();
             $ctrl->execute();
             test('finished execute', 1);
             break;
         case 'search':
             PHPWS_Core::initModClass('intern', 'UI/SearchUI.php');
             $view = new SearchUI();
             $this->content = $view->display();
             break;
         case 'results':
             PHPWS_Core::initModClass('intern', 'UI/ResultsUI.php');
             $view = new ResultsUI();
             $this->content = $view->display();
             break;
         case DEPT_EDIT:
             PHPWS_Core::initModClass('intern', 'UI/DepartmentUI.php');
             PHPWS_Core::initModClass('intern', 'Department.php');
             if (isset($_REQUEST['add'])) {
                 /* Add department with the name in REQUEST */
                 if (isset($_REQUEST['name'])) {
                     Department::add($_REQUEST['name']);
                 } else {
                     NQ::simple('intern', INTERN_ERROR, "Department must have name.");
                 }
             } else {
                 if (isset($_REQUEST['rename'])) {
                     /* Rename dept with ID to new name that was passed in REQUEST */
                     if (isset($_REQUEST['id'])) {
                         $d = new Department($_REQUEST['id']);
                         $d->rename($_REQUEST['rename']);
                     } else {
                         NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot rename department.");
                     }
                 } else {
                     if (isset($_REQUEST['hide'])) {
                         /* Hide/Show department with ID passed in REQUEST. */
                         if (isset($_REQUEST['id'])) {
                             $d = new Department($_REQUEST['id']);
                             $d->hide($_REQUEST['hide'] == 1);
                         } else {
                             NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot hide department.");
                         }
                     } else {
                         if (isset($_REQUEST['del'])) {
                             /* Delete department with same ID passed in REQUEST. */
                             if (isset($_REQUEST['id'])) {
                                 $d = new Department($_REQUEST['id']);
                                 $d->del();
                             } else {
                                 NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot delete department.");
                             }
                         } else {
                             if (isset($_REQUEST['fDel'])) {
                                 /** for now... */
                                 NQ::simple('intern', INTERN_WARNING, 'Sorry, cannot forcefully delete a department.');
                             }
                         }
                     }
                 }
             }
             $view = new DepartmentUI();
             $this->content = $view->display();
             break;
         case GRAD_PROG_EDIT:
             PHPWS_Core::initModClass('intern', 'GradProgram.php');
             PHPWS_Core::initModClass('intern', 'UI/GradProgramUI.php');
             if (isset($_REQUEST['add'])) {
                 /* Add grad program with the name in REQUEST */
                 if (isset($_REQUEST['name'])) {
                     GradProgram::add($_REQUEST['name']);
                 } else {
                     NQ::simple('intern', INTERN_ERROR, "Grad Program must have name.");
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:101,代码来源:InternshipInventory.php

示例4: handleRequest

 public function handleRequest()
 {
     /* Check if it is time to insert more terms into DB */
     if (Term::isTimeToUpdate()) {
         Term::doTermUpdate();
     }
     // Fetch the action from the REQUEST.
     if (!isset($_REQUEST['action'])) {
         $req = "";
     } else {
         $req = $_REQUEST['action'];
     }
     // Show requested page.
     switch ($req) {
         case 'example_form':
             header('Content-type: application/pdf');
             readfile(\PHPWS_SOURCE_DIR . 'mod/intern/pdf/Internship_Example.pdf');
             exit;
             break;
         case 'ShowInternship':
             $ctrl = new Command\ShowInternship();
             $this->content = $ctrl->execute();
             break;
         case 'ShowAddInternship':
             $ctrl = new Command\ShowAddInternship();
             $this->content = $ctrl->execute()->getView()->render();
             break;
         case 'AddInternship':
             $ctrl = new Command\AddInternship();
             $ctrl->execute();
             break;
         case 'SaveInternship':
             $ctrl = new Command\SaveInternship();
             $ctrl->execute();
             break;
         case 'search':
             $view = new UI\SearchUI();
             $this->content = $view->display();
             break;
         case 'results':
             $view = new UI\ResultsUI();
             $this->content = $view->display();
             break;
         case 'showEditDept':
             $view = new UI\DepartmentUI();
             $this->content = $view->display();
             break;
         case 'edit_dept':
             if (isset($_REQUEST['add'])) {
                 /* Add department with the name in REQUEST */
                 if (isset($_REQUEST['name'])) {
                     Department::add($_REQUEST['name']);
                 } else {
                     \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Department must have name.");
                 }
             } else {
                 if (isset($_REQUEST['rename'])) {
                     /* Rename dept with ID to new name that was passed in REQUEST */
                     if (isset($_REQUEST['id'])) {
                         $d = new Department($_REQUEST['id']);
                         $d->rename($_REQUEST['rename']);
                     } else {
                         \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot rename department.");
                     }
                 } else {
                     if (isset($_REQUEST['hide'])) {
                         /* Hide/Show department with ID passed in REQUEST. */
                         if (isset($_REQUEST['id'])) {
                             $d = new Department($_REQUEST['id']);
                             $d->hide($_REQUEST['hide'] == 1);
                         } else {
                             \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot hide department.");
                         }
                     } else {
                         if (isset($_REQUEST['del'])) {
                             /* Delete department with same ID passed in REQUEST. */
                             if (isset($_REQUEST['id'])) {
                                 $d = new Department($_REQUEST['id']);
                                 $d->del();
                             } else {
                                 \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot delete department.");
                             }
                         }
                     }
                 }
             }
             \PHPWS_Core::reroute('index.php?module=intern&action=showEditDept');
             break;
         case 'showEditGradProgs':
             $view = new UI\GradProgramUI();
             $this->content = $view->display();
             break;
         case 'edit_grad':
             //TODO Separate these into their own controllers
             if (isset($_REQUEST['add'])) {
                 /* Add grad program with the name in REQUEST */
                 if (isset($_REQUEST['name'])) {
                     GradProgram::add($_REQUEST['name']);
                 } else {
                     \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "Grad Program must have name.");
//.........这里部分代码省略.........
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:101,代码来源:InternshipInventory.php


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