本文整理汇总了PHP中Vtiger_Util_Helper::transferListSearchParamsToFilterCondition方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Util_Helper::transferListSearchParamsToFilterCondition方法的具体用法?PHP Vtiger_Util_Helper::transferListSearchParamsToFilterCondition怎么用?PHP Vtiger_Util_Helper::transferListSearchParamsToFilterCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Util_Helper
的用法示例。
在下文中一共展示了Vtiger_Util_Helper::transferListSearchParamsToFilterCondition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transferListSearchParamsToFilterCondition
public function transferListSearchParamsToFilterCondition($listSearchParams, $moduleModel)
{
return Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($listSearchParams, $moduleModel);
}
示例2: getRecordIds
/**
* Function which provides the records for the current view
* @param <Boolean> $skipRecords - List of the RecordIds to be skipped
* @return <Array> List of RecordsIds
*/
public function getRecordIds($skipRecords = false, $module = false)
{
$db = PearDatabase::getInstance();
$cvId = $this->getId();
$moduleModel = $this->getModule();
$moduleName = $moduleModel->get('name');
$baseTableName = $moduleModel->get('basetable');
$baseTableId = $moduleModel->get('basetableid');
$listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $cvId);
$queryGenerator = $listViewModel->get('query_generator');
$searchKey = $this->get('search_key');
$searchValue = $this->get('search_value');
$operator = $this->get('operator');
if (!empty($searchValue)) {
$queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
}
$searchParams = $this->get('search_params');
if (empty($searchParams)) {
$searchParams = array();
}
$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParams, $moduleModel);
$queryGenerator->parseAdvFilterList($transformedSearchParams);
$listQuery = $queryGenerator->getQuery();
if ($module == 'RecycleBin') {
$listQuery = preg_replace("/vtiger_crmentity.deleted\\s*=\\s*0/i", 'vtiger_crmentity.deleted = 1', $listQuery);
}
if ($skipRecords && !empty($skipRecords) && is_array($skipRecords) && count($skipRecords) > 0) {
$listQuery .= ' AND ' . $baseTableName . '.' . $baseTableId . ' NOT IN (' . implode(',', $skipRecords) . ')';
}
$result = $db->query($listQuery);
$noOfRecords = $db->num_rows($result);
$recordIds = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$recordIds[] = $db->query_result($result, $i, $baseTableId);
}
return $recordIds;
}
示例3: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $this->getModule($request);
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
$relatedParentModule = $request->get('related_parent_module');
$relatedParentId = $request->get('related_parent_id');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
//Check whether the request is in multi select mode
$multiSelectMode = $request->get('multi_select');
if (empty($multiSelectMode)) {
$multiSelectMode = false;
}
if (empty($cvId)) {
$cvId = '0';
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (vglobal('popupAjax')) {
$pagingModel->set('noLimit', true);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$isRecordExists = Vtiger_Util_Helper::checkRecordExistance($relatedParentId);
if ($isRecordExists) {
$relatedParentModule = '';
$relatedParentId = '';
} else {
if ($isRecordExists === NULL) {
$relatedParentModule = '';
$relatedParentId = '';
}
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($relatedParentId, $relatedParentModule);
$listViewModel = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $moduleName, $label);
} else {
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
}
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$orderBy = $moduleInstance->default_order_by;
$sortOrder = $moduleInstance->default_sort_order;
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
$searchParmams = $request->get('search_params');
if (empty($searchParmams)) {
$searchParmams = array();
}
$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParmams, $moduleModel);
$listViewModel->set('search_params', $transformedSearchParams);
//To make smarty to get the details easily accesible
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$this->listViewHeaders = $listViewModel->getHeaders();
$models = $listViewModel->getEntries($pagingModel);
$noOfEntries = count($models);
foreach ($models as $recordId => $recordModel) {
foreach ($this->listViewHeaders as $fieldName => $fieldModel) {
$recordModel->set($fieldName, $recordModel->getDisplayValue($fieldName));
}
$models[$recordId] = $recordModel;
}
$this->listViewEntries = $models;
if (count($this->listViewEntries) > 0) {
$parent_related_records = true;
}
} else {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
//.........这里部分代码省略.........
示例4: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
//src_module value is added to just to stop showing inactive products
$request->set('src_module', $request->getModule());
$moduleName = $this->getModule($request);
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
$potentialId = $request->get('potentialid');
$searchParams = $request->get('search_params');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
//Check whether the request is in multi select mode
$multiSelectMode = $request->get('multi_select');
if (empty($multiSelectMode)) {
$multiSelectMode = false;
}
if (empty($cvId)) {
$cvId = '0';
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$orderBy = $moduleInstance->default_order_by;
$sortOrder = $moduleInstance->default_sort_order;
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
$searchParmams = $request->get('search_params');
if (empty($searchParmams)) {
$searchParmams = array();
}
$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParmams, $moduleModel);
$listViewModel->set('search_params', $transformedSearchParams);
//To make smarty to get the details easily accesible
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (Settings_SalesProcesses_Module_Model::checkRelatedToPotentialsLimit() && Settings_SalesProcesses_Module_Model::isLimitForModule($sourceModule)) {
if ($potentialId == '') {
$potentialId = -1;
}
$listViewModel->set('potential_id', $potentialId);
$viewer->assign('INVENTORY_LIMITED_FROM_POTENTIALS', true);
}
$productModel = Vtiger_Module_Model::getInstance('Products');
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries && $productModel->isActive()) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
if (!$productModel->isActive()) {
$this->listViewEntries = array();
$viewer->assign('LBL_MODULE_DISABLED', true);
}
foreach ($this->listViewEntries as $key => $listViewEntry) {
$productId = $listViewEntry->getId();
$subProducts = $listViewModel->getSubProducts($productId);
if ($subProducts) {
$listViewEntry->set('subProducts', $subProducts);
}
}
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
//.........这里部分代码省略.........