當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser方法代碼示例

本文整理匯總了PHP中ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser方法的具體用法?PHP ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser怎麽用?PHP ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ZurmoDefaultViewUtil的用法示例。


在下文中一共展示了ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionConvertFinal

 public function actionConvertFinal($id)
 {
     assert('!empty($id)');
     $accountPostData = LeadsUtil::getFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
     if (empty($accountPostData)) {
         $urlParams = array('/leads/' . $this->getId() . '/convert', 'id' => $id);
         $this->redirect($urlParams);
     }
     $contact = Contact::getById(intval($id));
     if (!LeadsUtil::isStateALead($contact->state)) {
         $urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id);
         $this->redirect($urlParams);
     }
     $convertToAccountSetting = LeadsModule::getConvertToAccountSetting();
     $convertToOpportunitySetting = LeadsModule::getConvertToOpportunitySetting();
     $opportunity = new Opportunity();
     ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($contact);
     $userCanAccessContacts = RightsUtil::canUserAccessModule('ContactsModule', Yii::app()->user->userModel);
     $userCanAccessAccounts = RightsUtil::canUserAccessModule('AccountsModule', Yii::app()->user->userModel);
     $userCanAccessOpportunities = RightsUtil::canUserAccessModule('OpportunitiesModule', Yii::app()->user->userModel);
     $userCanCreateOpportunity = RightsUtil::doesUserHaveAllowByRightName('OpportunitiesModule', OpportunitiesModule::RIGHT_CREATE_OPPORTUNITIES, Yii::app()->user->userModel);
     LeadsControllerSecurityUtil::resolveCanUserProperlyConvertLead($userCanAccessContacts, $userCanAccessAccounts, $convertToAccountSetting);
     LeadsControllerSecurityUtil::resolveCanUserProperlyConvertLeadFinalStep($userCanAccessContacts, $userCanAccessOpportunities, $convertToOpportunitySetting);
     if (isset($_POST['Opportunity'])) {
         $controllerUtil = static::getZurmoControllerUtil();
         $savedSuccessfully = false;
         $modelToStringValue = null;
         $postData = $_POST['Opportunity'];
         $opportunity = $controllerUtil->saveModelFromPost($postData, $opportunity, $savedSuccessfully, $modelToStringValue, false);
         if ($savedSuccessfully) {
             $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($contact);
             ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($opportunity, $explicitReadWriteModelPermissions);
             $account = LeadsUtil::createAccountForLeadConversionFromAccountPostData($accountPostData, $contact, $controllerUtil);
             $opportunity->account = $account;
             if (!$opportunity->save()) {
                 throw new NotSupportedException();
             }
             LeadsUtil::removeFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
             $this->actionSaveConvertedContact($contact, $account, $opportunity);
         }
     } elseif (isset($_POST['OpportunitySkip']) || $convertToOpportunitySetting == LeadsModule::CONVERT_NO_OPPORTUNITY || $convertToOpportunitySetting == LeadsModule::CONVERT_OPPORTUNITY_NOT_REQUIRED && !$userCanAccessOpportunities) {
         $controllerUtil = static::getZurmoControllerUtil();
         $account = LeadsUtil::createAccountForLeadConversionFromAccountPostData($accountPostData, $contact, $controllerUtil);
         LeadsUtil::removeFromSession(LeadsUtil::LEAD_CONVERSION_ACCOUNT_DATA_SESSION_KEY);
         $this->actionSaveConvertedContact($contact, $account, null);
     }
     $progressBarAndStepsView = new LeadConversionStepsAndProgressBarForWizardView(1);
     $convertView = new LeadConvertOpportunityView($this->getId(), $this->getModule()->getId(), $contact->id, strval($contact), $opportunity, $convertToOpportunitySetting, $userCanCreateOpportunity);
     $view = new LeadsPageView(ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser($this, $progressBarAndStepsView, $convertView));
     echo $view->render();
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:51,代碼來源:DefaultController.php


注:本文中的ZurmoDefaultViewUtil::makeTwoStandardViewsForCurrentUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。