本文整理汇总了PHP中Department::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::add方法的具体用法?PHP Department::add怎么用?PHP Department::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: department_make_add
public function department_make_add($data)
{
$retData = Department::add($data);
$__viewData = array();
$__viewData['Data']['TableHeader'] = Department::$HEADER;
$__viewData['Data']['TableContent'] = MyDataParser::build_table_view(Department::get_list(), Department::$HEADER);
$__viewData['Data']['IsRenderAfterPost'] = true;
$__viewData['Data']['Error'] = $retData;
$this->template->__yield__ = View::forge('department/department', $__viewData);
}
示例2: add
public function add()
{
return Department::add($this->data);
}
示例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: Validate
<?php
require_once '../core/init.php';
if (Input::exists() && privilege() != NULL) {
$validate = new Validate();
$validation = $validate->check($_POST, array('name' => array('required' => true), 'id' => array('required' => true)));
if ($validate->passed()) {
$dep = new Department();
$add = $dep->add(Input::get('id'), Input::get('name'));
if ($add == 3) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Sorry, you don\'t have privilege to create department.';
echo '</div>';
} else {
if ($add == 2) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo '<a href="view_department.php?id=' . Input::get('id') . '"> ' . Input::get('name') . '</a> Department already exists.';
echo '</div>';
} else {
if ($add == 1) {
echo '<div class="alert alert-success alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Department created successfully';
echo '</div>';
} else {
if ($add == 0) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Temporary Error, while creating new department.';
示例5: Employee
}
// Instantiation de trois employés possédant des compétences :
$benjamin = new Employee('Benjamin');
$benjamin->setSkills(['PHP', 'Java']);
echo "Compétences de {$benjamin} :\n";
print_r($benjamin->getSkills());
$camille = new Employee('Camille');
$camille->setSkills(['CSS', 'Illustrator', 'Javascript']);
echo "Compétences de {$camille} :\n";
print_r($camille->getSkills());
$thomas = new Employee('Thomas');
$thomas->setSkills(['Javascript', 'PHP', 'Node.js']);
echo "Compétences de {$thomas} :\n";
print_r($thomas->getSkills());
// Instatiation de trois services :
$rd = new Department("R&d");
$front = new Department("R&d / Frontend");
$back = new Department("R&d / Backend");
// Distribution des compétences :
$front->add($camille);
$front->add($thomas);
$back->add($benjamin);
$back->add($thomas);
$rd->add($front);
$rd->add($back);
echo "Compétences du service '{$front}' :\n";
print_r($front->getSkills());
echo "Compétences du service '{$back}' :\n";
print_r($back->getSkills());
echo "Compétences du service '{$rd}' : \n";
print_r($rd->getSkills());
示例6: 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.");
//.........这里部分代码省略.........