示例#1
0
 public static function shortcuts()
 {
     if (!Current_User::allow('access')) {
         Current_User::disallow();
         return;
     }
     $modal = new Modal('access-shortcut', null, dgettext('access', 'Shortcuts'));
     $modal->sizeSmall();
     $button = '<button class="btn btn-success" id="save-shortcut">Save</button>';
     $modal->addButton($button);
     \Layout::add((string) $modal);
     javascript('jquery');
     \Layout::includeJavascript('mod/access/javascript/access.min.js');
     PHPWS_Core::initModClass('access', 'Shortcut.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('access_shortcuts', 'Access_Shortcut');
     $pager->setModule('access');
     $pager->setTemplate('forms/shortcut_list.tpl');
     $pager->setLink('index.php?module=access&amp;tab=shortcuts');
     $pager->addToggle('class="bgcolor1"');
     $pager->setSearch('keyword');
     $form = new PHPWS_Form('shortcut_list');
     $form->addHidden('module', 'access');
     $form->addHidden('command', 'post_shortcut_list');
     $options['none'] = '';
     if (Current_User::allow('access', 'admin_options')) {
         $options['active'] = dgettext('access', 'Activate');
         $options['deactive'] = dgettext('access', 'Deactivate');
     }
     $options['delete'] = dgettext('access', 'Delete');
     $form->addSelect('list_action', $options);
     $page_tags = $form->getTemplate();
     $page_tags['MENU_FIX'] = PHPWS_Text::secureLink(dgettext('access', 'Update menu links'), 'access', array('command' => 'menu_fix'));
     $page_tags['PAGE_FIX'] = PHPWS_Text::secureLink(dgettext('access', 'Shortcut all pages'), 'access', array('command' => 'page_fix'));
     if (PHPWS_Settings::get('access', 'forward_ids')) {
         $page_tags['PAGE_FORWARDING'] = PHPWS_Text::secureLink(dgettext('access', 'Turn OFF autoforwarding of Pagesmith id pages'), 'access', array('command' => 'autoforward_off'));
     } else {
         $page_tags['PAGE_FORWARDING'] = PHPWS_Text::secureLink(dgettext('access', 'Turn ON autoforwarding of Pagesmith id pages'), 'access', array('command' => 'autoforward_on'));
     }
     $page_tags['MENU_WARNING'] = dgettext('menu', 'This change is irreversable. Please backup menu_links prior to running it.');
     $page_tags['URL_LABEL'] = dgettext('access', 'Url');
     $page_tags['ACTIVE_LABEL'] = dgettext('access', 'Active?');
     $page_tags['ACTION_LABEL'] = dgettext('access', 'Action');
     $page_tags['CHECK_ALL_SHORTCUTS'] = javascript('check_all', array('checkbox_name' => 'shortcut[]'));
     $js_vars['value'] = dgettext('access', 'Go');
     $js_vars['select_id'] = $form->getId('list_action');
     $js_vars['action_match'] = 'delete';
     $js_vars['message'] = dgettext('access', 'Are you sure you want to delete the checked shortcuts?');
     $page_tags['SUBMIT'] = javascript('select_confirm', $js_vars);
     $pager->addPageTags($page_tags);
     $pager->addRowTags('rowTags');
     $content = $pager->get();
     return $content;
 }
示例#2
0
 public function show()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $tags = array();
     $tags['TITLE'] = "View Final RLC Assignments " . Term::toString(Term::getSelectedTerm());
     $pager = new DBPager('hms_learning_community_assignment', 'HMS_RLC_Assignment');
     //$pager->db->addWhere('hms_learning_community_applications.hms_assignment_id','hms_learning_community_assignment.id','=');
     $pager->db->addJoin('LEFT OUTER', 'hms_learning_community_assignment', 'hms_learning_community_applications', 'application_id', 'id');
     $pager->db->addWhere('hms_learning_community_applications.term', Term::getSelectedTerm());
     $pager->db->addWhere('hms_learning_community_assignment.state', 'confirmed');
     $pager->joinResult('application_id', 'hms_learning_community_applications', 'id', 'username', 'username');
     $pager->joinResult('application_id', 'hms_learning_community_applications', 'id', 'term', 'term');
     $pager->setModule('hms');
     $pager->setTemplate('admin/display_final_rlc_assignments.tpl');
     $pager->setLink('index.php?module=hms&type=rlc&op=assign_applicants_to_rlcs');
     $pager->setEmptyMessage('No RLC assignments have been made.');
     $pager->addPageTags($tags);
     $pager->addRowTags('getAdminPagerTags');
     $pager->setReportRow('getAdminCsvRow');
     Layout::addPageTitle("RLC Assignments");
     return $pager->get();
 }
