当前位置: 首页>>代码示例>>PHP>>正文


PHP Vtiger_Paging_Model::get方法代码示例

本文整理汇总了PHP中Vtiger_Paging_Model::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Paging_Model::get方法的具体用法?PHP Vtiger_Paging_Model::get怎么用?PHP Vtiger_Paging_Model::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vtiger_Paging_Model的用法示例。


在下文中一共展示了Vtiger_Paging_Model::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getListViewEntries

	/**
	 * Function to get the list view entries
	 * @param Vtiger_Paging_Model $pagingModel
	 * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
	 */
	public function getListViewEntries($pagingModel)
	{
		$db = PearDatabase::getInstance();

		$moduleName = $this->getModule()->get('name');
		$moduleFocus = CRMEntity::getInstance($moduleName);
		$moduleModel = Vtiger_Module_Model::getInstance($moduleName);

		$queryGenerator = $this->get('query_generator');
		$listViewContoller = $this->get('listview_controller');

		$searchParams = $this->get('search_params');
		if (empty($searchParams)) {
			$searchParams = array();
		}

		$glue = "";
		if (count($queryGenerator->getWhereFields()) > 0 && (count($searchParams)) > 0) {
			$glue = QueryGenerator::$AND;
		}
		$queryGenerator->parseAdvFilterList($searchParams, $glue);

		$searchKey = $this->get('search_key');
		$searchValue = $this->get('search_value');
		$operator = $this->get('operator');
		if (!empty($searchKey)) {
			$queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
		}



		$orderBy = $this->getForSql('orderby');
		$sortOrder = $this->getForSql('sortorder');

		//List view will be displayed on recently created/modified records
		if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
			$orderBy = 'modifiedtime';
			$sortOrder = 'DESC';
		}

		if (!empty($orderBy)) {
			$columnFieldMapping = $moduleModel->getColumnFieldMapping();
			$orderByFieldName = $columnFieldMapping[$orderBy];
			$orderByFieldModel = $moduleModel->getField($orderByFieldName);
			if ($orderByFieldModel && ($orderByFieldModel->isReferenceField() || $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::CURRENCY_LIST)) {
				//IF it is reference add it in the where fields so that from clause will be having join of the table
				$queryGenerator = $this->get('query_generator');
				$queryGenerator->addWhereField($orderByFieldName);
				//$queryGenerator->whereFields[] = $orderByFieldName;
			}
		}

		if (!empty($orderBy) && $orderBy === 'smownerid') {
			$fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
			if ($fieldModel->getFieldDataType() == 'owner') {
				$orderBy = 'COALESCE(' . getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users') . ',vtiger_groups.groupname)';
			}
		}

		$listQuery = $this->getQuery();

		$sourceModule = $this->get('src_module');
		$sourceField = $this->get('src_field');
		if (!empty($sourceModule)) {
			if (method_exists($moduleModel, 'getQueryByModuleField')) {
				$overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery, $this->get('currency_id'));
				if (!empty($overrideQuery)) {
					$listQuery = $overrideQuery;
				}
			}
		}

		$startIndex = $pagingModel->getStartIndex();
		$pageLimit = $pagingModel->getPageLimit();

		if (!empty($orderBy)) {
			if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
				$referenceModules = $orderByFieldModel->getReferenceList();
				$referenceNameFieldOrderBy = array();
				foreach ($referenceModules as $referenceModuleName) {
					$referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
					$referenceNameFields = $referenceModuleModel->getNameFields();

					$columnList = array();
					foreach ($referenceNameFields as $nameField) {
						$fieldModel = $referenceModuleModel->getField($nameField);
						$columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
					}
					if (count($columnList) > 1) {
						$referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
					} else {
						$referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
					}
				}
				$listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
//.........这里部分代码省略.........
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:101,代码来源:ListView.php

示例2: getListViewEntries

 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel, $searchResult = false)
 {
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $queryGenerator = $this->get('query_generator');
     $listViewContoller = $this->get('listview_controller');
     $listViewFields = array('visibility', 'assigned_user_id', 'activitystatus');
     $queryGenerator->setFields(array_unique(array_merge($queryGenerator->getFields(), $listViewFields)));
     $searchParams = $this->get('search_params');
     if (empty($searchParams)) {
         $searchParams = array();
     }
     $glue = "";
     if (count($queryGenerator->getWhereFields()) > 0 && count($searchParams) > 0) {
         $glue = QueryGenerator::$AND;
     }
     $queryGenerator->parseAdvFilterList($searchParams, $glue);
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->setConditionField($orderByFieldName);
             //$queryGenerator->whereFields[] = $orderByFieldName;
         }
     }
     if (!empty($orderBy) && $orderBy === 'smownerid') {
         $fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
         if ($fieldModel->getFieldDataType() == 'owner') {
             $orderBy = 'COALESCE(' . getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users', '') . ', vtiger_groups.groupname)';
         }
     }
     //To combine date and time fields for sorting
     if ($orderBy == 'date_start') {
         $orderBy = "str_to_date(concat(date_start,time_start),'%Y-%m-%d %H:%i:%s')";
     } else {
         if ($orderBy == 'due_date') {
             $orderBy = "str_to_date(concat(due_date,time_end),'%Y-%m-%d %H:%i:%s')";
         }
     }
     $listQuery = $this->getQuery();
     if ($searchResult && $searchResult != '' && is_array($searchResult)) {
         $listQuery .= " AND vtiger_crmentity.crmid IN (" . implode(', ', $searchResult) . ") ";
     }
     unset($searchResult);
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(', ', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
//.........这里部分代码省略.........
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:101,代码来源:ListView.php

示例3: getListViewEntries

 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel)
 {
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $queryGenerator = $this->get('query_generator');
     $listViewContoller = $this->get('listview_controller');
     $searchParams = $this->get('search_params');
     if (empty($searchParams)) {
         $searchParams = array();
     }
     $glue = "";
     if (count($queryGenerator->getWhereFields()) > 0 && count($searchParams) > 0) {
         $glue = QueryGenerator::$AND;
     }
     $queryGenerator->parseAdvFilterList($searchParams, $glue);
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->addWhereField($orderByFieldName);
         }
     }
     if (!empty($orderBy) && $orderBy === 'smownerid') {
         $fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
         if ($fieldModel->getFieldDataType() == 'owner') {
             $orderBy = 'COALESCE(CONCAT(vtiger_users.first_name,vtiger_users.last_name),vtiger_groups.groupname)';
         }
     }
     $listQuery = $this->getQuery();
     $request = new Vtiger_Request($_REQUEST, $_REQUEST);
     $potential_id = $this->get('potential_id');
     if (Settings_SalesProcesses_Module_Model::checkRelatedToPotentialsLimit() && Settings_SalesProcesses_Module_Model::isLimitForModule($request->get('module'))) {
         if (empty($potential_id)) {
             $potential_id = $this->get('potentialid');
             if ($potential_id == '') {
                 $potential_id = -1;
             }
         }
         $newListQuery = '';
         $explodedListQuery = explode('INNER JOIN', $listQuery);
         foreach ($explodedListQuery as $key => $value) {
             $newListQuery .= 'INNER JOIN' . $value;
             if ($key == 0 && $moduleName == 'Products') {
                 $newListQuery .= ' INNER JOIN vtiger_seproductsrel AS seproductsrel ON vtiger_products.productid = seproductsrel.productid ';
             } elseif ($key == 0 && $moduleName == 'Services') {
                 $newListQuery .= ' INNER JOIN vtiger_crmentityrel ON (vtiger_crmentityrel.relcrmid = vtiger_service.serviceid OR vtiger_crmentityrel.crmid = vtiger_service.serviceid) ';
             }
         }
         $newListQuery = trim($newListQuery, 'INNER JOIN');
         if ($moduleName == 'Products') {
             $newListQuery .= " AND seproductsrel.crmid = '{$potential_id}' ";
         } elseif ($moduleName == 'Services') {
             $newListQuery .= " AND ( (vtiger_crmentityrel.crmid = '{$potential_id}' AND module = 'Potentials') OR (vtiger_crmentityrel.relcrmid = '{$potential_id}' AND relmodule = 'Potentials')) ";
         }
         $listQuery = $newListQuery;
     }
     if ($this->get('subProductsPopup')) {
         $listQuery = $this->addSubProductsQuery($listQuery);
     }
     $sourceModule = $this->get('src_module');
     $sourceField = $this->get('src_field');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $sourceField, $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
