Пример #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();
 }
 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();
 }
Пример #3
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();
 }
Пример #4
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;
 }
 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();
 }
Пример #6
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();
 }
Пример #7
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();
 }
Пример #8
0
 public function show()
 {
     $pager = new DBPager('hms_learning_communities', 'HMS_Learning_Community');
     $pager->db->addOrder('community_name ASC');
     $pager->setModule('hms');
     $pager->setTemplate('admin/rlc_edit_list.tpl');
     $pager->addRowTags('rowTags');
     $addCmd = CommandFactory::getCommand('ShowAddRlc');
     $pageTags = array();
     $pageTags['ADD_LINK'] = $addCmd->getURI();
     $pager->addPageTags($pageTags);
     $this->setTitle('Edit Learning Communities');
     return $pager->get();
 }
Пример #9
0
 public static function listTrackers()
 {
     PHPWS_Core::initModClass('analytics', 'GenericTracker.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('analytics_tracker', 'GenericTracker');
     $pager->addSortHeader('name', dgettext('analytics', 'Name'));
     $pager->addSortHeader('type', dgettext('analytics', 'Type'));
     $pager->addSortHeader('active', dgettext('analytics', 'Active'));
     $pageTags = array();
     $pageTags['ACTION'] = dgettext('analytics', 'Action');
     $pageTags['ACCOUNT'] = dgettext('analytics', 'Account ID');
     $pager->setModule('analytics');
     $pager->setTemplate('list.tpl');
     $pager->addToggle('class="toggle1"');
     $pager->addRowTags('getPagerTags');
     $pager->addPageTags($pageTags);
     $pager->setSearch('name');
     $pager->setDefaultOrder('name', 'asc');
     $pager->cacheQueries();
     return $pager->get();
 }
Пример #10
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();
 }
Пример #11
0
 public static function blockList()
 {
     Layout::addStyle('block');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pageTags['NEW_BLOCK'] = PHPWS_Text::secureLink(dgettext('block', 'Create new block'), 'block', array('action' => 'new'), null, dgettext('block', 'Create new block'), 'button');
     $pageTags['NEW_BLOCK_URI'] = PHPWS_Text::linkAddress('block', array('action' => 'new'), true);
     $pageTags['CONTENT'] = dgettext('block', 'Content');
     $pageTags['ACTION'] = dgettext('block', 'Action');
     $pager = new DBPager('block', 'Block_Item');
     $pager->setModule('block');
     $pager->setTemplate('list.tpl');
     $pager->addToggle('class="bgcolor1"');
     $pager->addPageTags($pageTags);
     $pager->addRowTags('getTpl');
     $pager->addSortHeader('title', dgettext('block', 'Title'));
     $content = $pager->get();
     return $content;
 }
Пример #12
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();
 }
Пример #13
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();
 }
Пример #14
0
 protected function propertiesList($contact_id = null)
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $this->title = 'Property listing';
     $pager = new \DBPager('properties', 'Properties\\Property');
     if ($contact_id) {
         $pager->addWhere('contact_id', $contact_id);
         $data['is_contact'] = 1;
         $page_tags['new'] = \PHPWS_Text::moduleLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('cop' => 'edit_property', 'k' => $this->contact->getKey()), null, null, 'btn btn-success');
     } else {
         $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('aop' => 'edit_property'), null, null, 'btn btn-success');
     }
     // photo was previously uploaded
     if (!empty($_GET['pid'])) {
         $data['pid'] = $_GET['pid'];
     } else {
         $data['pid'] = 0;
     }
     javascriptMod('properties', 'photo_upload', $data);
     $pager->setSearch('name', 'company_name');
     $pager->addSortHeader('name', 'Name of property');
     $pager->addSortHeader('company_name', 'Management company');
     $pager->addSortHeader('timeout', 'Time until purge');
     $pager->setModule('properties');
     $pager->setTemplate('properties_list.tpl');
     $pager->addRowTags('row_tags', (bool) $contact_id);
     $pager->joinResult('contact_id', 'prop_contacts', 'id', 'company_name', null, true);
     $pager->addPageTags($page_tags);
     $pager->cacheQueries();
     $this->content = $pager->get();
 }
