public function process(Vtiger_Request $request) { $viewer = $this->getViewer($request); $moduleName = $request->getModule(); $qualifiedModuleName = $request->getModule(false); $configDetail = Settings_GravityForm_Module_Model::fetchConfig(); $viewer->assign('CONFIG', $configDetail); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('MODULE', $moduleName); echo $viewer->view('Configure.tpl', $qualifiedModuleName, true); }
public function process(Vtiger_Request $request) { $qualifiedModuleName = $request->getModule(false); $viewer = $this->getViewer($request); $formid = $request->get('formid'); $viewer->assign('FORMID', $formid); $viewer->assign('MODULE_MODEL', Settings_GravityForm_Mapping_Model::getInstance($formid, TRUE)); $viewer->assign('LEADS_MODULE_MODEL', Settings_Leads_Module_Model::getInstance('Leads')); $viewer->assign('GRAVITY_MODULE_MODEL', Settings_GravityForm_Module_Model::getGravityFields($formid)); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->view('GravityFieldMappingEdit.tpl', $qualifiedModuleName); }
public function process(Vtiger_Request $request) { $module = $request->get('module'); $qualifiedModuleName = $request->getModule(false); $response = new Vtiger_Response(); try { $result = Settings_GravityForm_Module_Model::save($request); $response->setResult(array('success' => $result)); } catch (Exception $e) { $response->setError($e->getCode(), $e->getMessage()); } $response->emit(); }
public function process(Vtiger_Request $request) { $db = PearDatabase::getInstance(); //result array to send as json response $result = array(); $moduleName = $request->getModule(); $moduleModel = Settings_GravityForm_Module_Model::getInstance($moduleName); $moduleModel->set('url', $request->get('url')); $moduleModel->set('api_key', $request->get('api_key')); $moduleModel->set('private_key', $request->get('private_key')); $moduleModel->save_config($request); $result['success'] = true; $response = new Vtiger_Response(); $response->setEmitType(Vtiger_Response::$EMIT_JSON); $response->setResult($result); $response->emit(); }
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); } }