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&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 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(); }
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(); }
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(); }
/** * 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(); }
/** * 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(); }
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; }
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(); }
/** * 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(); }
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&action=admin&tab=manage_groups&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(); }
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, '&nosub=1'); $page['SUB'] = sprintf('<li class="%s"><a href="%s%s">Subleases only</a></li>', $sub_class, $link, '&sub=1'); $pager->addPageTags($page); $content = $pager->get(); \Layout::add($content); }
public static function ignore() { PHPWS_Core::initCoreClass('DBPager.php'); $tpl['TITLE'] = dgettext('search', 'Ignored'); PHPWS_Core::initModClass('search', 'Stats.php'); $pager = new DBPager('search_stats', 'Search_Stats'); $pager->setModule('search'); $pager->setTemplate('ignore.tpl'); $pager->addRowTags('getTplTags'); $options['keyword'] = ''; $options['delete_keyword'] = dgettext('search', 'Delete'); // if entered in search box, remove $options['remove_ignore'] = dgettext('search', 'Allow'); $form = new PHPWS_Form(); $form->setMethod('get'); $form->addHidden('module', 'search'); $form->addSelect('command', $options); $template = $form->getTemplate(); $js_vars['value'] = dgettext('search', 'Go'); $js_vars['select_id'] = 'command'; $js_vars['action_match'] = 'delete_keyword'; $js_vars['message'] = dgettext('search', 'Are you sure you want to delete the checked item(s)?'); $template['SUBMIT'] = javascript('select_confirm', $js_vars); $template['CHECK_ALL'] = javascript('check_all', array('checkbox_name' => 'keyword[]')); $template['KEYWORD_LABEL'] = dgettext('search', 'Keyword'); $template['TOTAL_QUERY_LABEL'] = dgettext('search', 'Total queries'); $template['LAST_CALL_DATE_LABEL'] = dgettext('search', 'Last called'); $pager->addPageTags($template); $pager->addToggle('class="bgcolor1"'); $pager->setSearch('keyword'); $pager->addWhere('ignored', 1); $tpl['CONTENT'] = $pager->get(); return $tpl; }
/** * Interwiki Setup * * @author Greg Meiste <*****@*****.**> */ function setup() { if (!Current_User::authorized('wiki', 'edit_page') && !(PHPWS_Settings::get('wiki', 'allow_page_edit') && Current_User::isLogged())) { Current_User::disallow(dgettext('wiki', 'User attempted access to Interwiki setup.')); return; } PHPWS_Core::initCoreClass('DBPager.php'); if ($_REQUEST['op'] == 'editinterwiki') { $tags = $this->edit(); } else { if ($_REQUEST['op'] == 'deleteinterwiki') { $tags = $this->kill(); } else { $tags = $this->add(); } } if ($_REQUEST['op'] == 'addinterwiki' || $_REQUEST['op'] == 'saveinterwiki') { WikiManager::sendMessage($this->save(), 'interwikisetup'); } else { if ($_REQUEST['op'] == 'dodeleteinterwiki') { WikiManager::sendMessage($this->kill(), 'interwikisetup'); } } $tags['MESSAGE'] = WikiManager::getMessage(); $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki'); $tags['SITE_LIST_LABEL'] = dgettext('wiki', 'Site list'); $tags['USAGE'] = sprintf(dgettext('wiki', 'To link to an interwiki site, use %s.'), 'WikiName:PageName'); $tags['LIST_LABEL'] = dgettext('wiki', 'Site Name'); $tags['LIST_URL'] = dgettext('wiki', 'URL'); $tags['LIST_UPDATED'] = dgettext('wiki', 'Updated'); $tags['LIST_ACTIONS'] = dgettext('wiki', 'Actions'); $pager = new DBPager('wiki_interwiki', 'InterWiki'); $pager->setModule('wiki'); $pager->setTemplate('interwiki/setup.tpl'); $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS); $pager->addPageTags($tags); $pager->addRowTags('getTpl'); $pager->setSearch('label'); $pager->setDefaultOrder('label', 'asc'); $pager->cacheQueries(); $template['TITLE'] = dgettext('wiki', 'Interwiki Setup'); $template['CONTENT'] = $pager->get(); Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE); }
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&aop=menu&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&aop=menu&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(); }
public function reasons() { PHPWS_Core::initCoreClass('DBPager.php'); PHPWS_Core::initModClass('checkin', 'Reasons.php'); $pt['MESSAGE_LABEL'] = dgettext('checkin', 'Submission message'); $pt['ADD_REASON'] = PHPWS_Text::secureLink(dgettext('checkin', 'Add reason'), 'checkin', array('aop' => 'edit_reason')); $pager = new DBPager('checkin_reasons', 'Checkin_Reasons'); $pager->setModule('checkin'); $pager->setTemplate('reasons.tpl'); $pager->addPageTags($pt); $pager->addSortHeader('id', dgettext('checkin', 'Id')); $pager->addSortHeader('summary', dgettext('checkin', 'Summary')); $pager->addRowTags('rowTags'); $this->title = dgettext('checkin', 'Reasons'); $this->content = $pager->get(); }
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'); }
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(); }
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(); }
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(); }
/** * 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(); }
/** * 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(); }
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; }
/** * ******************* * 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(); }
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(); }
/** * 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(); }
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(); }
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; }
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(); }
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; }
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(); }