示例#3
0
 /**
  * *******************
  * Static UI Methods *
  * *******************
  */
 public static function bed_pager_by_room($room_id)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_bed', 'HMS_Bed');
     $pager->db->addJoin('LEFT OUTER', 'hms_bed', 'hms_room', 'room_id', 'id');
     $pager->addWhere('hms_room.id', $room_id);
     $pager->db->addOrder('hms_bed.bedroom_label');
     $pager->db->addOrder('hms_bed.bed_letter');
     $page_tags = array();
     $page_tags['BEDROOM_LABEL'] = 'Bedroom';
     $page_tags['BED_LETTER_LABEL'] = 'Bed';
     $page_tags['ASSIGNED_TO_LABEL'] = 'Assigned to';
     $page_tags['RA_LABEL'] = 'RA Roommate bed';
     $pager->setDefaultLimit(50);
     if (Current_User::allow('hms', 'bed_structure') && UserStatus::isAdmin()) {
         $addBedCmd = CommandFactory::getCommand('ShowAddBed');
         $addBedCmd->setRoomId($room_id);
         $page_tags['ADD_BED_URI'] = $addBedCmd->getURI();
     }
     $pager->setModule('hms');
     $pager->setTemplate('admin/bed_pager_by_room.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No beds found.");
     $pager->addRowTags('getPagerByRoomTags');
     $pager->addPageTags($page_tags);
     return $pager->get();
 }
 /**
  * Sets up the pager object for searching questionnairs.
  *
  * @return String HTML output
  */
 public static function profile_search_pager($term)
 {
     // get the current student's gender
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $student->getApplicationTerm());
     $gender = $student->getGender();
     PHPWS_Core::initCoreClass('DBPager.php');
     $pageTags = array();
     $pageTags['USERNAME'] = _('Email');
     $pageTags['FIRST_NAME'] = _('First Name');
     $pageTags['LAST_NAME'] = _('Last Name');
     $pageTags['ACTIONS'] = _('Action');
     $pager = new DBPager('hms_student_profiles', 'RoommateProfile');
     $pager->db->addWhere('term', $term);
     // Check to see if user is assigned to an RLC
     $rlc_assignment = HMS_RLC_Assignment::checkForAssignment($student->getUsername(), $student->getApplicationTerm());
     if ($rlc_assignment != false) {
         // User is assigned to an RLC, only show results from other students in the same RLC
         $pager->db->addJoin('LEFT OUTER', 'hms_student_profiles', 'hms_learning_community_applications', 'username', 'username');
         $pager->db->addJoin('LEFT OUTER', 'hms_learning_community_assignment', 'hms_learning_community_applications', 'application_id', 'id');
         $pager->db->addWhere('hms_learning_community_assignment.rlc_id', $rlc_assignment['rlc_id']);
         // $pager->db->setTestMode();
     }
     // If an ASU username was entered, just use that. Otherwise, use the rest of the fields.
     if (isset($_REQUEST['asu_username']) && $_REQUEST['asu_username'] != '') {
         $pager->addWhere('hms_student_profiles.username', $_REQUEST['asu_username'], 'ILIKE');
         $_SESSION['profile_search_asu_username'] = $_REQUEST['asu_username'];
     } else {
         $m = new RoommateProfile();
         $hobbiesCount = count($m->hobbies_array);
         // Hobby check boxes
         for ($x = 0; $x < $hobbiesCount; $x++) {
             if (isset($_REQUEST['hobbies_checkbox'][$m->hobbies_array[$x]])) {
                 $pager->addWhere('hms_student_profiles.' . $m->hobbies_array[$x], 1, '=');
                 $_SESSION['hobbies_checkbox'][$m->hobbies_array[$x]] = 1;
             }
         }
         $musicCount = count($m->music_array);
         // Music check boxes
         for ($x = 0; $x < $musicCount; $x++) {
             if (isset($_REQUEST['music_checkbox'][$m->music_array[$x]])) {
                 $pager->addWhere('hms_student_profiles.' . $m->music_array[$x], 1, '=');
                 $_SESSION['hobbies_checkbox'][$m->music_array[$x]] = 1;
             }
         }
         $studyCount = count($m->study_array);
         // Study times
         for ($x = 0; $x < $studyCount; $x++) {
             if (isset($_REQUEST['study_times'][$m->study_array[$x]])) {
                 $pager->addWhere('hms_student_profiles.' . $m->study_array[$x], 1, '=');
                 $_SESSION['study_times'][$m->study_array[$x]] = 1;
             }
         }
         $dropDownCount = count($m->drop_down_array);
         // Drop downs
         for ($x = 0; $x < $dropDownCount; $x++) {
             if (isset($_REQUEST[$m->drop_down_array[$x]]) && $_REQUEST[$m->drop_down_array[$x]] != 0) {
                 $pager->addWhere('hms_student_profiles.' . $m->drop_down_array[$x], $_REQUEST[$m->drop_down_array[$x]], '=');
                 $_SESSION[$m->drop_down_array[$x]] = $_REQUEST[$m->drop_down_array[$x]];
             }
         }
         $langCount = count($m->lang_array);
         // Spoken Languages
         for ($x = 0; $x < $langCount; $x++) {
             if (isset($_REQUEST['language_checkbox'][$m->lang_array[$x]])) {
                 $pager->addWhere('hms_student_profiles.' . $m->lang_array[$x], 1, '=');
                 $_SESSION['language_checkbox'][$m->lang_array[$x]] = 1;
             }
         }
     }
     // Join with hms_application table on username to make sure genders match.
     $pager->db->addJoin('LEFT OUTER', 'hms_student_profiles', 'hms_new_application', 'username', 'username');
     // $pager->addWhere('hms_student_profiles.user_id','hms_application.asu_username','ILIKE');
     $pager->addWhere('hms_new_application.gender', $gender, '=');
     // Don't list the current user as a match
     $pager->addWhere('hms_student_profiles.username', UserStatus::getUsername(), 'NOT LIKE');
     $pager->db->addOrder('username', 'ASC');
     $pager->setModule('hms');
     $pager->setTemplate('student/profile_search_pager.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No matches found. Try broadening your search by selecting fewer criteria.");
     $pager->addRowTags('getPagerTags');
     $pager->addPageTags($pageTags);
     return $pager->get();
 }
