本文整理汇总了PHP中ListViewSession类的典型用法代码示例。如果您正苦于以下问题:PHP ListViewSession类的具体用法?PHP ListViewSession怎么用?PHP ListViewSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListViewSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:60,代码来源:Import_ListView_Controller.php
示例2: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$qualifiedModuleName = $request->getModule(false);
$recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
$recordModel->set('posturl', vglobal('site_URL') . 'modules/Webforms/capture.php');
$recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_DETAIL);
$moduleModel = $recordModel->getModule();
$navigationInfo = ListViewSession::getListViewNavigation($recordId);
$viewer = $this->getViewer($request);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('MODULE_NAME', $qualifiedModuleName);
$viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure());
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
$viewer->assign('SOURCE_MODULE', $recordModel->get('targetmodule'));
$viewer->assign('DETAILVIEW_LINKS', $recordModel->getDetailViewLinks());
$viewer->assign('SELECTED_FIELD_MODELS_LIST', $recordModel->getSelectedFieldsList());
$viewer->assign('NO_PAGINATION', true);
$viewer->view('DetailView.tpl', $qualifiedModuleName);
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:21,代码来源:Detail.php
示例3: fixPostgresQuery
//Retreiving the no of rows
$count_result = $adb->query(mkCountQuery($query));
$num_records = $adb->query_result($count_result, 0, "count");
if ($num_records > 0) {
$displayFolder = true;
}
//navigation start
$max_entries_per_page = $list_max_entries_per_page;
//Postgres 8 fixes
if ($adb->dbType == "pgsql") {
$list_query = fixPostgresQuery($query, $log, 0);
}
if ($folder_id == $request_folderid) {
$start[$folder_id] = 1;
if (!empty($_REQUEST['start'])) {
$start[$folder_id] = ListViewSession::getRequestStartPage();
if ($start[$folder_id] == 'last') {
if ($num_records > 0) {
$start[$folder_id] = ceil($num_records / $max_entries_per_page);
}
}
if (!is_numeric($start[$folder_id])) {
$start[$folder_id] = 1;
}
}
}
$navigation_array = VT_getSimpleNavigationValues($start[$folder_id], $max_entries_per_page, $num_records);
if ($folder_id == $request_folderid) {
if (!is_array($_SESSION['lvs'][$currentModule]['start'])) {
$_SESSION['lvs'][$currentModule]['start'] = array();
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:31,代码来源:ListView.php
示例4: 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
示例5: Emails
global $app_strings;
global $mod_strings;
global $list_max_entries_per_page, $adb;
$log = LoggerManager::getLogger('email_list');
global $currentModule;
global $image_path;
global $theme;
$url_string = '';
// assigning http url string
$focus = new Emails();
// Initialize sort by fields
$focus->initSortbyField('Emails');
// END
$smarty = new vtigerCRM_Smarty();
$other_text = array();
if (ListViewSession::hasViewChanged($currentModule, $viewid)) {
$_SESSION['EMAILS_ORDER_BY'] = '';
}
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
if ($_REQUEST['order_by'] != '') {
$order_by = $adb->sql_escape_string($_REQUEST['order_by']);
} else {
$order_by = $_SESSION['EMAILS_ORDER_BY'] != '' ? $_SESSION['EMAILS_ORDER_BY'] : $focus->default_order_by;
}
if ($_REQUEST['sorder'] != '') {
$sorder = $adb->sql_escape_string($_REQUEST['sorder']);
} else {
$sorder = $_SESSION['EMAILS_SORT_ORDER'] != '' ? $_SESSION['EMAILS_SORT_ORDER'] : $focus->default_sort_order;
}
$_SESSION['EMAILS_ORDER_BY'] = $order_by;
$_SESSION['EMAILS_SORT_ORDER'] = $sorder;
开发者ID:hardikk,项目名称:HNH,代码行数:31,代码来源:ListView.php
示例6: 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
示例7: export
/**
* This function exports all the data for a given module
* Param $type - module name
* Return type text
*/
function export($type)
{
global $log, $list_max_entries_per_page;
$log->debug("Entering export(" . $type . ") method ...");
global $adb;
$focus = 0;
$content = '';
if ($type != "") {
// vtlib customization: Hook to dynamically include required module file.
// Refer to the logic in setting $currentModule in index.php
$focus = CRMEntity::getInstance($type);
}
$log = LoggerManager::getLogger('export_' . $type);
$db = PearDatabase::getInstance();
$oCustomView = new CustomView("{$type}");
$viewid = $oCustomView->getViewId("{$type}");
$sorder = $focus->getSortOrder();
$order_by = $focus->getOrderBy();
$search_type = $_REQUEST['search_type'];
$export_data = $_REQUEST['export_data'];
if (isset($_SESSION['export_where']) && $_SESSION['export_where'] != '' && $search_type == 'includesearch') {
$where = $_SESSION['export_where'];
}
$query = $focus->create_export_query($where);
if ($search_type != 'includesearch' && $type != 'Calendar') {
$stdfiltersql = $oCustomView->getCVStdFilterSQL($viewid);
$advfiltersql = $oCustomView->getCVAdvFilterSQL($viewid);
if (isset($stdfiltersql) && $stdfiltersql != '') {
$query .= ' and ' . $stdfiltersql;
}
if (isset($advfiltersql) && $advfiltersql != '') {
$query .= ' and ' . $advfiltersql;
}
}
$params = array();
if (($search_type == 'withoutsearch' || $search_type == 'includesearch') && $export_data == 'selecteddata') {
$idstring = explode(";", $_REQUEST['idstring']);
if ($type == 'Accounts' && count($idstring) > 0) {
$query .= ' and vtiger_account.accountid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Contacts' && count($idstring) > 0) {
$query .= ' and vtiger_contactdetails.contactid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Potentials' && count($idstring) > 0) {
$query .= ' and vtiger_potential.potentialid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Leads' && count($idstring) > 0) {
$query .= ' and vtiger_leaddetails.leadid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Products' && count($idstring) > 0) {
$query .= ' and vtiger_products.productid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Documents' && count($idstring) > 0) {
$query .= ' and vtiger_notes.notesid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'HelpDesk' && count($idstring) > 0) {
$query .= ' and vtiger_troubletickets.ticketid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} elseif ($type == 'Vendors' && count($idstring) > 0) {
$query .= ' and vtiger_vendor.vendorid in (' . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
} else {
if (count($idstring) > 0) {
// vtlib customization: Hook to make the export feature available for custom modules.
$query .= " and {$focus->table_name}.{$focus->table_index} in (" . generateQuestionMarks($idstring) . ')';
array_push($params, $idstring);
// END
}
}
}
if (isset($order_by) && $order_by != '') {
if ($order_by == 'smownerid') {
$query .= ' ORDER BY user_name ' . $sorder;
} elseif ($order_by == 'lastname' && $type == 'Documents') {
$query .= ' ORDER BY vtiger_contactdetails.lastname ' . $sorder;
} elseif ($order_by == 'crmid' && $type == 'HelpDesk') {
$query .= ' ORDER BY vtiger_troubletickets.ticketid ' . $sorder;
} else {
$tablename = getTableNameForField($type, $order_by);
$tablename = $tablename != '' ? $tablename . "." : '';
if ($adb->dbType == "pgsql") {
$query .= ' GROUP BY ' . $tablename . $order_by;
}
$query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
}
}
if ($export_data == 'currentpage') {
$current_page = ListViewSession::getCurrentPage($type, $viewid);
$limit_start_rec = ($current_page - 1) * $list_max_entries_per_page;
if ($limit_start_rec < 0) {
$limit_start_rec = 0;
}
$query .= ' LIMIT ' . $limit_start_rec . ',' . $list_max_entries_per_page;
}
$result = $adb->pquery($query, $params, true, "Error exporting {$type}: " . "<BR>{$query}");
//.........这里部分代码省略.........
开发者ID:nvh3010,项目名称:quancrm,代码行数:101,代码来源:export.php
示例8: getRequestCurrentPage
public static function getRequestCurrentPage($currentModule, $query, $viewid, $queryMode = false)
{
global $list_max_entries_per_page, $adb;
$start = 1;
if (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true' && $_REQUEST['start'] != "last") {
return ListViewSession::getRequestStartPage();
}
if (!empty($_REQUEST['start'])) {
$start = $_REQUEST['start'];
if ($start == 'last') {
$count_result = $adb->query(mkCountQuery($query));
$noofrows = $adb->query_result($count_result, 0, "count");
if ($noofrows > 0) {
$start = ceil($noofrows / $list_max_entries_per_page);
}
}
if (!is_numeric($start)) {
$start = 1;
} elseif ($start < 1) {
$start = 1;
}
$start = ceil($start);
} else {
if (!empty($_SESSION['lvs'][$currentModule][$viewid]['start'])) {
$start = $_SESSION['lvs'][$currentModule][$viewid]['start'];
}
}
if (!$queryMode) {
$_SESSION['lvs'][$currentModule][$viewid]['start'] = intval($start);
}
return $start;
}
开发者ID:kduqi,项目名称:corebos,代码行数:32,代码来源:ListViewSession.php
示例9: getDuplicateRecordsArr
/** Function to return the duplicate records data as a formatted array */
function getDuplicateRecordsArr($module)
{
global $adb, $app_strings, $list_max_entries_per_page, $theme;
$field_values_array = getFieldValues($module);
$field_values = $field_values_array['fieldnames_list'];
$fld_arr = $field_values_array['fieldnames_array'];
$col_arr = $field_values_array['columnnames_array'];
$fld_labl_arr = $field_values_array['fieldlabels_array'];
$ui_type = $field_values_array['fieldname_uitype'];
$dup_query = getDuplicateQuery($module, $field_values, $ui_type);
// added for page navigation
$dup_count_query = substr($dup_query, stripos($dup_query, 'FROM'), strlen($dup_query));
$dup_count_query = "SELECT count(*) as count " . $dup_count_query;
$count_res = $adb->query($dup_count_query);
$no_of_rows = $adb->query_result($count_res, 0, "count");
if ($no_of_rows <= $list_max_entries_per_page) {
$_SESSION['dup_nav_start' . $module] = 1;
} else {
if (isset($_REQUEST["start"]) && $_REQUEST["start"] != "" && $_SESSION['dup_nav_start' . $module] != $_REQUEST["start"]) {
$_SESSION['dup_nav_start' . $module] = ListViewSession::getRequestStartPage();
}
}
$start = $_SESSION['dup_nav_start' . $module] != "" ? $_SESSION['dup_nav_start' . $module] : 1;
$navigation_array = getNavigationValues($start, $no_of_rows, $list_max_entries_per_page);
$start_rec = $navigation_array['start'];
$end_rec = $navigation_array['end_val'];
$navigationOutput = getTableHeaderNavigation($navigation_array, "", $module, "FindDuplicate", "");
if ($start_rec == 0) {
$limit_start_rec = 0;
} else {
$limit_start_rec = $start_rec - 1;
}
$dup_query .= " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}";
//ends
$nresult = $adb->query($dup_query);
$no_rows = $adb->num_rows($nresult);
require_once 'modules/Vtiger/layout_utils.php';
if ($no_rows == 0) {
if ($_REQUEST['action'] == 'FindDuplicateRecords') {
//echo "<br><br><center>".$app_strings['LBL_NO_DUPLICATE']." <a href='javascript:window.history.back()'>".$app_strings['LBL_GO_BACK'].".</a></center>";
//die;
echo "<link rel='stylesheet' type='text/css' href='themes/{$theme}/style.css'>";
echo "<table border='0' cellpadding='5' cellspacing='0' width='100%' height='450px'><tr><td align='center'>";
echo "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 55%; position: relative; z-index: 10000000;'>\n\n\t\t\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t\t<tbody><tr>\n\t\t\t\t<td rowspan='2' width='11%'><img src='" . vtiger_imageurl('empty.jpg', $theme) . "' ></td>\n\t\t\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='70%'><span class='genHeaderSmall'>{$app_strings['LBL_NO_DUPLICATE']}</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td class='small' align='right' nowrap='nowrap'>\n\t\t\t\t<a href='javascript:window.history.back();'>{$app_strings['LBL_GO_BACK']}</a><br> </td>\n\t\t\t\t</tr>\n\t\t\t\t</tbody></table>\n\t\t\t\t</div>";
echo "</td></tr></table>";
exit;
} else {
echo "<br><br><table align='center' class='reportCreateBottom big' width='95%'><tr><td align='center'>" . $app_strings['LBL_NO_DUPLICATE'] . "</td></tr></table>";
die;
}
}
$rec_cnt = 0;
$temp = array();
$sl_arr = array();
$grp = "group0";
$gcnt = 0;
$ii = 0;
//ii'th record in group
while ($rec_cnt < $no_rows) {
$result = $adb->fetchByAssoc($nresult);
//echo '<pre>';print_r($result);echo '</pre>';
if ($rec_cnt != 0) {
$sl_arr = array_slice($result, 2);
array_walk($temp, 'lower_array');
array_walk($sl_arr, 'lower_array');
$arr_diff = array_diff($temp, $sl_arr);
if (count($arr_diff) > 0) {
$gcnt++;
$temp = $sl_arr;
$ii = 0;
}
$grp = "group" . $gcnt;
}
$fld_values[$grp][$ii]['recordid'] = $result['recordid'];
for ($k = 0; $k < count($col_arr); $k++) {
if ($rec_cnt == 0) {
$temp[$fld_labl_arr[$k]] = $result[$col_arr[$k]];
}
if ($ui_type[$fld_arr[$k]] == 56) {
if ($result[$col_arr[$k]] == 0) {
$result[$col_arr[$k]] = $app_strings['no'];
} else {
$result[$col_arr[$k]] = $app_strings['yes'];
}
}
if ($ui_type[$fld_arr[$k]] == 75 || $ui_type[$fld_arr[$k]] == 81) {
$vendor_id = $result[$col_arr[$k]];
if ($vendor_id != '') {
$vendor_name = getVendorName($vendor_id);
}
$result[$col_arr[$k]] = $vendor_name;
}
if ($ui_type[$fld_arr[$k]] == 57) {
$contact_id = $result[$col_arr[$k]];
if ($contact_id != '') {
$parent_module = 'Contacts';
$displayValueArray = getEntityName($parent_module, $contact_id);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $key => $field_value) {
//.........这里部分代码省略.........
开发者ID:jgjermeni,项目名称:corebos,代码行数:101,代码来源:utils.php
示例10: 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
示例11: 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
示例12: preProcess
function preProcess(Vtiger_Request $request, $display = true)
{
$db = PearDatabase::getInstance();
parent::preProcess($request, false);
$origModuleName = $request->getModule();
$recordId = $request->get('record');
if (!$this->record) {
$this->record = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
}
$recordModel = $this->record->getRecord();
$recordStrucure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_DETAIL);
$summaryInfo = array();
// Take first block information as summary information
$stucturedValues = $recordStrucure->getStructure();
foreach ($stucturedValues as $blockLabel => $fieldList) {
$summaryInfo[$blockLabel] = $fieldList;
break;
}
$detailViewLinkParams = array('MODULE' => $moduleName, 'RECORD' => $recordId);
$detailViewLinks = $this->record->getDetailViewLinks($detailViewLinkParams);
$navigationInfo = ListViewSession::getListViewNavigation($recordId);
$viewer = $this->getViewer($request);
$modid = $recordModel->get('moduleid');
$moduleNameResult = $db->query("select name from vtiger_tab where tabid = '{$modid}'", true);
$moduleName = $db->query_result($moduleNameResult, 0, 'name');
$tName = vtranslate($moduleName, $moduleName);
$viewer->assign('MODULEID_NAME', $tName);
$viewer->assign('RECORD', $recordModel);
//var_dump($recordModel);
//exit;
///Conditions
vimport('~~modules/OSSPdf/helpers/Conditions.php');
$baseModule = Vtiger_Functions::getModuleName($modid);
$Condition = Conditions::getConditionRelToRecordFieldInfo($request->get('record'), $baseModule);
$viewer->assign('REQUIRED_CONDITIONS', $Condition['required_conditions']);
$viewer->assign('OPTIONAL_CONDITIONS', $Condition['optional_conditions']);
$viewer->assign('BASE_MODULE', $baseModule);
///Conditions
$viewer->assign('NAVIGATION', $navigationInfo);
//Intially make the prev and next records as null
$prevRecordId = null;
$nextRecordId = null;
$found = false;
if ($navigationInfo) {
foreach ($navigationInfo as $page => $pageInfo) {
foreach ($pageInfo as $index => $record) {
//If record found then next record in the interation
//will be next record
if ($found) {
$nextRecordId = $record;
break;
}
if ($record == $recordId) {
$found = true;
}
//If record not found then we are assiging previousRecordId
//assuming next record will get matched
if (!$found) {
$prevRecordId = $record;
}
}
//if record is found and next record is not calculated we need to perform iteration
if ($found && !empty($nextRecordId)) {
break;
}
}
}
$moduleModel = Vtiger_Module_Model::getInstance($origModuleName);
if (!empty($prevRecordId)) {
$viewer->assign('PREVIOUS_RECORD_URL', $moduleModel->getDetailViewUrl($prevRecordId));
}
if (!empty($nextRecordId)) {
$viewer->assign('NEXT_RECORD_URL', $moduleModel->getDetailViewUrl($nextRecordId));
}
$viewer->assign('MODULE_MODEL', $this->record->getModule());
$viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
$viewer->assign('MODULE', $request->getModule());
$viewer->assign('IS_EDITABLE', $this->record->getRecord()->isEditable($moduleName));
$viewer->assign('IS_DELETABLE', $this->record->getRecord()->isDeletable($moduleName));
$viewer->assign('URL_CONTENT', "index.php?module=OSSPdf&view=content&record={$recordId}");
$viewer->assign('URL_FOOTER', "index.php?module=OSSPdf&view=footer&record={$recordId}");
$viewer->assign('URL_HEADER', "index.php?module=OSSPdf&view=header&record={$recordId}");
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
$linkModels = $this->record->getSideBarLinks($linkParams);
$viewer->assign('QUICK_LINKS', $linkModels);
if ($display) {
$this->preProcessDisplay($request);
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:89,代码来源:Detail.php
示例13: 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 = $th
|
请发表评论