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


PHP ListViewSession::setSessionQuery方法代码示例

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


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

示例1: getListViewEntries


//.........这里部分代码省略.........
				$queryGenerator->addWhereField($orderByFieldName);
				//$queryGenerator->whereFields[] = $orderByFieldName;
			}
		}

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

		$listQuery = $this->getQuery();

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

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

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

					$columnList = array();
					foreach ($referenceNameFields as $nameField) {
						$fieldModel = $referenceModuleModel->getField($nameField);
						$columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
					}
					if (count($columnList) > 1) {
						$referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
					} else {
						$referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
					}
				}
				$listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
			} else if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::CURRENCY_LIST) {
				$listQuery .= ' ORDER BY ' . $orderByFieldModel->getUITypeModel()->getCurrenyListReferenceFieldName() . ' ' . $sortOrder;
			} else {
				$listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
			}
		}

		$viewid = ListViewSession::getCurrentView($moduleName);
		if (empty($viewid)) {
			$viewid = $pagingModel->get('viewid');
		}
		$_SESSION['lvs'][$moduleName][$viewid]['start'] = $pagingModel->get('page');
		ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);

		//For Pricebooks popup in Products and Services Related list
		if ($sourceField !== 'productsRelatedList') {
			$listQuery .= " LIMIT $startIndex," . ($pageLimit + 1);
		}

		$listResult = $db->pquery($listQuery, array());

		$listViewRecordModels = array();
		$listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);

		$pagingModel->calculatePageRange($listViewEntries);

		//To check if next page
		if ($db->num_rows($listResult) > $pageLimit && $sourceField !== 'productsRelatedList') {
			array_pop($listViewEntries);
			$pagingModel->set('nextPageExists', true);
		} else {
			$pagingModel->set('nextPageExists', false);
		}

		$index = 0;
		foreach ($listViewEntries as $recordId => $record) {
			$rawData = $db->query_result_rowdata($listResult, $index++);
			$record['id'] = $recordId;

			// Pass through the src_record state to dependent model
			if ($this->has('src_record')) {
				$rawData['src_record'] = $this->get('src_record');
			}

			$listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record, $rawData);
			$listViewRecordModels[$recordId]->lockEditView = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
			$listViewRecordModels[$recordId]->isPermittedToEditView = Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId);
			$listViewRecordModels[$recordId]->colorList = Settings_DataAccess_Module_Model::executeColorListHandlers($moduleName, $recordId, $listViewRecordModels[$recordId]);
		}

		return $listViewRecordModels;
	}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:101,代码来源:ListView.php

示例2: getListViewEntries