Пример #15
0
 /**
  * Lists the branches on the system
  */
 public function listBranches()
 {
     $page_tags['BRANCH_NAME_LABEL'] = dgettext('branch', 'Branch name');
     $page_tags['DIRECTORY_LABEL'] = dgettext('branch', 'Directory');
     $page_tags['URL_LABEL'] = dgettext('branch', 'Url');
     $page_tags['ACTION_LABEL'] = dgettext('branch', 'Action');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('branch_sites', 'Branch');
     $pager->setModule('branch');
     $pager->setTemplate('branch_list.tpl');
     $pager->addPageTags($page_tags);
     $pager->addToggle('class="toggle1"');
     $pager->addRowTags('getTpl');
     $pager->setSearch('branch_name');
     $this->title = dgettext('branch', 'Branch List');
     $this->content = $pager->get();
 }
Пример #16
0
 private function viewReported()
 {
     javascriptMod('properties', 'report');
     javascript('confirm');
     \PHPWS_Core::initModClass('properties', 'Report.php');
     $this->title = 'Reported messages';
     $pager = new \DBPager('prop_report', 'Properties\\Report');
     if (!isset($_SESSION['prop_show_blocked'])) {
         $vars['aop'] = 'show_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Show blocked', 'properties', $vars, null, null, 'btn btn-default');
         $pager->db->addWhere('prop_report.block', 0);
     } else {
         $vars['aop'] = 'hide_blocked';
         $tags['BLOCKED'] = \PHPWS_Text::secureLink('Hide blocked', 'properties', $vars, null, null, 'btn btn-default');
     }
     $pager->addPageTags($tags);
     $pager->addSortHeader('date_sent', 'Date reported');
     $pager->joinResult('message_id', 'prop_messages', 'id', 'body', 'message');
     $pager->db->addJoin('left', 'prop_report', 'prop_messages', 'message_id', 'id');
     $pager->setModule('properties');
     $pager->setTemplate('reported_list.tpl');
     $pager->addRowTags('row');
     $this->content = $pager->get();
 }
Пример #17
0
 public static function import()
 {
     PHPWS_Core::requireConfig('rss');
     if (!ini_get('allow_url_fopen')) {
         $tpl['TITLE'] = dgettext('rss', 'Sorry');
         $tpl['CONTENT'] = dgettext('rss', 'You must enable allow_url_fopen in your php.ini file.');
         return $tpl;
     }
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('rss', 'Feed.php');
     $content = NULL;
     $vars['address'] = 'index.php?module=rss&command=add_feed';
     $vars['label'] = dgettext('rss', 'Add feed');
     $vars['width'] = '450';
     $vars['height'] = '350';
     $template['ADD_LINK'] = javascript('open_window', $vars);
     $template['TITLE_LABEL'] = dgettext('rss', 'Title');
     $template['ADDRESS_LABEL'] = dgettext('rss', 'Address');
     $template['DISPLAY_LABEL'] = dgettext('rss', 'Display?');
     $template['ACTION_LABEL'] = dgettext('rss', 'Action');
     $template['REFRESH_TIME_LABEL'] = dgettext('rss', 'Refresh feed');
     $pager = new DBPager('rss_feeds', 'RSS_Feed');
     $pager->setModule('rss');
     $pager->setTemplate('admin_feeds.tpl');
     $pager->addPageTags($template);
     $pager->addRowTags('pagerTags');
     $content = $pager->get();
     $tpl['TITLE'] = dgettext('rss', 'Import RSS Feeds');
     $tpl['CONTENT'] = $content;
     if (!defined('ALLOW_CACHE_LITE') || !ALLOW_CACHE_LITE) {
         $tpl['MESSAGE'] = dgettext('rss', 'Please enable Cache Lite in your config/core/config.php file.');
     }
     return $tpl;
 }
Пример #18
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();
 }
Пример #19
0
 function history()
 {
     PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     if (PHPWS_Settings::get('wiki', 'add_to_title')) {
         Layout::addPageTitle($this->getTitle());
     }
     $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $this->getTitle(FALSE)));
     $tags['TITLE'] = dgettext('wiki', 'Revision History');
     $tags['VERSION'] = dgettext('wiki', 'Version');
     $tags['UPDATED'] = dgettext('wiki', 'Updated');
     $tags['EDITOR'] = dgettext('wiki', 'Editor');
     $tags['COMMENT'] = dgettext('wiki', 'Comment');
     $tags['DIFF'] = dgettext('wiki', 'Compare To');
     $tags['ACTIONS'] = dgettext('wiki', 'Actions');
     $pager = new DBPager('wiki_pages_version', 'OldWikiPage');
     $pager->setModule('wiki');
     $pager->setTemplate('history/list.tpl');
     $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS);
     $pager->addPageTags($tags);
     $pager->addRowTags('getHistoryTpl');
     $pager->addWhere('source_id', $this->getId());
     $pager->setSearch('pagetext', 'comment');
     $pager->setDefaultOrder('vr_number', 'desc');
     return $pager->get();
 }
