$object_name){ if ($curModule == 'Home' || ($curModule == $module && !empty($_REQUEST['ajax']))) { $focus = CRMEntity::getInstance($module); if(isPermitted($module,"index") == "yes"){ $smarty = new vtigerCRM_Smarty; if(!file_exists("modules/$module/language/".$current_language.".lang.php")) $current_language = 'en_us'; require_once("modules/$module/language/".$current_language.".lang.php"); global $mod_strings; global $app_strings; $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH",$image_path); $smarty->assign("MODULE",$module); $smarty->assign("TAG_SEARCH",$search_tag); $smarty->assign("SEARCH_MODULE",vtlib_purify($_REQUEST['search_module'])); $smarty->assign("SINGLE_MOD",$module); $smarty->assign("SEARCH_STRING",htmlentities($search_val, ENT_QUOTES, $default_charset)); $listquery = getListQuery($module); $oCustomView = ''; $oCustomView = new CustomView($module); //Instead of getting current customview id, use cvid of All so that all entities will be found //$viewid = $oCustomView->getViewId($module); $cv_res = $adb->pquery("select cvid from vtiger_customview where viewname='All' and entitytype=?", array($module)); $viewid = $adb->query_result($cv_res,0,'cvid'); $customviewcombo_html = $oCustomView->getCustomViewCombo($viewid); $listquery = $oCustomView->getModifiedCvListQuery($viewid,$listquery,$module); if ($module == "Calendar"){ if (!isset($oCustomView->list_fields['Close'])){ $oCustomView->list_fields['Close']=array ( 'activity' => 'status' ); } if (!isset($oCustomView->list_fields_name['Close'])){ $oCustomView->list_fields_name['Close']='status'; } } if($search_module != '' || $search_tag != ''){//This is for Tag search $where = getTagWhere($search_val,$current_user->id); $search_msg = $app_strings['LBL_TAG_SEARCH']; $search_msg .= "".to_html($search_val).""; }else{ //This is for Global search $where = getUnifiedWhere($listquery,$module,$search_val); $search_msg = $app_strings['LBL_SEARCH_RESULTS_FOR']; $search_msg .= "".htmlentities($search_val, ENT_QUOTES, $default_charset).""; } if($where != ''){ $listquery .= ' and ('.$where.')'; } if(!(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')) { $count_result = $adb->query($listquery); $noofrows = $adb->num_rows($count_result); } else { $noofrows = vtlib_purify($_REQUEST['recordCount']); } $moduleRecordCount[$module]['count'] = $noofrows; global $list_max_entries_per_page; if(!empty($_REQUEST['start'])){ $start = $_REQUEST['start']; if($start == 'last'){ $count_result = $adb->query( mkCountQuery($listquery)); $noofrows = $adb->query_result($count_result,0,"count"); if($noofrows > 0){ $start = ceil($noofrows/$list_max_entries_per_page); } } if(!is_numeric($start)){ $start = 1; } elseif($start < 0){ $start = 1; } $start = ceil($start); }else{ $start = 1; } $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows); $limitStartRecord = ($navigation_array['start'] - 1) * $list_max_entries_per_page; $log->debug('查询语句: '.$listquery); if( $adb->dbType == "pgsql"){ $listquery = $listquery. " OFFSET $limitStartRecord LIMIT $list_max_entries_per_page"; }else{ $listquery = $listquery. " LIMIT $limitStartRecord, $list_max_entries_per_page"; } $list_result = $adb->query($listquery); $moduleRecordCount[$module]['recordListRangeMessage'] = getRecordRangeMessage($list_result, $limitStartRecord, $noofrows); $info_message='&recordcount='.$_REQUEST['recordcount'].'&noofrows='.$_REQUEST['noofrows'].'&message='.$_REQUEST['message'].'&skipped_record_count='.$_REQUEST['skipped_record_count']; $url_string = '&modulename='.$_REQUEST['modulename'].'&nav_module='.$module_name.$info_message; $viewid = ''; $navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,$module,"UnifiedSearch",$viewid); $listview_header = getListViewHeader($focus,$module,"","","","global",$oCustomView); $listview_entries = getListViewEntries($focus,$module,$list_result,$navigation_array,"","","","",$oCustomView); //Do not display the Header if there are no entires in listview_entries if(count($listview_entries) > 0){ $display_header = 1; }else{ $display_header = 0; } $smarty->assign("NAVIGATION", $navigationOutput); $smarty->assign("LISTHEADER", $listview_header); $smarty->assign("LISTENTITY", $listview_entries); $smarty->assign("DISPLAYHEADER", $display_header); $smarty->assign("HEADERCOUNT", count($listview_header)); $smarty->assign("ModuleRecordCount", $moduleRecordCount); $total_record_count = $total_record_count + $noofrows; $smarty->assign("SEARCH_CRITERIA","( $noofrows )".$search_msg); $smarty->assign("MODULES_LIST", $object_array); $smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html); if(($i != 0 && empty($_REQUEST['ajax'])) || !(empty($_REQUEST['ajax']))) $smarty->display("UnifiedSearchAjax.tpl"); else $smarty->display('UnifiedSearchDisplay.tpl'); unset($_SESSION['lvs'][$module]); $i++; } } } //Added to display the Total record count if(empty($_REQUEST['ajax'])) { ?>
        ".$mod_strings['ERR_ONE_CHAR'].""; } /** * Function to get the the List of Searchable Modules as a combo list which will be displayed in right corner under the Header * @param string $search_module -- search module, this module result will be shown defaultly */ function getSearchModulesComboList($search_module){ global $object_array; global $app_strings; global $mod_strings; ?>
   
$object_name1,$module_name2=>$object_name2,$module_name3=>$object_name3,$module_name4=>$object_name4,-----); */ function getSearchModules($filter = array()){ global $adb; // vtlib customization: Ignore disabled modules. //$sql = 'select distinct vtiger_field.tabid,name from vtiger_field inner join vtiger_tab on vtiger_tab.tabid=vtiger_field.tabid where vtiger_tab.tabid not in (16,29)'; $sql = 'select distinct vtiger_field.tabid,name from vtiger_field inner join vtiger_tab on vtiger_tab.tabid=vtiger_field.tabid where vtiger_tab.tabid not in (16,29) and vtiger_tab.presence != 1 and vtiger_field.presence in (0,2)'; // END $result = $adb->pquery($sql, array()); while($module_result = $adb->fetch_array($result)){ $modulename = $module_result['name']; // Do we need to filter the module selection? if(!empty($filter) && is_array($filter) && !in_array($modulename, $filter)) { continue; } // END if($modulename != 'Calendar'){ $return_arr[$modulename] = $modulename; }else{ $return_arr[$modulename] = 'Activity'; } } return $return_arr; } ?>