本文整理汇总了PHP中State::setActive方法的典型用法代码示例。如果您正苦于以下问题:PHP State::setActive方法的具体用法?PHP State::setActive怎么用?PHP State::setActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::setActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
//.........这里部分代码省略.........
$m = new Major($_REQUEST['id']);
$m->hide($_REQUEST['hide'] == 1);
} else {
NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot hide major.");
}
} else {
if (isset($_REQUEST['del'])) {
/* Delete major with same ID passed in REQUEST. */
if (isset($_REQUEST['id'])) {
$m = new Major($_REQUEST['id']);
$m->del();
} else {
NQ::simple('intern', INTERN_ERROR, "No ID given. Cannot delete major.");
}
}
}
}
}
$view = new MajorUI();
$this->content = $view->display();
break;
/**
* Matt additions!
*/
/**
* Matt additions!
*/
case 'add_state':
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
PHPWS_Core::initModClass('intern', 'State.php');
$state = new State($_GET['abbr']);
$state->setActive(true);
$state->save();
exit;
break;
case 'remove_state':
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
PHPWS_Core::initModClass('intern', 'State.php');
$state = new State($_GET['abbr']);
$state->setActive(false);
$state->save();
exit;
break;
case STATE_EDIT:
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
PHPWS_Core::initModClass('intern', 'UI/StateUI.php');
$view = new StateUI();
$this->content = $view->display();
break;
case 'edit_admins':
PHPWS_Core::initModClass('intern', 'UI/AdminUI.php');
PHPWS_Core::initModClass('intern', 'Admin.php');
PHPWS_Core::initModClass('intern', 'Department.php');
if (isset($_REQUEST['add'])) {
// Add user in REQUEST to administrator list for the department in REQUEST.
Admin::add($_REQUEST['username'], $_REQUEST['department_id']);
} else {
if (isset($_REQUEST['del'])) {
// Delete the user in REQUEST from department in REQUEST.
Admin::del($_REQUEST['username'], $_REQUEST['department_id']);
示例2: handleRequest
//.........这里部分代码省略.........
/* Hide major with ID passed in REQUEST. */
if (isset($_REQUEST['id'])) {
$m = new Major($_REQUEST['id']);
$m->hide($_REQUEST['hide'] == 1);
} else {
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot hide major.");
}
} else {
if (isset($_REQUEST['del'])) {
/* Delete major with same ID passed in REQUEST. */
if (isset($_REQUEST['id'])) {
$m = new Major($_REQUEST['id']);
$m->del();
} else {
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, "No ID given. Cannot delete major.");
}
}
}
}
}
\PHPWS_Core::reroute('index.php?module=intern&action=showEditMajors');
break;
/**
* Matt additions!
*/
/**
* Matt additions!
*/
case 'add_state':
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
$state = new State($_GET['abbr']);
$state->setActive(true);
$state->save();
exit;
break;
case 'remove_state':
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
$state = new State($_GET['abbr']);
$state->setActive(false);
$state->save();
exit;
break;
case 'edit_states':
if (!Current_User::allow('intern', 'edit_state')) {
disallow();
}
$view = new StateUI();
$this->content = $view->display();
break;
case 'showEditAdmins':
$view = new UI\AdminUI();
$this->content = $view->display();
break;
case 'edit_admins':
if (isset($_REQUEST['add'])) {
// Add user in REQUEST to administrator list for the department in REQUEST.
Admin::add($_REQUEST['username'], $_REQUEST['department_id']);
} else {
if (isset($_REQUEST['del'])) {
// Delete the user in REQUEST from department in REQUEST.
Admin::del($_REQUEST['username'], $_REQUEST['department_id']);
} else {