0

嗨,我对 SugarCRM 还是很陌生,并试图让我的头脑了解糖 MVC。

我正在制作一个没有自己的 SugarBean 的模块,而是需要与 Contacts Bean 和 Quotes Bean 交互。

我的示例代码如下。

我的问题是如何从 view.searchengineer.php 文件中的 controller.php 访问 $contact_bean 和 $quote_bean,以便在加载记录后从它们中调用信息。

控制器.php

Class PCP_TasksController extends SugarController
{
    function action_search_engineers()
    {
       // Get Contacts ID
       $contact_id = $_GET['Contact_id'];
       //Load Contacts Bean and pull Record
       $contact_bean = New Contact();
       $contact_bean->retrieve($contact_id );

       //Get Quote ID
       $quote_id = $_GET['Quote_id'];
       //Load Quotes Module and pull record
       $quote_bean = New AOS_Quotes();
       $quote_bean->retrieve($quote_id );


       $this->view = 'SearchEngineer';
    }

}

意见/view.searchengineer.php

class PCP_tasksViewSearchengineer extends SugarView
{

   function display() { 

       Echo "The Contact Name is ";

       Echo "The Quote Ref is ";
   }

}
4

1 回答 1

1

我只是将相同的代码直接放在视图中。

于 2012-10-14T23:37:32.420 回答