本文整理汇总了PHP中Vtiger_Paging_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Paging_Model类的具体用法?PHP Vtiger_Paging_Model怎么用?PHP Vtiger_Paging_Model使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Paging_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleName = $request->getModule();
$page = $request->get('page');
$linkId = $request->get('linkid');
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', 10);
$user = $request->get('type');
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$overDueActivities = $moduleModel->getCalendarActivities('overdue', $pagingModel, $user);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer = $this->getViewer($request);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('ACTIVITIES', $overDueActivities);
$viewer->assign('PAGING', $pagingModel);
$viewer->assign('CURRENTUSER', $currentUser);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/CalendarActivitiesContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/CalendarActivities.tpl', $moduleName);
}
}
示例2: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$number = $request->get('number');
$page = $request->get('page');
$linkId = $request->get('linkid');
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$limit = (int) $widget->get('limit');
if (empty($limit)) {
$limit = 10;
}
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', $limit);
$columnList = array('LBL_NAME' => 'label', 'LBL_MODULE_NAME' => 'setype', 'Last Modified By' => 'modifiedtime', 'LBL_OWNER' => 'smownerid');
$recordList = ListUpdatedRecord::getListRecord(NULL, $columnList);
$viewer->assign('COLUMN_LIST', $columnList);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('LIST', $recordList);
$viewer->assign('PAGE', $page);
$viewer->assign('NEXTPAGE', count($recordList) < $limit ? 0 : $page + 1);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/ListUpdatedRecordContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/ListUpdatedRecord.tpl', $moduleName);
}
}
示例3: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
global $log;
$log->debug("Entering ./views/FindDuplicates.php::initializeListViewContents");
$currentUser = vglobal('current_user');
$viewer = $this->getViewer($request);
$module = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($module);
$massActionLink = array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_DELETE', 'linkurl' => 'Javascript:Vtiger_FindDuplicates_Js.massDeleteRecords("index.php?module=' . $module . '&action=MassDelete");', 'linkicon' => '');
$massActionLinks[] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
$viewer->assign('LISTVIEW_LINKS', $massActionLinks);
$viewer->assign('MODULE_MODEL', $moduleModel);
$pageNumber = $request->get('page');
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$pageLimit = $pagingModel->getPageLimit();
$duplicateSearchFields = $request->get('fields');
$dataModelInstance = Vtiger_FindDuplicate_Model::getInstance($module);
$dataModelInstance->set('fields', $duplicateSearchFields);
$ignoreEmpty = $request->get('ignoreEmpty');
$ignoreEmptyValue = false;
if ($ignoreEmpty == 'on' || $ignoreEmpty == 'true' || $ignoreEmpty == '1') {
$ignoreEmptyValue = true;
}
$dataModelInstance->set('ignoreEmpty', $ignoreEmptyValue);
if (!$this->listViewEntries) {
$this->listViewEntries = $dataModelInstance->getListViewEntries($pagingModel);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $dataModelInstance->getListViewHeaders();
}
if (!$this->rows) {
$this->rows = $dataModelInstance->getRecordCount();
$viewer->assign('TOTAL_COUNT', $this->rows);
}
$rowCount = 0;
foreach ($this->listViewEntries as $group) {
foreach ($group as $row) {
$rowCount++;
}
}
//for calculating the page range
for ($i = 0; $i < $rowCount; $i++) {
$dummyListEntries[] = $i;
}
$pagingModel->calculatePageRange($dummyListEntries);
$viewer->assign('IGNORE_EMPTY', $ignoreEmpty);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $rowCount);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('MODULE', $module);
$viewer->assign('DUPLICATE_SEARCH_FIELDS', $duplicateSearchFields);
$customViewModel = CustomView_Record_Model::getAllFilterByModule($module);
$viewer->assign('VIEW_NAME', $customViewModel->getId());
}
示例4: 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');
$listQuery = $queryGenerator->getQuery();
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$importedRecordIds = $this->getLastImportedRecord();
$listViewRecordModels = array();
if (count($importedRecordIds) != 0) {
$moduleModel = $this->get('module');
$listQuery .= ' AND ' . $moduleModel->basetable . '.' . $moduleModel->basetableid . ' IN (' . implode(',', $importedRecordIds) . ')';
$listQuery .= " LIMIT {$startIndex}, {$pageLimit}";
$listResult = $db->pquery($listQuery, array());
$listViewEntries = $listViewContoller->getListViewRecords($moduleFocus, $moduleName, $listResult);
$pagingModel->calculatePageRange($listViewEntries);
foreach ($listViewEntries as $recordId => $record) {
$record['id'] = $recordId;
$listViewRecordModels[$recordId] = $moduleModel->getRecordFromArray($record);
}
}
return $listViewRecordModels;
}
示例5: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$page = $request->get('page');
$linkId = $request->get('linkid');
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
if (!$request->has('owner')) {
$owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
} else {
$owner = $request->get('owner');
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', (int) $widget->get('limit'));
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('PAGING', $pagingModel);
$viewer->assign('CURRENTUSER', $currentUser);
$title_max_length = vglobal('title_max_length');
$href_max_length = vglobal('href_max_length');
$viewer->assign('NAMELENGHT', $title_max_length);
$viewer->assign('HREFNAMELENGHT', $href_max_length);
$viewer->assign('NODATAMSGLABLE', 'LBL_NO_SCHEDULED_ACTIVITIES');
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$viewer->assign('CURRENT_USER', $currentUserModel);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/CalendarContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/Calendar.tpl', $moduleName);
}
}
示例6: process
public function process(Vtiger_Request $request)
{
$LIMIT = 10;
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$type = $request->get('type');
$page = $request->get('page');
$linkId = $request->get('linkid');
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', $LIMIT);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$history = $moduleModel->getHistory($pagingModel, $type);
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('HISTORIES', $history);
$viewer->assign('PAGE', $page);
$viewer->assign('NEXTPAGE', count($history) < $LIMIT ? 0 : $page + 1);
$viewer->assign('COMMENTS_MODULE_MODEL', $modCommentsModel);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/HistoryContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/History.tpl', $moduleName);
}
}
示例7: process
public function process(Vtiger_Request $request)
{
$mode = $request->getMode();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
$reportModel = Reports_Record_Model::getInstanceById($record);
$reportModel->setModule('Reports');
$reportModel->set('advancedFilter', $request->get('advanced_filter'));
$page = $request->get('page');
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', Reports_Detail_View::REPORT_LIMIT);
if ($mode === 'save') {
$reportModel->saveAdvancedFilters();
$reportData = $reportModel->getReportData($pagingModel);
$data = $reportData['data'];
} else {
if ($mode === 'generate') {
$reportData = $reportModel->generateData($pagingModel);
$data = $reportData['data'];
}
}
$calculation = $reportModel->generateCalculationData();
$viewer->assign('PRIMARY_MODULE', $reportModel->getPrimaryModule());
$viewer->assign('CALCULATION_FIELDS', $calculation);
$viewer->assign('DATA', $data);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('NEW_COUNT', $reportData['count']);
$viewer->assign('REPORT_RUN_INSTANCE', ReportRun::getInstance($record));
$viewer->view('ReportContents.tpl', $moduleName);
}
示例8: 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();
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$orderBy = $this->getForSql('orderby');
$sortOrder = $this->getForSql('sortorder');
$listQuery = $this->getQuery();
$searchKey = $this->get('search_key');
$searchValue = $this->get('search_value');
if (!empty($searchKey) && !empty($searchValue)) {
$listQuery .= " WHERE {$searchKey} LIKE '{$searchValue}%'";
}
if ($orderBy) {
$listQuery .= " ORDER BY {$orderBy} {$sortOrder}";
}
$listQuery .= " LIMIT {$startIndex}," . ($pageLimit + 1);
$result = $db->pquery($listQuery, array());
$num_rows = $db->num_rows($result);
$listViewRecordModels = array();
for ($i = 0; $i < $num_rows; $i++) {
$recordModel = new EmailTemplates_Record_Model();
$recordModel->setModule('EmailTemplates');
$row = $db->query_result_rowdata($result, $i);
$listViewRecordModels[$row['templateid']] = $recordModel->setData($row);
}
$pagingModel->calculatePageRange($listViewRecordModels);
if ($num_rows > $pageLimit) {
array_pop($listViewRecordModels);
$pagingModel->set('nextPageExists', true);
} else {
$pagingModel->set('nextPageExists', false);
}
return $listViewRecordModels;
}
示例9: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$linkId = $request->get('linkid');
$page = $request->get('page');
if (empty($page)) {
$page = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$models = $moduleModel->getTopPotentials($pagingModel);
$moduleHeader = $moduleModel->getTopPotentialsHeader();
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('MODULE_HEADER', $moduleHeader);
$viewer->assign('MODELS', $models);
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/TopPotentialsContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/TopPotentials.tpl', $moduleName);
}
}
示例10: process
function process(Vtiger_Request $request)
{
$branches = $request->get('branches');
$filter = $request->get('filter');
if (empty($branches)) {
return;
}
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$treeViewModel = Vtiger_TreeView_Model::getInstance($moduleModel);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$listViewModel = Vtiger_ListView_Model::getInstance($moduleName, $filter);
$listViewModel->set('search_params', $treeViewModel->getSearchParams($branches));
$listEntries = $listViewModel->getListViewEntries($pagingModel, true);
if (count($listEntries) === 0) {
return;
}
$listHeaders = $listViewModel->getListViewHeaders();
$viewer->assign('ENTRIES', $listEntries);
$viewer->assign('HEADERS', $listHeaders);
$viewer->assign('MODULE', $moduleName);
$viewer->view('TreeRecords.tpl', $moduleName);
}
示例11: 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();
$module = $this->getModule();
$moduleName = $module->getName();
$parentModuleName = $module->getParentName();
$qualifiedModuleName = $moduleName;
if (!empty($parentModuleName)) {
$qualifiedModuleName = $parentModuleName . ':' . $qualifiedModuleName;
}
$recordModelClass = Vtiger_Loader::getComponentClassName('Model', 'Record', $qualifiedModuleName);
$listQuery = $this->getBasicListQuery();
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$orderBy = $this->getForSql('orderby');
if (!empty($orderBy) && $orderBy === 'smownerid') {
$fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
if ($fieldModel->getFieldDataType() == 'owner') {
$orderBy = 'COALESCE(' . getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users') . ',vtiger_groups.groupname)';
}
}
if (!empty($orderBy)) {
$listQuery .= ' ORDER BY ' . $orderBy . ' ' . $this->getForSql('sortorder');
}
if ($module->isPagingSupported()) {
$nextListQuery = $listQuery . ' LIMIT ' . ($startIndex + $pageLimit) . ',1';
$listQuery .= " LIMIT $startIndex, $pageLimit";
}
$listResult = $db->pquery($listQuery, array());
$noOfRecords = $db->num_rows($listResult);
$listViewRecordModels = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$row = $db->query_result_rowdata($listResult, $i);
$record = new $recordModelClass();
$record->setData($row);
if (method_exists($record, 'getModule') && method_exists($record, 'setModule')) {
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
$record->setModule($moduleModel);
}
$listViewRecordModels[$record->getId()] = $record;
}
if ($module->isPagingSupported()) {
$pagingModel->calculatePageRange($listViewRecordModels);
$nextPageResult = $db->pquery($nextListQuery, array());
$nextPageNumRows = $db->num_rows($nextPageResult);
if ($nextPageNumRows <= 0) {
$pagingModel->set('nextPageExists', false);
}
}
return $listViewRecordModels;
}
示例12: process
public function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$page = $request->get('page');
$linkId = $request->get('linkid');
$widget = Vtiger_Widget_Model::getInstance($linkId, $currentUser->getId());
if (!$request->has('owner')) {
$owner = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget);
} else {
$owner = $request->get('owner');
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', (int) $widget->get('limit'));
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$projectsTasks = $owner === false ? array() : $moduleModel->getAssignedProjectsTasks('upcoming', $pagingModel, $owner);
$viewer->assign('WIDGET', $widget);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('PROJECTSTASKS', $projectsTasks);
$viewer->assign('PAGING', $pagingModel);
$viewer->assign('CURRENTUSER', $currentUser);
global $title_max_length, $href_max_length;
$viewer->assign('NAMELENGHT', $title_max_length);
$viewer->assign('HREFNAMELENGHT', $href_max_length);
$viewer->assign('NODATAMSGLABLE', 'LBL_NO_OVERDUE_ACTIVITIES');
$content = $request->get('content');
if (!empty($content)) {
$viewer->view('dashboards/AssignedProjectsTasksContents.tpl', $moduleName);
} else {
$viewer->view('dashboards/AssignedProjectsTasks.tpl', $moduleName);
}
}
示例13: 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());
}
示例14: process
function process(Vtiger_Request $request)
{
$branches = $request->get('branches');
$filter = $request->get('filter');
if (empty($branches)) {
return;
}
$moduleName = $request->getModule();
$viewer = $this->getViewer($request);
$baseModuleName = 'Accounts';
$multiReferenceFirld = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($baseModuleName, $moduleName);
if (count($multiReferenceFirld) === 0) {
return;
}
$multiReferenceFirld = reset($multiReferenceFirld);
$searchParams = [['columns' => [['columnname' => $multiReferenceFirld['tablename'] . ':' . $multiReferenceFirld['columnname'] . ':' . $multiReferenceFirld['fieldname'], 'value' => implode(',', $branches), 'column_condition' => '', 'comparator' => 'c']]]];
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$listViewModel = Vtiger_ListView_Model::getInstance($baseModuleName, $filter);
$listViewModel->set('search_key', $multiReferenceFirld['fieldname']);
$listViewModel->set('search_params', $searchParams);
$listEntries = $listViewModel->getListViewEntries($pagingModel, true);
if (count($listEntries) === 0) {
return;
}
$listHeaders = $listViewModel->getListViewHeaders();
$viewer->assign('ENTRIES', $listEntries);
$viewer->assign('HEADERS', $listHeaders);
$viewer->assign('MODULE', $baseModuleName);
$viewer->view('TreeRecords.tpl', $moduleName);
}
示例15: getActivities
/**
* Function to get activities
* @param Vtiger_Request $request
* @return <List of activity models>
*/
public function getActivities(Vtiger_Request $request)
{
$moduleName = 'Calendar';
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$currentUserPriviligesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
if ($currentUserPriviligesModel->hasModulePermission($moduleModel->getId())) {
$moduleName = $request->getModule();
$recordId = $request->get('record');
$pageNumber = $request->get('page');
if (empty($pageNumber)) {
$pageNumber = 1;
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$pagingModel->set('limit', 10);
if (!$this->record) {
$this->record = Vtiger_DetailView_Model::getInstance($moduleName, $recordId);
}
$recordModel = $this->record->getRecord();
$moduleModel = $recordModel->getModule();
$relatedActivities = $moduleModel->getCalendarActivities('', $pagingModel, 'all', $recordId);
$viewer = $this->getViewer($request);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('ACTIVITIES', $relatedActivities);
return $viewer->view('RelatedActivities.tpl', $moduleName, true);
}
}