本文整理汇总了PHP中Vtiger_ListView_Model::getInstanceForPopup方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_ListView_Model::getInstanceForPopup方法的具体用法?PHP Vtiger_ListView_Model::getInstanceForPopup怎么用?PHP Vtiger_ListView_Model::getInstanceForPopup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_ListView_Model
的用法示例。
在下文中一共展示了Vtiger_ListView_Model::getInstanceForPopup方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getModule();
$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');
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);
$sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
//get the unit prices for the pricebooks based on the product currency
$productUnitPrice = Vtiger_Functions::getUnitPrice($sourceRecord, $sourceModule);
$productPriceDetails = getPriceDetailsForProduct($sourceRecord, $productUnitPrice, 'available', $sourceModule);
$productCurrencyPrice = array();
foreach ($productPriceDetails as $priceDetails) {
$productCurrencyPrice[$priceDetails['curid']] = $priceDetails['curvalue'];
}
foreach ($this->listViewEntries as $recordId => $recordModel) {
$recordDetails = $recordModel->getRawData();
$priceBookCurrencyId = $recordDetails['currency_id'];
$recordModel->set('unit_price', $productCurrencyPrice[$priceBookCurrencyId]);
}
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SOURCE_RECORD_MODEL', $sourceRecordModel);
//PARENT_MODULE is used for only translations
$viewer->assign('PARENT_MODULE', 'PriceBooks');
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('VIEW', 'ProductPriceBookPopup');
}
示例2: getListViewCount
/**
* Function to get listView count
* @param Vtiger_Request $request
*/
function getListViewCount(Vtiger_Request $request)
{
$moduleName = $this->getModule($request);
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$subProductsPopup = $request->get('subProductsPopup');
$parentProductId = $request->get('productid');
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName);
if (!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if ($subProductsPopup && $parentProductId) {
$listViewModel->set('subProductsPopup', true);
$listViewModel->set('productId', $parentProductId);
}
$count = $listViewModel->getListViewCount();
return $count;
}
示例3: 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 {
//.........这里部分代码省略.........
示例4: getListViewCount
/**
* Function to get listView count
* @param Vtiger_Request $request
*/
function getListViewCount(Vtiger_Request $request)
{
$moduleName = $this->getModule($request);
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$currencyId = $request->get('currency_id');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$relatedParentModule = $request->get('related_parent_module');
$relatedParentId = $request->get('related_parent_id');
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($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
$listViewModel->set('currency_id', $currencyId);
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$count = $listViewModel->getRelatedEntriesCount();
} else {
$count = $listViewModel->getListViewCount();
}
return $count;
}
示例5: 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');
$selectedFields = $request->get('selectedFields');
if (!empty($selectedFields)) {
foreach ($selectedFields as $key => $value) {
$selectFields[$value] = $value;
}
}
$view = $request->get('view');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
//Enable multiselect mode for email related popup
$multiSelectMode = true;
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);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$primaryEmailFieldName = 'email';
if ($moduleName == 'Accounts' || $moduleName == 'Users') {
$primaryEmailFieldName = 'email1';
}
$listViewModel->extendPopupFields(array($primaryEmailFieldName => $primaryEmailFieldName));
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);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SELECT_FIELDS', $selectFields);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('VIEW', $view);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$totalCount = $this->listViewCount;
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
//.........这里部分代码省略.........
示例6: 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');
//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);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
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);
}
if(!empty($currencyId)) {
$listViewModel->set('currency_id', $currencyId);
}
if(!$this->listViewHeaders){
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$this->listViewHeaders['listprice'] = $field;
if(!$this->listViewEntries){
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
foreach ($this->listViewEntries as $recordId => $recordModel) {
$recordModel->set('listprice', $recordModel->getProductsListPrice($sourceRecord));
}
$noOfEntries = count($this->listViewEntries);
if(empty($sortOrder)) {
$sortOrder = "ASC";
}
if($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
}else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY',$orderBy);
$viewer->assign('SORT_ORDER',$sortOrder);
$viewer->assign('NEXT_SORT_ORDER',$nextSortOrder);
$viewer->assign('SORT_IMAGE',$sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
//.........这里部分代码省略.........
示例7: getRecords
private function getRecords()
{
$selectedRecords = $this->getSelectedRecords();
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($this->moduleName, $this->src_module);
if (!empty($this->src_module)) {
$listViewModel->set('src_module', $this->src_module);
$listViewModel->set('src_record', $this->src_record);
}
$listEntries = $listViewModel->getListViewEntries($pagingModel, true);
$tree = [];
foreach ($listEntries as $item) {
$this->lastIdinTree++;
$parent = $item->get('pscategory');
$parent = (int) str_replace('T', '', $parent);
$tree[] = ['id' => $this->lastIdinTree, 'record_id' => $item->getId(), 'parent' => $parent == 0 ? '#' : $parent, 'text' => $item->getName(), 'state' => ['selected' => in_array($item->getId(), $selectedRecords)], 'icon' => 'glyphicon glyphicon-file'];
}
return $tree;
}
示例8: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$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');
$relatedParentModule = $request->get('related_parent_module');
$relatedParentId = $request->get('related_parent_id');
$potentialId = $request->get('potentialid');
//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);
$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);
}
if (!empty($potentialId) && vglobal('inventory_popup_limited_from_potentials')) {
$listViewModel->set('potential_id', $potentialId);
$viewer->assign('INVENTORY_LIMITED_FROM_POTENTIALS', true);
}
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);
}
// If there are no related records with parent module then, we should show all the records
if (!$parent_related_records && !empty($relatedParentModule) && !empty($relatedParentId)) {
$relatedParentModule = null;
$relatedParentId = null;
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
//.........这里部分代码省略.........
示例9: 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 || $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;
}
}
// Limit the choice of products/services only to the ones related to currently selected Opportunity - second step.
if (Settings_SalesProcesses_Module_Model::checkRelatedToPotentialsLimit($sourceModule)) {
$salesProcessId = $request->get('salesprocessid');
if (empty($salesProcessId)) {
$salesProcessId = -1;
}
$listViewModel->set('salesprocessid', $salesProcessId);
$viewer->assign('INVENTORY_LIMITED_FROM_POTENTIALS', true);
}
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;
//.........这里部分代码省略.........
示例10: getAllRecords
private function getAllRecords()
{
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($this->getModuleName(), $this->get('srcModule'));
if (!empty($this->get('srcModule'))) {
$listViewModel->set('src_module', $this->get('srcModule'));
$listViewModel->set('src_record', $this->get('srcRecord'));
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$listEntries = $listViewModel->getListViewEntries($pagingModel, true);
return $listEntries;
}
示例11: 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');
//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);
}
if (!empty($potentialId) && vglobal('inventory_popup_limited_from_potentials')) {
$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 {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('RELATED_MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
//.........这里部分代码省略.........