本文整理汇总了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);
}
}
}
示例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();
}
示例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 {
//.........这里部分代码省略.........
示例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.");
//.........这里部分代码省略.........