本文整理汇总了PHP中CustomView类的典型用法代码示例。如果您正苦于以下问题:PHP CustomView类的具体用法?PHP CustomView怎么用?PHP CustomView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomView类的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: preProcess
function preProcess(Vtiger_Request $request, $display = true)
{
global $current_user;
parent::preProcess($request, false);
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$listViewModel = Vtiger_ListView_Model::getInstance($moduleName);
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
$viewer->assign('CUSTOM_VIEWS', CustomView_Record_Model::getAllByGroup($moduleName));
$this->viewName = $request->get('viewname');
if (empty($this->viewName)) {
//If not view name exits then get it from custom view
//This can return default view id or view id present in session
$customView = new CustomView();
$this->viewName = $customView->getViewId($moduleName);
}
$quickLinkModels = $listViewModel->getSideBarLinks($linkParams);
$viewer->assign('QUICK_LINKS', $quickLinkModels);
$this->initializeListViewContents($request, $viewer);
$viewer->assign('VIEWID', $this->viewName);
//Modified by jmangarret 16jun2015
$viewer->assign('ROLEID', $current_user->roleid);
if ($display) {
$this->preProcessDisplay($request);
}
}
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:26,代码来源:List.php
示例3: getKeyMetricsWithCount
protected function getKeyMetricsWithCount()
{
global $current_user, $adb;
$current_user = Users_Record_Model::getCurrentUserModel();
require_once 'modules/CustomView/ListViewTop.php';
$metriclists = getMetricList();
foreach ($metriclists as $key => $metriclist) {
$metricresult = NULL;
if ($metriclist['module'] == "Calendar") {
$listquery = getListQuery($metriclist['module']);
$oCustomView = new CustomView($metriclist['module']);
$metricsql = $oCustomView->getModifiedCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
$metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
} else {
$queryGenerator = new QueryGenerator($metriclist['module'], $current_user);
$queryGenerator->initForCustomViewById($metriclist['id']);
$metricsql = $queryGenerator->getQuery();
$metricresult = $adb->query(Vtiger_Functions::mkCountQuery($metricsql));
}
if ($metricresult) {
$rowcount = $adb->fetch_array($metricresult);
$metriclists[$key]['count'] = $rowcount['count'];
}
}
return $metriclists;
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:26,代码来源:Notebook.php
示例4: getKeyMetrics
/** to get the details of a KeyMetrics on Home page
* @returns $customviewlist Array in the following format
* $values = Array('Title'=>Array(0=>'image name',
* 1=>'Key Metrics',
* 2=>'home_metrics'
* ),
* 'Header'=>Array(0=>'Metrics',
* 1=>'Count'
* ),
* 'Entries'=>Array($cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* ),
* $cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* ),
* |
* |
* $cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* )
* )
*
*/
function getKeyMetrics()
{
require_once "data/Tracker.php";
require_once 'modules/CustomView/CustomView.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $log;
global $current_language;
$metricviewnames = "'Hot Leads'";
$current_module_strings = return_module_language($current_language, "CustomView");
$log = LoggerManager::getLogger('metrics');
$metriclists = getMetricList();
$log->info("Metrics :: Successfully got MetricList to be displayed");
if (isset($metriclists)) {
foreach ($metriclists as $key => $metriclist) {
$listquery = getListQuery($metriclist['module']);
if (empty($listquery)) {
if (is_file("modules/" . $metriclist['module'] . "/" . $metriclist['module'] . ".php")) {
include_once "modules/" . $metriclist['module'] . "/" . $metriclist['module'] . ".php";
$metric_focus = new $metriclist['module']();
$listquery = $metric_focus->getListQuery('');
}
}
$oCustomView = new CustomView($metriclist['module']);
$metricsql = $oCustomView->getMetricsCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
$metricresult = $adb->query($metricsql);
if ($metricresult) {
$rowcount = $adb->fetch_array($metricresult);
if (isset($rowcount)) {
$metriclists[$key]['count'] = $rowcount['count'];
}
}
}
$log->info("Metrics :: Successfully build the Metrics");
}
$title = array();
$title[] = 'keyMetrics.gif';
$title[] = $app_strings['LBL_HOME_KEY_METRICS'];
$title[] = 'home_metrics';
$header = array();
$header[] = $app_strings['LBL_HOME_METRICS'];
$header[] = $app_strings['LBL_HOME_COUNT'];
$entries = array();
if (isset($metriclists)) {
$oddRow = true;
foreach ($metriclists as $metriclist) {
$value = array();
$metric_fields = array('ID' => $metriclist['id'], 'NAME' => $metriclist['name'], 'COUNT' => $metriclist['count'], 'MODULE' => $metriclist['module']);
$value[] = '<a href="index.php?action=index&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['name'] . '</a>';
$value[] = '<a href="index.php?action=index&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['count'] . '</a>';
$entries[$metriclist['id']] = $value;
}
}
$values = array('Title' => $title, 'Header' => $header, 'Entries' => $entries);
//if ( ($display_empty_home_blocks ) || (count($value)!= 0) )
return $values;
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:85,代码来源:ListViewTop.php
示例5: getContent
function getContent(Mobile_API_Request $request)
{
global $current_user, $adb;
$current_user = $this->getActiveUser();
$module = $request->get('module');
$limit = $request->get('number');
$offset = $request->get('offset');
$search = isset($_REQUEST['src_str']) ? $request->get('src_str') : '';
$customView = new CustomView($module);
if (!empty($_REQUEST['view'])) {
$viewid = $_REQUEST['view'];
} else {
$viewid = $customView->getViewId($module);
}
$queryGenerator = new QueryGenerator($module, $current_user);
if ($viewid != "0") {
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
$list_query = $queryGenerator->getQuery();
//get entity fields for each module
$entity_sql = "select fieldname,tablename,entityidfield from vtiger_entityname where modulename =?";
$ws_entity = $adb->pquery($entity_sql, array($module));
$fieldname = $adb->query_result($ws_entity, 0, 'fieldname');
$tablename = $adb->query_result($ws_entity, 0, 'tablename');
//set the list and content order
if ($module == 'Contacts' || $module == 'Leads') {
$list_query .= " AND (lastname LIKE '%{$search}%' OR firstname LIKE '%{$search}%') ORDER BY lastname";
} elseif ($module != 'Calendar' and $module != 'Events') {
$list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
} elseif ($module == 'Calendar' || $module == 'Events') {
$calendarview_selected = $request->get('viewName');
$list_query .= " AND vtiger_activity.activitytype!='Emails'";
if ($calendarview_selected == 'week') {
$list_query .= " AND week(date_start) = week(NOW()) AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'month') {
$list_query .= " AND month(date_start) = month(NOW()) AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'year') {
$list_query .= " AND year(date_start) = year(NOW())";
} elseif ($calendarview_selected == 'today') {
$list_query .= " AND DATE(date_start) = DATE(NOW())";
}
$list_query .= " AND subject LIKE '%{$search}%' ORDER BY date_start DESC";
} else {
$list_query .= " AND " . $tablename . "." . $fieldname . " LIKE '%{$search}%' ORDER BY " . $tablename . "." . $fieldname;
}
$list_query .= " LIMIT {$offset}, {$limit};";
$listview_entries = $adb->pquery($list_query, array());
$response = new Mobile_API_Response();
$response->setResult(array('records' => $listview_entries, 'module' => $module));
return $response;
}
开发者ID:kduqi,项目名称:corebos,代码行数:53,代码来源:getScrollContent.php
示例6: process
public function process(Vtiger_Request $request)
{
$customView = new CustomView();
$modules = $request->get('related_modules');
$cvIds = array();
if (is_array($modules)) {
foreach ($modules as $key => $module) {
$cvIds[$module] = $customView->getViewId($module);
}
}
$response = new Vtiger_Response();
$response->setResult($cvIds);
$response->emit();
}
开发者ID:googlicius,项目名称:SP,代码行数:14,代码来源:getViewNames.php
示例7: vtws_getfilterfields
function vtws_getfilterfields($module, $user)
{
global $log, $adb, $default_language;
$log->debug("Entering function vtws_getfilterfields");
include_once "modules/{$module}/{$module}.php";
$focus = new $module();
$linkfields = array($focus->list_link_field);
if ($module == 'Contacts' or $module == 'Leads') {
$linkfields = array('firstname', 'lastname');
}
$customView = new CustomView($module);
$viewid = $customView->getViewId($module);
$viewinfo = $customView->getColumnsListByCvid($viewid);
$fields = array();
foreach ($viewinfo as $fld) {
$finfo = explode(':', $fld);
$fields[] = $finfo[1] == 'smownerid' ? 'assigned_user_id' : $finfo[2];
}
return array('fields' => $fields, 'linkfields' => $linkfields);
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:20,代码来源:GetFilterFields.php
示例8: getModuleFilterDetails
protected function getModuleFilterDetails($filterid)
{
global $adb;
$result = $adb->pquery("SELECT * FROM vtiger_customview WHERE cvid=?", array($filterid));
if ($result && $adb->num_rows($result)) {
$resultrow = $adb->fetch_array($result);
$module = $resultrow['entitytype'];
$view = new CustomView($module);
$viewid = $resultrow['cvid'];
$view->getCustomViewByCvid($viewid);
$viewQuery = $view->getModifiedCvListQuery($viewid, getListQuery($module), $module);
$countResult = $adb->pquery(Vtiger_Functions::mkCountQuery($viewQuery), array());
$count = 0;
if ($countResult && $adb->num_rows($countResult)) {
$count = $adb->query_result($countResult, 0, 'count');
}
$filter = $this->prepareFilterDetailUsingResultRow($resultrow);
$filter['userName'] = getUserName($resultrow['userid']);
$filter['count'] = $count;
return $filter;
}
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:22,代码来源:FilterDetailsWithCount.php
示例9: getStdFilterHTML
$stdfiltercolhtml = getStdFilterHTML($cv_module);
$stdfilterjs = $oCustomView->getCriteriaJS();
$smarty->assign("STDFILTERCOLUMNS", $stdfiltercolhtml);
$smarty->assign("STDCOLUMNSCOUNT", count($stdfiltercolhtml));
$smarty->assign("STDFILTERCRITERIA", $stdfilterhtml);
$smarty->assign("STDFILTER_JAVASCRIPT", $stdfilterjs);
$advfilterhtml = getAdvCriteriaHTML();
$modulecolumnshtml = getByModule_ColumnsHTML($cv_module, $modulecollist);
$smarty->assign("FOPTION", $advfilterhtml);
$smarty->assign("COLUMNS_BLOCK", $modulecolumnshtml);
$smarty->assign("MANDATORYCHECK", implode(",", array_unique($oCustomView->mandatoryvalues)));
$smarty->assign("SHOWVALUES", implode(",", $oCustomView->showvalues));
$data_type[] = $oCustomView->data_type;
$smarty->assign("DATATYPE", $data_type);
} else {
$oCustomView = new CustomView($cv_module);
$now_action = vtlib_purify($_REQUEST['action']);
if ($oCustomView->isPermittedCustomView($recordid, $now_action, $oCustomView->customviewmodule) == 'yes') {
$customviewdtls = $oCustomView->getCustomViewByCvid($recordid);
$log->info('CustomView :: Successfully got ViewDetails for the Viewid' . $recordid);
$modulecollist = $oCustomView->getModuleColumnsList($cv_module);
$selectedcolumnslist = $oCustomView->getColumnsListByCvid($recordid);
$log->info('CustomView :: Successfully got ColumnsList for the Viewid' . $recordid);
$smarty->assign("VIEWNAME", $customviewdtls["viewname"]);
if ($customviewdtls["setdefault"] == 1) {
$smarty->assign("CHECKED", "checked");
}
if ($customviewdtls["setmetrics"] == 1) {
$smarty->assign("MCHECKED", "checked");
}
$status = $customviewdtls["status"];
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:EditView.php
示例10: generateAdvFilterSql
function generateAdvFilterSql($advfilterlist)
{
$adb = PearDatabase::getInstance();
$advfiltersql = "";
$customView = new CustomView();
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advfilterlist as $groupindex => $groupinfo) {
$groupcondition = $groupinfo['condition'];
$groupcolumns = $groupinfo['columns'];
if (count($groupcolumns) > 0) {
$advfiltergroupsql = "";
foreach ($groupcolumns as $columnindex => $columninfo) {
$fieldcolname = $columninfo["columnname"];
$comparator = $columninfo["comparator"];
$value = $columninfo["value"];
$columncondition = $columninfo["column_condition"];
$advcolsql = array();
if ($fieldcolname != "" && $comparator != "") {
if (in_array($comparator, $dateSpecificConditions)) {
if ($fieldcolname != 'none') {
$selectedFields = explode(':', $fieldcolname);
if ($selectedFields[0] == 'vtiger_crmentity' . $this->primarymodule) {
$selectedFields[0] = 'vtiger_crmentity';
}
if ($comparator != 'custom') {
list($startDate, $endDate) = $this->getStandarFiltersStartAndEndDate($comparator);
} else {
list($startDateTime, $endDateTime) = explode(',', $value);
list($startDate, $startTime) = explode(' ', $startDateTime);
list($endDate, $endTime) = explode(' ', $endDateTime);
}
$type = $selectedFields[4];
if ($startDate != '0000-00-00' && $endDate != '0000-00-00' && $startDate != '' && $endDate != '') {
$startDateTime = new DateTimeField($startDate . ' ' . date('H:i:s'));
$userStartDate = $startDateTime->getDisplayDate();
if ($type == 'DT') {
$userStartDate = $userStartDate . ' 00:00:00';
}
$startDateTime = getValidDBInsertDateTimeValue($userStartDate);
$endDateTime = new DateTimeField($endDate . ' ' . date('H:i:s'));
$userEndDate = $endDateTime->getDisplayDate();
if ($type == 'DT') {
$userEndDate = $userEndDate . ' 23:59:59';
}
$endDateTime = getValidDBInsertDateTimeValue($userEndDate);
if ($selectedFields[1] == 'birthday') {
$tableColumnSql = 'DATE_FORMAT(' . $selectedFields[0] . '.' . $selectedFields[1] . ', "%m%d")';
$startDateTime = "DATE_FORMAT('{$startDateTime}', '%m%d')";
$endDateTime = "DATE_FORMAT('{$endDateTime}', '%m%d')";
} else {
if ($selectedFields[0] == 'vtiger_activity' && $selectedFields[1] == 'date_start') {
$tableColumnSql = 'CAST((CONCAT(date_start, " ", time_start)) AS DATETIME)';
} else {
$tableColumnSql = $selectedFields[0] . '.' . $selectedFields[1];
}
$startDateTime = "'{$startDateTime}'";
$endDateTime = "'{$endDateTime}'";
}
$advfiltergroupsql .= "{$tableColumnSql} BETWEEN {$startDateTime} AND {$endDateTime}";
if (!empty($columncondition)) {
$advfiltergroupsql .= ' ' . $columncondition . ' ';
}
$this->queryPlanner->addTable($selectedFields[0]);
}
}
continue;
}
$selectedFields = explode(":", $fieldcolname);
$tempComparators = array('e', 'n', 'bw', 'a', 'b');
if ($selectedFields[4] == 'DT' && in_array($comparator, $tempComparators)) {
if ($selectedFields[0] == 'vtiger_crmentity' . $this->primarymodule) {
$selectedFields[0] = 'vtiger_crmentity';
}
if ($selectedFields[0] == 'vtiger_activity' && $selectedFields[1] == 'date_start') {
$tableColumnSql = 'CAST((CONCAT(date_start, " ", time_start)) AS DATETIME)';
} else {
$tableColumnSql = $selectedFields[0] . '.' . $selectedFields[1];
}
if ($value != null && $value != '') {
if ($comparator == 'e' || $comparator == 'n') {
$dateTimeComponents = explode(' ', $value);
$dateTime = new DateTime($dateTimeComponents[0] . ' ' . '00:00:00');
$date1 = $dateTime->format('Y-m-d H:i:s');
$dateTime->modify("+1 days");
$date2 = $dateTime->format('Y-m-d H:i:s');
$tempDate = strtotime($date2) - 1;
$date2 = date('Y-m-d H:i:s', $tempDate);
$start = getValidDBInsertDateTimeValue($date1);
$end = getValidDBInsertDateTimeValue($date2);
$start = "'{$start}'";
$end = "'{$end}'";
if ($comparator == 'e') {
$advfiltergroupsql .= "{$tableColumnSql} BETWEEN {$start} AND {$end}";
} else {
$advfiltergroupsql .= "{$tableColumnSql} NOT BETWEEN {$start} AND {$end}";
}
} else {
if ($comparator == 'bw') {
$values = explode(',', $value);
$startDateTime = explode(' ', $values[0]);
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:101,代码来源:ReportRun.php
示例11: getListViewNavigation
public static function getListViewNavigation($currentRecordId)
{
global $currentModule, $current_user, $adb, $log, $list_max_entries_per_page;
Zend_Json::$useBuiltinEncoderDecoder = true;
$reUseData = false;
$displayBufferRecordCount = 10;
$bufferRecordCount = 15;
if ($currentModule == 'Documents') {
$sql = "select folderid from vtiger_notes where notesid=?";
$params = array($currentRecordId);
$result = $adb->pquery($sql, $params);
$folderId = $adb->query_result($result, 0, 'folderid');
}
$cv = new CustomView();
$viewId = $cv->getViewId($currentModule);
if (!empty($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId])) {
$recordNavigationInfo = Zend_Json::decode($_SESSION[$currentModule . '_DetailView_Navigation' . $viewId]);
$pageNumber = 0;
if (count($recordNavigationInfo) == 1) {
foreach ($recordNavigationInfo as $recordIdList) {
if (in_array($currentRecordId, $recordIdList)) {
$reUseData = true;
}
}
} else {
$recordList = array();
$recordPageMapping = array();
foreach ($recordNavigationInfo as $start => $recordIdList) {
foreach ($recordIdList as $index => $recordId) {
$recordList[] = $recordId;
$recordPageMapping[$recordId] = $start;
if ($recordId == $currentRecordId) {
$searchKey = count($recordList) - 1;
}
}
}
if ($searchKey > $displayBufferRecordCount - 1 && $searchKey < count($recordList) - $displayBufferRecordCount) {
$reUseData = true;
}
}
}
if ($reUseData === false) {
$recordNavigationInfo = array();
if (!empty($_REQUEST['start'])) {
$start = ListViewSession::getRequestStartPage();
} else {
$start = ListViewSession::getCurrentPage($currentModule, $viewId);
}
$startRecord = ($start - 1) * $list_max_entries_per_page - $bufferRecordCount;
if ($startRecord < 0) {
$startRecord = 0;
}
$list_query = $_SESSION[$currentModule . '_listquery'];
$instance = CRMEntity::getInstance($currentModule);
$instance->getNonAdminAccessControlQuery($currentModule, $current_user);
vtlib_setup_modulevars($currentModule, $instance);
if ($currentModule == 'Documents' && !empty($folderId)) {
$list_query = preg_replace("/[\n\r\\s]+/", " ", $list_query);
$hasOrderBy = stripos($list_query, 'order by');
if ($hasOrderBy > 0) {
$list_query = substr($list_query, 0, $hasOrderBy - 1) . " AND vtiger_notes.folderid={$folderId} " . substr($list_query, $hasOrderBy);
} else {
$list_query .= " AND vtiger_notes.folderid={$folderId}";
$order_by = $instance->getOrderByForFolder($folderId);
$sorder = $instance->getSortOrderForFolder($folderId);
$tablename = getTableNameForField($currentModule, $order_by);
$tablename = $tablename != '' ? $tablename . "." : '';
if (!empty($order_by)) {
$list_query .= ' ORDER BY ' . $tablename . $order_by . ' ' . $sorder;
}
}
}
if ($start != 1) {
$recordCount = $list_max_entries_per_page + 2 * $bufferRecordCount;
} else {
$recordCount = $list_max_entries_per_page + $bufferRecordCount;
}
$list_query .= " LIMIT {$startRecord}, {$recordCount}";
$resultAllCRMIDlist_query = $adb->pquery($list_query, array());
$navigationRecordList = array();
while ($forAllCRMID = $adb->fetch_array($resultAllCRMIDlist_query)) {
$navigationRecordList[] = $forAllCRMID[$instance->table_index];
}
$pageCount = 0;
$current = $start;
if ($start == 1) {
$firstPageRecordCount = $list_max_entries_per_page;
} else {
$firstPageRecordCount = $bufferRecordCount;
$current -= 1;
}
$searchKey = array_search($currentRecordId, $navigationRecordList);
$recordNavigationInfo = array();
if ($searchKey !== false) {
foreach ($navigationRecordList as $index => $recordId) {
if (!is_array($recordNavigationInfo[$current])) {
$recordNavigationInfo[$current] = array();
}
if ($index == $firstPageRecordCount || $index == $firstPageRecordCount + $pageCount * $list_max_entries_per_page) {
$current++;
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:ListViewSession.php
示例12: getTopQuotes
/** function used to get the top 5 quotes from the ListView query
* @return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
*/
function getTopQuotes($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/Quotes/Quotes.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
require_once 'include/utils/utils.php';
require_once 'modules/CustomView/CustomView.php';
global $app_strings, $current_language, $current_user;
$current_module_strings = return_module_language($current_language, 'Quotes');
global $list_max_entries_per_page, $adb, $theme, $mod_strings;
$log = LoggerManager::getLogger('quote_list');
$url_string = '';
$sorder = '';
$oCustomView = new CustomView("Quotes");
$customviewcombo_html = $oCustomView->getCustomViewCombo();
if (isset($_REQUEST['viewname']) == false || $_REQUEST['viewname'] == '') {
if ($oCustomView->setdefaultviewid != "") {
$viewid = $oCustomView->setdefaultviewid;
} else {
$viewid = "0";
}
}
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'Quotes';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('subject', 'potential_id', 'account_id', 'total');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if (count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getTopQuotesSearch($_REQUEST, array('assigned_user_id' => $current_user->column_fields['user_name'], 'validtill' => $date_var, 'quotestage.Rejected' => $current_module_strings['Rejected'], 'quotestage.Accepted' => $current_module_strings['Accepted']));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true' . getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($query);
//Retreiving the no of rows
$noofrows = $adb->num_rows($list_result);
//Retreiving the start value from request
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
$start = vtlib_purify($_REQUEST['start']);
} else {
$start = 1;
}
//Retreive the Navigation array
$navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
if ($navigation_array['start'] == 1) {
if ($noofrows != 0) {
$start_rec = $navigation_array['start'];
} else {
$start_rec = 0;
}
if ($noofrows > $list_max_entries_per_page) {
$end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
} else {
$end_rec = $noofrows;
}
} else {
if ($navigation_array['next'] > $list_max_entries_per_page) {
$start_rec = $navigation_array['next'] - $list_max_entries_per_page;
$end_rec = $navigation_array['next'] - 1;
} else {
$start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
$end_rec = $noofrows;
}
}
$focus = new Quotes();
$title = array('TopOpenQuotes.gif', $current_module_strings['LBL_MY_TOP_QUOTE'], 'home_mytopquote');
//Retreive the List View Table Header
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus, $currentModule, $url_string, $sorder, $order_by, true);
$entries = $controller->getListViewEntries($focus, $currentModule, $list_result, $navigation_array, true);
//.........这里部分代码省略.........
开发者ID:latechdirect,项目名称:vtiger,代码行数:101,代码来源:ListTopQuotes.php
示例13: getAllFilterByModule
/**
* Function gives default custom view for a module
* @param <String> $module
* @return <CustomView_Record_Model>
*/
public static function getAllFilterByModule($module)
{
$db = PearDatabase::getInstance();
$query = "SELECT cvid FROM vtiger_customview WHERE viewname='All' AND entitytype = ?";
$result = $db->pquery($query, array($module));
$viewId = $db->query_result($result, 0, 'cvid');
if (!$viewId) {
$customView = new CustomView($module);
$viewId = $customView->getViewId($module);
}
return self::getInstanceById($viewId);
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:17,代码来源:Record.php
示例14: getKeyMetrics
/** to get the details of a KeyMetrics on Home page
* @returns $customviewlist Array in the following format
* $values = Array('Title'=>Array(0=>'image name',
* 1=>'Key Metrics',
* 2=>'home_metrics'
* ),
* 'Header'=>Array(0=>'Metrics',
* 1=>'Count'
* ),
* 'Entries'=>Array($cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* ),
* $cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* ),
* |
* |
* $cvid=>Array(
* 0=>$customview name,
* 1=>$no of records for the view
* )
* )
*
*/
function getKeyMetrics($maxval, $calCnt)
{
require_once "data/Tracker.php";
require_once 'modules/CustomView/CustomView.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $log;
global $current_language;
$metricviewnames = "'Hot Leads'";
$current_module_strings = return_module_language($current_language, "CustomView");
$log = LoggerManager::getLogger('metrics');
$metriclists = getMetricList();
// Determine if the KeyMetrics widget should appear or not?
if ($calCnt == 'calculateCnt') {
return count($metriclists);
}
$log->info("Metrics :: Successfully got MetricList to be displayed");
if (isset($metriclists)) {
foreach ($metriclists as $key => $metriclist) {
$listquery = getListQuery($metriclist['module']);
if ($metriclist['module'] == 'Calendar') {
$listquery .= " AND vtiger_activity.activitytype != 'Emails' ";
}
$oCustomView = new CustomView($metriclist['module']);
$metricsql = $oCustomView->getMetricsCvListQuery($metriclist['id'], $listquery, $metriclist['module']);
if ($metriclist['module'] == "Calendar" and !$adb->isPostgres()) {
$metricsql .= " group by vtiger_activity.activityid ";
}
$metricresult = $adb->query($metricsql);
if ($metricresult) {
if ($metriclist['module'] == "Calendar") {
$metriclists[$key]['count'] = $adb->num_rows($metricresult);
} else {
$rowcount = $adb->fetch_array($metricresult);
if (isset($rowcount)) {
$metriclists[$key]['count'] = $rowcount['count'];
}
}
}
}
$log->info("Metrics :: Successfully build the Metrics");
}
$title = array();
$title[] = 'keyMetrics.gif';
$title[] = $app_strings['LBL_HOME_KEY_METRICS'];
$title[] = 'home_metrics';
$header = array();
$header[] = $app_strings['LBL_HOME_METRICS'];
$header[] = $app_strings['LBL_MODULE'];
$header[] = $app_strings['LBL_HOME_COUNT'];
$entries = array();
if (isset($metriclists)) {
$oddRow = true;
foreach ($metriclists as $metriclist) {
$value = array();
$CVname = strlen($metriclist['name']) > 20 ? substr($metriclist['name'], 0, 20) . '...' : $metriclist['name'];
$value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $CVname . '</a> <font style="color:#6E6E6E;">(' . $metriclist['user'] . ')</font>';
$value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . getTranslatedString($metriclist['module']) . '</a>';
$value[] = '<a href="index.php?action=ListView&module=' . $metriclist['module'] . '&viewname=' . $metriclist['id'] . '">' . $metriclist['count'] . '</a>';
$entries[$metriclist['id']] = $value;
}
}
$values = array('Title' => $title, 'Header' => $header, 'Entries' => $entries);
if ($display_empty_home_blocks || count($value) != 0) {
return $values;
}
}
开发者ID:p6,项目名称:VF,代码行数:95,代码来源:ListViewTop.php
示例15: parseAdvFilterList
public function parseAdvFilterList($advFilterList, $glue = '')
{
if (!empty($glue)) {
$this->addConditionGlue($glue);
}
$customView = new CustomView($this->module);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$this->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
// For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field
if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') {
$nameComponents[4] = 'DT';
}
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $this->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
if ($nameComponents[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$filter['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
// If datatype is DT then we should append time also
if ($nameComponents[4] == 'DT') {
$startdate = explode(' ', $dateFilterResolvedList['startdate']);
if ($startdate[1] == '') {
$startdate[1] = '00:00:00';
}
$dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1];
$enddate = explode(' ', $dateFilterResolvedList['enddate']);
if ($enddate[1] == '') {
$enddate[1] = '23:59:59';
}
$dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1];
}
$value = array();
$value[] = $this->fixDateTimeValue($name, $dat
|
请发表评论