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


PHP StudentFactory::getStudentByBannerID方法代码示例

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


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

示例1: execute

 public function execute()
 {
     $db = PdoFactory::getPdoInstance();
     $query = "SELECT hms_assignment.banner_id, hms_hall_structure.room_number, hms_hall_structure.hall_name\n              FROM hms_assignment\n              JOIN hms_hall_structure\n                  ON hms_assignment.bed_id = hms_hall_structure.bedid\n              WHERE\n                hms_assignment.term = :term and\n                roomid IN (SELECT room_id\n                            FROM hms_learning_community_assignment\n                            JOIN hms_learning_community_applications\n                                ON hms_learning_community_assignment.application_id = hms_learning_community_applications.id\n                            JOIN hms_assignment\n                                ON (hms_learning_community_applications.username = hms_assignment.asu_username AND hms_learning_community_applications.term = hms_assignment.term)\n                            JOIN hms_bed\n                                ON hms_assignment.bed_id = hms_bed.id\n                            JOIN hms_room\n                                ON hms_bed.room_id = hms_room.id\n                            WHERE\n                                hms_learning_community_applications.term = :term)\n              ORDER BY roomid";
     $stmt = $db->prepare($query);
     $params = array('term' => $this->term);
     $stmt->execute($params);
     $queryResult = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $results = array();
     $i = 0;
     $count = 0;
     foreach ($queryResult as $result) {
         $tplVals = array();
         $tplVals['BANNER'] = $result['banner_id'];
         $student = StudentFactory::getStudentByBannerID($result['banner_id'], $this->term);
         $tplVals['USERNAME'] = $student->getUsername();
         $tplVals['FIRST_NAME'] = $student->getFirstName();
         $tplVals['LAST_NAME'] = $student->getLastName();
         $membership = RlcMembershipFactory::getMembership($student, $this->term);
         if ($membership) {
             $tplVals['COMMUNITY'] = $membership->getRlcName();
             $count++;
         } else {
             $tplVals['COMMUNITY'] = '';
         }
         $tplVals['HALL'] = $result['hall_name'];
         $tplVals['ROOM'] = $result['room_number'];
         $results[$i] = $tplVals;
         $i++;
     }
     $this->memberCount = $count;
     $this->data = $results;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:RlcRoster.php

示例2: 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

示例3: execute

 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'search')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to lookup student names!');
     }
     $student = null;
     $error = new JsonError(403);
     $username = $context->get('username');
     $banner_id = (int) $context->get('banner_id');
     try {
         if ($banner_id) {
             $student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm());
         } elseif (!empty($username)) {
             $student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm());
         } else {
             $error->setMessage('Did not receive Banner ID or user name.');
             $context->setContent(json_encode($error));
         }
         $student->gender_string = HMS_Util::formatGender($student->gender);
         $context->setContent(json_encode($student));
     } catch (\StudentNotFoundException $e) {
         $error->setMessage($e->getMessage());
         $context->setContent(json_encode($error));
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:JSONGetStudentCommand.php

示例4: execute

    public function execute(CommandContext $context)
    {
        $newrows = array();
        $pdo = PdoFactory::getPdoInstance();
        $floor_id = (int) $context->get('floorId');
        $query = <<<EOF
select\troom.id as room_id,
\troom.room_number,
\troom.gender_type,
\tbed.id as bed_id,
\tbed.bedroom_label,
\tbed.bed_letter,
\tassign.banner_id,
\tassign.meal_option,
        assign.asu_username
from  \thms_room as room
\tfull join
\t\thms_bed as bed on room.id=bed.room_id
\tfull join
\t\thms_assignment as assign on bed.id=assign.bed_id
where\troom.floor_id = :floor_id
order by room_number asc, bedroom_label, bed_letter;
EOF;
        $prep = $pdo->prepare($query);
        $prep->execute(array(':floor_id' => $floor_id));
        $rows = $prep->fetchAll(PDO::FETCH_ASSOC);
        if (empty($rows)) {
            $context->setContent(json_encode(array()));
            return;
        }
        $count = -1;
        $room_number_track = 0;
        foreach ($rows as $k => $v) {
            $gender = HMS_Util::formatGender($v['gender_type']);
            if ($v['banner_id']) {
                $student = StudentFactory::getStudentByBannerID($v['banner_id'], Term::getSelectedTerm());
                if ($student) {
                    $v['student'] = $student->first_name . ' ' . $student->last_name;
                } else {
                    $v['student'] = null;
                }
            } else {
                $v['student'] = null;
            }
            if ($v['room_number'] != $room_number_track) {
                $count++;
                $newrows[$count]['room_number'] = $v['room_number'];
                $newrows[$count]['gender'] = $gender;
                $newrows[$count]['beds'][] = $v;
                $room_number_track = $v['room_number'];
            } else {
                $newrows[$count]['beds'][] = $v;
            }
        }
        $context->setContent(json_encode($newrows));
    }
开发者ID:jlbooker,项目名称:homestead,代码行数:56,代码来源:JSONGetRoomsCommand.php

示例5: execute

 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'RoommateProfile.php');
     PHPWS_Core::initModClass('hms', 'RoommateProfileView.php');
     $student = StudentFactory::getStudentByBannerID($context->get('banner_id'), $context->get('term'));
     $profile = RoommateProfileFactory::getProfile($context->get('banner_id'), $context->get('term'));
     $view = new RoommateProfileView($student, $profile);
     $context->setContent($view->show());
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:10,代码来源:ShowRoommateProfileCommand.php