//.........这里部分代码省略.........
             $orderBy = 'COALESCE(CONCAT(vtiger_users.first_name,vtiger_users.last_name),vtiger_groups.groupname)';
         }
     }
     $listQuery = $this->getQuery();
     $request = new Vtiger_Request($_REQUEST, $_REQUEST);
     $potential_id = $this->get('potential_id');
     if (Settings_SalesProcesses_Module_Model::checkRelatedToPotentialsLimit() && Settings_SalesProcesses_Module_Model::isLimitForModule($request->get('module'))) {
         if (empty($potential_id)) {
             $potential_id = $this->get('potentialid');
             if ($potential_id == '') {
                 $potential_id = -1;
             }
         }
         $newListQuery = '';
         $explodedListQuery = explode('INNER JOIN', $listQuery);
         foreach ($explodedListQuery as $key => $value) {
             $newListQuery .= 'INNER JOIN' . $value;
             if ($key == 0 && $moduleName == 'Products') {
                 $newListQuery .= ' INNER JOIN vtiger_seproductsrel AS seproductsrel ON vtiger_products.productid = seproductsrel.productid ';
             } elseif ($key == 0 && $moduleName == 'Services') {
                 $newListQuery .= ' INNER JOIN vtiger_crmentityrel ON (vtiger_crmentityrel.relcrmid = vtiger_service.serviceid OR vtiger_crmentityrel.crmid = vtiger_service.serviceid) ';
             }
         }
         $newListQuery = trim($newListQuery, 'INNER JOIN');
         if ($moduleName == 'Products') {
             $newListQuery .= " AND seproductsrel.crmid = '{$potential_id}' ";
         } elseif ($moduleName == 'Services') {
             $newListQuery .= " AND ( (vtiger_crmentityrel.crmid = '{$potential_id}' AND module = 'Potentials') OR (vtiger_crmentityrel.relcrmid = '{$potential_id}' AND relmodule = 'Potentials')) ";
         }
         $listQuery = $newListQuery;
     }
     if ($this->get('subProductsPopup')) {
         $listQuery = $this->addSubProductsQuery($listQuery);
     }
     $sourceModule = $this->get('src_module');
     $sourceField = $this->get('src_field');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $sourceField, $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     if (empty($viewid)) {
         $viewid = $pagingModel->get('viewid');
     }
     $_SESSION['lvs'][$moduleName][$viewid]['start'] = $pagingModel->get('page');
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     //For Products popup in Price Book Related list
     if ($sourceModule !== 'PriceBooks' && $sourceField !== 'priceBookRelatedList') {
         $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     }
     $listResult = $db->pquery($listQuery, array());
     $listViewRecordModels = array();
     $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
     $pagingModel->calculatePageRange($listViewEntries);
     if ($db->num_rows($listResult) > $pageLimit && $sourceModule !== 'PriceBooks' && $sourceField !== 'priceBookRelatedList') {
         array_pop($listViewEntries);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     $index = 0;
     foreach ($listViewEntries as $recordId => $record) {
         $rawData = $db->query_result_rowdata($listResult, $index++);
         $record['id'] = $recordId;
         $listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record, $rawData);
         $listViewRecordModels[$recordId]->lockEditView = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
         $listViewRecordModels[$recordId]->isPermittedToEditView = Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId);
         $listViewRecordModels[$recordId]->colorList = Settings_DataAccess_Module_Model::executeColorListHandlers($moduleName, $recordId, $listViewRecordModels[$recordId]);
     }
     return $listViewRecordModels;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:101,代码来源:ListView.php

示例3: getMergeFields

$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
$smarty->assign("AVALABLE_FIELDS", getMergeFields($currentModule, "available_fields"));
$smarty->assign("FIELDS_TO_MERGE", getMergeFields($currentModule, "fileds_to_merge"));
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries), ";"));
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string, "Contacts", "index", $viewid);
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'lastname', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = $controller->getAdvancedSearchOptionString();
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("ALPHABETICAL", $alphabetical);
$smarty->assign("MODULE", $currentModule);
$smarty->assign("SINGLE_MOD", 'Contact');
$check_button = Button_Check($currentModule);
$smarty->assign("CHECK", $check_button);
ListViewSession::setSessionQuery($currentModule, $list_query, $viewid);
// Gather the custom link information to display
include_once 'vtlib/Vtiger/Link.php';
$customlink_params = array('MODULE' => $currentModule, 'ACTION' => vtlib_purify($_REQUEST['action']), 'CATEGORY' => $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), array('LISTVIEWBASIC', 'LISTVIEW'), $customlink_params));
// END
if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '') {
    $smarty->display("ListViewEntries.tpl");
} else {
    $smarty->display("ListView.tpl");
}
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:ListView.php

