本文整理汇总了PHP中Vtiger_RecordStructure_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_RecordStructure_Model类的具体用法?PHP Vtiger_RecordStructure_Model怎么用?PHP Vtiger_RecordStructure_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_RecordStructure_Model类的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: getStructure
/**
* Function to get the values in stuctured format
* @return <array> - values in structure array('block'=>array(fieldinfo));
*/
public function getStructure($moduleName)
{
if (!empty($this->structuredValues[$moduleName])) {
return $this->structuredValues[$moduleName];
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if ($moduleName === 'Emails') {
$restrictedTablesList = array('vtiger_emaildetails', 'vtiger_attachments');
$moduleRecordStructure = array();
$blockModelList = $moduleModel->getBlocks();
foreach ($blockModelList as $blockLabel => $blockModel) {
$fieldModelList = $blockModel->getFields();
if (!empty($fieldModelList)) {
$moduleRecordStructure[$blockLabel] = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
if (!in_array($fieldModel->get('table'), $restrictedTablesList) && $fieldModel->isViewable()) {
$moduleRecordStructure[$blockLabel][$fieldName] = $fieldModel;
}
}
}
}
} else {
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$moduleRecordStructure = $recordStructureInstance->getStructure();
}
$this->structuredValues[$moduleName] = $moduleRecordStructure;
return $moduleRecordStructure;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
$moduleName = $request->get('for_module');
$cvId = $request->get('viewname');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
if (empty($orderBy) && empty($sortOrder)) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$orderBy = $moduleInstance->default_order_by;
$sortOrder = $moduleInstance->default_sort_order;
}
if ($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
} else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
if (empty($pageNumber)) {
$pageNumber = '1';
}
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$listViewModel = Import_ListView_Model::getInstance($moduleName, $cvId);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
if (!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
if (!$this->listViewEntries) {
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
$noOfEntries = count($this->listViewEntries);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
$viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$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());
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: showAdvancedSearch
/**
* Function to display the UI for advance search on any of the module
* @param Vtiger_Request $request
*/
function showAdvancedSearch(Vtiger_Request $request)
{
//Modules for which search is excluded
$excludedModuleForSearch = array('Vtiger', 'Reports');
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
if ($request->get('source_module')) {
$moduleName = $request->get('source_module');
}
$saveFilterPermitted = true;
$saveFilterexcludedModules = array('ModComments', 'RSS', 'Portal', 'Integration', 'PBXManager', 'DashBoard');
if (in_array($moduleName, $saveFilterexcludedModules)) {
$saveFilterPermitted = false;
}
//See if it is an excluded module, If so search in home module
if (in_array($moduleName, $excludedModuleForSearch)) {
$moduleName = 'Home';
}
$module = $request->getModule();
$customViewModel = new CustomView_Record_Model();
$customViewModel->setModule($moduleName);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
$viewer->assign('SEARCHABLE_MODULES', Vtiger_Module_Model::getSearchableModules());
$viewer->assign('CUSTOMVIEW_MODEL', $customViewModel);
if ($moduleName == 'Calendar') {
$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('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
$viewer->assign('SOURCE_MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE_MODEL', $moduleModel);
$viewer->assign('MODULE', $module);
$viewer->assign('SAVE_FILTER_PERMITTED', $saveFilterPermitted);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
echo $viewer->view('AdvanceSearch.tpl', $moduleName, true);
}
示例15: 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);
}