本文整理汇总了PHP中Vtiger_RelationListView_Model::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_RelationListView_Model::getInstance方法的具体用法?PHP Vtiger_RelationListView_Model::getInstance怎么用?PHP Vtiger_RelationListView_Model::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_RelationListView_Model
的用法示例。
在下文中一共展示了Vtiger_RelationListView_Model::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelatedModuleRecordIds
public function getRelatedModuleRecordIds(Vtiger_Request $request, $recordIds = [])
{
$db = PearDatabase::getInstance();
$basicModule = $request->getModule();
$relatedModules = $request->get('related_modules');
$parentModuleModel = Vtiger_Module_Model::getInstance($basicModule);
$relatedIds = [];
if (!empty($relatedModules)) {
foreach ($relatedModules as $relModData) {
$relModData = explode('::', $relModData);
$relatedModule = $relModData[0];
$type = $relModData[1];
switch ($type) {
case 0:
$field = $relModData[2];
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
if ($recordModel->get($field) != 0 && Vtiger_Functions::getCRMRecordType($recordModel->get($field)) == $relatedModule) {
$relatedIds[] = $recordModel->get($field);
}
}
break;
case 1:
$relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModule);
$instance = CRMEntity::getInstance($relatedModule);
$relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModuleModel);
$fieldModel = $relationModel->getRelationField();
$tablename = $fieldModel->get('table');
$tabIndex = $instance->table_index;
$relIndex = $this->getRelatedFieldName($relatedModule, $basicModule);
if (!$relIndex) {
break;
}
$sql = "SELECT vtiger_crmentity.crmid FROM vtiger_crmentity INNER JOIN {$tablename} ON {$tablename}.{$tabIndex} = vtiger_crmentity.crmid\n\t\t\t\t\t\tWHERE {$tablename}.{$relIndex} IN (" . $db->generateQuestionMarks($recordIds) . ")";
$result = $db->pquery($sql, $recordIds);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
break;
case 2:
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $basicModule);
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $relatedModule);
$query = $relationListView->getRelationQuery();
$queryEx = explode('FROM', $query, 2);
$query = 'SELECT DISTINCT vtiger_crmentity.crmid FROM' . $queryEx[1];
$result = $db->query($query);
while ($crmid = $db->getSingleValue($result)) {
$relatedIds[] = $crmid;
}
}
break;
}
$relatedIds = array_unique($relatedIds);
}
}
return $relatedIds;
}
示例2: getInstance
public static function getInstance($record, $moduleName, $relatedRecord, $relatedModuleName)
{
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'RelatedCommentModal', $moduleName);
$instance = new $modelClassName();
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, $relatedModuleName);
$instance->set('relationListView', $relationListView)->set('record', $record)->set('moduleName', $moduleName)->set('relatedRecord', $relatedRecord)->set('relatedModuleName', $relatedModuleName);
return $instance;
}
示例3: getSelectedRecords
private function getSelectedRecords()
{
$parentRecordModel = Vtiger_Record_Model::getInstanceById($this->src_record, $this->src_module);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $this->moduleName);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$entries = $relationListView->getEntries($pagingModel);
return array_keys($entries);
}
示例4: showRelatedRecords
/**
* Function returns related records based on related moduleName
* @param Vtiger_Request $request
* @return <type>
*/
function showRelatedRecords(Vtiger_Request $request)
{
$parentId = $request->get('record');
$pageNumber = $request->get('page');
$limit = $request->get('limit');
$relatedModuleName = $request->get('relatedModule');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$whereCondition = $request->get('whereCondition');
$moduleName = $request->getModule();
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
} else {
$nextSortOrder = "ASC";
$sortImage = "icon-chevron-up";
}
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
if (!empty($orderBy)) {
$relationListView->set('orderby', $orderBy);
$relationListView->set('sortorder', $sortOrder);
}
if (empty($pageNumber)) {
$pageNumber = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (!empty($limit)) {
$pagingModel->set('limit', $limit);
}
if ($whereCondition) {
$relationListView->set('whereCondition', $whereCondition);
}
$models = $relationListView->getEntries($pagingModel);
$header = $relationListView->getHeaders();
$viewer = $this->getViewer($request);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RELATED_RECORDS', $models);
$viewer->assign('RELATED_HEADERS', $header);
$viewer->assign('RELATED_MODULE', $relatedModuleName);
$viewer->assign('RELATED_MODULE_MODEL', Vtiger_Module_Model::getInstance($relatedModuleName));
$viewer->assign('PAGING_MODEL', $pagingModel);
return $viewer->view('SummaryWidgets.tpl', $moduleName, 'true');
}
示例5: getRecordsCount
/**
* Function to get related Records count from this relation
* @param <Vtiger_Request> $request
* @return <Number> Number of record from this relation
*/
public function getRecordsCount(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedModuleName = $request->get('relatedModule');
$parentId = $request->get('record');
$label = $request->get('tab_label');
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
$count = $relationListView->getRelatedEntriesCount();
$result = array();
$result['module'] = $moduleName;
$result['viewname'] = $cvId;
$result['count'] = $count;
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setResult($result);
$response->emit();
}
示例6: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedModuleName = $request->get('relatedModule');
$parentId = $request->get('record');
$label = $request->get('tab_label');
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
$relationModel = $relationListView->getRelationModel();
$viewer = $this->getViewer($request);
if (array_key_exists($relatedModuleName, $relationModel->getEmailEnabledModulesInfoForDetailView())) {
$viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($relatedModuleName));
$viewer->assign('STATUS_VALUES', $relationModel->getCampaignRelationStatusValues());
$viewer->assign('SELECTED_IDS', $request->get('selectedIds'));
$viewer->assign('EXCLUDED_IDS', $request->get('excludedIds'));
}
return parent::process($request);
}
示例7: handleTask
/**
* @param $context \Workflow\VTEntity
* @return string
*/
public function handleTask(&$context)
{
global $list_max_entries_per_page, $adb, $currentModule;
$old_list_max_entries_per_page = $list_max_entries_per_page;
if ($this->get("related_module") == -1) {
return "no";
}
$currentModule = $this->getModuleName();
$found_rows = $this->get("found_rows");
if (empty($found_rows) || $found_rows == -1) {
$found_rows = 1;
}
$parts = explode("#~#", $this->get("related_module"));
$functionName = $parts[0];
$relatedModuleName = \Workflow\VtUtils::getModuleName($parts[1]);
//$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
$parentRecordModel = Vtiger_Record_Model::getInstanceById($context->getId(), $context->getModuleName());
/**
* @var Vtiger_RelationListView_Model $relatedListView
*/
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
$query = $relationListView->getRelationQuery();
$query = preg_replace('/SELECT(.+)FROM/imU', 'SELECT vtiger_crmentity.crmid FROM', $query);
$logger = new \Workflow\ConditionLogger();
$relModule = \Workflow\VtUtils::getModuleName($parts[1]);
$objMySQL = new \Workflow\ConditionMysql($relModule, $context);
$objMySQL->setLogger($logger);
$main_module = \CRMEntity::getInstance($relModule);
$sqlCondition = $objMySQL->parse($this->get("condition"));
$sqlTables = $objMySQL->generateTables();
$logs = $logger->getLogs();
$this->setStat($logs);
$idColumn = $main_module->table_name . "." . $main_module->table_index;
$sqlQuery = "SELECT {$idColumn} " . $sqlTables . " WHERE {$idColumn} IN (" . $query . ")" . (strlen($sqlCondition) > 3 ? " AND " . $sqlCondition : "");
$this->addStat("MySQL Query: " . $sqlQuery);
$result = $adb->query($sqlQuery, true);
$this->addStat("num Rows: " . $adb->num_rows($result));
$this->addStat("have to at least x rows: " . $found_rows);
if ($adb->num_rows($result) >= $found_rows) {
return 'yes';
}
return "no";
}
示例8: relatedIds
public function relatedIds($id, $relatedModule, $relatedLabel, $relatedHandler = null)
{
$ids = vtws_getIdComponents($id);
$sourceModule = $this->webserviceObject->getEntityName();
global $currentModule;
$currentModule = $sourceModule;
$sourceRecordModel = Vtiger_Record_Model::getInstanceById($ids[1], $sourceModule);
$targetModel = Vtiger_RelationListView_Model::getInstance($sourceRecordModel, $relatedModule, $relatedLabel);
$sql = $targetModel->getRelationQuery();
$relatedWebserviceObject = VtigerWebserviceObject::fromName($adb, $relatedModule);
$relatedModuleWSId = $relatedWebserviceObject->getEntityId();
// Rewrite query to pull only crmid transformed as webservice id.
$sqlFromPart = substr($sql, stripos($sql, ' FROM ') + 6);
$sql = sprintf("SELECT DISTINCT concat('%sx',vtiger_crmentity.crmid) as wsid FROM %s", $relatedModuleWSId, $sqlFromPart);
$rs = $this->pearDB->pquery($sql, array());
$relatedIds = array();
while ($row = $this->pearDB->fetch_array($rs)) {
$relatedIds[] = $row['wsid'];
}
return $relatedIds;
}
示例9: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
$moduleName = $this->getModule($request);
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
if(in_array($sourceModule, array('Quotes', 'SalesOrder')) && $sourceField == 'potential_id') {
$relatedParentModule = $request->get('related_parent_module');
$relatedParentId = $request->get('related_parent_id');
if(empty($relatedParentModule)) {
return parent::initializeListViewContents($request, $viewer);
}
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
$requestedPage = $pageNumber;
if(empty ($requestedPage)) {
$requestedPage = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page',$requestedPage);
$parentRecordModel = Vtiger_Record_Model::getInstanceById($relatedParentId, $relatedParentModule);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $moduleName, $label);
if($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
} else {
$nextSortOrder = "ASC";
$sortImage = "icon-chevron-up";
}
if(!empty($orderBy)) {
$relationListView->set('orderby', $orderBy);
$relationListView->set('sortorder',$sortOrder);
}
$headers = $relationListView->getHeaders();
$models = $relationListView->getEntries($pagingModel);
$noOfEntries = count($models);
foreach ($models as $recordId => $recordModel) {
foreach ($headers as $fieldName => $fieldModel) {
$recordModel->set($fieldName, $recordModel->getDisplayValue($fieldName));
}
$models[$recordId] = $recordModel;
}
//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';
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('RELATED_PARENT_MODULE', $relatedParentModule);
$viewer->assign('RELATED_PARENT_ID', $relatedParentId);
$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_ENTIRES_COUNT',$noOfEntries);
//.........这里部分代码省略.........
示例10: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedModuleName = $request->get('relatedModule');
$parentId = $request->get('record');
$label = $request->get('tab_label');
$requestedPage = $request->get('page');
if (empty($requestedPage)) {
$requestedPage = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $requestedPage);
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if ($sortOrder == 'ASC') {
$nextSortOrder = 'DESC';
$sortImage = 'icon-chevron-down';
} else {
$nextSortOrder = 'ASC';
$sortImage = 'icon-chevron-up';
}
if (!empty($orderBy)) {
$relationListView->set('orderby', $orderBy);
$relationListView->set('sortorder', $sortOrder);
}
$models = $relationListView->getEntries($pagingModel);
$links = $relationListView->getLinks();
$header = $relationListView->getHeaders();
$noOfEntries = count($models);
$relationModel = $relationListView->getRelationModel();
$relatedModuleModel = $relationModel->getRelationModuleModel();
$relationField = $relationModel->getRelationField();
$viewer = $this->getViewer($request);
$viewer->assign('RELATED_RECORDS', $models);
$viewer->assign('PARENT_RECORD', $parentRecordModel);
$viewer->assign('RELATED_LIST_LINKS', $links);
$viewer->assign('RELATED_HEADERS', $header);
$viewer->assign('RELATED_MODULE', $relatedModuleModel);
$viewer->assign('RELATED_ENTIRES_COUNT', $noOfEntries);
$viewer->assign('RELATION_FIELD', $relationField);
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
$totalCount = $relationListView->getRelatedEntriesCount();
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
}
$viewer->assign('PAGE_COUNT', $pageCount);
$viewer->assign('TOTAL_ENTRIES', $totalCount);
$viewer->assign('PERFORMANCE', true);
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('PAGING', $pagingModel);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('COLUMN_NAME', $orderBy);
$viewer->assign('IS_EDITABLE', $relationModel->isEditable());
$viewer->assign('IS_DELETABLE', $relationModel->isDeletable());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('VIEW', $request->get('view'));
$viewer->assign('TOTALBS', 0);
$viewer->assign('TOTALDS', 0);
$viewer->assign('CANTIDAD', 0);
return $viewer->view('RelatedList.tpl', $moduleName, 'true');
}
示例11: 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');
$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);
$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 (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);
}
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;
//.........这里部分代码省略.........
示例12: getSelectedRecords
private function getSelectedRecords($onlyKeys = true)
{
$currentModule = vglobal('currentModule');
vglobal('currentModule', $this->get('srcModule'));
$parentRecordModel = Vtiger_Record_Model::getInstanceById($this->get('srcRecord'), $this->get('srcModule'));
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $this->getModuleName());
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$entries = $relationListView->getEntries($pagingModel);
vglobal('currentModule', $currentModule);
if ($onlyKeys) {
return array_keys($entries);
} else {
return $entries;
}
}
示例13: getRelatedListPageCount
/**
* Function to get the page count for reltedlist
* @return total number of pages
*/
function getRelatedListPageCount(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedModuleName = $request->get('relatedModule');
$parentId = $request->get('record');
$label = $request->get('tab_label');
$pagingModel = new Vtiger_Paging_Model();
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
$totalCount = $relationListView->getRelatedEntriesCount();
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
}
$result = array();
$result['numberOfRecords'] = $totalCount;
$result['page'] = $pageCount;
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例14: getNoOfEntries
function getNoOfEntries($request, $relatedModuleName)
{
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', 1);
$recordId = $request->get('relatedRecord');
$moduleName = $request->get('relatedModule');
$allowCountModules = array('Contacts', 'Accounts', 'Quotes', 'SalesOrder', 'Invoice', 'HelpDesk', 'Coupons', 'Calendar');
if (in_array($relatedModuleName, $allowCountModules)) {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
$models = $relationListView->getEntries($pagingModel);
$noOfEntries = count($models);
return $noOfEntries;
}
return -1;
}
示例15: showRelatedRecords
/**
* Function returns related records based on related moduleName
* @param Vtiger_Request $request
* @return <type>
*/
function showRelatedRecords(Vtiger_Request $request)
{
$parentId = $request->get('record');
$pageNumber = $request->get('page');
$limit = $request->get('limit');
$relatedModuleName = $request->get('relatedModule');
$moduleName = $request->getModule();
if (empty($pageNumber)) {
$pageNumber = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (!empty($limit)) {
$pagingModel->set('limit', $limit);
}
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
$models = $relationListView->getEntries($pagingModel);
$header = $relationListView->getHeaders();
$viewer = $this->getViewer($request);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RELATED_RECORDS', $models);
$viewer->assign('RELATED_HEADERS', $header);
$viewer->assign('RELATED_MODULE', $relatedModuleName);
$viewer->assign('PAGING_MODEL', $pagingModel);
return $viewer->view('SummaryWidgets.tpl', $moduleName, 'true');
}