Пример #20
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();
 }
Пример #21
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();
 }
Пример #22
0
 public function listSignup()
 {
     $ptags['TITLE_HEADER'] = dgettext('signup', 'Title');
     $ptags['START_TIME_HEADER'] = dgettext('signup', 'Start Time');
     $ptags['END_TIME_HEADER'] = dgettext('signup', 'End Time');
     PHPWS_Core::initModClass('signup', 'Sheet.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('signup_sheet', 'Signup_Sheet');
     $pager->setModule('signup');
     $pager->setTemplate('sheet_list.tpl');
     $pager->addRowTags('rowTag');
     $pager->addPageTags($ptags);
     Key::restrictEdit($pager->db, 'signup', 'edit_sheet');
     $this->signup->content = $pager->get();
     $this->signup->title = dgettext('signup', 'Signup Sheets');
 }
Пример #23
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();
 }
Пример #24
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();
 }
Пример #25
0
 /**
  * Recent Changes
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function recentChanges()
 {
     PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki');
     $tags['PAGE'] = dgettext('wiki', 'Page Name');
     $tags['UPDATED'] = dgettext('wiki', 'Updated');
     $tags['EDITOR'] = dgettext('wiki', 'Editor');
     $tags['COMMENT'] = dgettext('wiki', 'Comment');
     $tags['VIEW'] = dgettext('wiki', 'View');
     $pager = new DBPager('wiki_pages_version', 'OldWikiPage');
     $pager->setModule('wiki');
     $pager->setTemplate('recentchanges/list.tpl');
     $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS);
     $pager->addPageTags($tags);
     $pager->addRowTags('getRecentChangesTpl');
     $pager->setSearch('pagetext', 'comment');
     $pager->setDefaultOrder('id', 'desc');
     $pager->setLimitList(array(10, 25, 50, 75, 100));
     return $pager->get();
 }
Пример #26
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();
 }
 /**
  * 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();
 }
Пример #28
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();
 }
Пример #29
0
 public static function import()
 {
     $source_http = PHPWS_SOURCE_HTTP;
     $script = "<script src='{$source_http}mod/rss/javascript/feed.js'></script>";
     javascript('jquery');
     \Layout::addJSHeader($script);
     PHPWS_Core::requireConfig('rss');
     if (!ini_get('allow_url_fopen')) {
         $tpl['TITLE'] = dgettext('rss', 'Sorry');
         $tpl['CONTENT'] = dgettext('rss', 'You must enable allow_url_fopen in your php.ini file.');
         return $tpl;
     }
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('rss', 'Feed.php');
     $content = NULL;
     $template['ADD_LINK'] = '<button class="btn btn-success edit-feed"><i></i> Add Feed</button>';
     /*
      $vars['address'] = 'index.php?module=rss&command=add_feed';
      $vars['label'] = dgettext('rss', 'Add feed');
      $vars['width'] = '450';
      $vars['height'] = '350';
      $template['ADD_LINK'] = javascript('open_window', $vars);
     * 
     */
     $template['TITLE_LABEL'] = dgettext('rss', 'Title');
     $template['ADDRESS_LABEL'] = dgettext('rss', 'Address');
     $template['DISPLAY_LABEL'] = dgettext('rss', 'Display?');
     $template['ACTION_LABEL'] = dgettext('rss', 'Action');
     $template['REFRESH_TIME_LABEL'] = dgettext('rss', 'Refresh feed');
     $modal = new \Modal('rss-modal');
     $modal->addButton('<button class="btn btn-primary" id="save-feed"><i class="fa fa-save"></i> Save</button>');
     $modal_content = RSS_Admin::editFeed();
     $modal->setContent($modal_content);
     $modal->setTitle('Edit feed');
     $modal->setWidthPixel('400');
     $template['MODAL'] = $modal->get();
     $pager = new DBPager('rss_feeds', 'RSS_Feed');
     $pager->setModule('rss');
     $pager->setTemplate('admin_feeds.tpl');
     $pager->addPageTags($template);
     $pager->addRowTags('pagerTags');
     $content = $pager->get();
     $tpl['TITLE'] = dgettext('rss', 'Import RSS Feeds');
     $tpl['CONTENT'] = $content;
     if (!defined('ALLOW_CACHE_LITE') || !ALLOW_CACHE_LITE) {
         $tpl['MESSAGE'] = dgettext('rss', 'Please enable Cache Lite in your config/core/config.php file.');
     }
     return $tpl;
 }
Пример #30
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();
 }