本文整理汇总了PHP中PerformancePrefs类的典型用法代码示例。如果您正苦于以下问题:PHP PerformancePrefs类的具体用法?PHP PerformancePrefs怎么用?PHP PerformancePrefs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PerformancePrefs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public static function render($userInputObject, $user)
{
global $list_max_entries_per_page;
$adb = PearDatabase::getInstance();
$viewer = new Import_UI_Viewer();
$ownerId = $userInputObject->get('foruser');
$owner = new Users();
$owner->id = $ownerId;
$owner->retrieve_entity_info($ownerId, 'Users');
if (!is_admin($user) && $user->id != $owner->id) {
$viewer->display('OperationNotPermitted.tpl', 'Vtiger');
exit;
}
$userDBTableName = Import_Utils::getDbTableName($owner);
$moduleName = $userInputObject->get('module');
$moduleMeta = self::getModuleMeta($moduleName, $user);
$result = $adb->query('SELECT recordid FROM ' . $userDBTableName . ' WHERE status is NOT NULL AND recordid IS NOT NULL');
$noOfRecords = $adb->num_rows($result);
$importedRecordIds = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$importedRecordIds[] = $adb->query_result($result, $i, 'recordid');
}
if (count($importedRecordIds) == 0) {
$importedRecordIds[] = 0;
}
$focus = CRMEntity::getInstance($moduleName);
$queryGenerator = new QueryGenerator($moduleName, $user);
$customView = new CustomView($moduleName);
$viewId = $customView->getViewIdByName('All', $moduleName);
$queryGenerator->initForCustomViewById($viewId);
$list_query = $queryGenerator->getQuery();
// Fetch only last imported records
$list_query .= ' AND ' . $focus->table_name . '.' . $focus->table_index . ' IN (' . implode(',', $importedRecordIds) . ')';
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
$count_result = $adb->query(mkCountQuery($list_query));
$noofrows = $adb->query_result($count_result, 0, "count");
} else {
$noofrows = null;
}
$start = ListViewSession::getRequestCurrentPage($moduleName, $list_query, $viewId, false);
$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($list_query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
$viewer->assign('recordListRange', $recordListRangeMsg);
$controller = new ListViewController($adb, $user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus, $moduleName, $url_string, $sorder, $order_by, true);
$listview_entries = $controller->getListViewEntries($focus, $moduleName, $list_result, $navigation_array, true);
$viewer->assign('CURRENT_PAGE', $start);
$viewer->assign('LISTHEADER', $listview_header);
$viewer->assign('LISTENTITY', $listview_entries);
$viewer->assign('FOR_MODULE', $moduleName);
$viewer->assign('FOR_USER', $ownerId);
$isAjax = $userInputObject->get('ajax');
if (!empty($isAjax)) {
echo $viewer->fetch('ListViewEntries.tpl');
} else {
$viewer->display('ImportListView.tpl');
}
}
示例2: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$pageNumber = $request->get('page');
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$pagingModel->set('viewid', $cvId);
$viewer->assign('PAGING_MODEL', $pagingModel);
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
if (!$this->listViewCount) {
$this->listViewCount = $accountListViewModel->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);
}
if (!$this->listViewEntries) {
$this->listViewEntries = $accountListViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
$viewer->view('ListViewActions.tpl', $request->getModule());
}
示例3: getOrderBy
/**
* Function to get order by
* return string $order_by - fieldname(eg: 'campaignname')
*/
function getOrderBy()
{
global $log;
$log->debug("Entering getOrderBy() method ...");
$use_default_order_by = '';
if (PerformancePrefs::getBoolean('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['CAMPAIGN_ORDER_BY'] != '' ? $_SESSION['CAMPAIGN_ORDER_BY'] : $use_default_order_by;
}
$log->debug("Exiting getOrderBy method ...");
return $order_by;
}
示例4: getOrderBy
function getOrderBy()
{
global $currentModule;
$use_default_order_by = '';
if (PerformancePrefs::getBoolean('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;
}
示例5: saveentity
function saveentity($module, $fileid = '')
{
global $current_user, $adb;
//$adb added by raju for mass mailing
$insertion_mode = $this->mode;
$this->db->println("TRANS saveentity starts {$module}");
$this->db->startTransaction();
foreach ($this->tab_name as $table_name) {
if ($table_name == "vtiger_crmentity") {
$this->insertIntoCrmEntity($module, $fileid);
} else {
$this->insertIntoEntityTable($table_name, $module, $fileid);
}
}
//Calling the Module specific save code
$this->save_module($module);
$assigntype = vtlib_purify($_REQUEST['assigntype']);
if (PerformancePrefs::getBoolean('NOTIFY_OWNER_EMAILS', true) === true) {
if ($module != "Calendar" && $module != "Accounts" && $module != "Contacts") {
$this->whomToSendMail($module, $this->mode, $assigntype);
}
}
$this->db->completeTransaction();
$this->db->println("TRANS saveentity ends");
// vtlib customization: Hook provide to enable generic module relation.
// Ticket 6386 fix
global $singlepane_view;
if ($_REQUEST['return_action'] == 'CallRelatedList' || isset($singlepane_view) && $singlepane_view == true && $_REQUEST['return_action'] == 'DetailView' && !empty($_REQUEST['return_module'])) {
$for_module = vtlib_purify($_REQUEST['return_module']);
$for_crmid = vtlib_purify($_REQUEST['return_id']);
$on_focus = CRMEntity::getInstance($for_module);
// Do conditional check && call only for Custom Module at present
// TOOD: $on_focus->IsCustomModule is not required if save_related_module function
// is used for core modules as well.
if ($on_focus->IsCustomModule && method_exists($on_focus, 'save_related_module')) {
$with_module = $module;
$with_crmid = $this->id;
$on_focus->save_related_module($for_module, $for_crmid, $with_module, $with_crmid);
}
}
// END
}
示例6: 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);
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
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);
}
示例7: 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');
}
示例8: 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 (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true) {
$recordListRangeMsg .= ' ' . $app_strings['LBL_LIST_OF'] . " {$totalRows}";
}
}
return $recordListRangeMsg;
}
示例9: PearDatabase
/**
* Constructor
*/
function PearDatabase($dbtype = '', $host = '', $dbname = '', $username = '', $passwd = '')
{
global $currentModule;
$this->log =& LoggerManager::getLogger('PearDatabase_' . $currentModule);
$this->resetSettings($dbtype, $host, $dbname, $username, $passwd);
// Initialize performance parameters
$this->isdb_default_utf8_charset = PerformancePrefs::getBoolean('DB_DEFAULT_CHARSET_UTF8');
$this->enableCache = PerformancePrefs::getBoolean('CACHE_QUERY_RESULT', false);
// END
if (!isset($this->dbType)) {
$this->println("ADODB Connect : DBType not specified");
return;
}
// Initialize the cache object to use.
if (isset($this->enableCache) && $this->enableCache) {
$this->__setCacheInstance(new PearDatabaseCache($this));
}
// END
}
示例10: getListViewEntries2
//.........这里部分代码省略.........
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
}
} elseif ($module == 'Calendar' && ($fieldname != 'taskstatus' && $fieldname != 'eventstatus')) {
if ($activitytype == 'Task') {
if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
} else {
if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
}
} elseif ($module == "Accounting" && $fieldname == "accounting_id") {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
$value = '<a href="index.php?action=DetailView&module=' . $module . '&parenttab=' . $tabname . '&record=' . $entity_id . '">' . $value . '</a>';
} else {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
}
}
// vtlib customization: For listview javascript triggers
$value = "{$value} <span type='vtlib_metainfo' vtrecordid='{$entity_id}' vtfieldname='{$fieldname}' vtmodule='{$module}' style='display:none;'></span>";
// END
if ($module == "Calendar" && $name == $app_strings['Close']) {
if (isPermitted("Calendar", "EditView") == 'yes') {
if (getFieldVisibilityPermission('Events', $current_user->id, 'eventstatus') == '0' || getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
array_push($list_header, $value);
}
}
} else {
$list_header[] = $value;
}
}
}
$varreturnset = '';
if ($returnset == '') {
$varreturnset = '&return_module=' . $module . '&return_action=index';
} else {
$varreturnset = $returnset;
}
if ($module == 'Calendar') {
$actvity_type = $adb->query_result($list_result, $list_result_count, 'activitytype');
if ($actvity_type == 'Task') {
$varreturnset .= '&activity_mode=Task';
} else {
$varreturnset .= '&activity_mode=Events';
}
}
//Added for Actions ie., edit and delete links in listview
$links_info = "";
if (!(is_array($selectedfields) && $selectedfields != '')) {
if (isPermitted($module, "EditView", "") == 'yes') {
$edit_link = getListViewEditLink($module, $entity_id, $relatedlist, $varreturnset, $list_result, $list_result_count);
if (isset($_REQUEST['start']) && $_REQUEST['start'] > 1 && $module != 'Emails') {
$links_info .= "<a href=\"{$edit_link}&start=" . vtlib_purify($_REQUEST['start']) . "\">" . $app_strings["LNK_EDIT"] . "</a> ";
} else {
$links_info .= "<a href=\"{$edit_link}\">" . $app_strings["LNK_EDIT"] . "</a> ";
}
}
if (isPermitted($module, "Delete", "") == 'yes') {
$del_link = getListViewDeleteLink($module, $entity_id, $relatedlist, $varreturnset);
if ($links_info != "" && $del_link != "") {
$links_info .= " | ";
}
if ($del_link != "") {
$links_info .= "<a href='javascript:confirmdelete(\"" . addslashes(urlencode($del_link)) . "\")'>" . $app_strings["LNK_DELETE"] . "</a>";
}
}
}
// Record Change Notification
if (method_exists($focus, 'isViewed') && PerformancePrefs::getBoolean('LISTVIEW_RECORD_CHANGE_INDICATOR', true)) {
if (!$focus->isViewed($entity_id)) {
$links_info .= " | <img src='" . vtiger_imageurl('important1.gif', $theme) . "' border=0>";
}
}
// END
if ($links_info != "" && !$skipActions) {
$list_header[] = $links_info;
}
// $list_block[$entity_id] = $list_header;
if (isset($_SESSION['partialpaymentview']) && $_SESSION['partialpaymentview'] == "true") {
$list_block[$entity_id . "_" . $i] = $list_header;
} else {
$list_block[$entity_id] = $list_header;
}
}
}
$log->debug("Exiting getListViewEntries method ...");
return $list_block;
}
示例11: getOrderByForFolder
/**
* Function used to get the order by value for Documents listview
* @return String order by column for a given folder.
*/
function getOrderByForFolder($folderId)
{
$use_default_order_by = '';
if (PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
$use_default_order_by = $this->default_order_by;
}
if (isset($_REQUEST['order_by']) && $_REQUEST['folderid'] == $folderId) {
$order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
} elseif (is_array($_SESSION['NOTES_FOLDER_ORDER_BY']) && !empty($_SESSION['NOTES_FOLDER_ORDER_BY'][$folderId])) {
$order_by = $_SESSION['NOTES_FOLDER_ORDER_BY'][$folderId];
} else {
$order_by = $use_default_order_by;
}
return $order_by;
}
示例12: 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 = '')
{
global $log;
$log->debug("Entering getPriceBookRelatedServices(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
global $adb;
global $app_strings;
global $current_language, $current_user;
$current_module_strings = return_module_language($current_language, 'Services');
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 (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
$noofrows = $adb->query_result($adb->query(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->dbType == "pgsql") {
$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 . '\',\'' . $listprice . '\')" 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;
}
示例13: getOrderBy
/**
* Function to get order by
* return string $order_by - fieldname(eg: 'accountname')
*/
function getOrderBy()
{
global $log, $currentModule;
$log->debug("Entering getOrderBy() method ...");
$use_default_order_by = '';
if (PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
$use_default_order_by = $this->default_order_by;
}
$order_by = $use_default_order_by;
if (isset($_REQUEST['order_by'])) {
$order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
} else {
if (!empty($_SESSION[$currentModule . '_Order_By'])) {
$order_by = $_SESSION[$currentModule . '_Order_By'];
}
}
$log->debug("Exiting getOrderBy method ...");
return $order_by;
}
示例14: 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($sortOrder == "ASC"){
$nextSortOrder = "DESC";
$sortImage = "icon-chevron-down";
}else{
$nextSortOrder = "ASC";
$sortImage = "icon-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_ENTIRES_COUNT',$noOfEntries);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
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'));
}
示例15: 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 (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
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);
}