//.........这里部分代码省略.........
开发者ID:noclav,项目名称:UpdatePackages,代码行数:101,代码来源:ListView.php

示例4: getListViewEntries

 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel)
 {
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $queryGenerator = $this->get('query_generator');
     $listViewContoller = $this->get('listview_controller');
     $folderKey = $this->get('folder_id');
     $folderValue = $this->get('folder_value');
     if (!empty($folderValue)) {
         $queryGenerator->addCondition($folderKey, $folderValue, 'e');
     }
     $searchParams = $this->get('search_params');
     if (empty($searchParams)) {
         $searchParams = array();
     }
     $glue = "";
     if (count($queryGenerator->getWhereFields()) > 0 && count($searchParams) > 0) {
         $glue = QueryGenerator::$AND;
     }
     $queryGenerator->parseAdvFilterList($searchParams, $glue);
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->addWhereField($orderByFieldName);
             //$queryGenerator->whereFields[] = $orderByFieldName;
         }
     }
     if (!empty($orderBy) && $orderBy === 'smownerid') {
         $fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
         if ($fieldModel->getFieldDataType() == 'owner') {
             $orderBy = 'COALESCE(CONCAT(vtiger_users.first_name,vtiger_users.last_name),vtiger_groups.groupname)';
         }
     }
     $listQuery = $this->getQuery();
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     if (empty($viewid)) {
         $viewid = $pagingModel->get('viewid');
     }
     $_SESSION['lvs'][$moduleName][$viewid]['start'] = $pagingModel->get('page');
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     $listResult = $db->pquery($listQuery, array());
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:ListView.php


注:本文中的Vtiger_Paging_Model::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。