本文整理汇总了PHP中AppConfig::performance方法的典型用法代码示例。如果您正苦于以下问题:PHP AppConfig::performance方法的具体用法?PHP AppConfig::performance怎么用?PHP AppConfig::performance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppConfig
的用法示例。
在下文中一共展示了AppConfig::performance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrderBy
function getOrderBy()
{
$currentModule = vglobal('currentModule');
$use_default_order_by = '';
if (AppConfig::performance('LISTVIEW_DEFAULT_SORTING', true)) {
$use_default_order_by = $this->default_order_by;
}
$orderby = $use_default_order_by;
if ($_REQUEST['order_by']) {
$orderby = $this->db->sql_escape_string($_REQUEST['order_by']);
} else {
if ($_SESSION[$currentModule . '_Order_By']) {
$orderby = $_SESSION[$currentModule . '_Order_By'];
}
}
return $orderby;
}
示例2: load
public static function load($key, $config)
{
switch ($key) {
case 'debug':
self::$debug = $config;
break;
case 'developer':
self::$developer = $config;
break;
case 'security':
self::$security = $config;
break;
case 'securityKeys':
self::$securityKeys = $config;
break;
case 'performance':
self::$performance = $config;
break;
case 'relation':
self::$relation = $config;
break;
}
}
示例3: 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 (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);
$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 (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
$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());
$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'));
return $viewer->view('EmailRelatedList.tpl', $moduleName, 'true');
}
示例4: getOrderBy
/**
* Function to get order by
* return string $order_by - fieldname(eg: 'subject')
*/
function getOrderBy()
{
$log = vglobal('log');
$log->debug("Entering getOrderBy() method ...");
$use_default_order_by = '';
if (AppConfig::performance('LISTVIEW_DEFAULT_SORTING', true)) {
$use_default_order_by = $this->default_order_by;
}
if (isset($_REQUEST['order_by'])) {
$order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
} else {
$order_by = $_SESSION['USERS_ORDER_BY'] != '' ? $_SESSION['USERS_ORDER_BY'] : $use_default_order_by;
}
$log->debug("Exiting getOrderBy method ...");
return $order_by;
}
示例5: executeCron
public function executeCron($who_trigger)
{
$log = vglobal('log');
$log->debug('Start executeCron');
$row = self::getActiveScan();
if ($row > 0) {
$log->warn(vtranslate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));
return vtranslate('ERROR_ACTIVE_CRON', 'OSSMailScanner');
}
$OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
$OSSMailScannerModel = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
$countEmails = 0;
$scanId = 0;
$accounts = $OSSMailModel->getAccountsList();
if (!$accounts) {
$log->warn('There are no accounts to be scanned');
return false;
}
self::setCronStatus('2');
$scanId = $OSSMailScannerModel->add_scan_history(array('user' => $who_trigger));
foreach ($OSSMailModel->getAccountsList() as $account) {
$log->debug('Start checking account: ' . $account['username']);
foreach ($OSSMailScannerModel->getConfigFolderList() as $key => $folders) {
if ($folders != null) {
$folderArray = array();
if (strpos($folders, ',')) {
$folderArray = explode(",", $folders);
} else {
$folderArray[0] = $folders;
}
foreach ($folderArray as $folder) {
$log->debug('Start checking folder: ' . $folder);
$mbox = $OSSMailModel->imapConnect($account['username'], $account['password'], $account['mail_host'], $folder, false);
if (!$mbox) {
$log->fatal('Incorrect mail access data: ' . $account['username']);
continue;
}
$countEmails = $OSSMailScannerModel->mail_Scan($mbox, $account, $folder, $scanId, $countEmails);
imap_close($mbox);
if ($countEmails >= AppConfig::performance('NUMBERS_EMAILS_DOWNLOADED_DURING_ONE_SCANNING')) {
$log->warn('Reached the maximum number of scanned mails');
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
return 'ok';
}
}
}
}
}
$OSSMailScannerModel->update_scan_history($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);
self::setCronStatus('1');
$log->debug('End executeCron');
return 'ok';
}
示例6: initializeListViewContents
//.........这里部分代码省略.........
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (!empty($relatedParentModule) && !empty($relatedParentId)) {
$this->listViewHeaders = $listViewModel->getHeaders();
$models = $listViewModel->getEntries($pagingModel);
$noOfEntries = count($models);
foreach ($models as $recordId => $recordModel) {
foreach ($this->listViewHeaders as $fieldName => $fieldModel) {
$recordModel->set($fieldName, $recordModel->getDisplayValue($fieldName));
}
$models[$recordId] = $recordModel;
}
$this->listViewEntries = $models;
if (count($this->listViewEntries) > 0) {
$parent_related_records = true;
}
} else {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
// If there are no related records with parent module then, we should show all the records
if (!$parent_related_records && !empty($relatedParentModule) && !empty($relatedParentId)) {
$relatedParentModule = null;
$relatedParentId = null;
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName, $sourceModule);
$listViewModel->set('search_params', $transformedSearchParams);
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);
}
$this->listViewHeaders = $listViewModel->getListViewHeaders();
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
// End
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RELATED_MODULE', $moduleName);
$viewer->assign('MODULE_NAME', $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('POPUPTYPE', vglobal('popupType'));
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$totalCount = $this->listViewCount;
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
}
$viewer->assign('PAGE_COUNT', $pageCount);
$viewer->assign('LISTVIEW_COUNT', $totalCount);
}
$viewer->assign('MULTI_SELECT', $multiSelectMode);
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('SEARCH_DETAILS', $searchParmams);
}
示例7: getPriceBookRelatedServices
/** Function to display the Services which are related to the PriceBook
* @param string $query - query to get the list of products which are related to the current PriceBook
* @param object $focus - PriceBook object which contains all the information of the current PriceBook
* @param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
* return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Service entries
*/
function getPriceBookRelatedServices($query, $focus, $returnset = '')
{
$log = vglobal('log');
$log->debug("Entering getPriceBookRelatedServices(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
$adb = PearDatabase::getInstance();
global $app_strings;
$current_user = vglobal('current_user');
$current_language = vglobal('current_language');
$current_module_strings = return_module_language($current_language, 'Services');
$no_of_decimal_places = getCurrencyDecimalPlaces();
global $list_max_entries_per_page;
global $urlPrefix;
global $theme;
$pricebook_id = $_REQUEST['record'];
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$computeCount = $_REQUEST['withCount'];
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT') === true || (bool) $computeCount == true) {
$noofrows = $adb->query_result($adb->query(Vtiger_Functions::mkCountQuery($query)), 0, 'count');
} else {
$noofrows = null;
}
$module = 'PriceBooks';
$relatedmodule = 'Services';
if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
$modObj = new ListViewSession();
$modObj->sortby = $focus->default_order_by;
$modObj->sorder = $focus->default_sort_order;
$_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
}
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;
if ($adb->isPostgres()) {
$list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
} else {
$list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
}
$header = array();
$header[] = $current_module_strings['LBL_LIST_SERVICE_NAME'];
if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
$header[] = $current_module_strings['LBL_SERVICE_UNIT_PRICE'];
}
$header[] = $current_module_strings['LBL_PB_LIST_PRICE'];
if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
$header[] = $app_strings['LBL_ACTION'];
}
$currency_id = $focus->column_fields['currency_id'];
$numRows = $adb->num_rows($list_result);
for ($i = 0; $i < $numRows; $i++) {
$entity_id = $adb->query_result($list_result, $i, "crmid");
$unit_price = $adb->query_result($list_result, $i, "unit_price");
if ($currency_id != null) {
$prod_prices = getPricesForProducts($currency_id, array($entity_id), 'Services');
$unit_price = $prod_prices[$entity_id];
}
$listprice = $adb->query_result($list_result, $i, "listprice");
$field_name = $entity_id . "_listprice";
$entries = array();
$entries[] = textlength_check($adb->query_result($list_result, $i, "servicename"));
if (getFieldVisibilityPermission('Services', $current_user->id, 'unit_price') == '0') {
$entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
}
$entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
$action = "";
if (isPermitted("PriceBooks", "EditView", "") == 'yes' && isPermitted('Services', 'EditView', $entity_id) == 'yes') {
$action .= '<img style="cursor:pointer;" src="themes/images/editfield.gif" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . number_format($listprice, $no_of_decimal_places, '.', '') . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
} else {
$action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
}
if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Services', 'Delete', $entity_id) == 'yes') {
if ($action != "") {
$action .= ' | ';
}
$action .= '<img src="themes/images/delete.gif" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
}
if ($action != "") {
$entries[] = $action;
}
$entries_list[] = $entries;
}
$navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
$navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, '', $module, $relatedmodule, $focus->id);
$return_data = array('header' => $header, 'entries' => $entries_list, 'navigation' => $navigationOutput);
$log->debug("Exiting getPriceBookRelatedServices method ...");
return $return_data;
}
示例8: initializeListViewContents
//.........这里部分代码省略.........
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
$searchParmams = $request->get('search_params');
if (empty($searchParmams)) {
$searchParmams = array();
}
$transformedSearchParams = Vtiger_Util_Helper::transferListSearchParamsToFilterCondition($searchParmams, $moduleModel);
$listViewModel->set('search_params', $transformedSearchParams);
//To make smarty to get the details easily accesible
foreach ($searchParmams as $fieldListGroup) {
foreach ($fieldListGroup as $fieldSearchInfo) {
$fieldSearchInfo['searchValue'] = $fieldSearchInfo[2];
$fieldSearchInfo['fieldName'] = $fieldName = $fieldSearchInfo[0];
$searchParmams[$fieldName] = $fieldSearchInfo;
}
}
if (Settings_SalesProcesses_Module_Model::checkRelatedToPotentialsLimit() && Settings_SalesProcesses_Module_Model::isLimitForModule($sourceModule)) {
if ($potentialId == '') {
$potentialId = -1;
}
$listViewModel->set('potential_id', $potentialId);
$viewer->assign('INVENTORY_LIMITED_FROM_POTENTIALS', true);
}
$productModel = Vtiger_Module_Model::getInstance('Products');
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries && $productModel->isActive()) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
if (!$productModel->isActive()) {
$this->listViewEntries = array();
$viewer->assign('LBL_MODULE_DISABLED', true);
}
foreach ($this->listViewEntries as $key => $listViewEntry) {
$productId = $listViewEntry->getId();
$subProducts = $listViewModel->getSubProducts($productId);
if ($subProducts) {
$listViewEntry->set('subProducts', $subProducts);
}
}
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('RELATED_MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('POPUPTYPE', vglobal('popupType'));
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$totalCount = $this->listViewCount;
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
}
$viewer->assign('PAGE_COUNT', $pageCount);
$viewer->assign('LISTVIEW_COUNT', $totalCount);
}
$viewer->assign('MULTI_SELECT', $multiSelectMode);
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('TARGET_MODULE', $moduleName);
$viewer->assign('MODULE', $request->getModule());
$viewer->assign('GETURL', 'getTaxesURL');
$viewer->assign('VIEW', 'ProductsPopup');
$viewer->assign('SEARCH_DETAILS', $searchParmams);
}
示例9: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->getModule();
$cvId = $request->get('viewname');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$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($pageNumber)) {
$pageNumber = '1';
}
$listViewModel = EmailTemplates_ListView_Model::getInstance($moduleName, $cvId);
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'), 'CVID' => $cvId);
$linkModels = $listViewModel->getListViewMassActions($linkParams);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$operator = $request->get('operator');
if (!empty($operator)) {
$listViewModel->set('operator', $operator);
$viewer->assign('OPERATOR', $operator);
$viewer->assign('ALPHABET_VALUE', $searchValue);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('VIEWID', $cvId);
$viewer->assign('MODULE', $moduleName);
if (!$this->listViewLinks) {
$this->listViewLinks = $listViewModel->getListViewLinks($linkParams);
}
$viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
$viewer->assign('LISTVIEW_MASSACTIONS', $linkModels['LISTVIEWMASSACTION']);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$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('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$viewer->assign('LISTVIEW_COUNT', $this->listViewCount);
}
$viewer->assign('IS_MODULE_EDITABLE', $listViewModel->getModule()->isPermitted('EditView'));
$viewer->assign('IS_MODULE_DELETABLE', $listViewModel->getModule()->isPermitted('Delete'));
}
示例10: getSearchResult
/**
* Static Function to get the list of records matching the search key
* @param <String> $searchKey
* @return <Array> - List of Vtiger_Record_Model or Module Specific Record Model instances
*/
public static function getSearchResult($searchKey, $module = false, $limit = false)
{
$db = PearDatabase::getInstance();
$params = ["%{$searchKey}%"];
$sortColumns = $join = $where = '';
if ($module !== false) {
$where .= ' AND vtiger_crmentity.setype = ?';
$params[] = $module;
} else {
$join = 'INNER JOIN vtiger_entityname ON vtiger_crmentity.setype = vtiger_entityname.modulename';
$where .= ' AND vtiger_entityname.turn_off = ?';
$sortColumns .= 'vtiger_entityname.sequence ASC,';
$params[] = 1;
}
if (AppConfig::performance('SORT_SEARCH_RESULTS')) {
$sortColumns .= 'vtiger_crmentity.label ASC,';
}
$query = 'SELECT label, searchlabel, crmid, setype, createdtime, smownerid FROM vtiger_crmentity ' . $join . ' WHERE vtiger_crmentity.searchlabel LIKE ? AND vtiger_crmentity.deleted = 0' . $where;
if (!empty($sortColumns)) {
$query .= ' ORDER BY ' . $sortColumns;
$query = rtrim($query, ',');
}
$result = $db->pquery($query, $params);
$noOfRows = $db->num_rows($result);
$moduleModels = $matchingRecords = $leadIdsList = array();
for ($i = 0; $i < $noOfRows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
if ($row['setype'] === 'Leads') {
$leadIdsList[] = $row['crmid'];
}
}
$convertedInfo = Leads_Module_Model::getConvertedInfo($leadIdsList);
$user = Users_Record_Model::getCurrentUserModel();
$roleInstance = Settings_Roles_Record_Model::getInstanceById($user->get('roleid'));
$searchunpriv = $roleInstance->get('searchunpriv');
for ($i = 0, $recordsCount = 0; $i < $noOfRows && $recordsCount < vglobal('max_number_search_result'); ++$i) {
$row = $db->query_result_rowdata($result, $i);
if ($row['setype'] === 'Leads' && $convertedInfo[$row['crmid']]) {
continue;
}
$recordPermitted = $permitted = Users_Privileges_Model::isPermitted($row['setype'], 'DetailView', $row['crmid']);
if (!empty($searchunpriv)) {
if (in_array($row['setype'], explode(',', $searchunpriv))) {
$recordPermitted = true;
}
}
if ($recordPermitted) {
$row['id'] = $row['crmid'];
$row['permitted'] = $permitted;
$moduleName = $row['setype'];
if (!array_key_exists($moduleName, $moduleModels)) {
$moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
}
$moduleModel = $moduleModels[$moduleName];
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
$recordInstance = new $modelClassName();
$matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
$recordsCount++;
}
if ($limit && $limit == $recordsCount) {
return $matchingRecords;
}
}
return $matchingRecords;
}
示例11: process
function process(Vtiger_Request $request)
{
$targetModuleName = $request->getModule();
if ($targetModuleName == 'Assets' || $targetModuleName == 'Accounts' || $targetModuleName == 'Contacts' || $targetModuleName == 'Leads' || $targetModuleName == 'Products' || $targetModuleName == 'Services' || $targetModuleName == 'HelpDesk' || $targetModuleName == 'Vendors') {
$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);
$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 (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
$totalCount = $relationListView->getRelatedEntriesCount();
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
$viewer->assign('PAGE_COUNT', $pageCount);
$viewer->assign('TOTAL_ENTRIES', $totalCount);
$viewer->assign('PERFORMANCE', true);
}
$viewer->assign('SOURCEMODULE', $relatedModuleName);
$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('VIEW', $request->get('view'));
$record = $request->get('record');
$view = $request->get('view');
// check if passwords are encrypted
if (file_exists('modules/OSSPasswords/config.ini')) {
// encryption key exists so passwords are encrypted
$config = parse_ini_file('modules/OSSPasswords/config.ini');
// let smarty know that passwords are encrypted
$viewer->assign('ENCRYPTED', true);
$viewer->assign('ENC_KEY', $config['key']);
$viewer->assign('RECORD', $record);
$viewer->assign('VIEW', $view);
} else {
$viewer->assign('ENCRYPTED', false);
$viewer->assign('ENC_KEY', '');
$viewer->assign('RECORD', $record);
$viewer->assign('VIEW', $view);
}
return $viewer->view('ViewRelatedList.tpl', 'OSSPasswords', 'true');
} else {
return parent::process($request);
}
}
示例12: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
//src_module value is added to just to stop showing inactive products
$request->set('src_module', $request->getModule());
$moduleName = $this->getModule($request);
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
// To handle subproducts in popup view
$subProductsPopup = $request->get('subProductsPopup');
$parentProductId = $request->get('productid');
//Check whether the request is in multi select mode
$multiSelectMode = $request->get('multi_select');
if (empty($multiSelectMode)) {
$multiSelectMode = false;
}
if (empty($cvId)) {
$cvId = '0';
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$orderBy = $moduleInstance->default_order_by;
$sortOrder = $moduleInstance->default_sort_order;
}
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if (!empty($searchKey) && !empty($searchValue)) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if ($subProductsPopup && $parentProductId) {
$listViewModel->set('subProductsPopup', true);
$listViewModel->set('productId', $parentProductId);
$viewer->assign('SUBPRODUCTS_POPUP', $subProductsPopup);
$viewer->assign('PARENT_PRODUCT_ID', $parentProductId);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
if (empty($sortOrder)) {
$sortOrder = "ASC";
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY', $orderBy);
$viewer->assign('SORT_ORDER', $sortOrder);
$viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
$viewer->assign('SORT_IMAGE', $sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$totalCount = $this->listViewCount;
//.........这里部分代码省略.........
示例13: process
function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$folders = $moduleModel->getFolders();
$folderId = $request->get('viewname');
if (empty($folderId) || $folderId == 'undefined') {
$folderId = 'All';
}
$pageNumber = $request->get('page');
$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";
}
$listViewModel = new Reports_ListView_Model();
$listViewModel->set('module', $moduleModel);
$listViewModel->set('folderid', $folderId);
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
$listViewMassActionModels = $listViewModel->getListViewMassActions();
if (empty($pageNumber)) {
$pageNumber = '1';
}
$viewer->assign('MODULE', $moduleName);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('LISTVIEW_MASSACTIONS', $listViewMassActionModels);
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if ($folderId == 'All') {
$this->listViewHeaders['foldername'] = 'LBL_FOLDER_NAME';
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$noOfEntries = count($this->listViewEntries);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('VIEWNAME', $folderId);
$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);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT')) {
if (!$this->listViewCount) {
$this->listViewCount = $listViewModel->getListViewCount();
}
$totalCount = $this->listViewCount;
$pageLimit = $pagingModel->getPageLimit();
$pageCount = ceil((int) $totalCount / (int) $pageLimit);
if ($pageCount == 0) {
$pageCount = 1;
}
$viewer->assign('PAGE_COUNT', $pageCount);
$viewer->assign('LISTVIEW_COUNT', $totalCount);
}
$viewer->view('ListViewContents.tpl', $moduleName);
}
示例14: getRecordRangeMessage
function getRecordRangeMessage($listResult, $limitStartRecord, $totalRows = '')
{
global $adb, $app_strings;
$numRows = $adb->num_rows($listResult);
$recordListRangeMsg = '';
if ($numRows > 0) {
$recordListRangeMsg = $app_strings['LBL_SHOWING'] . ' ' . $app_strings['LBL_RECORDS'] . ' ' . ($limitStartRecord + 1) . ' - ' . ($limitStartRecord + $numRows);
if (AppConfig::performance('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
$recordListRangeMsg .= ' ' . $app_strings['LBL_LIST_OF'] . " {$totalRows}";
}
}
return $recordListRangeMsg;
}
示例15: get_user_array
function get_user_array($add_blank = true, $status = 'Active', $assigned_user = '', $private = '', $module = false)
{
$log = vglobal('log');
$log->debug('Entering get_user_array(' . $add_blank . ',' . $status . ',' . $assigned_user . ',' . $private . ') method ...');
$current_user = vglobal('current_user');
if (isset($current_user) && $current_user->id != '') {
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
}
static $user_array = null;
if (!$module) {
$module = $_REQUEST['module'];
}
if ($user_array == null) {
require_once 'include/database/PearDatabase.php';
$db = PearDatabase::getInstance();
$temp_result = array();
// Including deleted vtiger_users for now.
if (empty($status)) {
$query = 'SELECT id, user_name, is_admin from vtiger_users';
$params = array();
} else {
if ($private == 'private') {
$log->debug('Sharing is Private. Only the current user should be listed');
$query = "select id as id,user_name as user_name,first_name,last_name,is_admin from vtiger_users where id=? and status='Active' union select vtiger_user2role.userid as id,vtiger_users.user_name as user_name ,\n\t\t\t\t\t\t\t vtiger_users.first_name as first_name ,vtiger_users.last_name as last_name, is_admin \n\t\t\t\t\t\t\t from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like ? and status='Active' union\n\t\t\t\t\t\t\t select shareduserid as id,vtiger_users.user_name as user_name ,\n\t\t\t\t\t\t\t vtiger_users.first_name as first_name ,vtiger_users.last_name as last_name, is_admin from vtiger_tmp_write_user_sharing_per inner join vtiger_users on vtiger_users.id=vtiger_tmp_write_user_sharing_per.shareduserid where status='Active' and vtiger_tmp_write_user_sharing_per.userid=? and vtiger_tmp_write_user_sharing_per.tabid=?";
$params = array($current_user->id, $current_user_parent_role_seq . "::%", $current_user->id, getTabid($module));
} else {
$log->debug('Sharing is Public. All vtiger_users should be listed');
$query = 'SELECT id, user_name,first_name,last_name,is_admin from vtiger_users WHERE status=?';
$params = array($status);
}
}
if (!empty($assigned_user)) {
$query .= ' OR id=?';
array_push($params, $assigned_user);
}
$query .= ' ORDER BY last_name ASC, first_name ASC';
$result = $db->pquery($query, $params, true, 'Error filling in user array: ');
if ($add_blank == true) {
// Add in a blank row
$temp_result[''] = '';
}
// Get the id and the name.
while ($row = $db->fetchByAssoc($result)) {
if ($current_user->is_admin == 'on' || !(!AppConfig::performance('SHOW_ADMINISTRATORS_IN_USERS_LIST') && $row['is_admin'] == 'on')) {
$temp_result[$row['id']] = getFullNameFromArray('Users', $row);
}
}
$user_array =& $temp_result;
}
$log->debug('Exiting get_user_array method ...');
return $user_array;
}