Example #1
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();
 }
Example #2
0
 public static function manageUsers()
 {
     Layout::addStyle('users');
     PHPWS_Core::initCoreClass('DBPager.php');
     $form = new PHPWS_Form('group-search');
     $form->setMethod('get');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'admin');
     $form->addHidden('tab', 'manage_users');
     $form->addRadioAssoc('qgroup', array(dgettext('users', 'Not in group'), dgettext('users', 'In group')));
     if (isset($_GET['qgroup'])) {
         $qg =& $_GET['qgroup'];
     } else {
         $qg = 1;
     }
     $form->setMatch('qgroup', $qg);
     $db = new PHPWS_DB('users_groups');
     $db->addWhere('user_id', 0);
     $db->addColumn('id');
     $db->addColumn('name');
     $db->setIndexBy('id');
     $groups = $db->select('col');
     if (empty($groups)) {
         $groups[] = dgettext('users', '-- All --');
     } else {
         $groups = array(dgettext('users', '-- All --')) + $groups;
     }
     $form->addSelect('search_group', $groups);
     $form->addCssClass('search_group', 'form-control');
     if (isset($_GET['search_group'])) {
         $form->setMatch('search_group', $_GET['search_group']);
     }
     $form->addSubmit('group_sub', dgettext('users', 'Limit users by group'));
     $pageTags = $form->getTemplate();
     $pageTags['ACTIONS_LABEL'] = dgettext('users', 'Actions');
     if (PHPWS_Settings::get('users', 'allow_new_users') || Current_User::isDeity()) {
         $pageTags['NEW_USER'] = PHPWS_Text::secureLink(dgettext('users', 'Create new user'), 'users', array('action' => 'admin', 'command' => 'new_user'), null, dgettext('users', 'Create new user'), 'btn btn-success');
         $pageTags['NEW_USER_URI'] = PHPWS_Text::linkAddress('users', array('action' => 'admin', 'command' => 'new_user'));
     }
     $pager = new DBPager('users', 'PHPWS_User');
     $pager->setDefaultLimit(10);
     $pager->setModule('users');
     $pager->setTemplate('manager/users.tpl');
     $pager->setLink('index.php?module=users&action=admin&tab=manage_users&authkey=' . Current_User::getAuthKey());
     $pager->addPageTags($pageTags);
     $pager->addRowTags('getUserTpl');
     $pager->addToggle(' class="bgcolor1"');
     $pager->addSortHeader('username', dgettext('users', 'Username'));
     $pager->addSortHeader('display_name', dgettext('users', 'Display'));
     $pager->addSortHeader('email', dgettext('users', 'Email'));
     $pager->addSortHeader('last_logged', dgettext('users', 'Last Logged'));
     $pager->addSortHeader('active', dgettext('users', 'Active'));
     $pager->setSearch('username', 'email', 'display_name');
     $pager->cacheQueries();
     if (!empty($_GET['search_group'])) {
         $search_group = (int) $_GET['search_group'];
         if (!empty($_GET['qgroup'])) {
             $pager->addWhere('users_members.group_id', $search_group, '=', 'and', 'g1');
             $pager->addWhere('users_groups.id', 'users_members.member_id', '=', 'and', 'g1');
             $pager->addWhere('users.id', 'users_groups.user_id', '=', 'and', 'g1');
         } else {
             $pager->db->addJoin('left', 'users', 'users_groups', 'id', 'user_id');
             $pager->db->addJoin('left', 'users_groups', 'users_members', 'id', 'member_id');
             $pager->db->addWhere('users_members.group_id', null, 'is null', null, 'g1');
             $pager->db->addWhere('users_members.group_id', $search_group, '!=', 'or', 'g1');
         }
     }
     $result = $pager->get();
     return $result;
 }
Example #3
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();
 }
Example #4
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();
 }
Example #5
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();
 }