示例4: getListViewEntries

 /**
  * Overrided to add HTML content for callstatus irrespective of the filters
  */
 public function getListViewEntries($pagingModel)
 {
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     //Add the direction field to the query irrespective of filter
     $queryGenerator = $this->get('query_generator');
     $fields = $queryGenerator->getFields();
     array_push($fields, 'direction');
     $queryGenerator->setFields($fields);
     $this->set('query_generator', $queryGenerator);
     //END
     $listViewContoller = $this->get('listview_controller');
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->addWhereField($orderByFieldName);
             //$queryGenerator->whereFields[] = $orderByFieldName;
         }
     }
     $listQuery = $this->getQuery();
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     $listResult = $db->pquery($listQuery, array());
     $listViewRecordModels = array();
     $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
     $pagingModel->calculatePageRange($listViewEntries);
     if ($db->num_rows($listResult) > $pageLimit) {
         array_pop($listViewEntries);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     //Adding the HTML content based on the callstatus and direction to the records
     foreach ($listViewEntries as $recordId => $record) {
         //To Replace RecordingUrl by Icon
         $recordingUrl = explode('>', $listViewEntries[$recordId]['recordingurl']);
         $url = explode('<', $recordingUrl[1]);
         if ($url[0] != '' && $listViewEntries[$recordId]['callstatus'] == 'completed') {
             $listViewEntries[$recordId]['recordingurl'] = $recordingUrl[0] . '>' . '<i class="icon-volume-up"></i>' . '</a>';
         } else {
             $listViewEntries[$recordId]['recordingurl'] = '';
         }
         if ($listViewEntries[$recordId]['direction'] == 'outbound') {
//.........这里部分代码省略.........
开发者ID:xrstf,项目名称:vtiger-mirror,代码行数:101,代码来源:ListView.php

示例5: GetRelatedListBase


//.........这里部分代码省略.........
            $_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
            $_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
        }
    } elseif ($_SESSION['rlvs'][$module][$relatedmodule]) {
        $sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
        $order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
    } else {
        $order_by = $focus->default_order_by;
        $sorder = $focus->default_sort_order;
    }
    //Added by Don for AssignedTo ordering issue in Related Lists
    $query_order_by = $order_by;
    if ($order_by == 'smownerid') {
        $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
        $query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end ";
    } elseif ($order_by != 'crmid' && !empty($order_by)) {
        $tabname = getTableNameForField($relatedmodule, $order_by);
        if ($tabname !== '' and $tabname != NULL) {
            $query_order_by = $tabname . "." . $query_order_by;
        }
    }
    if (!empty($query_order_by)) {
        $query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
    }
    if ($relatedmodule == 'Calendar') {
        $mod_listquery = "activity_listquery";
    } else {
        $mod_listquery = strtolower($relatedmodule) . "_listquery";
    }
    $_SESSION[$mod_listquery] = $query;
    $url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder;
    $computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : '';
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
        //Retreiving the no of rows
        if ($relatedmodule == "Calendar") {
            //for calendar related list, count will increase when we have multiple contacts
            //relationship for single activity
            $count_query = mkCountQuery($query);
            $count_result = $adb->query($count_query);
            $noofrows = $adb->query_result($count_result, 0, "count");
        } else {
            $count_query = mkCountQuery($query);
            $count_result = $adb->query($count_query);
            if ($adb->num_rows($count_result) > 0) {
                $noofrows = $adb->query_result($count_result, 0, "count");
            } else {
                $noofrows = $adb->num_rows($count_result);
            }
        }
    } else {
        $noofrows = null;
    }
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    global $relationId;
    $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
    $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
    $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    /* Save the related list in session for when we click in a register
     * from this list we will can navigate with the arrows left and right, to move only in this related list
     */
    $relcv = new CustomView();
    $relviewId = $relcv->getViewId($relatedmodule);
    ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId);
    $_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start;
    //Retreive the List View Table Header
    $id = vtlib_purify($_REQUEST['record']);
    $listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions);
    //"Accounts");
    if ($noofrows > 15) {
        $smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
        $smarty->assign('SCROLLSTOP', '</div>');
    }
    $smarty->assign("LISTHEADER", $listview_header);
    if ($module == 'PriceBook' && $relatedmodule == 'Products') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    if ($module == 'Products' && $relatedmodule == 'PriceBooks') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions);
    } elseif ($relatedmodule == 'SalesOrder') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions);
    } else {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    $navigationOutput = array();
    $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
    if (empty($id) && !empty($_REQUEST['record'])) {
        $id = vtlib_purify($_REQUEST['record']);
    }
    $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id);
    $related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
    $log->debug("Exiting GetRelatedList method ...");
    return $related_entries;
}
开发者ID:kikojover,项目名称:corebos,代码行数:101,代码来源:RelatedListView.php

