本文整理汇总了PHP中Vtiger_Field_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field_Model类的具体用法?PHP Vtiger_Field_Model怎么用?PHP Vtiger_Field_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Field_Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleEvent
function handleEvent($eventName, $entityData)
{
if (in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
$fields = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($entityData['sourceModule'], $entityData['destinationModule']);
foreach ($fields as $field) {
$fieldModel = new Vtiger_Field_Model();
$fieldModel->initialize($field);
$UITypeModel = $fieldModel->getUITypeModel();
if ($eventName == 'vtiger.entity.link.after') {
$UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
} elseif ($eventName == 'vtiger.entity.unlink.after') {
$UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
}
}
} else {
if ($eventName == 'vtiger.entity.aftersave.final') {
$db = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$modules = Vtiger_MultiReferenceValue_UIType::getRelatedModules($moduleName);
foreach ($modules as $module) {
$db->insert('s_yf_multireference', ['source_module' => $module, 'dest_module' => $moduleName, 'lastid' => $entityData->getId(), 'type' => 1]);
}
}
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:25,代码来源:MultiReferenceUpdater.php
示例2: getInstanceFromField
/**
* Static function to get the UIType object from Vtiger Field Model
* @param Vtiger_Field_Model $fieldModel
* @return Vtiger_Base_UIType or UIType specific object instance
*/
public static function getInstanceFromField($fieldModel)
{
$fieldDataType = $fieldModel->getFieldDataType();
$uiTypeClassSuffix = ucfirst($fieldDataType);
$moduleName = $fieldModel->getModuleName();
$moduleSpecificUiTypeClassName = $moduleName . '_' . $uiTypeClassSuffix . '_UIType';
$uiTypeClassName = 'Vtiger_' . $uiTypeClassSuffix . '_UIType';
$fallBackClassName = 'Vtiger_Base_UIType';
$moduleSpecificFileName = 'modules.' . $moduleName . '.uitypes.' . $uiTypeClassSuffix;
$uiTypeClassFileName = 'modules.Vtiger.uitypes.' . $uiTypeClassSuffix;
$moduleSpecificFilePath = Vtiger_Loader::resolveNameToPath($moduleSpecificFileName);
$completeFilePath = Vtiger_Loader::resolveNameToPath($uiTypeClassFileName);
if (file_exists($moduleSpecificFilePath)) {
$instance = new $moduleSpecificUiTypeClassName();
} else if (file_exists($completeFilePath)) {
$instance = new $uiTypeClassName();
} else {
$instance = new $fallBackClassName();
}
$instance->set('field', $fieldModel);
return $instance;
}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:30,代码来源:Base.php
示例3: getHeaders
public function getHeaders()
{
$headerFields = parent::getHeaders();
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$headerFields['listprice'] = $field;
return $headerFields;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:11,代码来源:RelationListView.php
示例4: getCommentFieldsListForTasks
/**
* Function to get comment fields list which are useful in tasks
* @param <Vtiger_Module_Model> $moduleModel
* @return <Array> list of Field models <Vtiger_Field_Model>
*/
public static function getCommentFieldsListForTasks($moduleModel)
{
$commentsFieldsInfo = array('lastComment' => 'Last Comment', 'last5Comments' => 'Last 5 Comments', 'allComments' => 'All Comments');
$commentFieldModelsList = array();
foreach ($commentsFieldsInfo as $fieldName => $fieldLabel) {
$commentField = new Vtiger_Field_Model();
$commentField->setModule($moduleModel);
$commentField->set('name', $fieldName);
$commentField->set('label', $fieldLabel);
$commentFieldModelsList[$fieldName] = $commentField;
}
return $commentFieldModelsList;
}
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:18,代码来源:Field.php
示例5: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$recordModel = $this->record;
if (!$recordModel) {
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
}
$this->record = $recordModel;
}
$viewer = $this->getViewer($request);
$viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails());
$salutationFieldModel = Vtiger_Field_Model::getInstance('salutationtype', $recordModel->getModule());
// Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7851
$salutationType = $request->get('salutationtype');
if (!empty($salutationType)) {
$salutationFieldModel->set('fieldvalue', $request->get('salutationtype'));
} else {
$salutationFieldModel->set('fieldvalue', $recordModel->get('salutationtype'));
}
$viewer->assign('SALUTATION_FIELD_MODEL', $salutationFieldModel);
parent::process($request);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:Edit.php
示例6: save
public function save(Vtiger_Request $request)
{
$fieldId = $request->get('fieldid');
$fieldInstance = Vtiger_Field_Model::getInstance($fieldId);
$fields = ['presence', 'quickcreate', 'summaryfield', 'helpinfo', 'generatedtype', 'masseditable', 'displaytype'];
foreach ($request->getAll() as $key => $value) {
if ($key == 'mandatory') {
$fieldInstance->updateTypeofDataFromMandatory($value);
}
if (in_array($key, $fields)) {
$fieldInstance->set($key, $value);
}
}
$defaultValue = $request->get('fieldDefaultValue');
if ($fieldInstance->getFieldDataType() == 'date') {
$dateInstance = new Vtiger_Date_UIType();
$defaultValue = $dateInstance->getDBInsertedValue($defaultValue);
}
if ($request->has('fieldMask')) {
$fieldInstance->set('fieldparams', $request->get('fieldMask'));
}
if (is_array($defaultValue)) {
$defaultValue = implode(' |##| ', $defaultValue);
}
$fieldInstance->set('defaultvalue', $defaultValue);
$response = new Vtiger_Response();
try {
$fieldInstance->save();
$response->setResult(array('success' => true, 'presence' => $request->get('presence'), 'mandatory' => $fieldInstance->isMandatory(), 'label' => vtranslate($fieldInstance->get('label'), $request->get('sourceModule'))));
} catch (Exception $e) {
$response->setError($e->getCode(), $e->getMessage());
}
$response->emit();
}
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:34,代码来源:Field.php
示例7: process
public function process(Vtiger_Request $request)
{
$qualifiedModuleName = $request->getModule(false);
$moduleName = $request->getModule();
$baseModule = $request->get('base_module');
$idTpl = $request->get('tpl_id');
$viewer = $this->getViewer($request);
if ($idTpl && $baseModule != 'All') {
$docInfo = Settings_DataAccess_Module_Model::getDataAccessInfo($idTpl);
$viewer->assign('BASE_INFO', $docInfo['basic_info']);
for ($i = 0; $i < count($docInfo['required_conditions']); $i++) {
$fieldModel = Vtiger_Field_Model::getInstance($docInfo['required_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
$docInfo['required_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
}
$viewer->assign('REQUIRED_CONDITIONS', $docInfo['required_conditions']);
for ($i = 0; $i < count($docInfo['optional_conditions']); $i++) {
$fieldModel = Vtiger_Field_Model::getInstance($docInfo['optional_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
$docInfo['optional_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
}
$viewer->assign('OPTIONAL_CONDITIONS', $docInfo['optional_conditions']);
$viewer->assign('TPL_ID', $idTpl);
}
$viewer->assign('STEP', 2);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('REQUEST', $request);
$viewer->assign('SUMMARY', $request->get('summary'));
$viewer->assign('BASE_MODULE', $baseModule);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('FIELD_LIST', Settings_DataAccess_Module_Model::getListBaseModuleField($baseModule));
$viewer->assign('CONDITION_BY_TYPE', Settings_DataAccess_Module_Model::getConditionByType());
echo $viewer->view('Step2.tpl', $qualifiedModuleName, true);
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:32,代码来源:Step2.php
示例8: process
public function process(Vtiger_Request $request)
{
$moduleSettingsName = $request->getModule(false);
$moduleName = $request->getModule();
$baseModule = $request->get('module_name');
$idTpl = $request->get('tpl_id');
$viewer = $this->getViewer($request);
if ($idTpl) {
$docInfo = Settings_OSSDocumentControl_Module_Model::getDocInfo($idTpl);
$viewer->assign('BASE_INFO', $docInfo['basic_info']);
//var_dump($docInfo['required_conditions']);
for ($i = 0; $i < count($docInfo['required_conditions']); $i++) {
$fieldModel = Vtiger_Field_Model::getInstance($docInfo['required_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
$docInfo['required_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
}
$viewer->assign('REQUIRED_CONDITIONS', $docInfo['required_conditions']);
for ($i = 0; $i < count($docInfo['optional_conditions']); $i++) {
$fieldModel = Vtiger_Field_Model::getInstance($docInfo['optional_conditions'][$i]['fieldname'], Vtiger_Module_Model::getInstance($baseModule));
$docInfo['optional_conditions'][$i]['info'] = $fieldModel->getFieldInfo();
}
$viewer->assign('OPTIONAL_CONDITIONS', $docInfo['optional_conditions']);
$viewer->assign('TPL_ID', $idTpl);
//$fieldModel = Vtiger_Field_Model::getInstance($value->get('name'), $baseModuleModel);
}
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('SUMMARY', $request->get('summary'));
$viewer->assign('BASE_MODULE', $baseModule);
$viewer->assign('QUALIFIED_MODULE', $moduleSettingsName);
$viewer->assign('FIELD_LIST', Settings_OSSDocumentControl_Module_Model::getListBaseModuleField($baseModule));
//$viewer->assign('FOLDER_LIST', Documents_Module_Model::getAllFolders());
$viewer->assign('CONDITION_BY_TYPE', Settings_OSSDocumentControl_Module_Model::getConditionByType());
echo $viewer->view('Edit2.tpl', $moduleSettingsName, true);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:33,代码来源:Edit2.php
示例9: process
function process(Vtiger_Request $request)
{
$currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$viewer = $this->getViewer($request);
$recordId = $request->get('record');
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$moduleModel = $recordModel->getModule();
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('CONVERT_LEAD_FIELDS', $recordModel->getConvertLeadFields());
$assignedToFieldModel = $moduleModel->getField('assigned_user_id');
$assignedToFieldModel->set('fieldvalue', $recordModel->get('assigned_user_id'));
$viewer->assign('ASSIGN_TO', $assignedToFieldModel);
$potentialModuleModel = Vtiger_Module_Model::getInstance('Potentials');
$accountField = Vtiger_Field_Model::getInstance('related_to', $potentialModuleModel);
$contactField = Vtiger_Field_Model::getInstance('contact_id', $potentialModuleModel);
$viewer->assign('ACCOUNT_FIELD_MODEL', $accountField);
$viewer->assign('CONTACT_FIELD_MODEL', $contactField);
$contactsModuleModel = Vtiger_Module_Model::getInstance('Contacts');
$accountField = Vtiger_Field_Model::getInstance('parent_id', $contactsModuleModel);
$viewer->assign('CONTACT_ACCOUNT_FIELD_MODEL', $accountField);
$state = Settings_Leads_ConvertToAccount_Model::getState();
$viewer->assign('STATE', $state);
$viewer->view('ConvertLead.tpl', $moduleName);
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:28,代码来源:ConvertLead.php
示例10: getPopupViewFieldsList
/**
* Funtion that returns fields that will be showed in the record selection popup
* @return <Array of fields>
*/
public function getPopupViewFieldsList($sourceModule = false)
{
if (!empty($sourceModule)) {
$parentRecordModel = Vtiger_Module_Model::getInstance($sourceModule);
$relationModel = Vtiger_Relation_Model::getInstance($parentRecordModel, $this);
}
$popupFields = array();
if ($relationModel) {
$popupFields = $relationModel->getRelationFields(true);
}
if (count($popupFields) == 0) {
$popupFileds = $this->getSummaryViewFieldsList();
foreach ($popupFileds as $fieldName => $fieldModel) {
if ($fieldName === 'folderid' || $fieldName === 'modifiedtime') {
unset($popupFileds[$fieldName]);
}
}
$reqPopUpFields = array('File Status' => 'filestatus', 'File Size' => 'filesize', 'File Location Type' => 'filelocationtype');
foreach ($reqPopUpFields as $fieldLabel => $fieldName) {
$fieldModel = Vtiger_Field_Model::getInstance($fieldName, $this);
if ($fieldModel->getPermissions('readwrite')) {
$popupFileds[$fieldName] = $fieldModel;
}
}
$popupFields = array_keys($popupFileds);
}
return $popupFields;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:32,代码来源:Module.php
示例11: getListViewEntries
/**
* Function to get the list view entries
* @param Vtiger_Paging_Model $pagingModel
* @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance.
*/
public function getListViewEntries($pagingModel)
{
$db = PearDatabase::getInstance();
$module = $this->getModule();
$moduleName = $module->getName();
$parentModuleName = $module->getParentName();
$qualifiedModuleName = $moduleName;
if (!empty($parentModuleName)) {
$qualifiedModuleName = $parentModuleName . ':' . $qualifiedModuleName;
}
$recordModelClass = Vtiger_Loader::getComponentClassName('Model', 'Record', $qualifiedModuleName);
$listQuery = $this->getBasicListQuery();
$startIndex = $pagingModel->getStartIndex();
$pageLimit = $pagingModel->getPageLimit();
$orderBy = $this->getForSql('orderby');
if (!empty($orderBy) && $orderBy === 'smownerid') {
$fieldModel = Vtiger_Field_Model::getInstance('assigned_user_id', $moduleModel);
if ($fieldModel->getFieldDataType() == 'owner') {
$orderBy = 'COALESCE(' . getSqlForNameInDisplayFormat(['first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'], 'Users') . ',vtiger_groups.groupname)';
}
}
if (!empty($orderBy)) {
$listQuery .= ' ORDER BY ' . $orderBy . ' ' . $this->getForSql('sortorder');
}
if ($module->isPagingSupported()) {
$nextListQuery = $listQuery . ' LIMIT ' . ($startIndex + $pageLimit) . ',1';
$listQuery .= " LIMIT $startIndex, $pageLimit";
}
$listResult = $db->pquery($listQuery, array());
$noOfRecords = $db->num_rows($listResult);
$listViewRecordModels = array();
for ($i = 0; $i < $noOfRecords; ++$i) {
$row = $db->query_result_rowdata($listResult, $i);
$record = new $recordModelClass();
$record->setData($row);
if (method_exists($record, 'getModule') && method_exists($record, 'setModule')) {
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
$record->setModule($moduleModel);
}
$listViewRecordModels[$record->getId()] = $record;
}
if ($module->isPagingSupported()) {
$pagingModel->calculatePageRange($listViewRecordModels);
$nextPageResult = $db->pquery($nextListQuery, array());
$nextPageNumRows = $db->num_rows($nextPageResult);
if ($nextPageNumRows <= 0) {
$pagingModel->set('nextPageExists', false);
}
}
return $listViewRecordModels;
}
开发者ID:rubichcube,项目名称:YetiForceCRM,代码行数:65,代码来源:ListView.php
示例12: 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);
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:60,代码来源:Detail.php
示例13: handleEvent
function handleEvent($eventName, $entityData)
{
if (!in_array($eventName, ['vtiger.entity.link.after', 'vtiger.entity.unlink.after'])) {
return;
}
$fields = Vtiger_MultiReferenceValue_UIType::getMultiReferenceValueFields($entityData['sourceModule'], $entityData['destinationModule']);
foreach ($fields as $field) {
$fieldModel = new Vtiger_Field_Model();
$fieldModel->initialize($field);
$UITypeModel = $fieldModel->getUITypeModel();
if ($eventName == 'vtiger.entity.link.after') {
$UITypeModel->addValue($entityData['CRMEntity'], $entityData['sourceRecordId'], $entityData['destinationRecordId']);
} elseif ($eventName == 'vtiger.entity.unlink.after') {
$UITypeModel->removeValue(CRMEntity::getInstance($entityData['sourceModule']), $entityData['sourceRecordId'], $entityData['destinationRecordId']);
}
}
}
开发者ID:noclav,项目名称:UpdatePackages,代码行数:17,代码来源:MultiReferenceUpdater.php
示例14: getInstance
/**
* Function to get instance
* @param <String> $value - fieldname or fieldid
* @param <type> $module - optional - module instance
* @return <Vtiger_Field_Model>
*/
public static function getInstance($value, $module = false)
{
$fieldObject = parent::getInstance($value, $module);
if ($fieldObject) {
return self::getInstanceFromFieldObject($fieldObject);
}
return false;
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:14,代码来源:Field.php
示例15: getHeaders
public function getHeaders()
{
$relationModel = $this->getRelationModel();
$relatedModuleModel = $relationModel->getRelationModuleModel();
$headerFieldNames = $relatedModuleModel->getRelatedListFields();
$headerFields = array();
foreach ($headerFieldNames as $fieldName) {
$headerFields[$fieldName] = $relatedModuleModel->getField($fieldName);
}
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
array_push($headerFields, $field);
return $headerFields;
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:17,代码来源:RelationListView.php
示例16: 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);
}
开发者ID:wsLapshin,项目名称:charter_crm,代码行数:57,代码来源:ChartDetail.php
示例17: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$salutationFieldModel = Vtiger_Field_Model::getInstance('salutationtype', $moduleModel);
$viewer->assign('SALUTATION_FIELD_MODEL', $salutationFieldModel);
parent::process($request);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:9,代码来源:QuickCreateAjax.php
示例18: searchEmails
/**
* Function to search emails for send email
* @param <String> $searchValue
* @return <Array> Result of searched emails
*/
public function searchEmails($searchValue)
{
$emailsResult = array();
$db = PearDatabase::getInstance();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$emailSupportedModulesList = $this->getEmailRelatedModules();
foreach ($emailSupportedModulesList as $moduleName) {
$searchFields = array();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$emailFieldModels = $moduleModel->getFieldsByType('email');
foreach ($emailFieldModels as $fieldName => $fieldModel) {
if ($fieldModel->isViewable()) {
$searchFields[] = $fieldName;
}
}
$emailFields = $searchFields;
$nameFields = $moduleModel->getNameFields();
foreach ($nameFields as $fieldName) {
$fieldModel = Vtiger_Field_Model::getInstance($fieldName, $moduleModel);
if ($fieldModel->isViewable()) {
$searchFields[] = $fieldName;
}
}
if ($emailFields) {
$moduleInstance = CRMEntity::getInstance($moduleName);
$queryGenerator = new QueryGenerator($moduleName, $currentUserModel);
$listFields = $searchFields;
$listFields[] = 'id';
$queryGenerator->setFields($listFields);
//Opensource fix for showing up deleted records on email search
$queryGenerator->startGroup("");
foreach ($searchFields as $key => $emailField) {
$queryGenerator->addCondition($emailField, trim($searchValue), 'c', 'OR');
}
$queryGenerator->endGroup();
$result = $db->pquery($queryGenerator->getQuery(), array());
$numOfRows = $db->num_rows($result);
for ($i = 0; $i < $numOfRows; $i++) {
$row = $db->query_result_rowdata($result, $i);
foreach ($emailFields as $emailField) {
$emailFieldValue = $row[$emailField];
if ($emailFieldValue) {
//SalesPlatform.ru begin
$recordLabel = decode_html(getEntityFieldNameDisplay($moduleName, $nameFields, $row));
//$recordLabel = getEntityFieldNameDisplay($moduleName, $nameFields, $row);
//SalesPlatform.ru end
if (strpos($emailFieldValue, $searchValue) !== false || strpos($recordLabel, $searchValue) !== false) {
$emailsResult[vtranslate($moduleName, $moduleName)][$row[$moduleInstance->table_index]][] = array('value' => $emailFieldValue, 'label' => $recordLabel . ' <b>(' . $emailFieldValue . ')</b>');
}
}
}
}
}
}
return $emailsResult;
}
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:61,代码来源:Module.php
示例19: getHeaders
public function getHeaders()
{
$headerFields = parent::getHeaders();
if ($this->getRelationModel()->getRelationModuleModel()->getName() == 'PriceBooks') {
//Added to support Unit Price
$unitPriceField = new Vtiger_Field_Model();
$unitPriceField->set('name', 'unit_price');
$unitPriceField->set('column', 'unit_price');
$unitPriceField->set('label', 'Unit Price');
$headerFields['unit_price'] = $unitPriceField;
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$headerFields['listprice'] = $field;
}
return $headerFields;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:19,代码来源:RelationListView.php
示例20: getDateFilter
public static function getDateFilter($moduleName)
{
$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;
}
return $dateFilters;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:11,代码来源:AdvancedFilter.php
注:本文中的Vtiger_Field_Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论