![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: index.php 38 2008-02-11 11:38:51Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/companies/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('CompIdxOrderDir') ? ($AppUI->getState('CompIdxOrderDir') == 'asc' ? 'desc' : 'asc') : 'desc'; 11 $AppUI->setState('CompIdxOrderBy', w2PgetParam($_GET, 'orderby', null)); 12 $AppUI->setState('CompIdxOrderDir', $orderdir); 13 } 14 $orderby = $AppUI->getState('CompIdxOrderBy') ? $AppUI->getState('CompIdxOrderBy') : 'company_name'; 15 $orderdir = $AppUI->getState('CompIdxOrderDir') ? $AppUI->getState('CompIdxOrderDir') : 'asc'; 16 17 if (isset($_REQUEST['owner_filter_id'])) { 18 $AppUI->setState('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('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('owner_filter_id', $owner_filter_id); 25 } 26 } 27 // load the company types 28 $types = w2PgetSysVal('CompanyType'); 29 30 // get any records denied from viewing 31 $obj = new CCompany(); 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('search_string', $search_string); 39 } else { 40 $search_string = $AppUI->getState('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('companies'); 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('Companies', 'handshake.png', $m, $m . '.' . $a); 53 $titleBlock->addCell('<form name="searchform" action="?m=companies&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=companies&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 if ($canEdit) { 70 $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new company') . '">', '', '<form action="?m=companies&a=addedit" method="post">', '</form>'); 71 } 72 $titleBlock->show(); 73 74 if (isset($_GET['tab'])) { 75 $AppUI->setState('CompaniesIdxTab', w2PgetParam($_GET, 'tab', null)); 76 } 77 $companiesTypeTab = defVal($AppUI->getState('CompaniesIdxTab'), 0); 78 79 // $tabTypes = array(getCompanyTypeID('Client'), getCompanyTypeID('Supplier'), 0); 80 $companiesType = $companiesTypeTab; 81 82 $tabBox = new CTabBox('?m=companies', W2P_BASE_DIR . '/modules/companies/', $companiesTypeTab); 83 if ($tabbed = $tabBox->isTabbed()) { 84 $add_na = true; 85 if (isset($types[0])) { // They have a Not Applicable entry. 86 $add_na = false; 87 $types[] = $types[0]; 88 } 89 $types[0] = 'All Companies'; 90 if ($add_na) { 91 $types[] = 'Not Applicable'; 92 } 93 } 94 $type_filter = array(); 95 foreach ($types as $type => $type_name) { 96 $type_filter[] = $type; 97 $tabBox->add('vw_companies', $type_name); 98 } 99 100 $tabBox->show(); 101 ?>
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 |