![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: index.php 66 2008-03-02 20:58:57Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/departments/index.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $AppUI->savePlace(); 7 8 // retrieve any state parameters 9 if (isset($_GET['orderby'])) { 10 $orderdir = $AppUI->getState('DeptIdxOrderDir') ? ($AppUI->getState('DeptIdxOrderDir') == 'asc' ? 'desc' : 'asc') : 'desc'; 11 $AppUI->setState('DeptIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); 12 $AppUI->setState('DeptIdxOrderDir', $orderdir); 13 } 14 $orderby = $AppUI->getState('DeptIdxOrderBy') ? $AppUI->getState('DeptIdxOrderBy') : 'dept_name'; 15 $orderdir = $AppUI->getState('DeptIdxOrderDir') ? $AppUI->getState('DeptIdxOrderDir') : 'asc'; 16 17 if (isset($_REQUEST['owner_filter_id'])) { 18 $AppUI->setState('dept_owner_filter_id', w2PgetParam($_REQUEST, 'owner_filter_id', null)); 19 $owner_filter_id = w2PgetParam($_REQUEST, 'owner_filter_id', null); 20 } else { 21 $owner_filter_id = $AppUI->getState('dept_owner_filter_id'); 22 if (!isset($owner_filter_id)) { 23 $owner_filter_id = 0; //By default show all companies instead of $AppUI->user_id current user. 24 $AppUI->setState('dept_owner_filter_id', $owner_filter_id); 25 } 26 } 27 // load the department types 28 $types = w2PgetSysVal('DepartmentType'); 29 30 // get any records denied from viewing 31 $obj = new CDepartment(); 32 $deny = $obj->getDeniedRecords($AppUI->user_id); 33 34 // Company search by Kist 35 $search_string = w2PgetParam($_REQUEST, 'search_string', ''); 36 if ($search_string != '') { 37 $search_string = $search_string == '-1' ? '' : $search_string; 38 $AppUI->setState('dept_search_string', $search_string); 39 } else { 40 $search_string = $AppUI->getState('dept_search_string'); 41 } 42 43 // $canEdit = !getDenyEdit( $m ); 44 // retrieve list of records 45 $search_string = w2PformSafe($search_string, true); 46 47 $perms = &$AppUI->acl(); 48 $owner_list = array(0 => $AppUI->_('All', UI_OUTPUT_RAW)) + $perms->getPermittedUsers('departments'); 49 $owner_combo = arraySelect($owner_list, 'owner_filter_id', 'class="text" onchange="javascript:document.searchform.submit()"', $owner_filter_id, false); 50 51 // setup the title block 52 $titleBlock = new CTitleBlock('Departments', 'departments.png', $m, $m . '.' . $a); 53 $titleBlock->addCell('<form name="searchform" action="?m=departments&search_string=' . $search_string . '" method="post"> 54 <table> 55 <tr> 56 <td> 57 <strong>' . $AppUI->_('Search') . '</strong> 58 <input class="text" type="text" name="search_string" value="' . $search_string . '" /><br /> 59 <a href="index.php?m=departments&search_string=-1">' . $AppUI->_('Reset search') . "</a></td> 60 <td valign='top'> 61 <strong>" . $AppUI->_('Owner filter') . '</strong> ' . $owner_combo . ' 62 </td> 63 </tr> 64 </table> 65 </form>'); 66 67 $search_string = addslashes($search_string); 68 69 $titleBlock->show(); 70 71 if (isset($_GET['tab'])) { 72 $AppUI->setState('DeptIdxTab', w2PgetParam($_GET, 'tab', null)); 73 } 74 $deptsTypeTab = defVal($AppUI->getState('DeptIdxTab'), 0); 75 76 $deptsType = $deptsTypeTab; 77 78 $tabBox = new CTabBox('?m=departments', W2P_BASE_DIR . '/modules/departments/', $deptsTypeTab); 79 if ($tabbed = $tabBox->isTabbed()) { 80 $add_na = true; 81 if (isset($types[0])) { // They have a Not Defined entry. 82 $add_na = false; 83 $types[] = $types[0]; 84 } 85 $types[0] = 'All Departments'; 86 if ($add_na) { 87 $types[] = 'Not Defined'; 88 } 89 } 90 $type_filter = array(); 91 foreach ($types as $type => $type_name) { 92 $type_filter[] = $type; 93 $tabBox->add('vw_depts', $type_name); 94 } 95 96 $tabBox->show(); 97 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |