Example #1
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $scannerId = $request->get('record');
     if ($scannerId == '') {
         $scannerId = Settings_MailConverter_Module_Model::getDefaultId();
     }
     $qualifiedModuleName = $request->getModule(false);
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $recordExists = Settings_MailConverter_Module_Model::MailBoxExists();
     $recordModel = Settings_MailConverter_Record_Model::getAll();
     $viewer = $this->getViewer($request);
     $viewer->assign('LISTVIEW_LINKS', $listViewModel->getListViewLinks());
     $viewer->assign("MODULE_MODEL", Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName));
     $viewer->assign("MAILBOXES", Settings_MailConverter_Module_Model::getMailboxes());
     $viewer->assign("MODULE_NAME", $moduleName);
     $viewer->assign("QUALIFIED_MODULE_NAME", $qualifiedModuleName);
     $viewer->assign('CRON_RECORD_MODEL', Settings_CronTasks_Record_Model::getInstanceByName('MailScanner'));
     $viewer->assign('RECORD_EXISTS', $recordExists);
     if ($scannerId) {
         $viewer->assign('SCANNER_ID', $scannerId);
         $viewer->assign("RECORD", $recordModel[$scannerId]);
         $viewer->assign('SCANNER_MODEL', Settings_MailConverter_Record_Model::getInstanceById($scannerId));
         $viewer->assign('RULE_MODELS_LIST', Settings_MailConverter_RuleRecord_Model::getAll($scannerId));
         $viewer->assign('FOLDERS_SCANNED', Settings_MailConverter_Module_Model::getScannedFolders($scannerId));
     }
     $viewer->view("RulesList.tpl", $qualifiedModuleName);
 }
Example #2
0
 public function getPagination(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $pageNumber = $request->get('page');
     $searchResult = $request->get('searchResult');
     $qualifiedModuleName = $request->getModule(false);
     $sourceModule = $request->get('sourceModule');
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     if (empty($pageNumber)) {
         $pageNumber = '1';
     }
     if (!empty($sourceModule)) {
         $listViewModel->set('sourceModule', $sourceModule);
     }
     if (!empty($forModule)) {
         $listViewModel->set('formodule', $forModule);
     }
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     $pagingModel->set('viewid', $request->get('viewname'));
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     $operator = $request->get('operator');
     if (!empty($operator)) {
         $listViewModel->set('operator', $operator);
         $viewer->assign('OPERATOR', $operator);
         $viewer->assign('ALPHABET_VALUE', $searchValue);
     }
     if (!empty($searchKey) && !empty($searchValue)) {
         $listViewModel->set('search_key', $searchKey);
         $listViewModel->set('search_value', $searchValue);
     }
     $searchParmams = $request->get('search_params');
     if (empty($searchParmams) || !is_array($searchParmams)) {
         $searchParmams = [];
     }
     $transformedSearchParams = $this->transferListSearchParamsToFilterCondition($searchParmams, $listViewModel->getModule());
     $listViewModel->set('search_params', $transformedSearchParams);
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel, $searchResult);
     }
     if (!$this->listViewCount) {
         $this->listViewCount = $listViewModel->getListViewCount();
     }
     $noOfEntries = count($this->listViewEntries);
     $totalCount = $this->listViewCount;
     $pagingModel->set('totalCount', (int) $totalCount);
     $pageCount = $pagingModel->getPageCount();
     $startPaginFrom = $pagingModel->getStartPagingFrom();
     $viewer->assign('PAGE_COUNT', $pageCount);
     $viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
     $viewer->assign('PAGE_NUMBER', $pageNumber);
     $viewer->assign('LISTVIEW_COUNT', $totalCount);
     $viewer->assign('START_PAGIN_FROM', $startPaginFrom);
     $viewer->assign('PAGING_MODEL', $pagingModel);
     echo $viewer->view('Pagination.tpl', $moduleName, true);
 }
Example #3
0
 public function getListViewCount(Vtiger_Request $request)
 {
     $qualifiedModuleName = $request->getModule(false);
     $sourceModule = $request->get('sourceModule');
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     if (!empty($sourceModule)) {
         $listViewModel->set('sourceModule', $sourceModule);
     }
     return $listViewModel->getListViewCount();
 }
Example #4
0
 public function getListViewCount(Vtiger_Request $request)
 {
     $qualifiedModuleName = $request->getModule(false);
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $searchField = $request->get('search_key');
     $value = $request->get('search_value');
     if (!empty($searchField) && !empty($value)) {
         $listViewModel->set('search_key', $searchField);
         $listViewModel->set('search_value', $value);
     }
     return $listViewModel->getListViewCount();
 }
Example #5
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $viewer = $this->getViewer($request);
     $viewer->assign('LISTVIEW_LINKS', $listViewModel->getListViewLinks());
     $viewer->assign("MODULE_MODEL", Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName));
     $viewer->assign("RECORD_MODELS", Settings_MailConverter_Record_Model::getAll());
     $viewer->assign("MODULE_NAME", $moduleName);
     $viewer->assign("QUALIFIED_MODULE_NAME", $qualifiedModuleName);
     $viewer->assign('CRON_RECORD_MODEL', Settings_CronTasks_Record_Model::getInstanceByName('MailScanner'));
     $viewer->view("ListView.tpl", $qualifiedModuleName);
 }
Example #6
0
 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $listViewModel->set('orderby', 'sequence');
     $pagingModel = new Vtiger_Paging_Model();
     if (!$this->listViewHeaders) {
         $this->listViewHeaders = $listViewModel->getListViewHeaders();
     }
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
     }
     $viewer->assign('MODULE_MODEL', $listViewModel->getModule());
     $viewer->assign('PAGING_MODEL', $pagingModel);
     $viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
     $viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
 }
Example #7
0
 /**
  * Indicates user view by module model.
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     //full name in Settings module
     /* Model of module see  ../models/Module.php */
     $moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
     /* To get statuses */
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $pagingModel = new Vtiger_Paging_Model();
     /* Smarty display viewer */
     $viewer = $this->getViewer($request);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('MODEL', $moduleModel);
     $viewer->assign('USERS', Users_Record_Model::getAll(true));
     /* To display currnet statuses settings */
     $viewer->assign('LISTVIEW_HEADERS', $listViewModel->getListViewHeaders());
     $viewer->assign('LISTVIEW_ENTRIES', $listViewModel->getListViewEntries($pagingModel));
     $viewer->view('Index.tpl', $qualifiedModuleName);
 }
Example #8
0
 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $pageNumber = $request->get('page');
     $orderBy = $request->get('orderby');
     $sortOrder = $request->get('sortorder');
     $sourceModule = $request->get('sourceModule');
     $forModule = $request->get('formodule');
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     if ($sortOrder == "ASC") {
         $nextSortOrder = "DESC";
         $sortImage = "icon-chevron-down";
     } else {
         $nextSortOrder = "ASC";
         $sortImage = "icon-chevron-up";
     }
     if (empty($pageNumber)) {
         $pageNumber = 1;
     }
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     if (!empty($searchKey) && !empty($searchValue)) {
         $listViewModel->set('search_key', $searchKey);
         $listViewModel->set('search_value', $searchValue);
     }
     if (!empty($orderBy)) {
         $listViewModel->set('orderby', $orderBy);
         $listViewModel->set('sortorder', $sortOrder);
     }
     if (!empty($sourceModule)) {
         $listViewModel->set('sourceModule', $sourceModule);
     }
     if (!empty($forModule)) {
         $listViewModel->set('formodule', $forModule);
     }
     if (!$this->listViewHeaders) {
         $this->listViewHeaders = $listViewModel->getListViewHeaders();
     }
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
     }
     $noOfEntries = count($this->listViewEntries);
     if (!$this->listViewLinks) {
         $this->listViewLinks = $listViewModel->getListViewLinks();
     }
     $viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
     $configure = Settings_GravityForm_Module_Model::getConfigueUrl();
     $viewer->assign('CONFIGURE', $configure);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
     $viewer->assign('MODULE_MODEL', $listViewModel->getModule());
     $viewer->assign('PAGING_MODEL', $pagingModel);
     $viewer->assign('PAGE_NUMBER', $pageNumber);
     $viewer->assign('ORDER_BY', $orderBy);
     $viewer->assign('SORT_ORDER', $sortOrder);
     $viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
     $viewer->assign('SORT_IMAGE', $sortImage);
     $viewer->assign('COLUMN_NAME', $orderBy);
     $viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
     $viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
     $viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
     $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
     if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)) {
         if (!$this->listViewCount) {
             $this->listViewCount = $listViewModel->getListViewCount();
         }
         $totalCount = $this->listViewCount;
         $pageLimit = $pagingModel->getPageLimit();
         $pageCount = ceil((int) $totalCount / (int) $pageLimit);
         if ($pageCount == 0) {
             $pageCount = 1;
         }
         $viewer->assign('PAGE_COUNT', $pageCount);
         $viewer->assign('LISTVIEW_COUNT', $totalCount);
     }
 }
Example #9
0
 public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $pageNumber = $request->get('page');
     $orderBy = $request->get('orderby');
     $sortOrder = $request->get('sortorder');
     $sourceModule = $request->get('sourceModule');
     $forModule = $request->get('formodule');
     $searchKey = $request->get('search_key');
     $searchValue = $request->get('search_value');
     if ($sortOrder == "ASC") {
         $nextSortOrder = "DESC";
         $sortImage = "glyphicon glyphicon-chevron-down";
     } else {
         $nextSortOrder = "ASC";
         $sortImage = "glyphicon glyphicon-chevron-up";
     }
     if (empty($pageNumber)) {
         $pageNumber = 1;
     }
     $listViewModel = Settings_Vtiger_ListView_Model::getInstance($qualifiedModuleName);
     $pagingModel = new Vtiger_Paging_Model();
     $pagingModel->set('page', $pageNumber);
     if (!empty($searchKey) && !empty($searchValue)) {
         $listViewModel->set('search_key', $searchKey);
         $listViewModel->set('search_value', $searchValue);
     }
     if (!empty($orderBy)) {
         $listViewModel->set('orderby', $orderBy);
         $listViewModel->set('sortorder', $sortOrder);
     }
     if (!empty($sourceModule)) {
         $listViewModel->set('sourceModule', $sourceModule);
     }
     if (!empty($forModule)) {
         $listViewModel->set('formodule', $forModule);
     }
     if (!$this->listViewHeaders) {
         $this->listViewHeaders = $listViewModel->getListViewHeaders();
     }
     if (!$this->listViewEntries) {
         $this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
     }
     $noOfEntries = count($this->listViewEntries);
     if (!$this->listViewLinks) {
         $this->listViewLinks = $listViewModel->getListViewLinks();
     }
     $viewer->assign('LISTVIEW_LINKS', $this->listViewLinks);
     $viewer->assign('MODULE_MODEL', $listViewModel->getModule());
     $viewer->assign('PAGING_MODEL', $pagingModel);
     $viewer->assign('PAGE_NUMBER', $pageNumber);
     $viewer->assign('ORDER_BY', $orderBy);
     $viewer->assign('SORT_ORDER', $sortOrder);
     $viewer->assign('NEXT_SORT_ORDER', $nextSortOrder);
     $viewer->assign('SORT_IMAGE', $sortImage);
     $viewer->assign('COLUMN_NAME', $orderBy);
     $viewer->assign('LISTVIEW_ENTRIES_COUNT', $noOfEntries);
     $viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
     $viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
     if (!$this->listViewCount) {
         $this->listViewCount = $listViewModel->getListViewCount();
     }
     $totalCount = $this->listViewCount;
     $pagingModel->set('totalCount', (int) $totalCount);
     $pageCount = $pagingModel->getPageCount();
     $startPaginFrom = $pagingModel->getStartPagingFrom();
     $viewer->assign('PAGE_COUNT', $pageCount);
     $viewer->assign('LISTVIEW_COUNT', $totalCount);
     $viewer->assign('START_PAGIN_FROM', $startPaginFrom);
 }