当前位置: 首页>>代码示例>>PHP>>正文


PHP Current_User::getUsername方法代码示例

本文整理汇总了PHP中Current_User::getUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::getUsername方法的具体用法?PHP Current_User::getUsername怎么用?PHP Current_User::getUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Current_User的用法示例。


在下文中一共展示了Current_User::getUsername方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(CommandContext $context)
 {
     $term = Term::getSelectedTerm();
     $messageAll = Current_User::allow('hms', 'email_all');
     $db = new PHPWS_DB('hms_residence_hall');
     $db->addWhere('term', $term);
     $results = $db->getObjects('HMS_Residence_Hall');
     if (PHPWS_Error::logIfError($results) || is_null($results)) {
         $errorMsg = array();
         if (is_null($results)) {
             $errorMsg['error'] = 'You do not have permission to message any halls, sorry.';
         } else {
             $errorMsg['error'] = 'There was a problem reading the database, please try reloading the page.  If the problem persists contact ESS.';
         }
         echo json_encode($errorMsg);
         exit;
     }
     $permission = new HMS_Permission();
     $data = array();
     foreach ($results as $hall) {
         $somethingEnabled = false;
         $floors = $hall->get_floors();
         unset($obj);
         $obj = new stdClass();
         $obj->name = $hall->getHallName();
         $obj->id = $hall->getId();
         $obj->floors = array();
         //$blah = 'Verify: ' . ($permission->verify(UserStatus::getUsername(), $hall, 'email') ? 'true' : 'false');
         if ($permission->verify(UserStatus::getUsername(), $hall, 'email') || $messageAll) {
             $obj->enabled = true;
             $somethingEnabled = true;
             foreach ($floors as $floor) {
                 unset($floor_obj);
                 $floor_obj = new stdClass();
                 $floor_obj->name = "Floor: " . $floor->getFloorNumber();
                 $floor_obj->id = $floor->getId();
                 $floor_obj->enabled = true;
                 $obj->floors[] = $floor_obj;
             }
         } else {
             $obj->enabled = false;
             foreach ($floors as $floor) {
                 unset($floor_obj);
                 $floor_obj = new stdClass();
                 $floor_obj->name = "Floor: " . $floor->getFloorNumber();
                 $floor_obj->id = $floor->getId();
                 $floor_obj->enabled = $permission->verify(Current_User::getUsername(), $floor, 'email');
                 $obj->floors[] = $floor_obj;
                 if ($floor_obj->enabled) {
                     $somethingEnabled = true;
                 }
             }
         }
         if ($somethingEnabled) {
             $data[] = $obj;
         }
     }
     echo json_encode($data);
     exit;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:60,代码来源:ListAllowedHallsCommand.php

示例2: getUsername

 public static function getUsername($respectMask = true)
 {
     if (self::isMasquerading() && $respectMask) {
         return $_SESSION['hms_masquerade_username'];
     }
     return Current_User::getUsername();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:7,代码来源:UserStatus.php

示例3: execute

 /**
  * The main function for executing the command.
  */
 public function execute()
 {
     $returnData = array('username' => \Current_User::getUsername(), 'deity' => \Current_User::isDeity(), 'view' => \Current_User::allow('appsync', 'view'), 'purge' => \Current_User::allow('appsync', 'purge'));
     // Echo the values back to the front end after encoding them.
     echo json_encode($returnData);
     exit;
 }
开发者ID:csdetschjr,项目名称:OrgSyncAdmin,代码行数:10,代码来源:AjaxGetUserPermissions.php

示例4: __construct

 public function __construct($asu_username, $term)
 {
     $this->asu_username = $asu_username;
     $this->term = $term;
     $this->created_on = time();
     $this->created_by = Current_User::getUsername();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:7,代码来源:HMS_Eligibility_Waiver.php

示例5: execute

 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'approve_rlc_applications')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to approve/deny RLC applications.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     // Remove assignment
     $assignment = HMS_RLC_Assignment::getAssignmentById($context->get('assignId'));
     $rlcName = $assignment->getRlcName();
     $rlcApp = $assignment->getApplication();
     if (!is_null($assignment)) {
         $assignment->delete();
     } else {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Could not find an RLC assignment with that id.');
     }
     HMS_Activity_Log::log_activity($rlcApp->getUsername(), ACTIVITY_RLC_UNASSIGN, Current_User::getUsername(), "Removed from {$rlcName}");
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Removed from RLC');
     // Deny application
     $rlcApp->denied = 1;
     $rlcApp->save();
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'RLC Application denied');
     HMS_Activity_Log::log_activity($rlcApp->getUsername(), ACTIVITY_DENIED_RLC_APPLICATION, Current_User::getUsername(), 'RLC Application Denied');
     $context->goBack();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:RemoveDenyRlcAssignmentCommand.php

示例6: getProvider

 /**
  * Returns a concrete instance of a MajorsProvider object,
  * which can be then be used to fetch the array of Major objects
  *
  * @return MajorsProvider
  */
 public static function getProvider()
 {
     if (STUDENT_DATA_TEST) {
         return new TestMajorsProvider(\Current_User::getUsername());
     }
     return new BannerMajorsProvider(\Current_User::getUsername());
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:13,代码来源:MajorsProviderFactory.php

示例7: execute

 /**
  * The main function for executing the command.
  */
 public function execute()
 {
     // Retrieve the values from the request
     $umbrellaId = $_REQUEST['umbrellaId'];
     // Retrieve other important values and objects
     $username = \Current_User::getUsername();
     $permissions = \AppSync\UmbrellaAdminFactory::getUmbrellaAdmin($username, $umbrellaId);
     // If the permissions array is empty then the user does not have permission to use this command
     // throw an error back to the front end.
     if (sizeof($permissions) == 0) {
         echo '<div style="display: none;">User does not have permission to access this data.</div>';
         exit;
     }
     // Attempt to retrieve the portals and do a fuzzy search of them for the searchString
     try {
         $portals = \AppSync\PortalFactory::getPortals();
         $searchString = $_REQUEST['searchString'];
         $umbrella = $_REQUEST['umbrellaId'];
         $portList = $this->portalFuzzySearch($searchString, $umbrella, $portals);
         echo $this->encodePortals($portList);
     } catch (\Exception $e) {
         echo '<div style="display: none;">' . $e->getMessage() . '</div>';
     }
     exit;
 }
开发者ID:csdetschjr,项目名称:OrgSyncAdmin,代码行数:28,代码来源:GetSearchSuggestions.php

示例8: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     $tpl = array();
     $template = new PHPWS_Template('hms');
     $template->setFile('admin/review_hall_email.tpl');
     if (is_array($this->floors)) {
         foreach ($this->floors as $floorId) {
             $floor = new HMS_Floor();
             $floor->id = $floorId;
             $floor->load();
             $floor->loadHall();
             $tpl['halls'][$floor->_hall->getHallName()][] = 'Floor ' . $floor->getFloorNumber();
         }
     } else {
         $floor = new HMS_Floor();
         $floor->id = $this->floors;
         $floor->load();
         $floor->loadHall();
         $tpl['halls'][$floor->_hall->getHallName()][] = 'Floor ' . $floor->getFloorNumber();
     }
     $tpl['FROM'] = $this->anonymous && Current_User::allow('hms', 'anonymous_notifications') ? FROM_ADDRESS : Current_User::getUsername() . '@' . DOMAIN_NAME;
     $tpl['SUBJECT'] = $this->subject;
     $tpl['BODY'] = preg_replace('/\\n/', '<br />', $this->body);
     $editCmd = CommandFactory::getCommand('ShowHallNotificationEdit');
     $tpl['EDIT_URI'] = $editCmd->getUri();
     /*
     $form->addHidden('anonymous',   isset($this->anonymous) ? $this->anonymous : '');
     $form->addHidden('subject',     $this->subject);
     $form->addHidden('body',        $this->body);
     $form->addHidden('hall',        $this->halls);
     $form->addHidden('floor',       $this->floors);
     $form->addSubmit('back',        'Edit Message');
     */
     $form2 = new PHPWS_Form('review_email');
     $sendCmd = CommandFactory::getCommand('SendNotificationEmails');
     $sendCmd->initForm($form2);
     $form2->addHidden('anonymous', isset($this->anonymous) ? $this->anonymous : '');
     $form2->addHidden('subject', $this->subject);
     $form2->addHidden('body', $this->body);
     $form2->addHidden('hall', $this->halls);
     $form2->addHidden('floor', $this->floors);
     foreach ($tpl['halls'] as $hall => $floors) {
         foreach ($floors as $floor) {
             $template->setCurrentBlock('floors');
             $template->setData(array("FLOOR" => $floor));
             $template->parseCurrentBlock();
         }
         $template->setCurrentBlock('halls');
         $template->setData(array("HALL" => $hall));
         $template->parseCurrentBlock();
     }
     $form2->mergeTemplate($tpl);
     $tpl = $form2->getTemplate();
     $template->setCurrentBlock('remainder');
     $template->setData($tpl);
     $template->parseCurrentBlock();
     return $template->get();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:59,代码来源:ReviewHallNotificationMessageView.php

示例9: getProvider

 /**
  * Returns a concrete instance of a StudenDataProvider object,
  * which can then be used to create Student object
  *
  * @return StudentDataProvider
  */
 public static function getProvider()
 {
     if (STUDENT_DATA_TEST) {
         return new TestStudentProvider(\Current_User::getUsername());
     }
     // Other data providers could be used here..
     return new BannerStudentProvider(\Current_User::getUsername());
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:14,代码来源:StudentProviderFactory.php

示例10: execute

 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'cancel_housing_application')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to cancel housing applications.');
     }
     // Check for a housing application id
     $applicationId = $context->get('applicationId');
     if (!isset($applicationId) || is_null($applicationId)) {
         throw new InvalidArgumentException('Missing housing application id.');
     }
     // Check for a cancellation reason
     $cancelReason = $context->get('cancel_reason');
     if (!isset($cancelReason) || is_null($cancelReason)) {
         throw new InvalidArgumentException('Missing cancellation reason.');
     }
     // Load the housing application
     PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
     $application = HousingApplicationFactory::getApplicationById($applicationId);
     // Load the student
     $student = $application->getStudent();
     $username = $student->getUsername();
     $term = $application->getTerm();
     // Load the cancellation reasons
     $reasons = HousingApplication::getCancellationReasons();
     // Check for an assignment and remove it
     // Decide which term to use - If this application is in a past fall term, then use the current term
     if ($term < Term::getCurrentTerm() && Term::getTermSem($term) == TERM_FALL) {
         $assignmentTerm = Term::getCurrentTerm();
     } else {
         $assignmentTerm = $term;
     }
     PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
     $assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $assignmentTerm);
     if (isset($assignment)) {
         // TODO: Don't hard code cancellation refund percentage
         HMS_Assignment::unassignStudent($student, $assignmentTerm, 'Application cancellation: ' . $reasons[$cancelReason], UNASSIGN_CANCEL, 100);
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     $rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($username, $term);
     if (!is_null($rlcAssignment)) {
         $rlcAssignment->delete();
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     $rlcApplication = HMS_RLC_Application::getApplicationByUsername($username, $term);
     if (!is_null($rlcApplication)) {
         $rlcApplication->denied = 1;
         $rlcApplication->save();
         HMS_Activity_Log::log_activity($username, ACTIVITY_DENIED_RLC_APPLICATION, \Current_User::getUsername(), Term::toString($term) . ' Denied RLC Application due to Contract Cancellation');
     }
     // Cancel the application
     $application->cancel($cancelReason);
     $application->save();
     echo 'success';
     exit;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:56,代码来源:CancelHousingApplicationCommand.php

示例11: display

 /**
  * (non-PHPdoc)
  * @see UI::display()
  */
 public function display()
 {
     // Get the list of departments the current user has access to
     $departments = Department::getDepartmentsAssocForUsername(\Current_User::getUsername());
     $renderedDepts = '';
     foreach ($departments as $key => $val) {
         $renderedDepts .= \PHPWS_Template::process(array('ID' => $key, 'DEPT' => $val), 'intern', 'facultySelectOption.tpl');
     }
     $tpl = array();
     $tpl['FACULTY_EDIT'] = javascriptMod('intern', 'facultyEdit', array('DEPTS' => $renderedDepts));
     return \PHPWS_Template::process($tpl, 'intern', 'editFaculty.tpl');
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:16,代码来源:FacultyUI.php

示例12: __construct

 /**
  * Constructor
  *
  * @param HMS_Room $room
  * @param integer $damageType
  * @param string $note
  */
 public function __construct(HMS_Room $room, $term, $damageType, $side, $note)
 {
     $this->id = null;
     $this->room_persistent_id = $room->getPersistentId();
     $this->term = $term;
     $this->damage_type = $damageType;
     $this->side = $side;
     $this->repaired = false;
     $this->note = $note;
     $this->reported_by = Current_User::getUsername();
     $this->reported_on = time();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:19,代码来源:RoomDamage.php

示例13: execute

 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'approve_rlc_applications')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to approve/deny RLC applications.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     $app = HMS_RLC_Application::getApplicationById($context->get('applicationId'));
     $app->denied = 1;
     $app->save();
     PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
     HMS_Activity_Log::log_activity($app->username, 28, Current_User::getUsername(), 'Application Denied');
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Application denied.');
     $context->goBack();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:15,代码来源:DenyRlcApplicationCommand.php

示例14: log

 public static function log($message)
 {
     if (class_exists('Current_User') && isset($_SESSION['User'])) {
         $username = Current_User::getUsername();
     } else {
         $username = _('Unknown user');
     }
     $ip = $_SERVER['REMOTE_ADDR'];
     if (isset($_SERVER['HTTP_REFERER'])) {
         $via = sprintf(_('Coming from: %s'), $_SERVER['HTTP_REFERER']);
     } else {
         $via = _('Unknown source');
     }
     $infraction = sprintf('%s@%s %s -- %s', $username, $ip, $via, $message);
     PHPWS_Core::log(escapeshellcmd($infraction), 'security.log', _('Warning'));
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:Security.php

示例15: loggedIn

 public static function loggedIn()
 {
     $auth = Current_User::getAuthorization();
     $template['GREETING'] = dgettext('users', 'Hello');
     $template['USERNAME'] = Current_User::getUsername();
     $template['DISPLAY_NAME'] = Current_User::getDisplayName();
     $template['PANEL'] = $template['MODULES'] = PHPWS_ControlPanel::panelLink();
     $logout_link = $auth->getLogoutLink();
     $template['ACCOUNT'] = '<a href="index.php?module=users&action=user&tab=my_page">' . dgettext('users', '<span class="glyphicon glyphicon-user"></span> Account') . '</a>';
     if ($logout_link) {
         $template['LOGOUT'] =& $logout_link;
     } else {
         $template['LOGOUT'] = PHPWS_Text::moduleLink(dgettext('users', '<span class="fa fa-sign-out"></span> Log Out'), 'users', array('action' => 'user', 'command' => 'logout'));
     }
     $template['HOME_USER_PANEL'] = $template['HOME'] = PHPWS_Text::moduleLink(dgettext('users', 'Home'));
     $usermenu = PHPWS_User::getUserSetting('user_menu');
     return PHPWS_Template::process($template, 'users', 'usermenus/' . $usermenu);
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:18,代码来源:User_Form.php


注:本文中的Current_User::getUsername方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。