示例6: execute

 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'PdoFactory.php');
     $db = PdoFactory::getInstance()->getPdo();
     $query = 'SELECT hms_assignment.banner_id, hms_assignment.reason,
               hms_hall_structure.hall_name, hms_hall_structure.room_number, hms_hall_structure.bed_letter
               FROM hms_assignment
               JOIN hms_hall_structure ON hms_assignment.bed_id = hms_hall_structure.bedid
               WHERE hms_assignment.banner_id
               NOT IN (SELECT hms_assignment.banner_id
                       FROM hms_assignment
                       JOIN hms_bed ON hms_assignment.bed_id = hms_bed.id
                       JOIN hms_checkin ON hms_bed.persistent_id = hms_checkin.bed_persistent_id
                       WHERE hms_assignment.bed_id = hms_checkin.bed_id
                       AND hms_assignment.banner_id = hms_checkin.banner_id
                       AND hms_assignment.term = :term)
               AND hms_assignment.term = :term';
     $stmt = $db->prepare($query);
     $stmt->execute(array('term' => $this->term));
     $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $rows = array();
     $i = 0;
     foreach ($results as $row) {
         $rowVals = array();
         $student = StudentFactory::getStudentByBannerID($row['banner_id'], $this->term);
         $rowVals['banner_id'] = $row['banner_id'];
         $rowVals['username'] = $student->getUsername();
         $rowVals['name'] = $student->getFullName();
         $rowVals['class'] = $student->getClass();
         $rowVals['reason'] = constant($row['reason']);
         $rowVals['hall_name'] = $row['hall_name'];
         $rowVals['room_number'] = $row['room_number'];
         $rowVals['bed_letter'] = $row['bed_letter'];
         $rows[$i] = $rowVals;
         $i++;
     }
     $this->total = $i;
     $this->data = $rows;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:39,代码来源:NoShowList.php

示例7: get_assignee

 public function get_assignee()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     if (!$this->loadAssignment()) {
         return false;
     }
     if (!isset($this->_curr_assignment->banner_id)) {
         return NULL;
     } else {
         return StudentFactory::getStudentByBannerID($this->_curr_assignment->getBannerId(), $this->term);
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:12,代码来源:HMS_Bed.php

示例8: getBedHistoryArray

 /**
  * Pulls the assignment history for the current bed and plugs in the student profile link.
  * Returns null if no history is found.
  * @return array
  */
 private function getBedHistoryArray()
 {
     $db = \Database::newDB();
     $t1 = $db->addTable('hms_assignment_history');
     $t1->addFieldConditional('bed_id', $this->bed->id);
     /*
      if (isset($this->bed->_curr_assignment)) {
      $t1->addFieldConditional('banner_id', $this->bed->_curr_assignment->banner_id, '!=');
      }
     *
     */
     $t1->addOrderBy('assigned_on', 'DESC');
     $result = $db->select();
     if (empty($result)) {
         return null;
     }
     foreach ($result as $key => $assignment) {
         $student = StudentFactory::getStudentByBannerID($assignment['banner_id'], $this->bed->getTerm());
         $result[$key]['assigned_on_date'] = HMS_Util::get_short_date_time($assignment['assigned_on']);
         if (empty($assignment['removed_on'])) {
             $result[$key]['removed_on_date'] = 'Never';
         } else {
             $result[$key]['removed_on_date'] = HMS_Util::get_short_date_time($assignment['removed_on']);
         }
         $result[$key]['student'] = $student->getProfileLink();
     }
     return $result;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:BedView.php

示例9: sendRoomChangeDeniedNotice

 /**
  * Sends the appropriate emails for an officially denied room change request.
  *
  * @param $r RoomChangeRequest The Room Change Request that has been denied
  */
 public static function sendRoomChangeDeniedNotice(RoomChangeRequest $r)
 {
     $subject = 'Room Change Denied';
     $template = 'email/roomChangeDeniedNotice.tpl';
     $recipients = array();
     $tags = array('PARTICIPANTS' => array());
     $reason = $r->getDeniedReasonPublic();
     if (!is_null($reason) && !empty($reason)) {
         $tags['REASON'] = $reason;
     }
     // Add information about participants, also add each participant to recipients
     foreach ($r->getParticipants() as $p) {
         $student = StudentFactory::getStudentByBannerID($p->getBannerID(), $r->getTerm());
         $recipients[] = $student;
         $tags['PARTICIPANTS'][] = array('NAME' => $student->getName());
     }
     // Add any approvers that may have seen the previous email to recipients
     foreach ($r->getAllPotentialApprovers() as $a) {
         $recipients[] = array($a . TO_DOMAIN => '');
     }
     // Send a message per recipient
     $message = self::makeSwiftmailMessage(null, $subject, $tags, $template);
     foreach ($recipients as $r) {
         if ($r instanceof Student) {
             $message->setTo($r->getUsername() . TO_DOMAIN);
         } else {
             $message->setTo($r);
         }
         self::sendSwiftmailMessage($message);
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:36,代码来源:HMS_Email.php

示例10: getPagerTags

 /**
  * Sets up the row tags for the pager
  *
  * @return Array Array of template tags.
  */
 public function getPagerTags()
 {
     $student = StudentFactory::getStudentByBannerID($this->banner_id, $this->term);
     $tags = array();
     $tags['STUDENT_ID'] = $student->getUsername() . "@appstate.edu";
     $tags['FIRST_NAME'] = $student->getFirstName();
     $tags['LAST_NAME'] = $student->getLastName();
     $viewProfileCmd = CommandFactory::getCommand('ShowRoommateProfile');
     $viewProfileCmd->setBannerid($student->getBannerId());
     $viewProfileCmd->setTerm($this->term);
     $tags['ACTIONS'] = $viewProfileCmd->getLink('[View Profile]');
     return $tags;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:18,代码来源:RoommateProfile.php


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