示例#5
0
 public static function get_pager_by_hall($hall_id)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_floor', 'HMS_Floor');
     $pager->addWhere('hms_floor.residence_hall_id', $hall_id);
     $pager->db->addOrder('hms_floor.floor_number');
     $pager->setModule('hms');
     $pager->setTemplate('admin/floor_pager_by_hall.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No floors found.");
     $pager->addRowTags('get_pager_by_hall_tags');
     return $pager->get();
 }
示例#6
0
 public static function manageGroups()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     Layout::addStyle('users');
     $pageTags['MEMBERS_LABEL'] = dgettext('users', 'Members');
     $pageTags['ACTIONS_LABEL'] = dgettext('users', 'Actions');
     $pageTags['NEW_GROUP'] = PHPWS_Text::secureLink(dgettext('users', 'Create new group'), 'users', array('action' => 'admin', 'command' => 'new_group'), null, dgettext('users', 'Create new group'), 'btn btn-success');
     $pageTags['ADD_GROUP_URI'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'new_group'));
     $pager = new DBPager('users_groups', 'PHPWS_Group');
     $pager->setModule('users');
     $pager->setTemplate('manager/groups.tpl');
     $pager->setLink('index.php?module=users&amp;action=admin&amp;tab=manage_groups&amp;authkey=' . Current_User::getAuthKey());
     // If no order was set, then set it to default by user name
     if (!isset($pager->orderby)) {
         $pager->orderby = 'name';
         $pager->orderby_dir = 'asc';
     }
     $pager->addPageTags($pageTags);
     $pager->addRowTags('getTplTags');
     $pager->addToggle('class="toggle1"');
     $pager->addToggle('class="toggle2"');
     $pager->addSortHeader('name', dgettext('users', 'Group Name'));
     $pager->addWhere('user_id', 0);
     $pager->setSearch('name');
     $pager->cacheQueries();
     return $pager->get();
 }
