本文整理汇总了PHP中PHPWS_Core::home方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::home方法的具体用法?PHP PHPWS_Core::home怎么用?PHP PHPWS_Core::home使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::home方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
// Check permissions
if (!\Current_User::allow('intern', 'create_internship')) {
\NQ::simple('intern', NotifyUI::ERROR, 'You do not have permission to create new internships.');
\NQ::close();
\PHPWS_Core::home();
}
$view = new \Intern\AddInternshipView();
return new \Response($view);
}
示例2: execute
public function execute()
{
// Check permissions
if (!\Current_User::allow('intern', 'create_internship')) {
\NQ::simple('intern', NotifyUI::ERROR, 'You do not have permission to create new internships.');
\NQ::close();
\PHPWS_Core::home();
}
// Get a list of any missing input the user didn't fill in
$missingFieldList = $this->checkForMissingInput();
// If there are missing fields, redirect to the add internship interface
if (!empty($missingFieldList)) {
$this->redirectToForm();
}
// Check that the student Id looks valid
$studentId = $_POST['studentId'];
// Get the term
// TODO Double check that this is reasonable
$term = $_POST['term'];
// Create the student object
$student = StudentProviderFactory::getProvider()->getStudent($studentId, $term);
// Get the department ojbect
$departmentId = preg_replace("/^_/", '', $_POST['department']);
// Remove leading underscore in department id
$department = DepartmentFactory::getDepartmentById($departmentId);
if (!$department instanceof Department) {
throw new \Exception('Could not load department.');
}
// Create and save the agency object
$agency = new Agency($_POST['agency']);
DatabaseStorage::save($agency);
// Get the location
$location = $_POST['location'];
if ($location == 'international') {
$state = null;
$country = $_POST['country'];
} else {
$state = $_POST['state'];
$country = null;
}
// Create a new internship object
$intern = new Internship($student, $term, $location, $state, $country, $department, $agency);
// Save it!!
$intern->save();
$t = \Intern\WorkflowTransitionFactory::getTransitionByName('Intern\\WorkflowTransition\\CreationTransition');
$workflow = new \Intern\WorkflowController($intern, $t);
$workflow->doTransition(null);
$workflow->doNotification(null);
// Show a success notice and redirect to the edit page
\NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "Created internship for {$intern->getFullName()}");
\NQ::close();
return \PHPWS_Core::reroute('index.php?module=intern&action=ShowInternship&internship_id=' . $intern->getId());
}
示例3: get
public function get()
{
$this->loadContact();
switch ($_GET['cop']) {
case 'logout':
unset($_SESSION['Contact_User']);
\PHPWS_Core::home();
break;
case 'edit_property':
$this->checkPermission();
$this->loadProperty($this->contact->id);
$this->editProperty($this->contact->id);
break;
case 'view_properties':
$this->checkPermission();
$this->title = "Properties list";
$this->propertiesList($this->contact->id);
break;
case 'photo_form':
$photo = new Photo();
echo $photo->form();
exit;
break;
case 'activate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(true);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'deactivate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(false);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'edit_contact':
$this->checkPermission();
$this->editContact();
break;
case 'delete_photo':
// called via ajax
$this->checkPermission();
ob_start();
$photo = new Photo($_GET['id']);
$photo->delete();
echo Photo::getThumbs($photo->pid);
exit;
break;
case 'delete_property':
$this->checkPermission();
$this->loadProperty();
// double security
if ($this->property->contact_id == $this->contact->id) {
$this->property->delete();
}
\PHPWS_Core::goBack();
break;
case 'make_main':
$photo = new Photo($_GET['id']);
$photo->makeMain();
exit;
break;
case 'update':
$this->checkPermission();
$this->loadProperty();
$this->property->update();
\PHPWS_Core::goBack();
break;
}
$this->display();
}
示例4: whatsnew
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @version $Id$
* @author Verdon Vaillancourt <verdonv at gmail dot com>
*/
if (!defined('PHPWS_SOURCE_DIR')) {
include '../../core/conf/404.html';
exit;
}
PHPWS_Core::initModClass('whatsnew', 'Whatsnew.php');
$whatsnew = new whatsnew();
if (isset($_REQUEST['aop'])) {
$whatsnew->adminMenu();
} elseif (isset($_REQUEST['uop'])) {
$whatsnew->userMenu();
} else {
PHPWS_Core::home();
}
示例5: popUrlHistory
public static function popUrlHistory()
{
if (!isset($_SESSION['PHPWS_UrlHistory']) || count($_SESSION['PHPWS_UrlHistory']) == 0) {
PHPWS_Core::home();
}
PHPWS_Core::reroute(array_pop($_SESSION['PHPWS_UrlHistory']));
}
示例6: display
public static function display()
{
PHPWS_Core::initModClass('intern', 'Internship.php');
PHPWS_Core::initModClass('intern', 'InternshipFactory.php');
PHPWS_Core::initModClass('intern', 'Intern_Document.php');
PHPWS_Core::initModClass('intern', 'Intern_Folder.php');
PHPWS_Core::initModClass('intern', 'Agency.php');
PHPWS_Core::initModClass('intern', 'InternshipFormView.php');
PHPWS_Core::initModClass('intern', 'EditInternshipFormView.php');
PHPWS_Core::initModClass('intern', 'Term.php');
PHPWS_Core::initModClass('intern', 'Department.php');
PHPWS_Core::initModClass('intern', 'Major.php');
PHPWS_Core::initModClass('intern', 'GradProgram.php');
PHPWS_Core::initModClass('intern', 'Subject.php');
$tpl = array();
if (isset($_REQUEST['internship_id'])) {
/* Attempting to edit internship */
try {
$i = InternshipFactory::getInternshipById($_REQUEST['internship_id']);
} catch (InternshipNotFoundException $e) {
NQ::simple('intern', INTERN_ERROR, 'Could not locate an internship with the given ID.');
return;
}
$internshipForm = new EditInternshipFormView('Edit Internship', $i);
$internshipForm->buildInternshipForm();
$internshipForm->plugInternship();
$tpl['TITLE'] = 'Edit Internship';
$form = $internshipForm->getForm();
/*** 'Generate Contract' Button ***/
$tpl['PDF'] = PHPWS_Text::linkAddress('intern', array('action' => 'pdf', 'id' => $i->id));
/*** Document List ***/
$docs = $i->getDocuments();
if (!is_null($docs)) {
foreach ($docs as $doc) {
$tpl['docs'][] = array('DOWNLOAD' => $doc->getDownloadLink('blah'), 'DELETE' => $doc->getDeleteLink());
}
}
$folder = new Intern_Folder(Intern_Document::getFolderId());
$tpl['UPLOAD_DOC'] = $folder->documentUpload($i->id);
$wfState = $i->getWorkflowState();
if (($wfState instanceof SigAuthReadyState || $wfState instanceof SigAuthApprovedState || $wfState instanceof DeanApprovedState || $wfState instanceof RegisteredState) && $docs < 1) {
NQ::simple('intern', INTERN_WARNING, "No documents have been uploaded yet. Usually a copy of the signed contract document should be uploaded.");
}
/******************
* Change History *
*/
if (!is_null($i->id)) {
PHPWS_Core::initModClass('intern', 'ChangeHistoryView.php');
$historyView = new ChangeHistoryView($i);
$tpl['CHANGE_LOG'] = $historyView->show();
}
// Show a warning if in SigAuthReadyState, is international, and not OIED approved
if ($i->getWorkflowState() instanceof SigAuthReadyState && $i->isInternational() && !$i->isOiedCertified()) {
NQ::simple('intern', INTERN_WARNING, 'This internship can not be approved by the Signature Authority bearer until the internship is certified by the Office of International Education and Development.');
}
// Show a warning if in DeanApproved state and is distance_ed campus
if ($i->getWorkflowState() == 'DeanApprovedState' && $i->isDistanceEd()) {
NQ::simple('intern', INTERN_WARNING, 'This internship must be registered by Distance Education.');
}
// Sanity check cource section #
if ($i->isDistanceEd() && ($i->getCourseSection() < 300 || $i->getCourseSection() > 399)) {
NQ::simple('intern', INTERN_WARNING, "This is a distance ed internship, so the course section number should be between 300 and 399.");
}
// Sanity check distance ed radio
if (!$i->isDistanceEd() && ($i->getCourseSection() > 300 && $i->getCourseSection() < 400)) {
NQ::simple('intern', INTERN_WARNING, "The course section number you entered looks like a distance ed course. Be sure to check the Distance Ed option, or double check the section number.");
}
PHPWS_Core::initModClass('intern', 'EmergencyContactFormView.php');
$emgContactDialog = new EmergencyContactFormView($i);
$tpl['ADD_EMERGENCY_CONTACT'] = '<button type="button" class="btn btn-default btn-sm" id="add-ec-button"><i class="fa fa-plus"></i> Add Contact</button>';
$tpl['EMERGENCY_CONTACT_DIALOG'] = $emgContactDialog->getHtml();
} else {
// Attempting to create a new internship
// Check permissions
if (!Current_User::allow('intern', 'create_internship')) {
NQ::simple('intern', INTERN_ERROR, 'You do not have permission to create new internships.');
NQ::close();
PHPWS_Core::home();
}
$tpl['TITLE'] = 'Add Internship';
$internshipForm = new InternshipFormView('Add Internship');
$internshipForm->buildInternshipForm();
$tpl['AUTOFOCUS'] = 'autofocus';
/* Show form with empty fields. */
$form = $internshipForm->getForm();
// Show a disabled button in document list if we are adding an internship.
$tpl['UPLOAD_DOC'] = '<div title="Please save this internship first."><button id="doc-upload-btn" class="btn btn-default btn-sm" title="Please save this internship first." disabled="disabled"><i class="fa fa-upload"></i> Add document</button></div>';
// Show a disabled emergency contact button
$tpl['ADD_EMERGENCY_CONTACT'] = '<div title="Please save this internship first."><button class="btn btn-default btn-sm" id="add-ec-button" disabled="disabled" data-toggle="tooltip" title="first tooltip"><i class="fa fa-plus"></i> Add Contact</button></div>';
}
/*
* If 'missing' is set then we have been redirected
* back to the form because the user didn't type in something and
* somehow got past the javascript.
*/
if (isset($_REQUEST['missing'])) {
$missing = explode(' ', $_REQUEST['missing']);
//javascriptMod('intern', 'missing');
/*
* Set classes on field we are missing.
//.........这里部分代码省略.........
示例7: userAction
//.........这里部分代码省略.........
$content = dgettext('users', 'You already have an account.');
break;
}
$user = new PHPWS_User();
if (PHPWS_User::getUserSetting('new_user_method') == 0) {
$content = dgettext('users', 'Sorry, we are not accepting new users at this time.');
break;
}
$content = User_Form::signup_form($user);
break;
case 'submit_new_user':
$title = dgettext('users', 'New Account Sign-up');
$user_method = PHPWS_User::getUserSetting('new_user_method');
if ($user_method == 0) {
Current_User::disallow(dgettext('users', 'New user signup not allowed.'));
return;
}
$user = new PHPWS_User();
$result = User_Action::postNewUser($user);
if (is_array($result)) {
$content = User_Form::signup_form($user, $result);
} else {
$content = User_Action::successfulSignup($user);
}
break;
case 'logout':
$auth = Current_User::getAuthorization();
$auth->logout();
PHPWS_Core::killAllSessions();
PHPWS_Core::reroute('index.php?module=users&action=reset');
break;
case 'login_page':
if (Current_User::isLogged()) {
PHPWS_Core::home();
}
$title = dgettext('users', 'Login Page');
$content = User_Form::loginPage();
break;
case 'confirm_user':
if (Current_User::isLogged()) {
PHPWS_Core::home();
}
if (User_Action::confirmUser()) {
$title = dgettext('users', 'Welcome!');
$content = dgettext('users', 'Your account has been successfully activated. Please log in.');
} else {
$title = dgettext('users', 'Sorry');
$content = dgettext('users', 'This authentication does not exist.<br />
If you did not log in within the time frame specified in your email, please apply for another account.');
}
User_Action::cleanUpConfirm();
break;
case 'forgot_password':
if (Current_User::isLogged()) {
PHPWS_Core::home();
}
$title = dgettext('users', 'Forgot Password');
$content = User_Form::forgotForm();
break;
case 'post_forgot':
$title = dgettext('users', 'Forgot Password');
if (ALLOW_CAPTCHA) {
PHPWS_Core::initCoreClass('Captcha.php');
if (!Captcha::verify()) {
$content = dgettext('users', 'Captcha information was incorrect.');
$content .= User_Form::forgotForm();
示例8: get
public function get()
{
$this->loadContact();
switch ($_GET['cop']) {
case 'logout':
unset($_SESSION['Contact_User']);
\PHPWS_Core::home();
break;
case 'manager_sign_up':
if (!self::allowNewUserSignup()) {
$this->title = 'Sorry';
$this->content = '<p>New manager sign ups are not permitted at this time.</p>';
} else {
$this->newManagerSetup();
}
break;
case 'edit_property':
$this->checkPermission();
$this->loadProperty($this->contact->id);
$this->editProperty($this->contact->id);
break;
case 'view_properties':
$this->checkPermission();
$this->title = "Properties list";
$this->propertiesList($this->contact->id);
break;
case 'photo_form':
$photo = new Photo();
echo $photo->form();
exit;
break;
case 'activate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(true);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'deactivate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(false);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'edit_contact':
$this->checkPermission();
$this->editContact();
break;
case 'delete_photo':
// called via ajax
$this->checkPermission();
ob_start();
$photo = new Photo($_GET['id']);
$photo->delete();
echo Photo::getThumbs($photo->pid);
exit;
break;
case 'delete_property':
$this->checkPermission();
$this->loadProperty();
// double security
if ($this->property->contact_id == $this->contact->id) {
$this->property->delete();
}
\PHPWS_Core::goBack();
break;
case 'make_main':
$photo = new Photo($_GET['id']);
$photo->makeMain();
exit;
break;
case 'update':
$this->checkPermission();
$this->loadProperty();
$this->property->update();
\PHPWS_Core::goBack();
break;
case 'checkUsername':
$this->checkUsername();
exit;
case 'checkEmail':
$this->checkEmail();
exit;
}
$this->display();
}
示例9: userMenu
public function userMenu($action = null)
{
$javascript = false;
if (empty($action)) {
if (!isset($_REQUEST['uop'])) {
PHPWS_Core::errorPage('404');
}
$action = $_REQUEST['uop'];
}
switch ($action) {
case 'message':
$this->loadMessage();
if (empty($this->message)) {
PHPWS_Core::home();
}
$this->title = dgettext('signup', 'Signup');
break;
case 'signup_sheet':
$this->loadPeep();
$this->loadForm('user_signup');
break;
case 'slot_signup':
if ($this->postPeep()) {
if ($this->saveUnregistered()) {
$this->forwardMessage(dgettext('signup', 'You should receive an email allowing you to verify your application.<br />You have one hour to confirm your application.'), dgettext('signup', 'Thank you'));
$this->sendMessage();
} else {
$this->loadForm('user_signup');
}
} else {
$this->loadForm('user_signup');
}
break;
case 'confirm':
$this->confirmPeep();
$this->purgeOverdue();
break;
}
$tpl['TITLE'] = $this->title;
$tpl['MESSAGE'] = $this->message;
$tpl['CONTENT'] = $this->content;
if ($javascript) {
Layout::nakedDisplay(PHPWS_Template::process($tpl, 'signup', 'usermain.tpl'));
} else {
Layout::add(PHPWS_Template::process($tpl, 'signup', 'usermain.tpl'));
}
}