示例6: getListViewEntries

 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel)
 {
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $queryGenerator = $this->get('query_generator');
     $listViewContoller = $this->get('listview_controller');
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->addWhereField($orderByFieldName);
             //$queryGenerator->whereFields[] = $orderByFieldName;
         }
     }
     //To combine date and time fields for sorting
     if ($orderBy == 'date_start') {
         $orderBy = "str_to_date(concat(date_start,time_start),'%Y-%m-%d %H:%i:%s')";
     } else {
         if ($orderBy == 'due_date') {
             $orderBy = "str_to_date(concat(due_date,time_end),'%Y-%m-%d %H:%i:%s')";
         }
     }
     $listQuery = $this->getQuery();
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     $listQueryWithNoLimit = $listQuery;
     $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     $listResult = $db->pquery($listQuery, array());
     $listViewRecordModels = array();
     $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
     $pagingModel->calculatePageRange($listViewEntries);
     if ($db->num_rows($listResult) > $pageLimit) {
         array_pop($listViewEntries);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     $index = 0;
     foreach ($listViewEntries as $recordId => $record) {
         $rawData = $db->query_result_rowdata($listResult, $index++);
         $record['id'] = $recordId;
         $listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record, $rawData);
     }
//.........这里部分代码省略.........
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:101,代码来源:ListView.php

示例7: array_merge

    $smarty->assign("NO_FOLDERS", "yes");
}
$smarty->assign("NO_OF_FOLDERS", $foldercount);
$smarty->assign("FOLDERS", $folders);
$smarty->assign("EMPTY_FOLDERS", $emptyfolders);
$smarty->assign("ALL_FOLDERS", array_merge($folders, $emptyfolders));
//Added to select Multiple records in multiple pages
$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
$alphabetical = AlphabeticalSearch($currentModule, 'index', 'notes_title', 'true', 'basic', "", "", "", "", $viewid);
$fieldnames = $controller->getAdvancedSearchOptionString();
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
$smarty->assign("ALPHABETICAL", $alphabetical);
$smarty->assign("NAVIGATION", $navigationOutput);
$smarty->assign("RECORD_COUNTS", $record_string);
$smarty->assign("IS_ADMIN", $current_user->is_admin);
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
ListViewSession::setSessionQuery($currentModule, $focus->query, $viewid);
// Gather the custom link information to display
include_once 'vtlib/Vtiger/Link.php';
$customlink_params = array('MODULE' => $currentModule, 'ACTION' => vtlib_purify($_REQUEST['action']), 'CATEGORY' => $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), array('LISTVIEWBASIC', 'LISTVIEW'), $customlink_params));
// END
if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '' || $_REQUEST['mode'] == 'ajax') {
    $smarty->display("DocumentsListViewEntries.tpl");
} else {
    $smarty->display("DocumentsListView.tpl");
}
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:ListView.php

示例8: getListViewEntries


