本文整理汇总了PHP中Vtiger_RecordStructure_Model::getInstanceFromRecordModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_RecordStructure_Model::getInstanceFromRecordModel方法的具体用法?PHP Vtiger_RecordStructure_Model::getInstanceFromRecordModel怎么用?PHP Vtiger_RecordStructure_Model::getInstanceFromRecordModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_RecordStructure_Model
的用法示例。
在下文中一共展示了Vtiger_RecordStructure_Model::getInstanceFromRecordModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleList = array('Calendar', 'Events');
$quickCreateContents = array();
foreach ($moduleList as $module) {
$info = array();
$recordModel = Vtiger_Record_Model::getCleanInstance($module);
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$info['recordStructureModel'] = $recordStructureInstance;
$info['recordStructure'] = $recordStructureInstance->getStructure();
$info['moduleModel'] = $moduleModel;
$quickCreateContents[$module] = $info;
}
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer = $this->getViewer($request);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('MODULE', $moduleName);
$viewer->assign('QUICK_CREATE_CONTENTS', $quickCreateContents);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->view('QuickCreate.tpl', $moduleName);
}
示例2: process
public function process(Vtiger_Request $request)
{
global $log;
$log->debug("Entering ./views/QuickCreateAjax.php::process");
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer = $this->getViewer($request);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('SCRIPTS', $this->getHeaderScripts($request));
$viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
$viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
echo $viewer->view('QuickCreate.tpl', $moduleName, true);
}
示例3: preProcess
function preProcess(Vtiger_Request $request)
{
parent::preProcess($request);
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$recordId = $request->get('record');
$page = $request->get('page');
$detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
$reportModel = $detailViewModel->getRecord();
$reportModel->setModule('Reports');
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $page);
$pagingModel->set('limit', self::REPORT_LIMIT);
$this->reportData = $reportModel->getReportData($pagingModel);
$this->calculationFields = $reportModel->getReportCalulationData();
$primaryModule = $reportModel->getPrimaryModule();
$secondaryModules = $reportModel->getSecondaryModules();
$primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
$permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
if (!$permission) {
$viewer->assign('MODULE', $primaryModule);
$viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
$viewer->view('OperationNotPermitted.tpl', $primaryModule);
exit;
}
$detailViewLinks = $detailViewModel->getDetailViewLinks();
// Advanced filter conditions
$viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
$viewer->assign('PRIMARY_MODULE', $primaryModule);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
$primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
$secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
$viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
$viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
$secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
$advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
} else {
$advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
}
$viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
$viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
$dateFilters = Vtiger_Field_Model::getDateFilterTypes();
foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
$comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
$comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
$comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
$dateFilters[$comparatorKey] = $comparatorInfo;
}
$viewer->assign('DATE_FILTERS', $dateFilters);
$viewer->assign('LINEITEM_FIELD_IN_CALCULATION', $reportModel->showLineItemFieldsInFilter(false));
$viewer->assign('DETAILVIEW_LINKS', $detailViewLinks);
$viewer->assign('REPORT_MODEL', $reportModel);
$viewer->assign('RECORD_ID', $recordId);
$viewer->assign('COUNT', count($this->reportData));
$viewer->assign('MODULE', $moduleName);
$viewer->view('ReportHeader.tpl', $moduleName);
}
示例4: showFieldLayout
public function showFieldLayout(Vtiger_Request $request)
{
$sourceModule = $request->get('sourceModule');
$menuModelsList = Vtiger_Module_Model::getQuickCreateModules();
if (empty($sourceModule)) {
//To get the first element
$firstElement = reset($menuModelsList);
$sourceModule = array($firstElement->get('name'));
} else {
$sourceModule = array($sourceModule);
}
$quickCreateContents = array();
if (in_array('Calendar', $sourceModule)) {
$sourceModule = array('Calendar', 'Events');
}
foreach ($sourceModule as $module) {
$recordModel = Vtiger_Record_Model::getCleanInstance($module);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$quickCreateContents[$module] = $recordStructureInstance->getStructure();
}
$qualifiedModule = $request->getModule(false);
$viewer = $this->getViewer($request);
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule[0]);
$viewer->assign('SUPPORTED_MODULES', $menuModelsList);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('RECORDS_STRUCTURE', $quickCreateContents);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModule);
$viewer->view('Index.tpl', $qualifiedModule);
}
示例5: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$record = $request->get('record');
if (!empty($record) && $request->get('isDuplicate') == true) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('MODE', '');
} else {
if (!empty($record)) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$viewer->assign('MODE', '');
$parentId = $request->get('parentId');
$parentModule = $request->get('parentModule');
if ($parentId && $parentModule === 'HelpDesk') {
$parentRecordModel = Vtiger_Record_Model::getInstanceById($parentId, $parentModule);
$recordModel = Faq_Record_Model::getInstanceFromHelpDesk($parentRecordModel);
}
}
}
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$viewMode = $request->get('view_mode');
if (!empty($viewMode)) {
$viewer->assign('VIEW_MODE', $viewMode);
}
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('MODULE', $moduleName);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('BLOCK_LIST', $moduleModel->getBlocks());
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$isRelationOperation = $request->get('relationOperation');
//if it is relation edit
$viewer->assign('IS_RELATION_OPERATION', $isRelationOperation);
if ($isRelationOperation) {
$viewer->assign('SOURCE_MODULE', $request->get('sourceModule'));
$viewer->assign('SOURCE_RECORD', $request->get('sourceRecord'));
}
$viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
$viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
$viewer->view('EditView.tpl', $moduleName);
}
示例6: process
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);
}
示例7: process
public function process(Vtiger_Request $request)
{
$adb = PearDatabase::getInstance();
// get min, max, allow_chars from vtiger_passwords_config
$result = $adb->query("SELECT * FROM vtiger_passwords_config WHERE 1 LIMIT 1", true);
$min = $adb->query_result($result, 0, 'pass_length_min');
$max = $adb->query_result($result, 0, 'pass_length_max');
$allow_chars = $adb->query_result($result, 0, 'pass_allow_chars');
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$recordStructure = $recordStructureInstance->getStructure();
$sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
foreach ($sourceRelatedField as $field => $value) {
if (isset($recordStructure[$field])) {
$fieldvalue = $recordStructure[$field]->get('fieldvalue');
if (empty($fieldvalue)) {
$recordStructure[$field]->set('fieldvalue', $value);
unset($sourceRelatedField[$field]);
}
}
}
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$relatedModule = 'OSSPasswords';
$viewer = $this->getViewer($request);
$viewer->assign('RELATEDMODULE', $relatedModule);
$viewer->assign('GENERATEPASS', 'Generate Password');
$viewer->assign('VIEW', $request->get('view'));
$viewer->assign('GENERATEONCLICK', 'generate_password(' . $min . ',' . $max . ',\'' . $allow_chars . '\'); return false;');
$viewer->assign('VALIDATE_STRINGS', vtranslate('Very Weak', $relatedModule) . ',' . vtranslate('Weak', $relatedModule) . ',' . vtranslate('Better', $relatedModule) . ',' . vtranslate('Medium', $relatedModule) . ',' . vtranslate('Strong', $relatedModule) . ',' . vtranslate('Very Strong', $relatedModule));
$viewer->assign('Very Weak', 'Very Weak');
$viewer->assign('Weak', 'Weak');
$viewer->assign('Better', 'Better');
$viewer->assign('Medium', 'Medium');
$viewer->assign('Strong', 'Strong');
$viewer->assign('Very Strong', 'Very Strong');
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructure);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('SCRIPTS', $this->getFooterScripts($request));
echo $viewer->view('QuickCreate.tpl', $moduleName, true);
}
示例8: preProcess
function preProcess(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$recordId = $request->get('record');
$this->record = $detailViewModel = Reports_DetailView_Model::getInstance($moduleName, $recordId);
parent::preProcess($request);
$reportModel = $detailViewModel->getRecord();
$reportModel->setModule('Reports');
$primaryModule = $reportModel->getPrimaryModule();
$secondaryModules = $reportModel->getSecondaryModules();
$primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
$permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
if (!$permission) {
$viewer->assign('MODULE', $primaryModule);
$viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
$viewer->view('OperationNotPermitted.tpl', $primaryModule);
exit;
}
$isAdmin = $currentUser->isAdminUser();
$viewer->assign('isAdmin', $isAdmin);
// Advanced filter conditions
$viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
$viewer->assign('PRIMARY_MODULE', $primaryModule);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
$primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
$secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
$viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
$viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
$secondaryModuleIsCalendar = strpos($secondaryModules, 'Calendar');
if ($primaryModule == 'Calendar' || $secondaryModuleIsCalendar !== FALSE) {
$advanceFilterOpsByFieldType = Calendar_Field_Model::getAdvancedFilterOpsByFieldType();
} else {
$advanceFilterOpsByFieldType = Vtiger_Field_Model::getAdvancedFilterOpsByFieldType();
}
$viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
$viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', $advanceFilterOpsByFieldType);
$dateFilters = Vtiger_Field_Model::getDateFilterTypes();
foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
$comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
$comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
$comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $moduleName);
$dateFilters[$comparatorKey] = $comparatorInfo;
}
$reportChartModel = Reports_Chart_Model::getInstanceById($reportModel);
$viewer->assign('PRIMARY_MODULE_FIELDS', $reportModel->getPrimaryModuleFieldsForAdvancedReporting());
$viewer->assign('SECONDARY_MODULE_FIELDS', $reportModel->getSecondaryModuleFieldsForAdvancedReporting());
$viewer->assign('CALCULATION_FIELDS', $reportModel->getModuleCalculationFieldsForReport());
$viewer->assign('DATE_FILTERS', $dateFilters);
$viewer->assign('REPORT_MODEL', $reportModel);
$viewer->assign('RECORD', $recordId);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('CHART_MODEL', $reportChartModel);
$viewer->view('ChartReportHeader.tpl', $moduleName);
}
示例9: showModuleSummaryView
public function showModuleSummaryView($request)
{
$recordId = $request->get('record');
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$recordStrucure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_SUMMARY);
$viewer = $this->getViewer($request);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('IS_AJAX_ENABLED', $this->isAjaxEnabled($recordModel));
$viewer->assign('SUMMARY_INFORMATION', $recordModel->getSummaryInfo());
$viewer->assign('SUMMARY_RECORD_STRUCTURE', $recordStrucure->getStructure());
$viewer->assign('MODULE_NAME', $moduleName);
return $viewer->view('ModuleSummaryView.tpl', $moduleName, true);
}
示例10: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleList = ['Calendar', 'Events'];
$quickCreateContents = [];
foreach ($moduleList as $module) {
$info = [];
$recordModel = Vtiger_Record_Model::getCleanInstance($module);
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$recordStructure = $recordStructureInstance->getStructure();
$sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
foreach ($sourceRelatedField as $field => $value) {
if (isset($recordStructure[$field])) {
$fieldvalue = $recordStructure[$field]->get('fieldvalue');
if (empty($fieldvalue)) {
$recordStructure[$field]->set('fieldvalue', $value);
unset($sourceRelatedField[$field]);
}
}
}
$info['recordStructureModel'] = $recordStructureInstance;
$info['recordStructure'] = $recordStructure;
$info['moduleModel'] = $moduleModel;
$quickCreateContents[$module] = $info;
}
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer = $this->getViewer($request);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('SOURCE_RELATED_FIELD', $sourceRelatedField);
$viewer->assign('PREVIOUSDATE', date('Y-n-j', strtotime('yesterday')));
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('NEXTDATE', date('Y-n-j', strtotime('tomorrow')));
$viewer->assign('MODULE', $moduleName);
$viewer->assign('QUICK_CREATE_CONTENTS', $quickCreateContents);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('SCRIPTS', $this->getFooterScripts($request));
$viewer->view('QuickCreate.tpl', $moduleName);
}
示例11: process
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);
}
示例12: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$id = $request->get('record');
$recordModel = Vtiger_DetailView_Model::getInstance($moduleName, $id)->getRecord();
$recordStrucure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_DETAIL);
$structuredValues = $recordStrucure->getStructure();
$viewer = $this->getViewer($request);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('RECORD_STRUCTURE', $structuredValues);
$viewer->assign('RESTRICTS_ITEM', ['PLL_DISCARDED', 'PLL_ACCEPTED']);
$this->preProcess($request);
$viewer->view('Modal.tpl', $moduleName);
$this->postProcess($request);
}
示例13: process
public function process(Vtiger_Request $request)
{
$primaryModule = $request->get('primodule');
$secondaryModules = $request->get('secmodule');
$record = $request->get('record');
$reportModel = Reports_Record_Model::getCleanInstance($record);
/*if (!empty($record)) {
$viewer->assign('SELECTED_STANDARD_FILTER_FIELDS', $reportModel->getSelectedStandardFilter());
$viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
}*/
$reportModel->setPrimaryModule($primaryModule);
if (!empty($secondaryModules)) {
$reportModel->setSecondaryModule($secondaryModules);
}
$viewer = $this->getViewer($request);
$viewer->assign('SELECTED_ADVANCED_FILTER_FIELDS', $reportModel->transformToNewAdvancedFilter());
$viewer->assign('PRIMARY_MODULE', $primaryModule);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($reportModel);
$primaryModuleRecordStructure = $recordStructureInstance->getPrimaryModuleRecordStructure();
$secondaryModuleRecordStructures = $recordStructureInstance->getSecondaryModuleRecordStructure();
$viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $primaryModuleRecordStructure);
$viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $secondaryModuleRecordStructures);
//$viewer->assign('PRIMARY_MODULE_RECORD_STRUCTURE', $reportModel->getPrimaryModuleRecordStructure());
//$viewer->assign('SECONDARY_MODULE_RECORD_STRUCTURES', $reportModel->getSecondaryModuleRecordStructure());
$viewer->assign('ADVANCED_FILTER_OPTIONS', Vtiger_Field_Model::getAdvancedFilterOptions());
$viewer->assign('ADVANCED_FILTER_OPTIONS_BY_TYPE', Vtiger_Field_Model::getAdvancedFilterOpsByFieldType());
$dateFilters = Vtiger_Field_Model::getDateFilterTypes();
foreach ($dateFilters as $comparatorKey => $comparatorInfo) {
$comparatorInfo['startdate'] = DateTimeField::convertToUserFormat($comparatorInfo['startdate']);
$comparatorInfo['enddate'] = DateTimeField::convertToUserFormat($comparatorInfo['enddate']);
$comparatorInfo['label'] = vtranslate($comparatorInfo['label'], $module);
$dateFilters[$comparatorKey] = $comparatorInfo;
}
$viewer->assign('DATE_FILTERS', $dateFilters);
echo $viewer->view('BlockFilters.tpl', 'PDFMaker', true);
/*
$content = $viewer->view('BlockFilters.tpl', 'PDFMaker',true);
echo "aaaaaaaaa";
/*
$response = new Vtiger_Response();
$response->setResult($content);
$response->emit();
*/
}
示例14: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$dayStartPicklistValues = Users_Record_Model::getDayStartsPicklistValues($recordStructureInstance->getStructure());
$viewer = $this->getViewer($request);
$viewer->assign("DAY_STARTS", Zend_Json::encode($dayStartPicklistValues));
$viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails());
$viewer->assign('TAG_CLOUD', $recordModel->getTagCloudStatus());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
parent::process($request);
}
示例15: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$moduleModel = $recordModel->getModule();
$fieldList = $moduleModel->getFields();
$requestFieldList = array_intersect_key($request->getAll(), $fieldList);
foreach ($requestFieldList as $fieldName => $fieldValue) {
$fieldModel = $fieldList[$fieldName];
if ($fieldModel->isEditable()) {
$recordModel->set($fieldName, $fieldModel->getDBInsertValue($fieldValue));
}
}
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_QUICKCREATE);
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($moduleName);
$viewer = $this->getViewer($request);
$viewer->assign('PICKIST_DEPENDENCY_DATASOURCE', Zend_Json::encode($picklistDependencyDatasource));
$recordStructure = $recordStructureInstance->getStructure();
$mappingRelatedField = $moduleModel->getMappingRelatedField($moduleName);
$sourceRelatedField = $moduleModel->getValuesFromSource($moduleName, $request->get('sourceModule'), $request->get('sourceRecord'));
foreach ($sourceRelatedField as $field => &$value) {
if (isset($recordStructure[$field])) {
$fieldvalue = $recordStructure[$field]->get('fieldvalue');
if (empty($fieldvalue)) {
$recordStructure[$field]->set('fieldvalue', $value);
unset($sourceRelatedField[$field]);
}
}
}
$viewer->assign('MAPPING_RELATED_FIELD', Zend_Json::encode($mappingRelatedField));
$viewer->assign('SOURCE_RELATED_FIELD', $sourceRelatedField);
$viewer->assign('CURRENTDATE', date('Y-n-j'));
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SINGLE_MODULE', 'SINGLE_' . $moduleName);
$viewer->assign('MODULE_MODEL', $moduleModel);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructure);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('VIEW', $request->get('view'));
$viewer->assign('SCRIPTS', $this->getFooterScripts($request));
$viewer->assign('MAX_UPLOAD_LIMIT_MB', Vtiger_Util_Helper::getMaxUploadSize());
$viewer->assign('MAX_UPLOAD_LIMIT', vglobal('upload_maxsize'));
echo $viewer->view('QuickCreate.tpl', $moduleName, true);
}