Example #1
0
$orderby = $AppUI->getState('DeptIdxOrderBy') ? $AppUI->getState('DeptIdxOrderBy') : 'dept_name';
$orderdir = $AppUI->getState('DeptIdxOrderDir') ? $AppUI->getState('DeptIdxOrderDir') : 'asc';
if (isset($_REQUEST['owner_filter_id'])) {
    $AppUI->setState('dept_owner_filter_id', w2PgetParam($_REQUEST, 'owner_filter_id', null));
    $owner_filter_id = w2PgetParam($_REQUEST, 'owner_filter_id', null);
} else {
    $owner_filter_id = $AppUI->getState('dept_owner_filter_id');
    if (!isset($owner_filter_id)) {
        $owner_filter_id = 0;
        //By default show all companies instead of $AppUI->user_id current user.
        $AppUI->setState('dept_owner_filter_id', $owner_filter_id);
    }
}
// get any records denied from viewing
$obj = new CDepartment();
$deny = $obj->getDeniedRecords($AppUI->user_id);
// Company search by Kist
$search_string = w2PgetParam($_REQUEST, 'search_string', '');
if ($search_string != '') {
    $search_string = $search_string == '-1' ? '' : $search_string;
    $AppUI->setState('dept_search_string', $search_string);
} else {
    $search_string = $AppUI->getState('dept_search_string');
}
$search_string = w2PformSafe($search_string, true);
$perms =& $AppUI->acl();
$owner_list = array(0 => $AppUI->_('All', UI_OUTPUT_RAW)) + $perms->getPermittedUsers('departments');
$owner_combo = arraySelect($owner_list, 'owner_filter_id', 'class="text" onchange="javascript:document.searchform.submit()"', $owner_filter_id, false);
// setup the title block
$titleBlock = new w2p_Theme_TitleBlock('Departments', 'departments.png', $m, $m . '.' . $a);
$titleBlock->addCell('<form name="searchform" action="?m=departments&amp;search_string=' . $search_string . '" method="post" accept-charset="utf-8">