public function execute() { PHPWS_Core::initModClass('hms', 'HousingApplication.php'); $this->reasons = HousingApplication::getCancellationReasons(); // All students $db = new PHPWS_DB('hms_new_application'); $db->addColumn('cancelled_reason'); $db->addColumn('id', null, 'ount', true); $db->addWhere('term', $this->getTerm()); $db->addWhere('cancelled', 1); $db->addGroupBy('cancelled_reason'); $this->reasonCounts = $db->select('assoc'); // Freshmen $db = new PHPWS_DB('hms_new_application'); $db->addColumn('cancelled_reason'); $db->addColumn('id', null, 'count', true); $db->addWhere('term', $this->getTerm()); $db->addWhere('cancelled', 1); $db->addWhere('student_type', TYPE_FRESHMEN); $db->addGroupBy('cancelled_reason'); $this->freshmenReasonCounts = $db->select('assoc'); // Continuing $db = new PHPWS_DB('hms_new_application'); $db->addColumn('cancelled_reason'); $db->addColumn('id', null, 'count', true); $db->addWhere('term', $this->getTerm()); $db->addWhere('cancelled', 1); $db->addWhere('student_type', TYPE_CONTINUING); $db->addGroupBy('cancelled_reason'); $this->continuingReasonCounts = $db->select('assoc'); }
public function save() { $result = parent::save(); if (PHPWS_Error::isError($result)) { return $result; } $db = new PHPWS_DB('analytics_tracker_piwik'); $db->addWhere('id', $this->id); $result = $db->select(); if (PHPWS_Error::logIfError($result)) { return $result; } $db = new PHPWS_DB('analytics_tracker_piwik'); $db->addValue('id', $this->id); $db->addValue('piwik_url', $this->piwik_url); $db->addValue('piwik_id', $this->piwik_id); if (count($result) < 1) { $result = $db->insert(false); } else { $result = $db->update(); } if (PHPWS_Error::logIfError($result)) { return $result; } }
public function execute() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $term = $this->term; $db = new PHPWS_DB('hms_checkin'); // Join hall structure $db->addJoin('', 'hms_checkin', 'hms_hall_structure', 'bed_id', 'bedid'); $db->addColumn('hms_checkin.banner_id'); $db->addColumn('hms_checkin.checkin_date'); $db->addColumn('hms_hall_structure.hall_name'); $db->addColumn('hms_hall_structure.room_number'); $db->addWhere('hms_checkin.term', $term); $db->addWhere('hms_checkin.checkout_date', null, 'IS NULL'); // Sort by hall, then room number $db->addOrder(array('hms_hall_structure.hall_name ASC', 'hms_hall_structure.room_number ASC')); $results = $db->select(); if (PHPWS_Error::isError($results)) { throw new DatabaseException($results->toString()); } // Post-processing, cleanup, making it pretty foreach ($results as $row) { // Updates counts $this->total++; $row['checkin_date'] = HMS_Util::get_short_date_time($row['checkin_date']); // Copy the cleaned up row to the member var for data $this->data[] = $row; } }
/** * Report lists rooms in each residence hall that are still available, along with * the available beds in the room. Also, show the number of beds allocated to the * lotter for each residence hall. * */ public static function reappAvailability() { $term = Term::getSelectedTerm(); // Available rooms in each residence hall. $db = new PHPWS_DB('hms_bed'); $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id'); $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); //$db->addWhere('hms_bed.ra_bed', 0); $db->addWhere('hms_room.private', 0); $db->addWhere('hms_room.overflow', 0); $db->addWhere('hms_room.reserved', 0); $db->addWhere('hms_room.offline', 0); $db->addWhere('hms_bed.term', $term); $db->addColumn('hms_room.room_number'); $db->addColumn('hms_bed.bed_letter', null, null, True); $db->addColumn('hms_residence_hall.hall_name'); $db->addGroupBy('hms_residence_hall.hall_name'); $db->addGroupBy('hms_room.room_number'); $db->addOrder('hms_residence_hall.hall_name'); $availRooms = $db->select(); // Allocated beds for lottery. $db = new PHPWS_DB('hms_bed'); $db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id'); $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); $db->addJoin('RIGHT', 'hms_bed', 'hms_lottery_reservation', 'id', 'bed_id'); $db->addWhere('hms_lottery_reservation.term', $term); $db->addColumn('hms_residence_hall.hall_name'); $db->addColumn('hms_bed.id', null, null, True); $db->addGroupBy('hms_residence_hall.hall_name'); $db->setIndexBy('hall_name'); $lotteryBeds = $db->select(); $tpl = new PHPWS_Template('hms'); $tpl->setFile('admin/reports/reapp_availability.tpl'); // // "The parent row must be parsed after the child rows." // Preload currHall with first residence hall name $currHall = $availRooms[0]['hall_name']; foreach ($availRooms as $row) { // Change halls, create new block. if ($currHall != $row['hall_name'] || $currHall == null) { $tpl->setCurrentBlock('halls'); // Get allocated beds for the residence hall. $lottCount = isset($lotteryBeds[$currHall]['count']) ? $lotteryBeds[$currHall]['count'] : 0; $tpl->setData(array('HALL_NAME' => $currHall, 'LOTTERY_BEDS' => $lottCount)); $tpl->parseCurrentBlock(); $currHall = $row['hall_name']; } // Add room to residence hall template block. $tpl->setCurrentBlock('rooms'); $tpl->setData(array('ROOM_NUM' => $row['room_number'], 'BED_COUNT' => $row['count'])); $tpl->parseCurrentBlock(); } // Get last residence hall. Can't parse parent before child with template class. $tpl->setCurrentBlock('halls'); $tpl->setData(array('HALL_NAME' => $currHall)); $tpl->parseCurrentBlock(); return $tpl->get(); }
public function execute() { PHPWS_Core::initModClass('hms', 'StudentFactory.php'); if (!isset($this->term) || is_null($this->term)) { throw new InvalidArgumentException('Missing term.'); } $db = new PHPWS_DB('hms_new_application'); $db->addColumn('banner_id'); $db->addColumn('username'); $db->addWhere('term', $this->term); $results = $db->select(); if (empty($results)) { return; } elseif (PEAR::isError($results)) { throw new DatabaseException($results->toString()); } $twentyFiveYearsAgo = strtotime("-25 years"); foreach ($results as $student) { try { $sf = StudentFactory::getStudentByBannerId($student['banner_id'], $this->term); $dob = $sf->getDOB(); if (strtotime($dob) > $twentyFiveYearsAgo) { continue; } $student['dob'] = $dob; $student['full_name'] = $sf->getFullName(); $this->all_rows[] = $student; } catch (Exception $e) { $student['dob'] = $student['full_name'] = null; $this->problems[] = $student['banner_id']; } } }
public function save() { $result = parent::save(); if (PHPWS_Error::isError($result)) { return $result; } $db = new PHPWS_DB('analytics_tracker_owa'); $db->addWhere('id', $this->id); $result = $db->select(); if (PHPWS_Error::logIfError($result)) { return $result; } $db = new PHPWS_DB('analytics_tracker_owa'); $db->addValue('id', $this->id); $db->addValue('owa_url', $this->owa_url); $db->addValue('owa_site_id', $this->owa_site_id); $db->addValue('owa_track_page_view', $this->owa_track_page_view); $db->addValue('owa_track_clicks', $this->owa_track_clicks); $db->addValue('owa_track_domstream', $this->owa_track_domstream); if (count($result) < 1) { $result = $db->insert(false); } else { $result = $db->update(); } if (PHPWS_Error::logIfError($result)) { return $result; } }
public function execute() { PHPWS_Core::initModClass('hms', 'HousingApplication.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); // Select all cancelled apps for the given term $db = new PHPWS_DB('hms_new_application'); $db->addWhere('cancelled', 1); $db->addWhere('term', $this->term); $results = $db->select(); // Initialize storage for processed rows $this->rows = array(); // Get friendly cancellation reasons from HousingApplication $reasons = HousingApplication::getCancellationReasons(); // Process and store each result foreach ($results as $app) { $row = array(); $row['bannerId'] = $app['banner_id']; $row['username'] = $app['username']; $row['gender'] = HMS_Util::formatGender($app['gender']); $row['application_term'] = $app['application_term']; $row['student_type'] = $app['student_type']; $row['cancelled_reason'] = $reasons[$app['cancelled_reason']]; $row['cancelled_on'] = HMS_Util::get_long_date($app['cancelled_on']); $row['cancelled_by'] = $app['cancelled_by']; $this->rows[] = $row; } }
function hms_install(&$content) { PHPWS_Core::initModClass('users', 'Users.php'); $DB = new PHPWS_DB('users'); $DB->addWhere('username', 'hms_admin'); $result = $DB->select('one'); if ($result == null) { $user = new PHPWS_User(); $user->setUsername('hms_admin'); $user->setPassword('in the white room, with black curtains'); $user->save(); } $DB = new PHPWS_DB('users'); $DB->addWhere('username', 'hms_student'); $result = $DB->select('one'); if ($result == null) { $user = new PHPWS_User(); $user->setUsername('hms_student'); $user->setPassword('shes my everything, shes my pride and joy'); $user->save(); } $directory = PHPWS_HOME_DIR . 'files/hms_reports/'; if (!is_dir($directory)) { mkdir($directory); } return true; }
public function execute(CommandContext $context) { if (!Current_User::allow('hms', 'edit_role_members')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to edit role members.'); } $username = $context->get('username'); $rolename = $context->get('role'); $class = $context->get('className'); $instance = $context->get('instance'); if (is_null($username) || is_null($rolename)) { echo json_encode(false); exit; } $db = new PHPWS_DB('hms_role'); $db->addWhere('name', $rolename); $result = $db->select('row'); if (PHPWS_Error::logIfError($result) || is_null($result['id'])) { echo json_encode(false); exit; } $role_id = $result['id']; $role = new HMS_Role(); $role->id = $role_id; if ($role->load()) { echo json_encode($role->removeUser($username, $class, $instance)); exit; } echo json_encode(false); exit; }
/** * Uninstall file for PhatForm v2 * * Rewritten to work with phpwebsite 1.0 * @version $Id$ */ function phatform_uninstall(&$content) { $db = new PHPWS_DB('mod_phatform_forms'); $db->addColumn('id'); $db->addColumn('archiveTableName'); $db->addWhere('saved', 1); $result = $db->select(); if (!empty($result)) { foreach ($result as $form) { if (empty($form['archiveTableName'])) { $table = 'mod_phatform_form_' . $form['id']; if (PHPWS_DB::isTable($table)) { PHPWS_DB::dropTable($table); } } else { $table = $form['archiveTableName']; PHPWS_DB::dropTable($table); } } $content[] = dgettext('phatform', 'Removed all dynamic Form Generator tables.'); } PHPWS_DB::dropTable('mod_phatform_forms'); PHPWS_DB::dropTable('mod_phatform_options'); PHPWS_DB::dropTable('mod_phatform_textfield'); PHPWS_DB::dropTable('mod_phatform_textarea'); PHPWS_DB::dropTable('mod_phatform_dropbox'); PHPWS_DB::dropTable('mod_phatform_multiselect'); PHPWS_DB::dropTable('mod_phatform_radiobutton'); PHPWS_DB::dropTable('mod_phatform_checkbox'); $content[] = dgettext('phatform', 'All Form Generator static tables removed.'); return TRUE; }
/** * Executes this pulse. Checks for any pending reports and runs them. */ public static function execute() { // Reschedule the next run of this process /* $sp = $this->makeClone(); $sp->execute_at = strtotime("+1 minutes"); $sp->save(); * */ // Load necessary classes PHPWS_Core::initModClass('hms', 'UserStatus.php'); PHPWS_Core::initModClass('hms', 'ReportFactory.php'); PHPWS_Core::initModCLass('hms', 'HMS_Email.php'); // Fake a user, in case we need that UserStatus::wearMask('HMS System'); // Check for any pending reports (scheduled for any time up until now) $db = new PHPWS_DB('hms_report'); $db->addWhere('completed_timestamp', null, 'IS'); // not completed $db->addWhere('began_timestamp', null, 'IS'); // not already running somewhere $db->addWhere('scheduled_exec_time', time(), '<='); // scheduled exec time is now or before $db->addOrder('scheduled_exec_time ASC'); // Run in order scheduled $results = $db->select(); // If there's nothing to do, quite nicely if (!isset($results) || is_null($results) || empty($results)) { UserStatus::removeMask(); return 'No reports waiting.'; } // Run each report foreach ($results as $row) { $report = null; try { // Load the proper controller for this report $reportCtrl = ReportFactory::getControllerById($row['id']); // Load this report's params $reportCtrl->loadParams(); // Generate the report $reportCtrl->generateReport(); $report = $reportCtrl->getReport(); } catch (Exception $e) { // handle the exception nicely self::emailError(self::formatException($e)); exit; } // Send success notification $username = $report->getCreatedBy(); if ($username == 'jbooker') { $username = '******'; } HMS_Email::sendReportCompleteNotification($username, $report->getFriendlyName()); } // Remove the mask UserStatus::removeMask(); // Exit cleanly return; }
public function execute() { $db = new PHPWS_DB('hms_new_application'); $db->addColumn('student_type'); $db->addColumn('id', null, 'count', true); $db->addWhere('term', $this->getTerm()); $db->addWhere('cancelled', 1); $db->addGroupBy('student_type'); $this->typeCounts = $db->select('assoc'); }
public static function checkForWaiver($username, $term = NULL) { $db = new PHPWS_DB('hms_eligibility_waiver'); $db->addWhere('asu_username', $username); if (!isset($term)) { $db->addWhere('term', Term::getCurrentTerm()); } else { $db->addWhere('term', $term); } return !is_null($db->select('row')); }
public function execute(CommandContext $context) { $db = new PHPWS_DB('hms_role'); $result = $db->select(); if (PHPWS_Error::logIfError($result)) { echo json_encode(array()); } else { echo json_encode($result); } exit; }
function getOwnerUsername() { $db = new PHPWS_DB('users'); $db->addWhere('id', $this->getOwnerId()); $db->addColumn('username'); $result = $db->select('col'); if (PHPWS_Error::logIfError($result)) { return dgettext('wiki', 'N/A'); } return $result[0]; }
public static function getUserRolesForInstance($instance) { $db = new PHPWS_DB('hms_user_role'); $db->addWhere('hms_user_role.class', strtolower(get_class($instance))); $db->addWhere('hms_user_role.instance', $instance->id); $result = $db->select(); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } return $result; }
public function execute() { PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php'); PHPWS_Core::initModClass('hms', 'HMS_Assignment.php'); PHPWS_Core::initModClass('hms', 'StudentFactory.php'); $db = new PHPWS_DB('hms_new_application'); $db->addColumn('hms_new_application.*'); $db->addWhere('term', $this->term); $db->addWhere('cancelled', 0); $term = Term::getTermSem($this->term); if ($term == TERM_FALL) { $db->addJoin('LEFT', 'hms_new_application', 'hms_fall_application', 'id', 'id'); $db->addColumn('hms_fall_application.*'); } else { if ($term == TERM_SUMMER1 || $term == TERM_SUMMER2) { $db->addJoin('LEFT', 'hms_new_application', 'hms_summer_application', 'id', 'id'); $db->addColumn('hms_summer_application.*'); } } $result = $db->select(); $app = array(); foreach ($result as $app) { $username = $app['username']; $bannerId = $app['banner_id']; $type = $app['student_type']; $cellPhone = $app['cell_phone']; $date = date('n/j/Y', $app['created_on']); $assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $this->term); if (!is_null($assignment)) { $room = $assignment->where_am_i(); } else { $room = ''; } $student = StudentFactory::getStudentByBannerId($bannerId, $this->term); $first = $student->getFirstName(); $middle = $student->getMiddleName(); $last = $student->getLastName(); $gender = $student->getPrintableGender(); $birthday = date("m/d/Y", $student->getDobDateTime()->getTimestamp()); $address = $student->getAddress(NULL); if ($term == TERM_SPRING || $term == TERM_FALL) { $lifestyle = $app['lifestyle_option'] == 1 ? 'Single Gender' : 'Co-Ed'; } else { $lifestyle = $app['room_type'] == 1 ? 'Single Room' : 'Double Room'; } if (!is_null($address) && $address !== false) { $this->rows[] = array($username, $bannerId, $first, $middle, $last, $gender, $type, $cellPhone, $room, $date, $address->line1, $address->line2, $address->line3, $address->city, $address->state, $address->zip, $birthday, $lifestyle); } else { $this->rows[] = array($username, $bannerId, $first, $middle, $last, '', $type, $cellPhone, $room, $date, '', '', '', '', '', '', $lifestyle); } } }
public static function getDisplayName($respectMask = true) { if (self::isGuest()) { return null; } if (self::isMasquerading() && $respectMask) { //TODO: Fix the users class so we don't have to query this ourselves.... $db = new \PHPWS_DB('users'); $db->addWhere('username', $_SESSION['hms_masquerade_username']); $result = $db->select('row'); return $result['display_name']; } return Current_User::getDisplayName(); }
public function execute() { $db = new PHPWS_DB('hms_room'); $db->addColumn('hms_residence_hall.hall_name'); $db->addColumn('hms_floor.floor_number'); $db->addColumn('hms_room.room_number'); $db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); $db->addWhere('hms_room.term', $this->term); $db->addWhere('hms_room.gender_type', COED); $results = $db->select(); $this->totalCoed = sizeof($results); $this->rows = $results; }
public static function getSubjects($mustIncludeId = null) { $subjects = array('-1' => 'Select a subject...'); $db = new PHPWS_DB('intern_subject'); $db->addWhere('active', 1, '=', 'OR'); if (!is_null($mustIncludeId)) { $db->addWhere('id', $mustIncludeId, '=', 'OR'); } $db->addOrder('abbreviation ASC'); $results = $db->select(); foreach ($results as $row) { $subjects[$row['id']] = $row['abbreviation'] . ' - ' . $row['description']; } return $subjects; }
public static function checkForProfile($bannerId, $term) { $db = new PHPWS_DB('hms_student_profiles'); $db->addWhere('banner_id', $bannerId); $db->addWhere('term', $term); $result = $db->select('row'); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } if ($result != NULL && sizeof($result > 0)) { return $result['id']; } else { return false; } }
public static function getAllowedStates() { $db = new \PHPWS_DB('intern_state'); $db->addWhere('active', 1); $db->addColumn('abbr'); $db->addColumn('full_name'); $db->setIndexBy('abbr'); $db->addOrder('full_name ASC'); $states = $db->select('col'); if (empty($states)) { \NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>'); \NQ::close(); PHPWS_Core::goBack(); } return $states; }
public function authenticate() { if (empty($this->password)) { return false; } $db = new PHPWS_DB('user_authorization'); if (!Current_User::allowUsername($this->user->username)) { return false; } $password_hash = md5($this->user->username . $this->password); $db->addColumn('username'); $db->addWhere('username', strtolower($this->user->username)); $db->addWhere('password', $password_hash); $result = $db->select('one'); return !PHPWS_Error::logIfError($result) && (bool) $result; }
public static function display() { javascriptMod('intern', 'pick_state'); $db = new PHPWS_DB('intern_state'); $db->addOrder('full_name'); $states = $db->select(); foreach ($states as $state) { extract($state); //abbr, full_name, active $row = array('ABBR' => $abbr, 'NAME' => $full_name); if (!$active) { $tpl['state_row'][] = $row; } else { $tpl['active_row'][] = $row; } } return PHPWS_Template::process($tpl, 'intern', 'state_list.tpl'); }
public function init() { PHPWS_Core::initCoreClass('Module.php'); $db = new PHPWS_DB('users_my_page_mods'); $db->addColumn('mod_title'); $result = $db->select('col'); if (PHPWS_Error::isError($result)) { return $result; } if ($result) { foreach ($result as $mod_title) { $this->modules[$mod_title] = new PHPWS_Module($mod_title); } } else { return FALSE; } return TRUE; }
/** * Returns an associative array containing the list of RLCs using their full names, keyed by their id. * * @param int $term * @param string $studentType * @param string $hidden * @throws DatabaseException * @return Array Array of communities */ public static function getRlcList($term, $studentType = NULL, $hidden = NULL) { $db = new PHPWS_DB('hms_learning_communities'); $db->addColumn('id'); $db->addColumn('community_name'); if (!is_null($studentType) && strlen($studentType) == 1) { $db->addWhere('allowed_student_types', "%{$student_type}%", 'ilike'); } if ($hidden === FALSE) { $db->addWhere('hide', 0); } $db->addOrder('community_name ASC'); $rlcs = $db->select('assoc'); if (PHPWS_Error::logIfError($rlcs)) { throw new DatabaseException($rlcs->toString()); } return $rlcs; }
public function execute() { if (!isset($this->term) || is_null($this->term)) { throw new InvalidArgumentException('Missing term.'); } /***** * Total Beds */ $db = new PHPWS_DB('hms_bed'); $db->addJoin('', 'hms_bed', 'hms_room', 'room_id', 'id'); $db->addJoin('', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); $db->addWhere('hms_bed.term', $this->term); $this->totalBedCount = $db->count(); if (PHPWS_Error::logIfError($this->totalBedCount)) { PHPWS_Core::initModClass('hms', 'exception', 'DatabaseException.php'); throw new DatabaseException($this->totalBedCount->toString()); } /******* * Unavailable Beds */ $db = new PHPWS_DB('hms_bed'); $db->addColumn('hms_residence_hall.hall_name'); $db->addColumn('hms_bed.*'); $db->addColumn('hms_room.*'); $db->addJoin('', 'hms_bed', 'hms_room', 'room_id', 'id'); $db->addJoin('', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); $db->addWhere('hms_room.reserved', 1, null, 'OR', 'foo'); $db->addWhere('hms_room.ra', 1, null, 'OR', 'foo'); $db->addWhere('hms_room.private', 1, null, 'OR', 'foo'); $db->addWhere('hms_room.overflow', 1, null, 'OR', 'foo'); $db->addWhere('hms_room.parlor', 1, null, 'OR', 'foo'); $db->addWhere('hms_room.offline', 1, null, 'OR', 'foo'); $db->addWhere('hms_bed.ra_roommate', 1, null, 'OR', 'foo'); $db->addWhere('hms_bed.international_reserved', 1, null, 'OR', 'foo'); $db->addWhere('hms_bed.term', $this->term); $db->addOrder(array('hms_residence_hall.hall_name', 'hms_room.room_number', 'bed_letter')); $this->unavailableBeds = $db->select(); if (PHPWS_Error::logIfError($this->unavailableBeds)) { PHPWS_Core::initModClass('hms', 'exception/DatabaseException.php'); throw new DatabaseException($this->unavailableBeds->toString()); } }
public function execute() { $db = new PHPWS_DB(); $query = <<<EOF SELECT assign.banner_id, assign.asu_username, bed.bed_letter, bed.bedroom_label, room.room_number, floor.floor_number, hall.hall_name FROM hms_assignment as assign LEFT JOIN hms_bed as bed on assign.bed_id=bed.id LEFT JOIN hms_room as room on bed.room_id=room.id LEFT JOIN hms_floor as floor on room.floor_id=floor.id LEFT JOIN hms_residence_hall as hall on floor.residence_hall_id=hall.id WHERE assign.term = '{$this->term}' ORDER BY hall.hall_name, floor.floor_number, room.room_number, bed.bedroom_label, bed.bed_letter EOF; $result = $db->select(null, $query); if (PEAR::isError($result)) { throw new DatabaseException($result->toString()); } $final_rows = array(); foreach ($result as $row) { $hall_name = $row['hall_name']; $student = StudentFactory::getStudentByBannerId($row['banner_id'], $this->term); $row['name'] = $student->getFullName(); $row['dob'] = $student->getDOB(); $row['year'] = $student->getClass(); $row['gender'] = HMS_Util::formatGender($student->getGender()); $final_rows[$hall_name][] = $row; } $this->rows =& $final_rows; }
public static function getAllowedStates() { $db = new PHPWS_DB('intern_state'); $db->addWhere('active', 1); $db->addColumn('abbr'); $db->addColumn('full_name'); $db->setIndexBy('abbr'); // get backwards because we flip it $db->addOrder('full_name desc'); $states = $db->select('col'); if (empty($states)) { NQ::simple('intern', INTERN_ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>'); NQ::close(); PHPWS_Core::goBack(); } $states[-1] = 'Select a state'; $states = array_reverse($states, true); return $states; }
/** * Main display method */ public function display() { javascript('jquery'); // housekeeping if (isset($_SESSION['query'])) { unset($_SESSION['query']); } $tags = array(); // Total number of internships for Diety users if (\Current_User::isDeity()) { $tags['GRAND_TOTAL_LABEL'] = _('Total Internships in Database: '); $db = new \PHPWS_DB('intern_internship'); $gt = $db->select('count'); $tags['GRAND_TOTAL'] = $gt; } // Example form link $tags['EXAMPLE_LINK'] = \PHPWS_Text::secureLink('Example form', 'intern', array('action' => 'example_form')); return \PHPWS_Template::process($tags, 'intern', 'menu.tpl'); }