• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Vtiger_RelationListView_Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Vtiger_RelationListView_Model的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_RelationListView_Model类的具体用法?PHP Vtiger_RelationListView_Model怎么用?PHP Vtiger_RelationListView_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Vtiger_RelationListView_Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:58,代码来源:TransferOwnership.php


示例2: 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);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:9,代码来源:TreeCategory.php


示例3: 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;
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:9,代码来源:RelatedCommentModal.php


示例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');
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:50,代码来源:Detail.php


示例5: 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);
 }
开发者ID:xrstf,项目名称:vtiger-mirror,代码行数:18,代码来源:RelatedList.php


示例6: 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();
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:23,代码来源:DetailAjax.php


示例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";
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:47,代码来源:WfTaskRelcheck.php


示例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;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:21,代码来源:VtigerModuleOperation.php


示例9: 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;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:44,代码来源:Popup.php


示例10: showRelatedList

 /**
  * Function returns related records
  * @param Vtiger_Request $request
  * @return <type>
  */
 function showRelatedList(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 (empty($orderBy) && empty($sortOrder)) {
         $moduleInstance = CRMEntity::getInstance($relatedModuleName);
         $orderBy = $moduleInstance->default_order_by;
         $sortOrder = $moduleInstance->default_sort_order;
     }
     if ($sortOrder == "ASC") {
         $nextSortOrder = "DESC";
         $sortImage = "glyphicon glyphicon-chevron-down";
     } else {
         $nextSortOrder = "ASC";
         $sortImage = "glyphicon glyphicon-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);
     $parentRecordCurrencyId = $parentRecordModel->get('currency_id');
     if ($parentRecordCurrencyId) {
         $relatedModuleModel = Vtiger_Module_Model::getInstance($relatedModuleName);
         foreach ($models as $recordId => $recorModel) {
             $productIdsList[$recordId] = $recordId;
         }
         $unitPricesList = $relatedModuleModel->getPricesForProducts($parentRecordCurrencyId, $productIdsList);
         foreach ($models as $recordId => $recorModel) {
             $recorModel->set('unit_price', $unitPricesList[$recordId]);
         }
     }
     $relationModel = $relationListView->getRelationModel();
     $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', $relationModel->getRelationModuleModel());
     $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('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     return $viewer->view('RelatedList.tpl', $moduleName, 'true');
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:83,代码来源:Detail.php


示例11: 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;
 }
开发者ID:googlicius,项目名称:SP,代码行数:16,代码来源:GetDetailView.php


示例12: showRelatedTree

 function showRelatedTree(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $parentId = $request->get('record');
     $relatedModuleName = $request->get('relatedModule');
     $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
     $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
     $relationModel = $relationListView->getRelationModel();
     $header = $relationListView->getTreeHeaders();
     $entries = $relationListView->getTreeEntries();
     $viewer = $this->getViewer($request);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('RECORDID', $parentId);
     $viewer->assign('RELATED_MODULE_NAME', $relatedModuleName);
     $viewer->assign('RELATED_RECORDS', $entries);
     $viewer->assign('RELATED_HEADERS', $header);
     $viewer->assign('SHOW_CREATOR_DETAIL', $relationModel->showCreatorDetail());
     $viewer->assign('SHOW_COMMENT', $relationModel->showComment());
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     return $viewer->view('RelatedTreeContent.tpl', $moduleName, 'true');
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:21,代码来源:Detail.php


示例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');
     $totalCount = 0;
     $relModules = [$relatedModuleName];
     if (in_array('ProductsAndServices', $relModules)) {
         $label = '';
         $relModules = ['Products', 'OutsourcedProducts', 'Assets', 'Services', 'OSSOutsourcedServices', 'OSSSoldServices'];
     }
     if (in_array('Comments', $relModules)) {
         $totalCount = ModComments_Record_Model::getCommentsCount($parentId);
     } else {
         $pagingModel = new Vtiger_Paging_Model();
         $parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $moduleName);
         foreach ($relModules as $relatedModuleName) {
             $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
             if (!vtlib_isModuleActive($relatedModuleName) || !$relationListView->getRelationModel()) {
                 continue;
             }
             $totalCount += (int) $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();
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:41,代码来源:RelationAjax.php


示例14: 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');
 }
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:69,代码来源:RelatedList.php


示例15: 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;
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:ServicesPopup.php


示例16: reloadValue

 /**
  * Update the value for relation
  * @param string $sourceModule Source module name
  * @param int $sourceRecord Source record
  */
 public function reloadValue($sourceModule, $sourceRecord)
 {
     $currentUser = vglobal('current_user');
     $user = new Users();
     vglobal('current_user', $user->retrieveCurrentUserInfoFromFile(Users::getActiveAdminId()));
     vglobal('currentModule', $sourceModule);
     $db = PearDatabase::getInstance();
     $params = $this->get('field')->getFieldParams();
     $sourceRecordModel = Vtiger_Record_Model::getInstanceById($sourceRecord, $sourceModule);
     $targetModel = Vtiger_RelationListView_Model::getInstance($sourceRecordModel, $params['module']);
     $fieldInfo = Vtiger_Functions::getModuleFieldInfoWithId($params['field']);
     $query = $targetModel->getRelationQuery();
     $explodedQuery = explode('FROM', $query, 2);
     $relationQuery = 'SELECT DISTINCT ' . $fieldInfo['columnname'] . ' FROM' . $explodedQuery[1] . ' AND ' . $fieldInfo['columnname'] . " <> ''";
     vglobal('current_user', $currentUser);
     $result = $db->query($relationQuery);
     $currentValue = self::COMMA;
     while ($value = $db->getSingleValue($result)) {
         $currentValue .= $value . self::COMMA;
     }
     $db->update($this->get('field')->get('table'), [$this->get('field')->get('column') => $currentValue], $sourceRecordModel->getEntity()->tab_name_index[$this->get('field')->get('table')] . ' = ?', [$sourceRecord]);
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:27,代码来源:MultiReferenceValue.php


示例17: 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);
//.........这里部分代码省略.........
开发者ID:nvh3010,项目名称:quancrm,代码行数:101,代码来源:Popup.php


示例18: 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();
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:26,代码来源:RelationAjax.php


示例19: process

 function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $relatedModuleName = $request->get('relatedModule');
     $parentId = $request->get('record');
     $label = $request->get('tab_label');
     $pageNumber = $request->get('page');
     $time = $request->get('time');
     if (empty($pageNumber)) {
         $pageNumber = 1;
     }
     if (empty($time)) {
         $time = 'current';
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     $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 = 'glyphicon glyphicon-chevron-down';
     } else {
         $nextSortOrder = 'ASC';
         $sortImage = 'glyphicon glyphicon-chevron-up';
     }
     if (empty($orderBy) && empty($sortOrder)) {
         $relatedInstance = CRMEntity::getInstance($relatedModuleName);
         $orderBy = $relatedInstance->default_order_by;
         $sortOrder = $relatedInstance->default_sort_order;
     }
     if (!empty($orderBy)) {
         $relationListView->set('orderby', $orderBy) 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Vtiger_Relation_Model类代码示例发布时间:2022-05-23
下一篇:
PHP Vtiger_Record_Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap