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_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(); }
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(); }
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(); }
/** * 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 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 report() { PHPWS_Core::initCoreClass('DBPager.php'); PHPWS_Core::initModClass('signup', 'Peeps.php'); $pager = new DBPager('signup_peeps', 'Signup_Peep'); $pager->addWhere('sheet_id', $this->signup->sheet->id); $pager->addWhere('registered', 1); $pager->setModule('signup'); $pager->setTemplate('applicants.tpl'); $pager->addRowTags('rowtags'); $pager->addSortHeader('phone', dgettext('signup', 'Phone')); $pager->addSortHeader('last_name', dgettext('signup', 'Last name')); $pager->addSortHeader('first_name', dgettext('signup', 'First name')); $pager->addSortHeader('email', dgettext('signup', 'Email')); $vars['sheet_id'] = $this->signup->sheet->id; $vars['aop'] = 'csv_applicants'; $page_tags['CSV'] = PHPWS_Text::secureLink(dgettext('signup', 'CSV file'), 'signup', $vars); $vars['aop'] = 'slot_listing'; $js['label'] = dgettext('signup', 'Slot listing'); $js['menubar'] = 'yes'; $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true); $page_tags['SLOT_LISTING'] = javascript('open_window', $js); $vars['aop'] = 'print_applicants'; if (!empty($pager->search)) { if (isset($pager->searchColumn)) { $vars['search'] = implode('+', $pager->searchColumn); } else { $vars['search'] = $pager->search; } } if ($pager->orderby) { $vars['orderby'] = $pager->orderby; $vars['orderby_dir'] = $pager->orderby_dir; } $js['label'] = dgettext('signup', 'Print list'); $js['width'] = '1024'; $js['height'] = '768'; $js['menubar'] = 'yes'; $js['address'] = PHPWS_Text::linkAddress('signup', $vars, true); $page_tags['PRINT'] = javascript('open_window', $js); $vars['aop'] = 'email_applicants'; $page_tags['EMAIL'] = PHPWS_Text::secureLink(dgettext('signup', 'Email'), 'signup', $vars, null, "Email all people in the search results"); $page_tags['EXTRA_LABEL'] = dgettext('signup', 'Extra details'); // Add a link that takes the user back to the signup sheets page, skipping all the re-sorts $vars['aop'] = 'menu'; $vars['tab'] = 'list'; $page_tags['BACK'] = PHPWS_Text::secureLink(dgettext('signup', 'Back to Signup Sheets'), 'signup', $vars); $pager->addPageTags($page_tags); $pager->setSearch('last_name', 'first_name', 'organization'); $limits[25] = 25; $limits[50] = 50; $limits[100] = 100; $pager->setLimitList($limits); $this->signup->title = sprintf(dgettext('signup', '%s Participants'), $this->signup->sheet->title); $this->signup->content = $pager->get(); }
public static function entry_list() { PHPWS_Core::initCoreClass('DBPager.php'); $db = new PHPWS_DB('blog_stickies'); $db->addColumn('blog_id'); $GLOBALS['blog_stickies'] = $db->select('col'); $pageTags['SUMMARY'] = dgettext('blog', 'Summary'); $pageTags['ACTION'] = dgettext('blog', 'Action'); $pageTags['ADD'] = PHPWS_Text::secureLink(t('Create new blog entry'), 'blog', array('action' => 'admin', 'command' => 'new'), null, t('Create new blog entry'), 'btn btn-success pull-right'); $pageTags['ADD_URI'] = PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'command' => 'new'), true); $pageTags['ADD_TEXT'] = t('Create new blog entry'); $pager = new DBPager('blog_entries', 'Blog'); $pager->addSortHeader('title', dgettext('blog', 'Title')); $pager->addSortHeader('create_date', dgettext('blog', 'Creation')); $pager->addSortHeader('publish_date', dgettext('blog', 'Publish')); $pager->addSortHeader('expire_date', dgettext('blog', 'Expire')); $pager->setModule('blog'); $pager->setTemplate('list.tpl'); $pager->addToggle('class="toggle1"'); $pager->addRowTags('getPagerTags'); $pager->addPageTags($pageTags); $pager->setSearch('title'); $pager->setDefaultOrder('create_date', 'desc'); $pager->cacheQueries(); $pager->setReportRow('report_rows'); $content = $pager->get(); return $content; }
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 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(); }
/** * 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(); }
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(); }
/** * 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(); }
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(); }
/** * 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(); }
private function contactList() { $email = \PHPWS_Settings::get('properties', 'email'); if (empty($email)) { $this->content = 'Please enter the site email under settings'; return; } \PHPWS_Core::initModClass('properties', 'Contact.php'); $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new contact', 'properties', array('aop' => 'edit_contact'), null, null, 'btn btn-success'); $this->title = 'Contact listing'; $pager = new \DBPager('prop_contacts', 'Properties\\Contact'); if (isset($_GET['show']) && $_GET['show'] == 'inactive') { $pager->addWhere('active', 0); $page_tags['inactive'] = \PHPWS_Text::secureLink('<i class="fa fa-plus-square-o"></i> All contacts', 'properties', array('aop' => 'contacts'), null, null, 'btn btn-default'); } else { $page_tags['inactive'] = \PHPWS_Text::secureLink('<i class="fa fa-minus-square-o"></i> Inactive contacts', 'properties', array('aop' => 'contacts', 'show' => 'inactive'), null, null, 'btn btn-default'); } $pager->addSortHeader('company_name', 'Company'); $pager->addSortHeader('last_name', 'Last, First name'); $pager->addSortHeader('email_address', 'Email'); $pager->addSortHeader('last_log', 'Last log'); $pager->setModule('properties'); $pager->setTemplate('contact_list.tpl'); $pager->addRowTags('row_tags'); $pager->addPageTags($page_tags); $pager->setSearch('company_name', 'first_name', 'last_name', 'email_address'); $pager->setDefaultLimit(10); $pager->setDefaultOrder('company_name'); $pager->cacheQueries(); $pager->addToggle(' style="background-color : #e3e3e3"'); $this->content = $pager->get(); }
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(); }
/** * Settings Administration * * @author Greg Meiste <*****@*****.**> */ function admin() { if (!Current_User::authorized('wiki', 'edit_settings')) { Current_User::disallow(dgettext('wiki', 'User attempted access to Wiki Settings administration.')); return; } javascript('jquery'); PHPWS_Core::initModClass('wiki', 'WikiPage.php'); PHPWS_Core::initCoreClass('DBPager.php'); if (isset($_POST['op']) && $_POST['op'] == 'savesettings') { WikiManager::sendMessage(WikiSettings::save(), 'admin'); } $tabs = 1; $form = new PHPWS_Form(); $msg = dgettext('wiki', 'Enabling this setting will show the default wiki page on the home page of the web site.'); $form->addCheck('show_on_home'); $form->setMatch('show_on_home', PHPWS_Settings::get('wiki', 'show_on_home')); $form->addTplTag('SHOW_ON_HOME_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Show on home page'), 'id' => 'show_on_home_info', 'message' => $msg))); $form->setTab('show_on_home', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will allow all visitors to view the wiki. When disabled, only registered users can view the wiki.'); $form->addCheck('allow_anon_view'); $form->setMatch('allow_anon_view', PHPWS_Settings::get('wiki', 'allow_anon_view')); $form->addTplTag('ALLOW_ANON_VIEW_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow anonymous viewing'), 'id' => 'allow_anon_view_info', 'message' => $msg))); $form->setTab('allow_anon_view', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will allow all registered users to edit pages. When disabled, only registered users with admin privileges can edit pages. Anonymous visitors can never edit pages.'); $form->addCheck('allow_page_edit'); $form->setMatch('allow_page_edit', PHPWS_Settings::get('wiki', 'allow_page_edit')); $form->addTplTag('ALLOW_PAGE_EDIT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow all registered users to edit pages'), 'id' => 'allow_page_edit_info', 'message' => $msg))); $form->setTab('allow_page_edit', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will allow all registered users to upload images. When disabled, only registered users with admin privileges can upload images. Anonymous visitors can never upload images.'); $form->addCheck('allow_image_upload'); $form->setMatch('allow_image_upload', PHPWS_Settings::get('wiki', 'allow_image_upload')); $form->addTplTag('ALLOW_IMAGE_UPLOAD_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Allow all registered users to upload images'), 'id' => 'allow_image_upload_info', 'message' => $msg))); $form->setTab('allow_image_upload', $tabs++); $msg = dgettext('wiki', 'When enabled, the page text will also be parsed by the BBCode parser instead of just the Text_Wiki parser. Keep in mind that everything you can do with BBCode can be done with wikitax.'); $form->addCheck('allow_bbcode'); $form->setMatch('allow_bbcode', PHPWS_Settings::get('wiki', 'allow_bbcode')); $form->addTplTag('ALLOW_BBCODE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Enable BBCode parser'), 'id' => 'allow_bbcode_info', 'message' => $msg))); $form->setTab('allow_bbcode', $tabs++); $msg = dgettext('wiki', 'When enabled, the extended character set will be supported for wiki page names. For example, German umlauts would be allowed in a wiki page name.'); $form->addCheck('ext_chars_support'); $form->setMatch('ext_chars_support', PHPWS_Settings::get('wiki', 'ext_chars_support')); $form->addTplTag('EXT_CHARS_SUPPORT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Enable extended character set'), 'id' => 'ext_chars_support_info', 'message' => $msg))); $form->setTab('ext_chars_support', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will add the current wiki page title to the site title which appears in the browser title bar. The site title is sometimes used in themes meaning this setting would add the wiki page title to the theme as well.'); $form->addCheck('add_to_title'); $form->setMatch('add_to_title', PHPWS_Settings::get('wiki', 'add_to_title')); $form->addTplTag('ADD_TO_TITLE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Add wiki page title to site title'), 'id' => 'add_to_title_info', 'message' => $msg))); $form->setTab('add_to_title', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will format the current wiki page title before being displayed anywhere (excluding the wiki page text) by the module. The page title in the page text will have to be formatted manually if you do not like the standard WordsSmashedTogether default. The automatic formatting by the module will add spaces to the WikiPageTitle, making it Wiki Page Title.<br /><br />Remember, you will still have to refer to the page as WikiPageTitle in the page text, but you can change its appearance by using [WikiPageTitle Your Formatted Title Here].<br /><br />If this is confusing to you or others, it is recommended to not use this feature.'); $form->addCheck('format_title'); $form->setMatch('format_title', PHPWS_Settings::get('wiki', 'format_title')); $form->addTplTag('FORMAT_TITLE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Format the wiki page title before displaying'), 'id' => 'format_title_info', 'message' => $msg))); $form->setTab('format_title', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will show the <b>Last modified by</b> information on each wiki page. However, if UPDATED_INFO tag is not in the view template, the information will never show up, regardless of how this option is set.'); $form->addCheck('show_modified_info'); $form->setMatch('show_modified_info', PHPWS_Settings::get('wiki', 'show_modified_info')); $form->addTplTag('SHOW_MODIFIED_INFO_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Show page modified information'), 'id' => 'show_modified_info_info', 'message' => $msg))); $form->setTab('show_modified_info', $tabs++); $msg = dgettext('wiki', 'By default, when comparing two page revisions, the changes will be presented in a two column format. On fixed width layouts this could cause excessive horizontal scrolling. Setting this option will change the comparison to a single column format.'); $form->addCheck('diff_type'); $form->setMatch('diff_type', PHPWS_Settings::get('wiki', 'diff_type') == 'one_col'); $form->addTplTag('DIFF_TYPE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Use single column diff'), 'id' => 'diff_type_info', 'message' => $msg))); $form->setTab('diff_type', $tabs++); $msg = dgettext('wiki', 'Enabling this setting will email a notification to the Wiki Administrator email address on every page edit.'); $form->addCheck('monitor_edits'); $form->setMatch('monitor_edits', PHPWS_Settings::get('wiki', 'monitor_edits')); $form->addTplTag('MONITOR_EDITS_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Monitor Edits'), 'id' => 'monitor_edits_info', 'message' => $msg))); $form->setTab('monitor_edits', $tabs++); $msg = dgettext('wiki', 'Enter in the email address of the Wiki administrator. If this field is left blank or has an invalid email address, then the change will be ignored.'); $form->addText('admin_email', PHPWS_Settings::get('wiki', 'admin_email')); $form->setSize('admin_email', 25); $form->addTplTag('ADMIN_EMAIL_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Wiki Admin Email'), 'id' => 'admin_email_info', 'message' => $msg))); $form->setTab('admin_email', $tabs++); $msg = dgettext('wiki', 'This is the body text of the email sent when wiki pages are edited. HTML will be stripped out as the email will be sent as Plain Text. You can use variables [page] and [url] to represent the name of the wiki page and the url to view the page, respectively.'); $form->addTextArea('email_text', PHPWS_Settings::get('wiki', 'email_text')); $form->setWidth('email_text', '80%'); $form->setRows('email_text', 5); $form->addTplTag('EMAIL_TEXT_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Email Notification Text'), 'id' => 'email_text_info', 'message' => $msg))); $form->setTab('email_text', $tabs++); $msg = dgettext('wiki', 'The default page to display when no instructions are passed to the Wiki module.'); $form->addText('default_page', PHPWS_Settings::get('wiki', 'default_page')); $form->setSize('default_page', 25, 100); $form->addTplTag('DEFAULT_PAGE_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Default page'), 'id' => 'default_page_info', 'message' => $msg))); $form->setTab('default_page', $tabs++); $msg = dgettext('wiki', 'This controls where external pages will appear. _blank opens the new page in a new window. _parent is used in the situation where a frameset file is nested inside another frameset file. A link in one of the inner frameset documents which uses _parent will load the new page where the inner frameset file had been. If the current page\'s frameset file does not have any parent, then _parent works exactly like _top - the new document is loaded in the full window. _self puts the new page in the same window and frame as the current page.'); $options = array('_blank' => '_blank', '_parent' => '_parent', '_self' => '_self', '_top' => '_top'); $form->addSelect('ext_page_target', $options); $form->setMatch('ext_page_target', PHPWS_Settings::get('wiki', 'ext_page_target')); $form->addTplTag('EXT_PAGE_TARGET_LABEL', javascript('slider', array('link' => dgettext('wiki', 'Target for external links'), 'id' => 'ext_page_target_info', 'message' => $msg))); $form->setTab('ext_page_target', $tabs++); $form->addCheck('immutable_page'); $form->setMatch('immutable_page', PHPWS_Settings::get('wiki', 'immutable_page')); $form->setLabel('immutable_page', dgettext('wiki', 'Show immutable page text (if applicable)')); $form->setTab('immutable_page', $tabs++); $form->addCheck('raw_text'); $form->setMatch('raw_text', PHPWS_Settings::get('wiki', 'raw_text')); $form->setLabel('raw_text', dgettext('wiki', 'Show raw text link')); $form->setTab('raw_text', $tabs++); $form->addCheck('print_view'); $form->setMatch('print_view', PHPWS_Settings::get('wiki', 'print_view')); $form->setLabel('print_view', dgettext('wiki', 'Show print view link')); $form->setTab('print_view', $tabs++); $form->addCheck('what_links_here'); $form->setMatch('what_links_here', PHPWS_Settings::get('wiki', 'what_links_here')); $form->setLabel('what_links_here', dgettext('wiki', 'Show what links here link')); $form->setTab('what_links_here', $tabs++); $form->addCheck('recent_changes'); $form->setMatch('recent_changes', PHPWS_Settings::get('wiki', 'recent_changes')); $form->setLabel('recent_changes', dgettext('wiki', 'Show recent changes link')); $form->setTab('recent_changes', $tabs++); $form->addCheck('random_page'); $form->setMatch('random_page', PHPWS_Settings::get('wiki', 'random_page')); $form->setLabel('random_page', dgettext('wiki', 'Show random page link')); $form->setTab('random_page', $tabs++); $form->addCheck('discussion'); $form->setMatch('discussion', PHPWS_Settings::get('wiki', 'discussion')); $form->setLabel('discussion', dgettext('wiki', 'Enable discussion for registered users')); $form->setTab('discussion', $tabs++); $form->addCheck('discussion_anon'); $form->setMatch('discussion_anon', PHPWS_Settings::get('wiki', 'discussion_anon')); $form->setLabel('discussion_anon', dgettext('wiki', 'Allow anonymous discussion')); $form->setTab('discussion_anon', $tabs++); $form->addSubmit('save', dgettext('wiki', 'Save Settings')); $form->setTab('save', $tabs); $form->addHidden('module', 'wiki'); $form->addHidden('op', 'savesettings'); $tags = $form->getTemplate(); $tags['BACK'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Wiki'), 'wiki'); $tags['MESSAGE'] = WikiManager::getMessage(); $tags['MENU_ITEMS_LABEL'] = dgettext('wiki', 'Menu Items'); $tags['DISCUSSION_SECTION_LABEL'] = dgettext('wiki', 'Discussion'); $tags['SETTINGS_LABEL'] = dgettext('wiki', 'Settings'); $tags['PAGES_LABEL'] = dgettext('wiki', 'Wiki Pages'); $tags['TITLE'] = dgettext('wiki', 'Page Name'); $tags['UPDATED'] = dgettext('wiki', 'Updated'); $tags['VERSION'] = dgettext('wiki', 'Version'); $tags['HITS'] = dgettext('wiki', 'Hits'); $tags['ORPHANED'] = dgettext('wiki', 'Orphaned'); $tags['ACTIONS'] = dgettext('wiki', 'Actions'); $pager = new DBPager('wiki_pages', 'WikiPage'); $pager->setModule('wiki'); $pager->setTemplate('admin.tpl'); $pager->addToggle(PHPWS_LIST_TOGGLE_CLASS); $pager->addPageTags($tags); $pager->addRowTags('getTpl'); $pager->setSearch('title', 'pagetext'); $pager->setDefaultOrder('title', 'asc'); $pager->cacheQueries(); $template['TITLE'] = dgettext('wiki', 'Wiki Administration'); $template['CONTENT'] = $pager->get(); Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE); }