public function approval() { PHPWS_Core::initCoreClass('DBPager.php'); PHPWS_Core::initModClass('calendar', 'Suggestion.php'); $pager = new DBPager('calendar_suggestions', 'Calendar_Suggestion'); $pager->setModule('calendar'); $pager->setTemplate('admin/approval.tpl'); $pager->setOrder('submitted', null, true); $pager->addRowTags('getTpl'); $pager->addToggle('class="bgcolor2"'); $page_tags['TITLE_LABEL'] = dgettext('calendar', 'Title / Time / Description'); $page_tags['LOCATION_LABEL'] = dgettext('calendar', 'Location'); $page_tags['ACTION_LABEL'] = dgettext('calendar', 'Action'); $pager->setEmptyMessage(dgettext('calendar', 'No suggestions to approve.')); $pager->addPageTags($page_tags); $this->title = dgettext('calendar', 'Suggested events'); $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(); }
/** * Special Interest Group DBPager for lottery * * @param unknown $group * @param unknown $term * @throws InvalidArgumentException */ public static function specialInterestPager($group, $term) { PHPWS_Core::initCoreClass('DBPager.php'); $pager = new DBPager('hms_new_application', 'LotteryApplication'); $pager->setModule('hms'); $pager->addRowTags('specialInterestTags'); $pager->db->addJoin('left outer', 'hms_new_application', 'hms_lottery_application', 'id', 'id'); // Gotta add column from hms_lottery_application so you can order by special_interest. $pager->db->addColumn('hms_lottery_application.*'); $pager->addWhere('hms_new_application.term', $term); // If student is in special interest group already then only show them in the list when their group // is selected in the drop down. Or show them everywhere is they're not in a group. $pager->addWhere('hms_lottery_application.special_interest', $group, '=', 'OR', 'in_group'); $pager->addWhere('hms_lottery_application.special_interest', 'NULL', '=', 'OR', 'in_group'); if ($group == 'honors') { $pager->addWhere('hms_lottery_application.honors_pref', 1); } else { if ($group == 'watauga_global') { $pager->addWhere('hms_lottery_application.wg_pref', 1); } else { if ($group == 'teaching') { $pager->addWhere('hms_lottery_application.tf_pref', 1); } else { if (substr($group, 0, 8) == 'sorority') { // starts with 'sorority' $pager->addWhere('hms_lottery_application.sorority_pref', $group); } else { if ($group == 'special_needs') { $pager->addWhere('hms_new_application.physical_disability', 1, '=', 'OR', 'blah'); $pager->addWhere('hms_new_application.psych_disability', 1, '=', 'OR', 'blah'); $pager->addWhere('hms_new_application.medical_need', 1, '=', 'OR', 'blah'); $pager->addWhere('hms_new_application.gender_need', 1, '=', 'OR', 'blah'); } else { // bad group throw new InvalidArgumentException('Invalid special interest group specified.'); } } } } } $pager->setOrder('hms_lottery_application.special_interest', 'desc'); $pager->setTemplate('admin/special_interest_pager.tpl'); $pager->setEmptyMessage('No students found.'); $pager->setReportRow('specialInterestCsvRow'); 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(); }