public function process(Vtiger_Request $request) { $recordId = $request->get('record'); $qualifiedModuleName = $request->getModule(false); $mode = ''; $selectedFieldsList = $allFieldsList = array(); if ($recordId) { $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName); $selectedFieldsList = $recordModel->getSelectedFieldsList(); $allFieldsList = $recordModel->getAllFieldsList(); $sourceModule = $recordModel->get('targetmodule'); $mode = 'edit'; } else { $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName); $sourceModule = $request->get('sourceModule'); if (!$sourceModule) { $sourceModule = reset(array_keys(Settings_Webforms_Module_Model::getSupportedModulesList())); } $allFieldsList = $recordModel->getAllFieldsList($sourceModule); } $recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT); $viewer = $this->getViewer($request); $viewer->assign('MODE', $mode); $viewer->assign('RECORD_ID', $recordId); $viewer->assign('RECORD_MODEL', $recordModel); $viewer->assign('MODULE', $qualifiedModuleName); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('SOURCE_MODULE', $sourceModule); $viewer->assign('ALL_FIELD_MODELS_LIST', $allFieldsList); $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList); $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructure); $viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure()); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->view('EditView.tpl', $qualifiedModuleName); }
/** * Function to get Picklist values * @return <Array> Picklist values */ public function getPicklistValues() { if ($this->getName() === 'targetmodule') { return Settings_Webforms_Module_Model::getsupportedModulesList(); } return array(); }
public function process(Vtiger_Request $request) { $recordId = $request->get('record'); $qualifiedModuleName = $request->getModule(false); $mode = ''; $selectedFieldsList = $allFieldsList = array(); $viewer = $this->getViewer($request); $supportedModules = Settings_Webforms_Module_Model::getSupportedModulesList(); if ($recordId) { $recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName); $selectedFieldsList = $recordModel->getSelectedFieldsList(); $sourceModule = $recordModel->get('targetmodule'); $mode = 'edit'; } else { $recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName); $sourceModule = $request->get('sourceModule'); if (!$sourceModule) { $sourceModule = reset(array_keys($supportedModules)); } $recordModel->set('targetmodule', $sourceModule); } if (!$supportedModules[$sourceModule]) { $message = vtranslate('LBL_ENABLE_TARGET_MODULES_FOR_WEBFORM', $qualifiedModuleName); $viewer->assign('MESSAGE', $message); $viewer->view('OperationNotPermitted.tpl', 'Vtiger'); return false; } $moduleModel = $recordModel->getModule(); $allFieldsList = $recordModel->getAllFieldsList($sourceModule); $recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT); $viewer->assign('MODE', $mode); $viewer->assign('RECORD_ID', $recordId); $viewer->assign('RECORD_MODEL', $recordModel); $viewer->assign('MODULE', $qualifiedModuleName); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('BLOCK_LIST', $moduleModel->getBlocks()); $viewer->assign('SOURCE_MODULE', $sourceModule); $viewer->assign('ALL_FIELD_MODELS_LIST', $allFieldsList); $viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList); $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructure); $viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure()); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->view('EditView.tpl', $qualifiedModuleName); }
/** * Function to get Settings links * @return <Array> */ public function getSettingLinks() { if (!$this->isEntityModule()) { return array(); } vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php'); $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif'); $editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png'); $settingsLinks = array(); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_FIELDS', 'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_WORKFLOWS', 'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->getName(), 'linkicon' => $editWorkflowsImagePath); } $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_PICKLIST_VALUES', 'linkurl' => 'index.php?parent=Settings&module=Picklist&view=Index&source_module=' . $this->getName(), 'linkicon' => ''); if ($this->hasSequenceNumberField()) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_MODULE_SEQUENCE_NUMBERING', 'linkurl' => 'index.php?parent=Settings&module=Vtiger&view=CustomRecordNumbering&sourceModule=' . $this->getName(), 'linkicon' => ''); } $webformSupportedModule = Settings_Webforms_Module_Model::getSupportedModulesList(); if (array_key_exists($this->getName(), $webformSupportedModule)) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_SETUP_WEBFORMS', 'linkurl' => 'index.php?module=Webforms&parent=Settings&view=Edit&sourceModule=' . $this->getName(), 'linkicon' => ''); } return $settingsLinks; }
/** * Function to get Settings links * @return <Array> */ public function getSettingLinks() { if (!$this->isEntityModule()) { return array(); } vimport('~~modules/com_vtiger_workflow/VTWorkflowUtils.php'); $layoutEditorImagePath = Vtiger_Theme::getImagePath('LayoutEditor.gif'); $editWorkflowsImagePath = Vtiger_Theme::getImagePath('EditWorkflows.png'); $settingsLinks = array(); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_FIELDS', 'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_ARRANGE_RELATED_TABS', 'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&mode=showRelatedListLayout&block=2&fieldid=41&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_QUICK_CREATE_EDITOR', 'linkurl' => 'index.php?parent=Settings&module=QuickCreateEditor&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_TREES_MANAGER', 'linkurl' => 'index.php?parent=Settings&module=TreesManager&view=List&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_WIDGETS_MANAGMENT', 'linkurl' => 'index.php?parent=Settings&module=Widgets&view=Index&sourceModule=' . $this->getName(), 'linkicon' => $layoutEditorImagePath); if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_WORKFLOWS', 'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->getName(), 'linkicon' => $editWorkflowsImagePath); } $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_EDIT_PICKLIST_VALUES', 'linkurl' => 'index.php?parent=Settings&module=Picklist&view=Index&source_module=' . $this->getName(), 'linkicon' => ''); $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_PICKLIST_DEPENDENCY', 'linkurl' => 'index.php?parent=Settings&module=PickListDependency&view=List&formodule=' . $this->getName(), 'linkicon' => ''); if ($this->hasSequenceNumberField()) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_MODULE_SEQUENCE_NUMBERING', 'linkurl' => 'index.php?parent=Settings&module=Vtiger&view=CustomRecordNumbering&sourceModule=' . $this->getName(), 'linkicon' => ''); } $webformSupportedModule = Settings_Webforms_Module_Model::getSupportedModulesList(); if (array_key_exists($this->getName(), $webformSupportedModule)) { $settingsLinks[] = array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'LBL_SETUP_WEBFORMS', 'linkurl' => 'index.php?module=Webforms&parent=Settings&view=Edit&sourceModule=' . $this->getName(), 'linkicon' => ''); } return $settingsLinks; }