本文整理汇总了PHP中Term::isTimeToUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::isTimeToUpdate方法的具体用法?PHP Term::isTimeToUpdate怎么用?PHP Term::isTimeToUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::isTimeToUpdate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 {
//.........这里部分代码省略.........
示例2: 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.");
//.........这里部分代码省略.........