本文整理汇总了PHP中QueryGenerator::addUserSearchConditions方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::addUserSearchConditions方法的具体用法?PHP QueryGenerator::addUserSearchConditions怎么用?PHP QueryGenerator::addUserSearchConditions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryGenerator
的用法示例。
在下文中一共展示了QueryGenerator::addUserSearchConditions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExportRecordIds
function getExportRecordIds($moduleName, $viewid, $input)
{
global $adb, $current_user, $list_max_entries_per_page;
$idstring = vtlib_purify($input['idstring']);
$export_data = vtlib_purify($input['export_data']);
if (in_array($moduleName, getInventoryModules()) && $export_data == 'currentpage') {
$queryGenerator = new QueryGenerator($moduleName, $current_user);
$queryGenerator->initForCustomViewById($viewid);
if ($input['query'] == 'true') {
$queryGenerator->addUserSearchConditions($input);
}
$queryGenerator->setFields(array('id'));
$query = $queryGenerator->getQuery();
$current_page = ListViewSession::getCurrentPage($moduleName, $viewid);
$limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
if ($limit_start_rec < 0) {
$limit_start_rec = 0;
}
$query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
$result = $adb->pquery($query, array());
$idstring = array();
$focus = CRMEntity::getInstance($moduleName);
for ($i = 0; $i < $adb->num_rows($result); $i++) {
$idstring[] = $adb->query_result($result, $i, $focus->table_index);
}
$idstring = implode(';', $idstring);
$export_data = 'selecteddata';
}
return $idstring . '#@@#' . $export_data;
}
示例2: CustomView
$select_module = $module_name[0];
} else {
show_error_msg('no_permitted_modules');
}
}
$focus = CRMEntity::getInstance($select_module);
if (count($module_name) > 0) {
$cur_mod_view = new CustomView($select_module);
$viewid = $cur_mod_view->getViewIdByName('All', $select_module);
global $current_user;
$queryGenerator = new QueryGenerator($select_module, $current_user);
$queryGenerator->initForCustomViewById($viewid);
// Enabling Module Search
$url_string = '';
if ($_REQUEST['query'] == 'true') {
$queryGenerator->addUserSearchConditions($_REQUEST);
$ustring = getSearchURL($_REQUEST);
$url_string .= "&query=true{$ustring}";
$smarty->assign('SEARCH_URL', $url_string);
}
$list_query = $queryGenerator->getQuery();
$list_query = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $list_query);
//Search criteria added to the list Query
if (isset($where) && $where != '') {
$list_query .= ' AND ' . $where;
}
$count_result = $adb->query(mkCountQuery($list_query));
$noofrows = $adb->query_result($count_result, 0, "count");
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$rb_listview_header = $controller->getListViewHeader($focus, $select_module, $url_string, $sorder, $order_by, true);
$listview_header_search = $controller->getBasicSearchFieldInfoList();
示例3: getSelectAllQuery
function getSelectAllQuery($input, $module)
{
global $adb, $current_user;
$viewid = vtlib_purify($input['viewname']);
if ($module == "Calendar") {
$listquery = getListQuery($module);
$oCustomView = new CustomView($module);
$query = $oCustomView->getModifiedCvListQuery($viewid, $listquery, $module);
$where = '';
if ($input['query'] == 'true') {
list($where, $ustring) = explode("#@@#", getWhereCondition($module, $input));
if (isset($where) && $where != '') {
$query .= " AND " . $where;
}
}
} else {
$queryGenerator = new QueryGenerator($module, $current_user);
$queryGenerator->initForCustomViewById($viewid);
if ($input['query'] == 'true') {
$queryGenerator->addUserSearchConditions($input);
}
$queryGenerator->setFields(array('id'));
$query = $queryGenerator->getQuery();
if ($module == 'Documents') {
$folderid = vtlib_purify($input['folderidstring']);
$folderid = str_replace(';', ',', $folderid);
$query .= " AND vtiger_notes.folderid in (" . $folderid . ")";
}
}
$result = $adb->pquery($query, array());
return $result;
}
示例4: getTopQuotes
/** function used to get the top 5 quotes from the ListView query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getTopQuotes($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Quotes/Quotes.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
global $app_strings, $current_language, $current_user;
$current_module_strings = return_module_language($current_language, 'Quotes');
global $list_max_entries_per_page, $adb, $theme, $mod_strings;
$log = LoggerManager::getLogger('quote_list');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Quotes");
$customviewcombo_html = $oCustomView->getCustomViewCombo();
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'Quotes';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('subject', 'potential_id', 'account_id', 'total');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if (count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getTopQuotesSearch($_REQUEST, array('assigned_user_id' => $current_user->column_fields['user_name'], 'validtill' => $date_var, 'quotestage.Rejected' => $current_module_strings['Rejected'], 'quotestage.Accepted' => $current_module_strings['Accepted']));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1) {
if ($noofrows != 0) {
$start_rec = $navigation_array['start'];
} else {
$start_rec = 0;
}
if ($noofrows > $list_max_entries_per_page) {
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
} else {
$end_rec = $noofrows;
}
} else {
if ($navigation_array['next'] > $list_max_entries_per_page) {
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
} else {
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
$focus = new Quotes();
$title = array('TopOpenQuotes.gif', $current_module_strings['LBL_MY_TOP_QUOTE'], 'home_mytopquote');
//Retreive the List View Table Header
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
$entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
//.........这里部分代码省略.........
示例5: getMyFaq
/** function used to get the top 5 recent FAQs from Listview query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getMyFaq($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Faq/Faq.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
global $current_language, $current_user, $list_max_entries_per_page, $adb;
$current_module_strings = return_module_language($current_language, 'Faq');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Faq");
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$focus = new Faq();
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$currentModule = 'Faq';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('question', 'product_id');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if (count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getMyFaqSearch($_REQUEST);
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1) {
if ($noofrows != 0) {
$start_rec = $navigation_array['start'];
} else {
$start_rec = 0;
}
if ($noofrows > $list_max_entries_per_page) {
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
} else {
$end_rec = $noofrows;
}
} else {
if ($navigation_array['next'] > $list_max_entries_per_page) {
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
} else {
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
//Retreive the List View Table Header
$title = array('myFaqs.gif', $current_module_strings['LBL_MY_FAQ'], 'home_myfaq');
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
$entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
$values = array('ModuleName' => 'Faq', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
if ($noofrows == 0 || $noofrows > 0) {
return $values;
}
}