示例#1
0
 protected function propertiesList($contact_id = null)
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $this->title = 'Property listing';
     $pager = new \DBPager('properties', 'Properties\\Property');
     if ($contact_id) {
         $pager->addWhere('contact_id', $contact_id);
         $data['is_contact'] = 1;
         $page_tags['new'] = \PHPWS_Text::moduleLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('cop' => 'edit_property', 'k' => $this->contact->getKey()), null, null, 'btn btn-success');
     } else {
         $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('aop' => 'edit_property'), null, null, 'btn btn-success');
     }
     // photo was previously uploaded
     if (!empty($_GET['pid'])) {
         $data['pid'] = $_GET['pid'];
     } else {
         $data['pid'] = 0;
     }
     javascriptMod('properties', 'photo_upload', $data);
     $pager->setSearch('name', 'company_name');
     $pager->addSortHeader('name', 'Name of property');
     $pager->addSortHeader('company_name', 'Management company');
     $pager->addSortHeader('timeout', 'Time until purge');
     $pager->setModule('properties');
     $pager->setTemplate('properties_list.tpl');
     $pager->addRowTags('row_tags', (bool) $contact_id);
     $pager->joinResult('contact_id', 'prop_contacts', 'id', 'company_name', null, true);
     $pager->addPageTags($page_tags);
     $pager->cacheQueries();
     $this->content = $pager->get();
 }
 /**
  * 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();
 }
示例#3
0
 public static function manageGroups()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     Layout::addStyle('users');
     $pageTags['MEMBERS_LABEL'] = dgettext('users', 'Members');
     $pageTags['ACTIONS_LABEL'] = dgettext('users', 'Actions');
     $pageTags['NEW_GROUP'] = PHPWS_Text::secureLink(dgettext('users', 'Create new group'), 'users', array('action' => 'admin', 'command' => 'new_group'), null, dgettext('users', 'Create new group'), 'btn btn-success');
     $pageTags['ADD_GROUP_URI'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'new_group'));
     $pager = new DBPager('users_groups', 'PHPWS_Group');
     $pager->setModule('users');
     $pager->setTemplate('manager/groups.tpl');
     $pager->setLink('index.php?module=users&amp;action=admin&amp;tab=manage_groups&amp;authkey=' . Current_User::getAuthKey());
     // If no order was set, then set it to default by user name
     if (!isset($pager->orderby)) {
         $pager->orderby = 'name';
         $pager->orderby_dir = 'asc';
     }
     $pager->addPageTags($pageTags);
     $pager->addRowTags('getTplTags');
     $pager->addToggle('class="toggle1"');
     $pager->addToggle('class="toggle2"');
     $pager->addSortHeader('name', dgettext('users', 'Group Name'));
     $pager->addWhere('user_id', 0);
     $pager->setSearch('name');
     $pager->cacheQueries();
     return $pager->get();
 }
示例#4
0
 public static function get_pager_by_hall($hall_id)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_floor', 'HMS_Floor');
     $pager->addWhere('hms_floor.residence_hall_id', $hall_id);
     $pager->db->addOrder('hms_floor.floor_number');
     $pager->setModule('hms');
     $pager->setTemplate('admin/floor_pager_by_hall.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No floors found.");
     $pager->addRowTags('get_pager_by_hall_tags');
     return $pager->get();
 }
示例#5
0
 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();
 }
示例#6
0
 public static function get_movein_times_pager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_movein_time', 'HMS_Movein_Time');
     $pager->addWhere('term', Term::getSelectedTerm());
     $pager->db->addOrder('begin_timestamp', 'DESC');
     $pager_tags = array();
     $pager_tags['BEGIN_TIMESTAMP_LABEL'] = 'Begin Date & Time';
     $pager_tags['END_TIMESTAMP_LABEL'] = 'End Date & Time';
     $pager_tags['ACTION_LABEL'] = 'Action';
     $pager->setModule('hms');
     $pager->setTemplate('admin/movein_time_pager.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No move-in times found.");
     $pager->addRowTags('getRowTags');
     $pager->addPageTags($pager_tags);
     return $pager->get();
 }
示例#7
0
 public function listRoommates()
 {
     $this->setSearchParameters();
     $this->searchPanel();
     \Layout::addStyle('properties', 'forms.css');
     if (!\Current_User::isLogged()) {
         $login = \PHPWS_Settings::get('properties', 'login_link');
         if (empty($login)) {
             $login = '******';
         }
         $tpl['LOGIN'] = sprintf('Want to request or contact a roommate? <a href="%s">You will need to login</a>', $login);
     } else {
         $tpl['LOGIN'] = $this->options();
     }
     $pager = new \DBPager('prop_roommate', 'properties\\Roommate');
     $pager->addPageTags($tpl);
     $pager->setModule('properties');
     $pager->setTemplate('roommates.tpl');
     $pager->setDefaultOrder('updated', 'desc');
     $pager->addRowTags('rowtags');
     $pager->addSortHeader('name', 'Title');
     $pager->addSortHeader('monthly_rent', 'Monthly rent');
     $pager->addSortHeader('share_bedroom', 'bedroom?');
     $pager->addSortHeader('share_bathroom', 'bathroom?');
     $pager->addSortHeader('campus_distance', 'Campus distance');
     $pager->addSortHeader('move_in_date', 'Move in date');
     $pager->setSearch('name');
     if (!empty($_SESSION['roommate_search'])) {
         foreach ($_SESSION['roommate_search'] as $key => $value) {
             switch ($key) {
                 case 'sub':
                     $pager->db->addWhere('sublease', '1', '=', 'and', 'search');
                     break;
                 case 'nosub':
                     $pager->db->addWhere('sublease', '0', '=', 'and', 'search');
                     break;
                 case 'gen':
                     $pager->db->addWhere('gender', array(0, $value), 'in', 'and', 'search');
                     break;
                 case 'smoke':
                     $pager->db->addWhere('smoking', array(0, $value), 'in', 'and', 'search');
                     break;
                 case 'distance':
                     $pager->db->addWhere('campus_distance', $value, '=', 'and', 'search');
                     break;
                 case 'beds':
                     // notice the reverse
                     $value = $value ? 0 : 1;
                     $pager->db->addWhere('share_bedroom', $value, '=', 'and', 'search');
                     break;
                 case 'bath':
                     // notice the reverse
                     $value = $value ? 0 : 1;
                     $pager->db->addWhere('share_bathroom', $value, '=', 'and', 'search');
                     break;
                 case 'manager':
                     $value = preg_replace('/[^\\w\\s]|\\s{2,}/', ' ', $value);
                     $vlist = explode(' ', $value);
                     $db2 = new \PHPWS_DB('prop_contacts');
                     foreach ($vlist as $v) {
                         $db2->addWhere('company_name', "%{$value}%", 'like', 'or');
                     }
                     $db2->addColumn('id');
                     $managers = $db2->select('col');
                     if (!empty($managers)) {
                         $pager->db->addWhere('contact_id', $managers, 'in', 'and', 'properties');
                     } else {
                         $pager->db->addWhere('id', 0, '=', 'and', 'cancel');
                     }
                     break;
                 case 'price':
                     $pager->db->addWhere('monthly_rent', $value['min'] * 100, '>=', 'and', 'search');
                     $pager->db->addWhere('monthly_rent', $value['max'] * 100, '<=', 'and', 'search');
                     break;
                 case 'amenities':
                     foreach ($value as $amen_name => $foo) {
                         switch ($amen_name) {
                             case 'ac':
                                 $pager->db->addWhere('appalcart', 1, '=', 'and', 'search');
                                 break;
                             case 'ch':
                                 $pager->db->addWhere('clubhouse', 1, '=', 'and', 'search');
                                 break;
                             case 'dish':
                                 $pager->db->addWhere('dishwasher', 1, '=', 'and', 'search');
                                 break;
                             case 'furn':
                                 $pager->db->addWhere('furnished', 1, '=', 'and', 'search');
                                 break;
                             case 'pet':
                                 $pager->db->addWhere('pets_allowed', 1, '=', 'and', 'search');
                                 break;
                             case 'tr':
                                 $pager->db->addWhere('trash_type', 1, '=', 'and', 'search');
                                 break;
                             case 'wo':
                                 $pager->db->addWhere('workout_room', 1, '=', 'and', 'search');
                                 break;
                             case 'wash':
                                 $pager->db->addWhere('laundry_type', 1, '=', 'and', 'search');
                                 break;
                         }
                     }
                     break;
                 case 'property':
                     $value = preg_replace('/[^\\w\\s]|\\s{2,}/', ' ', $value);
                     $vlist = explode(' ', $value);
                     foreach ($vlist as $v) {
                         $pager->db->addWhere('name', "%{$v}%", 'like', 'or', 'property');
                     }
                     break;
             }
         }
     }
     // roommates that are a month past move in date, are not shown
     $cut_off_date = time() - 86400 * 30;
     $pager->addWhere('move_in_date', $cut_off_date, '>');
     $pager->setEmptyMessage('No one is currently looking for a roommate. Try again later.');
     $this->content = $pager->get();
 }
示例#8
0
 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;
 }
示例#9
0
 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;
 }
示例#10
0
文件: WikiPage.php 项目: Jopperi/wiki
 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();
 }
示例#11
0
    /**
     * Lists the contents of a folder for adminstrative changes.
     * @param object $folder
     * @param boolean $pick_image
     */
    public function folderContents($folder)
    {
        $links = array();
        javascript('jquery');
        $src = PHPWS_SOURCE_HTTP . 'mod/filecabinet/javascript/folder_options/contents.js';
        \Layout::addJSHeader("<script type='text/javascript' src='{$src}'></script>", 'folder-options');
        Layout::addStyle('filecabinet');
        PHPWS_Core::initCoreClass('DBPager.php');
        $dir_write = true;
        if (!is_writable($folder->getFullDirectory())) {
            $this->cabinet->message .= dgettext('filecabinet', 'Warning: this folder\'s directory is not writable.');
            $dir_write = false;
        }
        if ($folder->ftype == IMAGE_FOLDER) {
            javascript('lightbox');
            PHPWS_Core::initModClass('filecabinet', 'Image.php');
            $pager = new DBPager('images', 'PHPWS_Image');
            $pager->setTemplate('Forms/image_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $operation = 'iop';
            $command = 'upload_image_form';
            $label = _('Add image');
        } elseif ($folder->ftype == DOCUMENT_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Document.php');
            $pager = new DBPager('documents', 'PHPWS_Document');
            $pager->setTemplate('Forms/file_list.tpl');
            $limits[10] = 10;
            $limits[25] = 25;
            $limits[50] = 50;
            $operation = 'dop';
            $label = _('Add document');
            $command = 'upload_document_form';
            $pager->addSortHeader('downloaded', sprintf('<abbr title="%s">%s</abbr>', dgettext('filecabinet', 'Downloaded'), dgettext('filecabinet', 'DL')));
        } elseif ($folder->ftype = MULTIMEDIA_FOLDER) {
            PHPWS_Core::initModClass('filecabinet', 'Multimedia.php');
            $pager = new DBPager('multimedia', 'PHPWS_Multimedia');
            $pager->setTemplate('Forms/multimedia_grid.tpl');
            $limits[9] = 9;
            $limits[16] = 16;
            $limits[25] = 25;
            $label = _('Add media');
            $command = 'upload_multimedia_form';
            $operation = 'mop';
        }
        if (Current_User::allow('filecabinet', 'edit_folders', $folder->id, 'folder')) {
            if ($dir_write) {
                $links[] = $folder->uploadLink('button');
            }
            if ($folder->ftype == MULTIMEDIA_FOLDER) {
                //$links[] = $folder->rtmpLink();
                $salt = array('mop' => 'edit_rtmp', 'folder_id' => $folder->id);
                $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
                $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_rtmp" data-operation="{$operation}" data-folder-id="{$folder->id}"><i class="fa fa-cloud"></i> Add RTMP video</button>
EOF;
            }
            //$links[] = $folder->editLink();
            $salt = array($operation => 'edit_folder', 'folder_id' => $folder->id);
            $authkey = \Current_User::getAuthKey(PHPWS_Text::saltArray($salt));
            $links[] = <<<EOF
<button class="btn btn-default show-modal" data-authkey="{$authkey}" data-command="edit_folder_modal" data-operation="aop" data-folder-id="{$folder->id}"><i class="fa fa-edit"></i> Edit</button>
EOF;
        }
        if ($this->cabinet->panel) {
            $pagetags['BACK'] = PHPWS_Text::moduleLink('<i class="fa fa-reply"></i> ' . dgettext('filecabinet', 'Back to folder list'), 'filecabinet', array('tab' => $this->cabinet->panel->getCurrentTab()), null, null, 'btn btn-default');
        }
        if (!empty($links)) {
            $pagetags['ADMIN_LINKS'] = implode(' ', $links);
        }
        $pagetags['MODAL'] = $this->getModal();
        $pagetags['ACTION_LABEL'] = dgettext('filecabinet', 'Action');
        $pager->setLimitList($limits);
        $pager->setSearch('file_name', 'title', 'description');
        $pager->addWhere('folder_id', $folder->id);
        $pager->setOrder('title', 'asc', true);
        $pager->setModule('filecabinet');
        $pager->addPageTags($pagetags);
        $pager->addRowTags('rowTags');
        $pager->addSortHeader('title', dgettext('filecabinet', 'Title'));
        $pager->addSortHeader('file_name', dgettext('filecabinet', 'File name'));
        $pager->addSortHeader('file_type', dgettext('filecabinet', 'File type'));
        $pager->addSortHeader('size', dgettext('filecabinet', 'Size'));
        $pager->setEmptyMessage(dgettext('filecabinet', 'Folder is empty.'));
        $this->cabinet->content = $pager->get();
    }
示例#12
0
 public static function room_pager_by_floor($floor_id, $editable = false)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     javascript('jquery');
     $pager = new DBPager('hms_room', 'HMS_Room');
     $pager->addWhere('hms_room.floor_id', $floor_id);
     $pager->db->addOrder('hms_room.room_number');
     $page_tags = array();
     if (Current_User::allow('hms', 'room_structure')) {
         $addRoomCmd = CommandFactory::getCommand('ShowAddRoom');
         $addRoomCmd->setFloorId($floor_id);
         $page_tags['ADD_ROOM_URI'] = $addRoomCmd->getURI();
     }
     $pager->limitList = array(200);
     $pager->setDefaultLimit(200);
     $pager->setModule('hms');
     $pager->setTemplate('admin/room_pager_by_floor.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage('No rooms found.');
     if ($editable) {
         $pager->addRowTags('get_row_edit');
         $page_tags['FORM'] = 'form=true';
     } else {
         $page_tags['FORM'] = 'form=false';
         $pager->addRowTags('get_row_tags');
     }
     $pager->addPageTags($page_tags);
     return $pager->get();
 }
示例#13
0
 private function roomDamagePager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('hms', 'RoomDamage.php');
     $pager = new DBPager('hms_room_damage', 'RoomDamageDb');
     $pager->db->addJoin('LEFT OUTER', 'hms_room_damage', 'hms_damage_type', 'damage_type', 'id');
     $pager->addWhere('hms_room_damage.room_persistent_id', $this->room->getPersistentId());
     $pager->addWhere('hms_room_damage.repaired', 0);
     // Only non-repaired damages
     $pager->setModule('hms');
     $pager->setTemplate('admin/roomDamagesPager.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No damages found.");
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
示例#14
0
 /**
  * *******************
  * Static UI Methods *
  * *******************
  */
 public static function bed_pager_by_room($room_id)
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('hms_bed', 'HMS_Bed');
     $pager->db->addJoin('LEFT OUTER', 'hms_bed', 'hms_room', 'room_id', 'id');
     $pager->addWhere('hms_room.id', $room_id);
     $pager->db->addOrder('hms_bed.bedroom_label');
     $pager->db->addOrder('hms_bed.bed_letter');
     $page_tags = array();
     $page_tags['BEDROOM_LABEL'] = 'Bedroom';
     $page_tags['BED_LETTER_LABEL'] = 'Bed';
     $page_tags['ASSIGNED_TO_LABEL'] = 'Assigned to';
     $page_tags['RA_LABEL'] = 'RA Roommate bed';
     $pager->setDefaultLimit(50);
     if (Current_User::allow('hms', 'bed_structure') && UserStatus::isAdmin()) {
         $addBedCmd = CommandFactory::getCommand('ShowAddBed');
         $addBedCmd->setRoomId($room_id);
         $page_tags['ADD_BED_URI'] = $addBedCmd->getURI();
     }
     $pager->setModule('hms');
     $pager->setTemplate('admin/bed_pager_by_room.tpl');
     $pager->setLink('index.php?module=hms');
     $pager->setEmptyMessage("No beds found.");
     $pager->addRowTags('getPagerByRoomTags');
     $pager->addPageTags($page_tags);
     return $pager->get();
 }
示例#15
0
 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();
 }
