本文整理汇总了PHP中UserStatus类的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus类的具体用法?PHP UserStatus怎么用?PHP UserStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wfUpdateUserStatus
function wfUpdateUserStatus($username, $gender, $province, $city, $birthday, $status)
{
global $wgUser;
$city = trim($city);
$status = trim($status);
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_UNKNOWN);
// This feature is only available for logged-in users.
if (!$wgUser->isLoggedIn()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_LOGGED_IN);
return $out;
}
// No need to allow blocked users to access this page, they could abuse it, y'know.
if ($wgUser->isBlocked()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_BLOCKED);
return $out;
}
// Database operations require write mode
if (wfReadOnly()) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_READ_ONLY);
return $out;
}
// Are we even allowed to do this?
if (!$wgUser->isAllowed('edit')) {
$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_ALLOWED);
return $out;
}
if ($username === $wgUser->getName()) {
$us = new UserStatus($wgUser);
if ($us->setAll($gender, $province, $city, $birthday, $status)) {
$out = ResponseGenerator::getJson(ResponseGenerator::SUCCESS);
}
}
return $out;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:34,代码来源:UserStatus_AjaxFunctions.php
示例2: wfUserFollowsInfoResponse
function wfUserFollowsInfoResponse($username)
{
$user = User::newFromName($username);
$ust = new UserStatus($user);
$sites = $ust->getUserAllInfo();
$ret = array('success' => true, 'result' => $sites);
$out = json_encode($ret);
//TODO: use wfMessage instead of hard code
return $out;
}
开发者ID:volvor,项目名称:SocialProfile,代码行数:10,代码来源:UserUserFollows_AjaxFunctions.php
示例3: getHMS
public static function getHMS()
{
$rh = getallheaders();
if (isset(HMSFactory::$hms)) {
return HMSFactory::$hms;
} else {
if (isset($_REQUEST['ajax']) || !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' || isset($_REQUEST['callback']) || array_key_exists('Accept', $rh) && stripos($rh['Accept'], 'application/json') !== FALSE) {
PHPWS_Core::initModClass('hms', 'AjaxHMS.php');
HMSFactory::$hms = new AjaxHMS();
} else {
if (UserStatus::isAdmin()) {
PHPWS_Core::initModClass('hms', 'AdminHMS.php');
HMSFactory::$hms = new AdminHMS();
} else {
if (UserStatus::isUser()) {
PHPWS_Core::initModClass('hms', 'UserHMS.php');
HMSFactory::$hms = new UserHMS();
} else {
// Guest
PHPWS_Core::initModClass('hms', 'GuestHMS.php');
HMSFactory::$hms = new GuestHMS();
}
}
}
}
return HMSFactory::$hms;
}
开发者ID:jlbooker,项目名称:homestead,代码行数:27,代码来源:HMSFactory.php
示例4: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'assign_by_floor')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to assign students by floor.');
}
$username = $context->get('username');
$banner_id = (int) $context->get('banner_id');
$reason = $context->get('reason');
$meal_plan = $context->get('meal_plan');
$bed_id = $context->get('bed_id');
$term = Term::getSelectedTerm();
try {
if ($banner_id) {
$student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm());
} elseif (!empty($username)) {
$student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm());
} else {
$context->setContent(json_encode(array('status' => 'failure', 'message' => 'Did not receive Banner ID or user name.')));
return;
}
try {
HMS_Assignment::assignStudent($student, $term, null, $bed_id, $meal_plan, null, null, $reason);
} catch (AssignmentException $e) {
$context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
return;
}
$message = $student->first_name . ' ' . $student->last_name;
$context->setContent(json_encode(array('status' => 'success', 'message' => $message, 'student' => $student)));
} catch (\StudentNotFoundException $e) {
$context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
}
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:JSONAssignStudentCommand.php
示例5: testBelongTo
public function testBelongTo()
{
$this->createPostsWithComments(5, 10);
$this->assertEqual(BlogPost::count(), 5);
$this->assertEqual(BlogComment::count(), 50);
$comment = BlogComment::findFirst(['conditions' => 'title = ?', 'values' => ['Comment 4 to Post 3']]);
$this->assertEqual($comment->message, 'This is a comment message 3:4!');
// Test belongsTo collection
$queryCount = TipyDAO::$queryCount;
$post = $comment->post;
// We got a new query
$this->assertEqual(TipyDAO::$queryCount, $queryCount + 1);
$this->assertNotEqual($post, null);
$this->assertEqual($post->title, 'Post 3');
// Test cached association
$this->assertNotEqual($comment->associationsCache["post"], null);
$this->assertEqual($post, $comment->associationsCache["post"]);
// Test no query
$queryCount = TipyDAO::$queryCount;
$postAgain = $comment->post;
// no more queries
$this->assertEqual(TipyDAO::$queryCount, $queryCount);
$this->assertEqual($post, $postAgain);
// belongsTo crash
$status = UserStatus::create(['name' => 'Some status']);
$user = User::create(['login' => 'login', 'password' => 'password', 'email' => '[email protected]', 'userStatusId' => $status->id]);
$this->assertEqual($user->userStatus->name, 'Some status');
}
开发者ID:smetana,项目名称:tipy,代码行数:28,代码来源:AssociationsTest.php
示例6: show
public function show()
{
$username = UserStatus::getUsername();
$currentTerm = Term::getCurrentTerm();
$student = StudentFactory::getStudentByUsername($username, $currentTerm);
$applicationTerm = $student->getApplicationTerm();
$tpl = array();
$tpl['TITLE'] = 'Contact Form';
$form = new PHPWS_Form();
$form->addText('name');
$form->setLabel('name', 'Name');
$form->addText('email');
$form->setLabel('email', 'Email Address');
$form->addText('phone');
$form->setLabel('phone', 'Phone number');
$form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
$form->setLabel('stype', 'Classification');
$form->addTextArea('comments');
$form->setLabel('comments', 'Question, Comments, or Description of the Problem');
$form->addSubmit('Submit');
$form->mergeTemplate($tpl);
$cmd = CommandFactory::getCommand('SubmitContactForm');
$cmd->setUsername($username);
$cmd->setApplicationTerm($applicationTerm);
$cmd->setStudentType($student->getType());
$cmd->initForm($form);
$tpl = $form->getTemplate();
//var_dump($tpl);exit;
return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:30,代码来源:ContactFormView.php
示例7: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
$requestId = $context->get('requestId');
$errorCmd = CommandFactory::getCommand('LotteryShowDenyRoommateRequest');
$errorCmd->setRequestId($requestId);
# Confirm the captcha
PHPWS_Core::initCoreClass('Captcha.php');
$captcha = Captcha::verify(TRUE);
if ($captcha === FALSE) {
NQ::simple('hms', hms\NotificationView::ERROR, 'The words you entered were incorrect. Please try again.');
$errorCmd->redirect();
}
# Get the roommate request
$request = HMS_Lottery::get_lottery_roommate_invite_by_id($context->get('requestId'));
# Make sure that the logged in user is the same as the confirming the request
if (UserStatus::getUsername() != $request['asu_username']) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Invalid roommate request. You can not confirm that roommate request.');
$errorCmd->redirect();
}
# Deny the roommate requst
try {
HMS_Lottery::denyRoommateRequest($requestId);
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'There was an error denying the roommate request. Please contact University Housing.');
$errorCmd->redirect();
}
# Log that it happened
PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
HMS_Activity_Log::log_activity(UserStatus::getUsername(), ACTIVITY_LOTTERY_ROOMMATE_DENIED, UserStatus::getUsername(), 'Captcha words: ' . $captcha);
# Success
NQ::simple('hms', hms\NotificationView::SUCCESS, 'The roommate request was successfully declined.');
$successCmd = CommandFactory::getCommand('ShowStudentMenu');
$successCmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:35,代码来源:LotteryDenyRoommateRequestCommand.php
示例8: execute
function execute(CommandContext $context)
{
if (!\UserStatus::isAdmin()) {
header('Location: ./?action=ShowGuestHome');
}
$image_url = "https://placeholdit.imgix.net/~text?txtsize=33&txt=250%C3%97150&w=250&h=150";
if ($_FILES['event_image']['size'] > 0 and $_FILES['event_image']['size'] < 2097152) {
$tempFile = $_FILES['event_image']['tmp_name'];
$targetPath = PHPWS_SOURCE_DIR . "mod/events/images/";
$targetFile = $targetPath . $_FILES['event_image']['name'];
$image_url = "mod/events/images/" . $_FILES['event_image']['name'];
move_uploaded_file($tempFile, $targetFile);
}
var_dump($_POST);
var_dump($context);
exit;
$event_name = $context->get('event_name');
$event_location = $context->get('event_location');
$event_date = strtotime($context->get('event_date')) + 86399;
$ticket_prices = $context->get('ticket_prices');
$ticket_location = $context->get('ticket_location');
$open_time = $context->get('open_time');
$start_time = $context->get('start_time');
$event_restrictions = $context->get('event_restrictions');
$artist_details = $context->get('event_details');
$db = \Database::getDB();
$pdo = $db->getPDO();
$query = "INSERT INTO events_events (id, eventname, eventlocation, eventdate, ticketprices, ticketlocation, opentime, starttime, eventrestrictions, artistdetails, imageurl)\n\t\t\t\t\tVALUES (nextval('events_seq'), :event_name, :event_location, :event_date, :ticket_prices, :ticket_location, :open_time, :start_time, :event_restrictions, :artist_details, :image_url)";
$sth = $pdo->prepare($query);
$sth->execute(array('event_name' => $event_name, 'event_location' => $event_location, 'event_date' => $event_date, 'ticket_prices' => $ticket_prices, 'ticket_location' => $ticket_location, 'open_time' => $open_time, 'start_time' => $start_time, 'event_restrictions' => $event_restrictions, 'artist_details' => $artist_details, 'image_url' => $image_url));
header('Location: ./?action=ShowAdminHome');
}
开发者ID:sinkdb,项目名称:events,代码行数:32,代码来源:AddEventCommand.php
示例9: beforeLogout
public function beforeLogout()
{
$uid = $this->getId();
Session::model()->deleteAllByAttributes(array("uid" => $uid));
UserStatus::model()->updateByPk($uid, array("invisible" => 0));
return true;
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:7,代码来源:ICUser.php
示例10: getStudentById
public function getStudentById($id, $term)
{
// Sanity checking on the Banner ID
$id = trim($id);
if (!isset($id) || empty($id) || $id == '') {
throw new InvalidArgumentException('Missing Banner id. Please enter a valid Banner ID (nine digits).');
}
if (strlen($id) > 9 || strlen($id) < 9 || !preg_match("/^[0-9]{9}\$/", $id)) {
throw new InvalidArgumentException('That was not a valid Banner ID. Please enter a valid Banner ID (nine digits).');
}
$student = new Student();
$soap = SOAP::getInstance(UserStatus::getUsername(), UserStatus::isAdmin() ? SOAP::ADMIN_USER : SOAP::STUDENT_USER);
$soapData = $soap->getStudentProfile($id, $term);
if ($soapData->error_num == 1101 && $soapData->error_desc == 'LookupStudentID') {
PHPWS_Core::initModClass('hms', 'exception/StudentNotFoundException.php');
throw new StudentNotFoundException('No matching student found.');
} elseif (isset($soapData->error_num) && $soapData->error_num > 0) {
//test($soapData,1);
throw new SOAPException("Error while accessing SOAP interface: {$soapData->error_desc} ({$soapData->error_num})", $soapData->error_num, 'getStudentProfile', array($id, $term));
}
SOAPDataProvider::plugSOAPData($student, $soapData);
//SOAPDataProvider::applyExceptions($student);
require_once PHPWS_SOURCE_DIR . SOAP_DATA_OVERRIDE_PATH;
$dataOverride = new SOAPDataOverride();
$dataOverride->applyExceptions($student);
$student->setDataSource(get_class($this));
return $student;
}
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:SOAPDataProvider.php
示例11: show
public function show()
{
if (\UserStatus::isGuest()) {
return '';
}
$terms = \Term::getTermsAssoc();
$current = \Term::getCurrentTerm();
if (isset($terms[$current])) {
$terms[$current] .= ' (Current)';
}
$form = new \PHPWS_Form('term_selector');
$cmd = \CommandFactory::getCommand('SelectTerm');
$cmd->initForm($form);
$form->addDropBox('term', $terms);
$tags = $form->getTemplate();
$currentTerm = \Term::getSelectedTerm();
$tags['TERM_OPTIONS'] = array();
foreach ($tags['TERM_VALUE'] as $key => $value) {
$selected = '';
if ($key == $currentTerm) {
$selected = 'selected="selected"';
}
$tags['TERM_OPTIONS'][] = array('id' => $key, 'term' => $value, 'selected' => $selected);
}
javascript('jquery');
javascriptMod('hms', 'jqueryCookie');
javascript('modules/hms/SelectTerm');
return \PHPWS_Template::process($tags, 'hms', 'admin/SelectTerm.tpl');
}
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:TermSelector.php
示例12: __construct
public function __construct()
{
parent::__construct();
// Check permissions
if (UserStatus::isAdmin()) {
if (Current_User::allow('hms', 'learning_community_maintenance')) {
$this->addCommandByName('Add/Edit Communities', 'ShowEditRlc');
}
if (Current_User::allow('hms', 'view_rlc_applications')) {
$this->addCommandByName('Assign Applicants to RLCs', 'ShowAssignRlcApplicants');
$this->addCommandByName('View Denied Applications', 'ShowDeniedRlcApplicants');
}
if (Current_User::allow('hms', 'learning_community_maintenance')) {
$this->addCommandByName('Send RLC Email Invites', 'ShowSendRlcInvites');
}
if (Current_User::allow('hms', 'view_rlc_members')) {
$this->addCommandByName('View RLC Members by RLC', 'ShowSearchByRlc');
$this->addCommandByName('View RLC Assignments', 'ViewRlcAssignments');
}
if (Current_User::allow('hms', 'email_rlc_rejections')) {
// Using JSConfirm, ask user if the _really_ want to send the emails
$onConfirmCmd = CommandFactory::getCommand('SendRlcRejectionEmails');
$cmd = CommandFactory::getCommand('JSConfirm');
$cmd->setLink('Send RLC Rejection Emails');
$cmd->setTitle('Send RLC Rejection Emails');
$cmd->setQuestion('Send notification emails to denied RLC applicants for selected term?');
$cmd->setOnConfirmCommand($onConfirmCmd);
$this->addCommand('Send RLC Rejection Emails', $cmd);
}
}
}
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:RLCMenu.php
示例13: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'view_activity_log')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to view the activity log.');
}
PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
PHPWS_Core::initModClass('hms', 'ActivityLogView.php');
$actee = $context->get('actee');
$actor = $context->get('actor');
$notes = $context->get('notes');
$exact = $context->get('exact');
$begin = $context->get('begin');
$end = $context->get('end');
if (!is_null($begin) && !is_null($end) && $end <= $begin) {
unset($_REQUEST['begin_year'], $_REQUEST['begin_month'], $_REQUEST['begin_day'], $_REQUEST['end_year'], $_REQUEST['end_month'], $_REQUEST['end_day']);
$begin = null;
$end = null;
NQ::simple('hms', hms\NotificationView::WARNING, 'Invalid date range. The search results will not be filtered by date.');
}
$activityMap = HMS_Activity_Log::getActivityMapping();
$activities = array();
foreach ($activityMap as $i => $t) {
$act = $context->get("a{$i}");
if (!is_null($act)) {
$activities[] = $i;
}
}
$activityLogView = new ActivityLogView($actee, $actor, $notes, $exact, $begin, $end, $activities);
$context->setContent($activityLogView->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:ShowActivityLogCommand.php
示例14: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'bed_structure')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to remove a bed.');
}
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
$viewCmd = CommandFactory::getCommand('EditRoomView');
$viewCmd->setRoomId($context->get('roomId'));
$bedId = $context->get('bedId');
$roomId = $context->get('roomId');
if (!isset($roomId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing room ID.');
$viewCmd->redirect();
}
if (!isset($bedId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing bed ID.');
$viewCmd->redirect();
}
# Try to delete the bed
try {
HMS_Bed::deleteBed($bedId);
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'There was an error deleting the bed: ' . $e->getMessage());
$viewCmd->redirect();
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Bed successfully deleted.');
$viewCmd->redirect();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:DeleteBedCommand.php
示例15: __construct
public function __construct()
{
parent::__construct();
// Check permissions
if (UserStatus::isAdmin()) {
if (Current_User::allow('hms', 'hall_view')) {
$residenceHallCmd = CommandFactory::getCommand('SelectResidenceHall');
$residenceHallCmd->setTitle('Edit a Residence Hall');
$residenceHallCmd->setOnSelectCmd(CommandFactory::getCommand('EditResidenceHallView'));
$this->addCommand('Edit a residence hall', $residenceHallCmd);
}
if (Current_User::allow('hms', 'floor_view')) {
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$this->addCommand('Edit a floor', $floorCmd);
}
if (Current_User::allow('hms', 'room_view')) {
$roomCmd = CommandFactory::getCommand('SelectRoom');
$roomCmd->setTitle('Edit a Room');
$roomCmd->setOnSelectCmd(CommandFactory::getCommand('EditRoomView'));
$this->addCommand('Edit a room', $roomCmd);
}
if (Current_User::allow('hms', 'bed_view')) {
$bedCmd = CommandFactory::getCommand('SelectBed');
$bedCmd->setTitle('Edit a Bed');
$bedCmd->setOnSelectCmd(CommandFactory::getCommand('EditBedView'));
$this->addCommand('Edit a bed', $bedCmd);
}
}
}
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:ResidenceHallMenu.php
示例16: render
function render()
{
// get the current page
$this->_page = $this->getCurrentPageFromRequest();
$this->_status = $this->getStatusFromRequest();
$this->_dest = $this->_getDestination();
// get the users of the blog
$users = new Users();
$siteUsers = $users->getAllUsers($this->_status, true, $this->_page, DEFAULT_ITEMS_PER_PAGE);
$numUsers = $users->getNumUsers($this->_status);
// in case of problems, empty array...
if (!$siteUsers) {
$siteUsers = array();
}
// notify the event
$this->notifyEvent(EVENT_USERS_LOADED, array("users" => &$blogUsers));
// calculate the links to the different pages
$pager = new Pager("?op=mailcentreUserSelector&&dest=" . $this->_dest . "&status=" . $this->_status . "&page=", $this->_page, $numUsers, DEFAULT_ITEMS_PER_PAGE);
// and generate the view
$this->setValue("siteusers", $siteUsers);
$this->setValue("userstatus", UserStatus::getStatusList(true));
$this->setValue("pager", $pager);
$this->setValue("currentstatus", $this->_status);
$this->setValue("dest", $this->_dest);
parent::render();
}
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:26,代码来源:mailcentreuserselectorview.class.php
示例17: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit floors.');
}
// Check for a hall ID
$floorId = $context->get('floor');
if (!isset($floorId)) {
throw new InvalidArgumentException('Missing floor ID.');
}
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
PHPWS_Core::initModClass('hms', 'FloorView.php');
$floor = new HMS_Floor($floorId);
if ($floor->term != Term::getSelectedTerm()) {
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$floorCmd->redirect();
}
$hall = $floor->get_parent();
$floorView = new FloorView($hall, $floor);
$context->setContent($floorView->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:25,代码来源:EditFloorViewCommand.php
示例18: execute
/**
* Executes this pulse. Does the withdrawn search and emails the results.
*/
public function execute()
{
// Reschedule the next run of this process
$sp = $this->makeClone();
$sp->execute_at = strtotime("tomorrow");
$sp->save();
// Load some classes
PHPWS_Core::initModClass('hms', 'HMS.php');
PHPWS_Core::initModClass('hms', 'WithdrawnSearch.php');
PHPWS_Core::initModClass('hms', 'HMS_Email.php');
PHPWS_Core::initModClass('hms', 'UserStatus.php');
UserStatus::wearMask('HMS System');
// The search is run over all future terms
$terms = Term::getFutureTerms();
$text = "";
foreach ($terms as $term) {
$search = new WithdrawnSearch($term);
$search->doSearch();
$text .= "\n\n=========== " . Term::toString($term) . " ===========\n\n";
$text .= $search->getTextView();
}
$text = $search->getTextView();
HMS_Email::sendWithdrawnSearchOutput($text);
UserStatus::removeMask();
HMS::quit();
}
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:WithdrawnSearchEmailCommand.php
示例19: execute
public function execute(CommandContext $context)
{
$id = $context->get('roommateId');
if (is_null($id)) {
throw new InvalidArgumentException('Must set roommateId');
}
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
$roommate = new HMS_Roommate($id);
if ($roommate->id == 0) {
throw new InvalidArgumentException('Invalid roommateId ' . $id);
}
$username = UserStatus::getUsername();
if ($username != $roommate->requestee) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException("{$username} tried to display confirmation screen for pairing {$roommate->id}");
}
$tpl = array();
$acceptCmd = CommandFactory::getCommand('ShowRoommateConfirmAccept');
$acceptCmd->setRoommateId($roommate->id);
$tpl['ACCEPT'] = $acceptCmd->getURI();
$rejectCmd = CommandFactory::getCommand('RoommateReject');
$rejectCmd->setRoommateId($roommate->id);
$tpl['DECLINE'] = $rejectCmd->getURI();
$cancelCmd = CommandFactory::getCommand('ShowStudentMenu');
$tpl['CANCEL'] = $cancelCmd->getURI();
$requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
$tpl['REQUESTOR_NAME'] = $requestor->getFullName();
$context->setContent(PHPWS_Template::process($tpl, 'hms', 'student/roommate_accept_reject_screen.tpl'));
}
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:ShowRoommateConfirmationCommand.php
示例20: execute
/**
* (non-PHPdoc)
* @see Command::execute()
*/
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'HousingApplication.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$term = $context->get('term');
// Check if the student has already applied. If so, redirect to the student menu
$app = HousingApplication::getApplicationByUser(UserStatus::getUsername(), $term);
if (isset($result) && $result->getApplicationType == 'offcampus_waiting_list') {
NQ::simple('hms', hms\NotificationView::ERROR, 'You have already enrolled on the on-campus housing Open Waiting List for this term.');
$menuCmd = CommandFactory::getCommand('ShowStudentMenu');
$menuCmd->redirect();
}
// Make sure the student agreed to the terms, if not, send them back to the terms & agreement command
$event = $context->get('event');
$_SESSION['application_data'] = array();
// If they haven't agreed, redirect to the agreement
if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
$onAgree = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
$onAgree->setTerm($term);
$agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
$agreementCmd->setTerm($term);
$agreementCmd->setAgreedCommand($onAgree);
$agreementCmd->redirect();
}
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
PHPWS_Core::initModClass('hms', 'ReApplicationOffCampusFormView.php');
$view = new ReApplicationOffCampusFormView($student, $term);
$context->setContent($view->show());
}
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:ShowOffCampusWaitListApplicationCommand.php
注:本文中的UserStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论