//.........这里部分代码省略.........
     //To combine date and time fields for sorting
     if ($orderBy == 'date_start') {
         $orderBy = "str_to_date(concat(date_start,time_start),'%Y-%m-%d %H:%i:%s')";
     } else {
         if ($orderBy == 'due_date') {
             $orderBy = "str_to_date(concat(due_date,time_end),'%Y-%m-%d %H:%i:%s')";
         }
     }
     $listQuery = $this->getQuery();
     if ($searchResult && $searchResult != '' && is_array($searchResult)) {
         $listQuery .= " AND vtiger_crmentity.crmid IN (" . implode(', ', $searchResult) . ") ";
     }
     unset($searchResult);
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(', ', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     if (empty($viewid)) {
         $viewid = $pagingModel->get('viewid');
     }
     $_SESSION['lvs'][$moduleName][$viewid]['start'] = $pagingModel->get('page');
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     $listQueryWithNoLimit = $listQuery;
     $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     $listResult = $db->pquery($listQuery, array());
     $listViewRecordModels = array();
     $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
     $pagingModel->calculatePageRange($listViewEntries);
     if ($db->num_rows($listResult) > $pageLimit) {
         array_pop($listViewEntries);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     $groupsIds = Vtiger_Util_Helper::getGroupsIdsForUsers($currentUser->getId());
     $index = 0;
     foreach ($listViewEntries as $recordId => $record) {
         $rawData = $db->query_result_rowdata($listResult, $index++);
         $visibleFields = array('activitytype', 'date_start', 'due_date', 'assigned_user_id', 'visibility', 'smownerid');
         $ownerId = $rawData['smownerid'];
         $visibility = true;
         if (in_array($ownerId, $groupsIds)) {
             $visibility = false;
         } else {
             if ($ownerId == $currentUser->getId()) {
                 $visibility = false;
             }
         }
         if (!$currentUser->isAdminUser() && $rawData['activitytype'] != 'Task' && $rawData['visibility'] == 'Private' && $ownerId && $visibility) {
             foreach ($record as $data => $value) {
                 if (in_array($data, $visibleFields) != -1) {
                     unset($rawData[$data]);
                     unset($record[$data]);
                 }
             }
             $record['subject'] = vtranslate('Busy', 'Events') . '*';
         }
         if ($record['activitytype'] == 'Task') {
             unset($record['visibility']);
             unset($rawData['visibility']);
         }
         $record['id'] = $recordId;
         $listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record, $rawData);
         $listViewRecordModels[$recordId]->lockEditView = Users_Privileges_Model::checkLockEdit($moduleName, $recordId);
         $listViewRecordModels[$recordId]->isPermittedToEditView = Users_Privileges_Model::isPermitted($moduleName, 'EditView  ', $recordId);
         $listViewRecordModels[$recordId]->colorList = Settings_DataAccess_Module_Model::executeColorListHandlers($moduleName, $recordId, $listViewRecordModels[$recordId]);
     }
     return $listViewRecordModels;
 }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:101,代码来源:ListView.php

示例9: getListViewEntries

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