示例#16
0
 /**
  * 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();
 }
示例#17
0
 public function pageList()
 {
     Layout::addStyle('pagesmith');
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('pagesmith', 'PS_Page.php');
     $pgtags['ACTION_LABEL'] = dgettext('pagesmith', 'Action');
     $createText = dgettext('pagesmith', 'New Page');
     $pgtags['NEW'] = "<a href='index.php?module=pagesmith&amp;aop=menu&amp;tab=new' class='button'>{$createText}/a>";
     if (PHPWS_Settings::get('pagesmith', 'text_only_default')) {
         $pgtags['NEW_PAGE_LINK_URI'] = 'index.php?module=pagesmith&aop=pick_template&tpl=text_only&pid=0&authkey=' . \Current_User::getAuthKey();
     } else {
         $pgtags['NEW_PAGE_LINK_URI'] = "index.php?module=pagesmith&amp;aop=menu&amp;tab=new";
     }
     $pgtags['NEW_PAGE_LINK_TEXT'] = $createText;
     $pager = new DBPager('ps_page', 'PS_Page');
     $pager->cacheQueries();
     $pager->addPageTags($pgtags);
     $pager->setModule('pagesmith');
     $pager->setTemplate('page_list.tpl');
     $pager->addRowTags('row_tags');
     $pager->setEmptyMessage(dgettext('pagesmith', 'No pages have been created.'));
     $pager->setSearch('title', 'id');
     $pager->addSortHeader('id', dgettext('pagesmith', 'Id'));
     $pager->addSortHeader('title', dgettext('pagesmith', 'Title'));
     $pager->addSortHeader('create_date', dgettext('pagesmith', 'Created'));
     $pager->addSortHeader('last_updated', dgettext('pagesmith', 'Updated'));
     $pager->addWhere('parent_page', 0);
     $pager->setDefaultLimit(10);
     $pager->setDefaultOrder('last_updated', 'desc');
     $this->ps->title = dgettext('pagesmith', 'Pages');
     $pager->initialize();
     $this->pullUpdated($pager);
     $this->ps->content = $pager->get();
 }