示例#7
0
 public static function get_movein_times_pager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_movein_time', 'HMS_Movein_Time');
     $pager->addWhere('term', Term::getSelectedTerm());
     $pager->db->addOrder('begin_timestamp', 'DESC');
     $pager_tags = array();
     $pager_tags['BEGIN_TIMESTAMP_LABEL'] = 'Begin Date & Time';
     $pager_tags['END_TIMESTAMP_LABEL'] = 'End Date & Time';
     $pager_tags['ACTION_LABEL'] = 'Action';
     $pager->setModule('hms');
     $pager->setTemplate('admin/movein_time_pager.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No move-in times found.");
     $pager->addRowTags('getRowTags');
     $pager->addPageTags($pager_tags);
     return $pager->get();
 }
示例#8
0
 public static function room_pager_by_floor($floor_id, $editable = false)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     javascript('jquery');
     $pager = new DBPager('hms_room', 'HMS_Room');
     $pager->addWhere('hms_room.floor_id', $floor_id);
     $pager->db->addOrder('hms_room.room_number');
     $page_tags = array();
     if (Current_User::allow('hms', 'room_structure')) {
         $addRoomCmd = CommandFactory::getCommand('ShowAddRoom');
         $addRoomCmd->setFloorId($floor_id);
         $page_tags['ADD_ROOM_URI'] = $addRoomCmd->getURI();
     }
     $pager->limitList = array(200);
     $pager->setDefaultLimit(200);
     $pager->setModule('hms');
     $pager->setTemplate('admin/room_pager_by_floor.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage('No rooms found.');
     if ($editable) {
         $pager->addRowTags('get_row_edit');
         $page_tags['FORM'] = 'form=true';
     } else {
         $page_tags['FORM'] = 'form=false';
         $pager->addRowTags('get_row_tags');
     }
     $pager->addPageTags($page_tags);
     return $pager->get();
 }
