当前位置: 首页>>代码示例>>PHP>>正文


PHP Users_Record_Model::getInstanceByName方法代码示例

本文整理汇总了PHP中Users_Record_Model::getInstanceByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Users_Record_Model::getInstanceByName方法的具体用法?PHP Users_Record_Model::getInstanceByName怎么用?PHP Users_Record_Model::getInstanceByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Users_Record_Model的用法示例。


在下文中一共展示了Users_Record_Model::getInstanceByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

    public function process(Vtiger_Request $request)
    {
        $currentUser = Users_Record_Model::getCurrentUserModel();
        $viewer = $this->getViewer($request);
        $moduleName = $request->getModule();
        $qualifiedModuleName = $request->getModule(false);
        $recordId = $request->get('task_id');
        $workflowId = $request->get('for_workflow');
        $workflowModel = Settings_Workflows_Record_Model::getInstance($workflowId);
        $taskTypes = $workflowModel->getTaskTypes();
        if ($recordId) {
            $taskModel = Settings_Workflows_TaskRecord_Model::getInstance($recordId);
        } else {
            $taskType = $request->get('type');
            if (empty($taskType)) {
                $taskType = !empty($taskTypes[0]) ? $taskTypes[0]->getName() : 'VTEmailTask';
            }
            $taskModel = Settings_Workflows_TaskRecord_Model::getCleanInstance($workflowModel, $taskType);
        }
        $taskTypeModel = $taskModel->getTaskType();
        $viewer->assign('TASK_TYPE_MODEL', $taskTypeModel);
        $viewer->assign('TASK_TEMPLATE_PATH', $taskTypeModel->getTemplatePath());
        $recordStructureInstance = Settings_Workflows_RecordStructure_Model::getInstanceForWorkFlowModule($workflowModel, Settings_Workflows_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDITTASK);
        $viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructureInstance);
        $viewer->assign('RECORD_STRUCTURE', $recordStructureInstance->getStructure());
        $moduleModel = $workflowModel->getModule();
        $dateTimeFields = $moduleModel->getFieldsByType(array('date', 'datetime'));
        $taskObject = $taskModel->getTaskObject();
        $taskType = get_class($taskObject);
        if ($taskType === 'VTCreateEntityTask') {
            if ($taskObject->entity_type) {
                $relationModuleModel = Vtiger_Module_Model::getInstance($taskObject->entity_type);
                $ownerFieldModels = $relationModuleModel->getFieldsByType('owner');
                $fieldMapping = Zend_Json::decode($taskObject->field_value_mapping);
                foreach ($fieldMapping as $key => $mappingInfo) {
                    if (array_key_exists($mappingInfo['fieldname'], $ownerFieldModels)) {
                        $userRecordModel = Users_Record_Model::getInstanceByName($mappingInfo['value']);
                        if ($userRecordModel) {
                            $ownerName = $userRecordModel->getId();
                        } else {
                            $groupRecordModel = Settings_Groups_Record_Model::getInstance($mappingInfo['value']);
                            $ownerName = $groupRecordModel->getId();
                        }
                        $fieldMapping[$key]['value'] = $ownerName;
                    }
                }
                $taskObject->field_value_mapping = Zend_Json::encode($fieldMapping);
            }
        }
        if ($taskType === 'VTUpdateFieldsTask') {
            if ($moduleModel->getName() == "Documents") {
                $restrictFields = array('folderid', 'filename', 'filelocationtype');
                $viewer->assign('RESTRICTFIELDS', $restrictFields);
            }
        }
        $viewer->assign('SOURCE_MODULE', $moduleModel->getName());
        $viewer->assign('MODULE_MODEL', $moduleModel);
        $viewer->assign('TASK_ID', $recordId);
        $viewer->assign('WORKFLOW_ID', $workflowId);
        $viewer->assign('DATETIME_FIELDS', $dateTimeFields);
        $viewer->assign('WORKFLOW_MODEL', $workflowModel);
        $viewer->assign('TASK_TYPES', $taskTypes);
        $viewer->assign('TASK_MODEL', $taskModel);
        $viewer->assign('CURRENTDATE', date('Y-n-j'));
        $metaVariables = Settings_Workflows_Module_Model::getMetaVariables();
        if ($moduleModel->getName() == 'Invoice' || $moduleModel->getName() == 'Quotes') {
            $metaVariables['Portal Pdf Url'] = '(general : (__VtigerMeta__) portalpdfurl)';
        }
        // Adding option Line Item block for Individual tax mode
        $individualTaxBlockLabel = vtranslate("LBL_LINEITEM_BLOCK_GROUP", $qualifiedModuleName);
        $individualTaxBlockValue = $viewer->view('LineItemsGroupTemplate.tpl', $qualifiedModuleName, $fetch = true);
        // Adding option Line Item block for group tax mode
        $groupTaxBlockLabel = vtranslate("LBL_LINEITEM_BLOCK_INDIVIDUAL", $qualifiedModuleName);
        $groupTaxBlockValue = $viewer->view('LineItemsIndividualTemplate.tpl', $qualifiedModuleName, $fetch = true);
        $templateVariables = array($individualTaxBlockValue => $individualTaxBlockLabel, $groupTaxBlockValue => $groupTaxBlockLabel);
        $viewer->assign('META_VARIABLES', $metaVariables);
        $viewer->assign('TEMPLATE_VARIABLES', $templateVariables);
        $viewer->assign('TASK_OBJECT', $taskObject);
        $viewer->assign('FIELD_EXPRESSIONS', Settings_Workflows_Module_Model::getExpressions());
        $repeat_date = $taskModel->getTaskObject()->calendar_repeat_limit_date;
        if (!empty($repeat_date)) {
            $repeat_date = Vtiger_Date_UIType::getDisplayDateValue($repeat_date);
        }
        $viewer->assign('REPEAT_DATE', $repeat_date);
        $userModel = Users_Record_Model::getCurrentUserModel();
        $viewer->assign('dateFormat', $userModel->get('date_format'));
        $viewer->assign('timeFormat', $userModel->get('hour_format'));
        $viewer->assign('MODULE', $moduleName);
        $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
        $emailFields = $recordStructureInstance->getAllEmailFields();
        foreach ($emailFields as $metaKey => $emailField) {
            $emailFieldoptions .= '<option value=",$' . $metaKey . '">' . $emailField->get('workflow_columnlabel') . '</option>';
        }
        $nameFields = $recordStructureInstance->getNameFields();
        $fromEmailFieldOptions = '<option value="">' . vtranslate('Optional', $qualifiedModuleName) . '</option>';
        $fromEmailFieldOptions .= '<option value="$(general : (__VtigerMeta__) supportName)<$(general : (__VtigerMeta__) supportEmailId)>"
									>' . vtranslate('LBL_HELPDESK_SUPPORT_EMAILID', $qualifiedModuleName) . '</option>';
        foreach ($emailFields as $metaKey => $emailField) {
            list($relationFieldName, $rest) = explode(' ', $metaKey);
            $value = '<$' . $metaKey . '>';
//.........这里部分代码省略.........
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:101,代码来源:EditTask.php


注:本文中的Users_Record_Model::getInstanceByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。