예제 #1
0
 public static function doPager()
 {
     $pager = new \DBPager('intern_major', '\\Intern\\Major');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('major_pager.tpl');
     $pager->setEmptyMessage('No Majors Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
예제 #2
0
 public static function doPager()
 {
     $pager = new \DBPager('intern_department', 'Intern\\Department');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('department_pager.tpl');
     $pager->setEmptyMessage('No Departments Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
 public static function doPager()
 {
     $pager = new \DBPager('intern_grad_prog', '\\Intern\\GradProgram');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('grad_pager.tpl');
     $pager->setEmptyMessage('No Graduate Programs Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
 public static function doPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('intern', 'GradProgram.php');
     $pager = new DBPager('intern_grad_prog', 'GradProgram');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('grad_pager.tpl');
     $pager->setEmptyMessage('No Graduate Programs Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
예제 #5
0
 public static function doPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('intern', 'Major.php');
     $pager = new DBPager('intern_major', 'Major');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('major_pager.tpl');
     $pager->setEmptyMessage('No Majors Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
예제 #6
0
 public function show()
 {
     $pager = new DBPager('hms_roommate', 'HMS_Roommate');
     $pager->db->addWhere('confirmed', 1);
     $pager->db->addWhere('term', Term::getSelectedTerm());
     $pager->setModule('hms');
     $pager->setTemplate('admin/roommate_pager.tpl');
     $pager->addRowTags('get_roommate_pager_tags');
     $pager->setEmptyMessage('No roommate groups found.');
     # Setup searching on the requestor and requestee columns
     $pager->setSearch('requestor', 'requestee');
     return $pager->get();
 }
예제 #7
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();
 }
예제 #8
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();
 }
예제 #9
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();
 }
예제 #10
0
 public static function denied_pager()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_learning_community_applications', 'HMS_RLC_Application');
     $pager->db->addWhere('term', Term::getSelectedTerm());
     $pager->db->addWhere('denied', 1);
     // show only denied applications
     $pager->db->addColumn('hms_learning_community_applications.*');
     $pager->db->addColumn('hms_learning_communities.abbreviation');
     $pager->db->addWhere('hms_learning_community_applications.rlc_first_choice_id', 'hms_learning_communities.id', '=');
     $pager->setModule('hms');
     $pager->setTemplate('admin/denied_rlc_app_pager.tpl');
     $pager->setEmptyMessage("No denied RLC applications exist.");
     $pager->addRowTags('getDeniedPagerTags');
     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();
 }
예제 #12
0
 /**
  * Image upload
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function imageUpload()
 {
     if (!Current_User::authorized('wiki', 'upload_images') && !(PHPWS_Settings::get('wiki', 'allow_image_upload') && Current_User::isLogged())) {
         Current_User::disallow(dgettext('wiki', 'User attempted access to image upload.'));
         return;
     }
     PHPWS_Core::initModClass('wiki', 'WikiImage.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     if (isset($_POST['op']) && $_POST['op'] == 'doimageupload') {
         $newImage = new WikiImage();
         WikiManager::sendMessage($newImage->save(), 'imageupload');
     }
     if ($_REQUEST['op'] == 'doimagedelete') {
         $delImage = new WikiImage($_REQUEST['id']);
         WikiManager::sendMessage($delImage->delete(), 'imageupload');
     }
     $tags = WikiImage::add();
     $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki');
     $tags['MESSAGE'] = WikiManager::getMessage();
     $tags['IMAGE_UPLOAD_LABEL'] = dgettext('wiki', 'Image Upload');
     $tags['IMAGE_LIST_LABEL'] = dgettext('wiki', 'Image List');
     $tags['USAGE'] = sprintf(dgettext('wiki', 'To include an image in a page, use %s.'), '[[image picture.jpg]]');
     $tags['LIST_FILENAME'] = dgettext('wiki', 'Filename');
     $tags['LIST_SIZE'] = dgettext('wiki', 'Size');
     $tags['LIST_TYPE'] = dgettext('wiki', 'Type');
     $tags['LIST_OWNER'] = dgettext('wiki', 'Uploader');
     $tags['LIST_CREATED'] = dgettext('wiki', 'Upload Date');
     $tags['LIST_ACTIONS'] = dgettext('wiki', 'Actions');
     $pager = new DBPager('wiki_images', 'WikiImage');
     $pager->setModule('wiki');
     $pager->setTemplate('images/admin.tpl');
     $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS);
     $pager->addPageTags($tags);
     $pager->addRowTags('getTpl');
     $pager->setSearch('filename', 'summary');
     $pager->setDefaultOrder('filename', 'asc');
     $pager->setEmptyMessage(dgettext('wiki', 'No images found.'));
     $pager->cacheQueries();
     $template['TITLE'] = dgettext('wiki', 'Wiki Images');
     $template['CONTENT'] = $pager->get();
     Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
 }
예제 #13
0
 public function staff()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('checkin', 'Staff.php');
     $page_tags['ADD_STAFF'] = $this->addStaffLink();
     //$page_tags['STAFF_NOTE'] = dgettext('checkin', 'Note: Staff members with no filters will not have visitors automatically assigned to them.');
     $page_tags['FILTER_LABEL'] = dgettext('checkin', 'Filter');
     $pager = new DBPager('checkin_staff', 'Checkin_Staff');
     $pager->setTemplate('staff.tpl');
     $pager->setModule('checkin');
     $pager->addRowTags('row_tags');
     $pager->setEmptyMessage(dgettext('checkin', 'No staff found.'));
     $pager->addPageTags($page_tags);
     $pager->joinResult('user_id', 'users', 'id', 'display_name');
     $pager->addSortHeader('lname_filter', dgettext('checkin', 'Filter'));
     $pager->addSortHeader('display_name', dgettext('checkin', 'Staff name'));
     $pager->addSortHeader('view_order', dgettext('checkin', 'Order'));
     $this->title = dgettext('checkin', 'Staff');
     $this->content = $pager->get();
 }
예제 #14
0
 public function pageList()
 {
     Layout::addStyle('pagesmith');
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('pagesmith', 'PS_Page.php');
     $pgtags['ACTION_LABEL'] = dgettext('pagesmith', 'Action');
     $createText = dgettext('pagesmith', 'New Page');
     $pgtags['NEW'] = "<a href='index.php?module=pagesmith&amp;aop=menu&amp;tab=new' class='button'>{$createText}/a>";
     if (PHPWS_Settings::get('pagesmith', 'text_only_default')) {
         $pgtags['NEW_PAGE_LINK_URI'] = 'index.php?module=pagesmith&aop=pick_template&tpl=text_only&pid=0&authkey=' . \Current_User::getAuthKey();
     } else {
         $pgtags['NEW_PAGE_LINK_URI'] = "index.php?module=pagesmith&amp;aop=menu&amp;tab=new";
     }
     $pgtags['NEW_PAGE_LINK_TEXT'] = $createText;
     $pager = new DBPager('ps_page', 'PS_Page');
     $pager->cacheQueries();
     $pager->addPageTags($pgtags);
     $pager->setModule('pagesmith');
     $pager->setTemplate('page_list.tpl');
     $pager->addRowTags('row_tags');
     $pager->setEmptyMessage(dgettext('pagesmith', 'No pages have been created.'));
     $pager->setSearch('title', 'id');
     $pager->addSortHeader('id', dgettext('pagesmith', 'Id'));
     $pager->addSortHeader('title', dgettext('pagesmith', 'Title'));
     $pager->addSortHeader('create_date', dgettext('pagesmith', 'Created'));
     $pager->addSortHeader('last_updated', dgettext('pagesmith', 'Updated'));
     $pager->addWhere('parent_page', 0);
     $pager->setDefaultLimit(10);
     $pager->setDefaultOrder('last_updated', 'desc');
     $this->ps->title = dgettext('pagesmith', 'Pages');
     $pager->initialize();
     $this->pullUpdated($pager);
     $this->ps->content = $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();
 }
예제 #16
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();
 }
예제 #17
0
파일: User.php 프로젝트: HaldunA/phpwebsite
 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);
 }
예제 #18
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();
 }
예제 #19
0
 public function scheduleListing()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('calendar', 'Schedule.php');
     require_once PHPWS_SOURCE_DIR . 'mod/calendar/class/Event.php';
     self::includeScheduleJS();
     self::includeEventJS();
     $schedule = new Calendar_Schedule();
     $schedule->id = 1;
     $this->title = dgettext('calendar', 'Schedules');
     $event = new Calendar_Event(0, $schedule);
     $page_tags['EVENT_FORM'] = self::eventModal($event);
     $page_tags['DESCRIPTION_LABEL'] = dgettext('calendar', 'Description');
     $page_tags['PUBLIC_LABEL'] = dgettext('calendar', 'Public');
     $page_tags['DISPLAY_NAME_LABEL'] = dgettext('calendar', 'User');
     $page_tags['AVAILABILITY_LABEL'] = dgettext('calendar', 'Availability');
     $page_tags['ADD_CALENDAR'] = '<button id="create-schedule" class="btn btn-success"><i class="fa fa-file-text"></i> ' . dgettext('calendar', 'Create schedule') . '</button>';
     $schedule_form = $this->calendar->schedule->form();
     $schedule_modal = new \Modal('schedule-modal', $schedule_form, 'Create schedule');
     $schedule_modal->sizeLarge();
     $page_tags['SCHEDULE_FORM'] = $schedule_modal->__toString();
     $page_tags['ADMIN_LABEL'] = dgettext('calendar', 'Options');
     $pager = new DBPager('calendar_schedule', 'Calendar_Schedule');
     $pager->setModule('calendar');
     $pager->setTemplate('admin/schedules.tpl');
     $pager->addPageTags($page_tags);
     $pager->addRowTags('rowTags');
     $pager->addToggle('class="bgcolor1"');
     $pager->setEmptyMessage(dgettext('calendar', 'No schedules have been created.'));
     $pager->addSortHeader('title', dgettext('calendar', 'Title'));
     $pager->addSortHeader('public', dgettext('calendar', 'Availability'));
     $pager->db->addWhere('user_id', 0);
     $pager->db->addWhere('user_id', 'users.id', '=', 'or');
     $pager->db->addColumn('*');
     $pager->db->addColumn('users.display_name');
     $pager->db->addJoin('left', 'calendar_schedule', 'users', 'user_id', 'id');
     $pager->initialize();
     $this->content = $pager->get();
 }
예제 #20
0
    /**
     * Lists the contents of a folder for adminstrative changes.
     * @param object $folder
     * @param boolean $pick_image
     */
    public function folderContents($folder)
    {
        $links = array();
        javascript('jquery');
        $src = PHPWS_SOURCE_HTTP . 'mod/filecabinet/javascript/folder_options/contents.js';
        \Layout::addJSHeader("<script type='text/javascript' src='{$src}'></script>", 'folder-options');
        Layout::addStyle('filecabinet');
        PHPWS_Core::initCoreClass('DBPager.php');
        $dir_write = true;
        if (!is_writable($folder->getFullDirectory())) {
            $this->cabinet->message .= dgettext('filecabinet', 'Warning: this folder\'s directory is not writable.');
            $dir_write = false;
        }
        if ($folder->ftype == IMAGE_FOLDER) {
            javascript('lightbox');
            PHPWS_Core::initModClass('filecabinet', 'Image.php');
            $pager = new DBPager('images', 'PHPWS_Image');
            $pager->setTemplate('Forms/image_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $operation = 'iop';
            $command = 'upload_image_form';
            $label = _('Add image');
        } elseif ($folder->ftype == DOCUMENT_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Document.php');
            $pager = new DBPager('documents', 'PHPWS_Document');
            $pager->setTemplate('Forms/file_list.tpl');
            $limits[10] = 10;
            $limits[25] = 25;
            $limits[50] = 50;
            $operation = 'dop';
            $label = _('Add document');
            $command = 'upload_document_form';
            $pager->addSortHeader('downloaded', sprintf('<abbr title="%s">%s</abbr>', dgettext('filecabinet', 'Downloaded'), dgettext('filecabinet', 'DL')));
        } elseif ($folder->ftype = MULTIMEDIA_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Multimedia.php');
            $pager = new DBPager('multimedia', 'PHPWS_Multimedia');
            $pager->setTemplate('Forms/multimedia_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $label = _('Add media');
            $command = 'upload_multimedia_form';
            $operation = 'mop';
        }
        if (Current_User::allow('filecabinet', 'edit_folders', $folder->id, 'folder')) {
            if ($dir_write) {
                $links[] = $folder->uploadLink('button');
            }
            if ($folder->ftype == MULTIMEDIA_FOLDER) {
                //$links[] = $folder->rtmpLink();
                $salt = array('mop' => 'edit_rtmp', 'folder_id' => $folder->id);
                $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
                $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_rtmp" data-operation="{$operation}" data-folder-id="{$folder->id}"><i class="fa fa-cloud"></i> Add RTMP video</button>
EOF;
            }
            //$links[] = $folder->editLink();
            $salt = array($operation => 'edit_folder', 'folder_id' => $folder->id);
            $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
            $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_folder_modal" data-operation="aop" data-folder-id="{$folder->id}"><i class="fa fa-edit"></i> Edit</button>
EOF;
        }
        if ($this->cabinet->panel) {
            $pagetags['BACK'] = PHPWS_Text::moduleLink('<i class="fa fa-reply"></i> ' . dgettext('filecabinet', 'Back to folder list'), 'filecabinet', array('tab' => $this->cabinet->panel->getCurrentTab()), null, null, 'btn btn-default');
        }
        if (!empty($links)) {
            $pagetags['ADMIN_LINKS'] = implode(' ', $links);
        }
        $pagetags['MODAL'] = $this->getModal();
        $pagetags['ACTION_LABEL'] = dgettext('filecabinet', 'Action');
        $pager->setLimitList($limits);
        $pager->setSearch('file_name', 'title', 'description');
        $pager->addWhere('folder_id', $folder->id);
        $pager->setOrder('title', 'asc', true);
        $pager->setModule('filecabinet');
        $pager->addPageTags($pagetags);
        $pager->addRowTags('rowTags');
        $pager->addSortHeader('title', dgettext('filecabinet', 'Title'));
        $pager->addSortHeader('file_name', dgettext('filecabinet', 'File name'));
        $pager->addSortHeader('file_type', dgettext('filecabinet', 'File type'));
        $pager->addSortHeader('size', dgettext('filecabinet', 'Size'));
        $pager->setEmptyMessage(dgettext('filecabinet', 'Folder is empty.'));
        $this->cabinet->content = $pager->get();
    }
예제 #21
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();
 }
예제 #22
0
파일: User.php 프로젝트: HaldunA/phpwebsite
 public static function getResults($phrase, $module = NULL, $exact_match = FALSE)
 {
     PHPWS_Core::initModClass('search', 'Stats.php');
     $pageTags = array();
     $pageTags['MODULE_LABEL'] = dgettext('search', 'Module');
     $pageTags['TITLE_LABEL'] = dgettext('search', 'Title');
     $ignore = Search_User::getIgnore();
     if (PHPWS_Error::isError($ignore)) {
         PHPWS_Error::log($ignore);
         $ignore = NULL;
     }
     if (empty($phrase)) {
         return FALSE;
     }
     $words = explode(' ', $phrase);
     if (!empty($ignore)) {
         $words_removed = array_intersect($words, $ignore);
         if (!empty($words_removed)) {
             $pageTags['REMOVED_LABEL'] = dgettext('search', 'The following search words were ignored');
             $pageTags['IGNORED_WORDS'] = implode(' ', $words_removed);
             foreach ($words_removed as $remove) {
                 $key = array_search($remove, $words);
                 unset($words[$key]);
             }
         }
     }
     if (empty($words)) {
         return FALSE;
     }
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('phpws_key', 'Key');
     $pager->setModule('search');
     $pager->setTemplate('search_results.tpl');
     $pager->addToggle('class="bgcolor1"');
     $pager->addRowTags('getTplTags');
     $pager->addPageTags($pageTags);
     foreach ($words as $keyword) {
         if (strlen($keyword) < SEARCH_MIN_WORD_LENGTH) {
             continue;
         }
         if ($exact_match) {
             $s_keyword = "%{$keyword} %";
         } else {
             $s_keyword = "%{$keyword}%";
         }
         $pager->addWhere('search.keywords', $s_keyword, 'like', 'or', 1);
     }
     // No keywords were set. All under minimum word length
     if (empty($s_keyword)) {
         return null;
     }
     $pager->setEmptyMessage(dgettext('search', 'Nothing found'));
     $pager->db->setGroupConj(1, 'AND');
     if ($module) {
         $pager->addWhere('search.module', $module);
         Key::restrictView($pager->db, $module);
     } else {
         Key::restrictView($pager->db);
     }
     $result = $pager->get();
     Search_Stats::record($words, $pager->total_rows, $exact_match);
     return $result;
 }
예제 #23
0
 /**
  * Waiting List pager for On-campus Waiting List
  * @return string HTML for pager
  */
 public static function waitingListPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $term = PHPWS_Settings::get('hms', 'lottery_term');
     $pager = new DBPager('hms_new_application', 'LotteryApplication');
     $pager->db->addColumn('hms_new_application.*');
     $pager->db->addColumn('hms_lottery_application.*');
     $pager->db->addJoin('LEFT', 'hms_new_application', 'hms_lottery_application', 'id', 'id');
     $pager->db->addJoin('LEFT OUTER', 'hms_new_application', 'hms_assignment', 'username', 'asu_username AND hms_new_application.term = hms_assignment.term');
     $pager->db->addWhere('hms_assignment.asu_username', 'NULL');
     $pager->db->addWhere('hms_new_application.term', $term);
     $pager->db->addWhere('hms_new_application.cancelled', 0);
     $pager->db->addWhere('hms_lottery_application.special_interest', 'NULL');
     $pager->db->addWhere('hms_lottery_application.waiting_list_date', 'NULL', '!=');
     // Order by class, then by application ID in order to keep a fixed order
     // This accounts for the 'you are x of y students' message on the student's menu
     $pager->db->addOrder(array('application_term DESC', 'hms_new_application.id ASC'));
     $pager->setModule('hms');
     $pager->setTemplate('admin/lottery_wait_list_pager.tpl');
     $pager->setEmptyMessage('No students found.');
     $pager->addPageTags(array('TITLE' => 'Re-application Waiting List - ' . Term::toString($term)));
     $pager->addRowTags('waitingListTags');
     $pager->setReportRow('waitingListCsvTags');
     $pager->setSearch('hms_new_application.username', 'hms_new_application.banner_id');
     return $pager->get();
 }
예제 #24
0
 public static function waitingListPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $term = PHPWS_Settings::get('hms', 'lottery_term');
     $pager = new DBPager('hms_new_application', 'WaitingListApplication');
     $pager->db->addJoin('LEFT', 'hms_new_application', 'hms_waitlist_application', 'id', 'id');
     $pager->db->addJoin('LEFT OUTER', 'hms_new_application', 'hms_assignment', 'username', 'asu_username AND hms_new_application.term = hms_assignment.term');
     $pager->db->addWhere('hms_assignment.asu_username', 'NULL');
     $pager->db->addWhere('hms_new_application.term', $term);
     $pager->db->addWhere('hms_new_application.application_type', 'offcampus_waiting_list');
     $pager->db->addWhere('hms_new_application.physical_disability', 0);
     $pager->db->addWhere('hms_new_application.psych_disability', 0);
     $pager->db->addWhere('hms_new_application.medical_need', 0);
     $pager->db->addWhere('hms_new_application.gender_need', 0);
     $pager->db->addWhere('hms_new_application.cancelled', 0);
     $pager->db->addOrder('hms_new_application.created_on ASC');
     //$query = "select username from hms_new_application UNION ALL select asu_username from hms_assignment";
     //$pager->db->setSQLQuery($query);
     $pager->setModule('hms');
     $pager->setTemplate('admin/lottery_wait_list_pager.tpl');
     $pager->setEmptyMessage('No students found.');
     $pager->addPageTags(array('TITLE' => 'Open Waiting List - ' . Term::toString($term)));
     $pager->addRowTags('waitingListTags');
     $pager->setReportRow('waitingListCsvTags');
     $pager->setSearch('hms_new_application.username', 'hms_new_application.banner_id');
     return $pager->get();
 }
예제 #25
0
 public static function getAdminPager()
 {
     $pager = new \DBPager('intern_admin', '\\Intern\\Admin');
     $pager->setModule('intern');
     $pager->setTemplate('admin_pager.tpl');
     $pager->setEmptyMessage('No admins found.');
     $pager->addRowTags('rowTags');
     $pager->joinResult('department_id', 'intern_department', 'id', 'name', 'department_name');
     //$pager->db->setTestMode();
     // Set a default order
     if (!isset($_REQUEST['orderby'])) {
         $pager->setOrder('department_name');
     }
     /***** Row Background Color Toggles ******/
     $pager->addToggle('tablerow-bg-color1');
     $pager->addToggle('tablerow-bg-color2');
     // Search
     $pager->setSearch('username');
     return $pager->get();
 }
예제 #26
0
 public function listRoommates()
 {
     $this->setSearchParameters();
     $this->searchPanel();
     \Layout::addStyle('properties', 'forms.css');
     if (!\Current_User::isLogged()) {
         $login = \PHPWS_Settings::get('properties', 'login_link');
         if (empty($login)) {
             $login = '******';
         }
         $tpl['LOGIN'] = sprintf('Want to request or contact a roommate? <a href="%s">You will need to login</a>', $login);
     } else {
         $tpl['LOGIN'] = $this->options();
     }
     $pager = new \DBPager('prop_roommate', 'properties\\Roommate');
     $pager->addPageTags($tpl);
     $pager->setModule('properties');
     $pager->setTemplate('roommates.tpl');
     $pager->setDefaultOrder('updated', 'desc');
     $pager->addRowTags('rowtags');
     $pager->addSortHeader('name', 'Title');
     $pager->addSortHeader('monthly_rent', 'Monthly rent');
     $pager->addSortHeader('share_bedroom', 'bedroom?');
     $pager->addSortHeader('share_bathroom', 'bathroom?');
     $pager->addSortHeader('campus_distance', 'Campus distance');
     $pager->addSortHeader('move_in_date', 'Move in date');
     $pager->setSearch('name');
     if (!empty($_SESSION['roommate_search'])) {
         foreach ($_SESSION['roommate_search'] as $key => $value) {
             switch ($key) {
                 case 'sub':
                     $pager->db->addWhere('sublease', '1', '=', 'and', 'search');
                     break;
                 case 'nosub':
                     $pager->db->addWhere('sublease', '0', '=', 'and', 'search');
                     break;
                 case 'gen':
                     $pager->db->addWhere('gender', array(0, $value), 'in', 'and', 'search');
                     break;
                 case 'smoke':
                     $pager->db->addWhere('smoking', array(0, $value), 'in', 'and', 'search');
                     break;
                 case 'distance':
                     $pager->db->addWhere('campus_distance', $value, '=', 'and', 'search');
                     break;
                 case 'beds':
                     // notice the reverse
                     $value = $value ? 0 : 1;
                     $pager->db->addWhere('share_bedroom', $value, '=', 'and', 'search');
                     break;
                 case 'bath':
                     // notice the reverse
                     $value = $value ? 0 : 1;
                     $pager->db->addWhere('share_bathroom', $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;
             }
         }
     }
     // roommates that are a month past move in date, are not shown
     $cut_off_date = time() - 86400 * 30;
     $pager->addWhere('move_in_date', $cut_off_date, '>');
     $pager->setEmptyMessage('No one is currently looking for a roommate. Try again later.');
     $this->content = $pager->get();
 }