示例#9
0
 public function propertyListing()
 {
     \PHPWS_Core::initModClass('properties', 'Base.php');
     \PHPWS_Core::initModClass('properties', 'Property.php');
     \Layout::addStyle('properties');
     $new_class = 'other';
     $all_class = 'current';
     $sub_class = 'other';
     if (\Current_User::isLogged()) {
         $page['ROOMMATE'] = \PHPWS_Text::moduleLink('Roommate/Sublease search', 'properties', array('rop' => 'view'), null, 'Roommate or Sublease search', 'btn btn-primary');
     } else {
         $page['ROOMMATE'] = '<div class="alert alert-info">Looking for a roommate? Need to sublease? <a class="alert-link" href="' . \propertiesLoginLink() . '">Login to the site!</a></div>';
     }
     $pager = new \DBPager('properties', 'properties\\Property');
     $pager->setModule('properties');
     $pager->setTemplate('listing.tpl');
     $pager->addRowTags('listRows');
     $pager->setDefaultOrder('updated', 'desc');
     $pager->setLink('index.php?module=properties&uop=list');
     $pager->joinResult('id', 'prop_photo', 'pid', 'path', 'thumbnail');
     $pager->db->addWhere('dbp1.main_pic', 1);
     $pager->db->addWhere('dbp1.main_pic', null, null, 'or');
     $pager->db->addWhere('active', 1, '=', 'and', 'search');
     $pager->setEmptyMessage('No properties found. You may want to reduce your search criteria.');
     $all_class = 'active';
     if (!empty($_SESSION['property_search'])) {
         foreach ($_SESSION['property_search'] as $key => $value) {
             switch ($key) {
                 case 'a':
                     if ($value) {
                         $pager->db->addWhere('student_type', $value, '=', 'and', 'search');
                     }
                     break;
                 case 'sub':
                     $new_class = null;
                     $all_class = null;
                     $sub_class = 'active';
                     $pager->db->addWhere('sublease', '1', '=', 'and', 'search');
                     break;
                 case 'nosub':
                     $new_class = 'active';
                     $all_class = null;
                     $sub_class = null;
                     $pager->db->addWhere('sublease', '0', '=', 'and', 'search');
                     break;
                 case 'distance':
                     $pager->db->addWhere('campus_distance', $value, '=', 'and', 'search');
                     break;
                 case 'beds':
                     $value = (int) $value;
                     $pager->db->addWhere('bedroom_no', (int) $value, '>=', 'and', 'search');
                     break;
                 case 'eff':
                     $pager->db->addWhere('efficiency', '1', '=', 'and', 'search');
                     break;
                 case 'bath':
                     $value = (int) $value;
                     $pager->db->addWhere('bathroom_no', $value, '>=', 'and', 'search');
                     break;
                 case 'manager':
                     $value = preg_replace('/[^\\w\\s]|\\s{2,}/', ' ', $value);
                     $vlist = explode(' ', $value);
                     $db2 = new \PHPWS_DB('prop_contacts');
                     foreach ($vlist as $v) {
                         $db2->addWhere('company_name', "%{$value}%", 'like', 'or');
                     }
                     $db2->addColumn('id');
                     $managers = $db2->select('col');
                     if (!empty($managers)) {
                         $pager->db->addWhere('contact_id', $managers, 'in', 'and', 'properties');
                     } else {
                         $pager->db->addWhere('id', 0, '=', 'and', 'cancel');
                     }
                     break;
                 case 'price':
                     $pager->db->addWhere('monthly_rent', $value['min'] * 100, '>=', 'and', 'search');
                     $pager->db->addWhere('monthly_rent', $value['max'] * 100, '<=', 'and', 'search');
                     break;
                 case 'amenities':
                     foreach ($value as $amen_name => $foo) {
                         switch ($amen_name) {
                             case 'ac':
                                 $pager->db->addWhere('appalcart', 1, '=', 'and', 'search');
                                 break;
                             case 'ch':
                                 $pager->db->addWhere('clubhouse', 1, '=', 'and', 'search');
                                 break;
                             case 'dish':
                                 $pager->db->addWhere('dishwasher', 1, '=', 'and', 'search');
                                 break;
                             case 'furn':
                                 $pager->db->addWhere('furnished', 1, '=', 'and', 'search');
                                 break;
                             case 'pet':
                                 $pager->db->addWhere('pets_allowed', 1, '=', 'and', 'search');
                                 break;
                             case 'tr':
                                 $pager->db->addWhere('trash_type', 1, '=', 'and', 'search');
                                 break;
                             case 'wo':
                                 $pager->db->addWhere('workout_room', 1, '=', 'and', 'search');
                                 break;
                             case 'wash':
                                 $pager->db->addWhere('laundry_type', 1, '=', 'and', 'search');
                                 break;
                         }
                     }
                     break;
                 case 'property':
                     $value = preg_replace('/[^\\w\\s]|\\s{2,}/', ' ', $value);
                     $vlist = explode(' ', $value);
                     foreach ($vlist as $v) {
                         $pager->db->addWhere('name', "%{$v}%", 'like', 'or', 'property');
                     }
                     break;
             }
         }
     }
     $link = 'index.php?module=properties&uop=search';
     $page['ALL'] = sprintf('<li class="%s"><a href="%s">All properties</a></li>', $all_class, 'index.php?module=properties&uop=remove&s=allsub');
     $page['NEW'] = sprintf('<li class="%s"><a href="%s%s">New leases only</a></li>', $new_class, $link, '&amp;nosub=1');
     $page['SUB'] = sprintf('<li class="%s"><a href="%s%s">Subleases only</a></li>', $sub_class, $link, '&amp;sub=1');
     $pager->addPageTags($page);
     $content = $pager->get();
     \Layout::add($content);
 }