示例10: getListViewEntries

 /**
  * Function to get the list view entries
  * @param Vtiger_Paging_Model $pagingModel
  * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
  */
 public function getListViewEntries($pagingModel)
 {
     global $current_user;
     $db = PearDatabase::getInstance();
     $moduleName = $this->getModule()->get('name');
     $moduleFocus = CRMEntity::getInstance($moduleName);
     $moduleModel = Vtiger_Module_Model::getInstance($moduleName);
     $queryGenerator = $this->get('query_generator');
     $listViewContoller = $this->get('listview_controller');
     $searchKey = $this->get('search_key');
     $searchValue = $this->get('search_value');
     $operator = $this->get('operator');
     if (!empty($searchKey)) {
         $queryGenerator->addUserSearchConditions(array('search_field' => $searchKey, 'search_text' => $searchValue, 'operator' => $operator));
     }
     $orderBy = $this->getForSql('orderby');
     $sortOrder = $this->getForSql('sortorder');
     //List view will be displayed on recently created/modified records
     if (empty($orderBy) && empty($sortOrder) && $moduleName != "Users") {
         $orderBy = 'modifiedtime';
         $orderBy = 'createdtime';
         $sortOrder = 'DESC';
     }
     if (!empty($orderBy)) {
         $columnFieldMapping = $moduleModel->getColumnFieldMapping();
         $orderByFieldName = $columnFieldMapping[$orderBy];
         $orderByFieldModel = $moduleModel->getField($orderByFieldName);
         if ($orderByFieldModel && $orderByFieldModel->getFieldDataType() == Vtiger_Field_Model::REFERENCE_TYPE) {
             //IF it is reference add it in the where fields so that from clause will be having join of the table
             $queryGenerator = $this->get('query_generator');
             $queryGenerator->addWhereField($orderByFieldName);
             //$queryGenerator->whereFields[] = $orderByFieldName;
         }
     }
     $listQuery = $this->getQuery();
     $sourceModule = $this->get('src_module');
     if (!empty($sourceModule)) {
         if (method_exists($moduleModel, 'getQueryByModuleField')) {
             $overrideQuery = $moduleModel->getQueryByModuleField($sourceModule, $this->get('src_field'), $this->get('src_record'), $listQuery);
             if (!empty($overrideQuery)) {
                 $listQuery = $overrideQuery;
             }
         }
     }
     $startIndex = $pagingModel->getStartIndex();
     $pageLimit = $pagingModel->getPageLimit();
     //Modified by jmangarret 16jun2015
     if ($current_user->roleid == "H9") {
         $listQuery .= ' AND smownerid=' . $current_user->id;
     }
     //Modified by jmangarret 13ene2016 popUP seleccionar localizadores desde Registro de Ventas
     if ($moduleName == "Localizadores" && $sourceModule == "RegistroDeVentas") {
         $listQuery .= ' AND vtiger_localizadores.procesado=0';
     }
     //Modified by jmangarret 03feb2016 popUP seleccionar cuentas desde Comsiones Satelites
     if ($moduleName == "Accounts" && $sourceModule == "ComisionSatelites") {
         $listQuery .= ' AND vtiger_account.account_type="Satelite"';
     }
     if (!empty($orderBy)) {
         if ($orderByFieldModel && $orderByFieldModel->isReferenceField()) {
             $referenceModules = $orderByFieldModel->getReferenceList();
             $referenceNameFieldOrderBy = array();
             foreach ($referenceModules as $referenceModuleName) {
                 $referenceModuleModel = Vtiger_Module_Model::getInstance($referenceModuleName);
                 $referenceNameFields = $referenceModuleModel->getNameFields();
                 $columnList = array();
                 foreach ($referenceNameFields as $nameField) {
                     $fieldModel = $referenceModuleModel->getField($nameField);
                     $columnList[] = $fieldModel->get('table') . $orderByFieldModel->getName() . '.' . $fieldModel->get('column');
                 }
                 if (count($columnList) > 1) {
                     $referenceNameFieldOrderBy[] = getSqlForNameInDisplayFormat(array('first_name' => $columnList[0], 'last_name' => $columnList[1]), 'Users') . ' ' . $sortOrder;
                 } else {
                     $referenceNameFieldOrderBy[] = implode('', $columnList) . ' ' . $sortOrder;
                 }
             }
             $listQuery .= ' ORDER BY ' . implode(',', $referenceNameFieldOrderBy);
         } else {
             $listQuery .= ' ORDER BY ' . $orderBy . ' ' . $sortOrder;
         }
     }
     $viewid = ListViewSession::getCurrentView($moduleName);
     ListViewSession::setSessionQuery($moduleName, $listQuery, $viewid);
     $listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
     $listResult = $db->pquery($listQuery, array());
     $listViewRecordModels = array();
     $listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
     $pagingModel->calculatePageRange($listViewEntries);
     if ($db->num_rows($listResult) > $pageLimit) {
         array_pop($listViewEntries);
         $pagingModel->set('nextPageExists', true);
     } else {
         $pagingModel->set('nextPageExists', false);
     }
     $index = 0;
//.........这里部分代码省略.........
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:101,代码来源:ListView.php


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