示例#10
0
 private function roomDamagePager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('hms', 'RoomDamage.php');
     $pager = new DBPager('hms_room_damage', 'RoomDamageDb');
     $pager->db->addJoin('LEFT OUTER', 'hms_room_damage', 'hms_damage_type', 'damage_type', 'id');
     $pager->addWhere('hms_room_damage.room_persistent_id', $this->room->getPersistentId());
     $pager->addWhere('hms_room_damage.repaired', 0);
     // Only non-repaired damages
     $pager->setModule('hms');
     $pager->setTemplate('admin/roomDamagesPager.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No damages found.");
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
示例#11
0
 /**
  * RLC Application pager for the RLC admin panel
  *
  * @return string HTML for application pager
  */
 public function rlcApplicationPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $submitCmd = CommandFactory::getCommand('AssignRlcApplicants');
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->addSubmit('submit', 'Submit Changes');
     $form->setClass('submit', 'btn btn-primary');
     $tags = $form->getTemplate();
     $pager = new DBPager('hms_learning_community_applications', 'HMS_RLC_Application');
     $pager->db->addColumn('hms_learning_community_applications.*');
     $pager->db->addJoin('LEFT OUTER', 'hms_learning_community_applications', 'hms_learning_community_assignment', 'id', 'application_id');
     $pager->db->addWhere('hms_learning_community_assignment.application_id', 'NULL', '=');
     $pager->db->addWhere('term', $this->term);
     $pager->db->addWhere('denied', 0);
     // Only show non-denied applications in this pager
     // If community filter is set, use it
     if (isset($this->rlc)) {
         $pager->db->addWhere('hms_learning_community_applications.rlc_first_choice_id', $this->rlc->getId(), '=');
     }
     // If student type filter is set, use it
     if (isset($this->studentType)) {
         if ($this->studentType == TYPE_FRESHMEN) {
             $pager->db->addWhere('hms_learning_community_applications.application_type', 'freshmen');
         } else {
             if ($this->studentType == TYPE_CONTINUING) {
                 // TODO fix this so 'returning' is consistent with 'continuing'.. really just use student types
                 $pager->db->addWhere('hms_learning_community_applications.application_type', 'returning');
             }
         }
     }
     $pager->setModule('hms');
     $pager->setLink('index.php?module=hms&action=SubmitRlcAssignments');
     $pager->setTemplate('admin/rlc_assignments_pager.tpl');
     $pager->setEmptyMessage("No pending RLC applications.");
     $pager->addPageTags($tags);
     $pager->addRowTags('getAdminPagerTags');
     $pager->setReportRow('applicantsReport');
     Layout::addPageTitle("RLC Assignments");
     return $pager->get();
 }