文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Howto integrate 3rd-party software with SugarCRM-2

Howto integrate 3rd-party software with SugarCRM-2

时间:2007-02-28  来源:zxltxwd1984


               
The second article in this series describes the inclusion of your
custom backend systems right into the webbased Sugar user interface. We
created
ZuckerDocs
following those steps (well, those maybe were the first 1 percent of
the whole project …), and it worked pretty good in the end - but there
are some obstacles to consider.

Starting a new module from scratch

There are some steps to take to make a new module appear in your Sugar user interface.
  • create a folder called “TestModule” in the “modules/”-folder of your Sugar installation
    • create some empty files in there: “index.php”, “Forms.php” and “Menu.php”
    • create a folder called “language” in there, containing an empty file “en_us.lang.php” (or whatever language you are using)
    • open the file “include/modules.php” with your text editor and add the line
      $moduleList[] = ‘TestModule’;
    • open the file “include/language/en_us.lang.php” (or your own language) and add the line
        ‘TestModule’ => ‘TestModule’,
      to the “moduleList”-array
      Note:
      If you have ever used the “Rename Tabs” function, you have to use this
      function again here instead of manually edit this file - just add
      “TestModule” to the tabs list.
    • Now login to Sugar as “admin” user, go to the “Admin”-panel, click
      on “Configure Tabs” and add the “TestModule” to the “Display Tabs” list
    • Go to the “My Account” panel, click on “Edit” and add the “TestModule” to the “Display Tabs” list
      Note: this step sometimes is required, sometimes not - don’t know the difference
    • The module now is visible in the module list.

      You may download a prepared module folder here:
      TestModule.zip

      Extending the skeleton

      You
      can now try to fill in your custom behaviour into this skeleton. One of
      the most important points is, that it is not possible with Sugar to
      call your PHP files directly, but all of them are called by the front
      controller “index.php” right in your Sugar folder. Direct access to
      your custom module is not allowed for calling your PHP scripts (just
      for resources as images or javascript). To call your script
      “myaction.php” in the TestModule, you have to use the link
      “index.php?module=TestModule&action=myaction” - rather easy, but
      you should know in advance. The default action called when clicking on
      your module in the module bar on the top always is called “index” -
      that is, the file “index.php” in your module folder is called first.

      The
      file “Menu.php” contains the hyperlinks which are shown in the menu bar
      on the left (depending on the theme you are using, it may also be
      located on the top or on the right). You just have to add one line to
      the “module_menu”- array to have an additional entry point available.

      The
      file “Forms.php” can optionally contain some extra forms and javascript
      code. For example, the function “get_validate_record_js” should return
      javascript code for validating your form entries. If it contains the
      function “get_new_record_form”, the returned HTML code is used for
      displaying those nice “quick create” forms just below the menubar (look
      at the “Contacts” or “Accounts” module for an example). Have a look at
      the TestModule (
      TestModule.zip
      ) - it just shows a company logo, but you can easily replace it with a small HTML form.

      Useful Sugar APIs

      In
      most cases, you don’t have to output your HTML code from PHP. Sugar
      includes a template engine which supports keyword replacements,
      listviews, variables and some more. It also provides database access to
      the Sugar database (hint: look at the global variable “$db”), and
      really a lot of helper functions for building up a visually integrated
      and appealing user interface for your modules. I will try to describe
      the most important APIs in other blog entries, it is out-of-scope for
      now.

      Using the Sugar Module Loader

      The
      file edit steps you did above in the “start from scratch” section are
      usually done automatically by the “Sugar Module Loader” - your users
      typically don’t have to edit Sugar configuration files manually to use
      your custom module. In the next blog entry I will describe how to build
      a complete module installable with the Sugar Module Loader starting
      from the TestModule created before.
      注:这篇文章是
      ftreml
      所写,另外感谢他把C3CRM开发的模块改成兼容SugarCRM的新版本和支持英文,并与非中文国家的用户分享,在此表示感谢。
                     
                     
                     
                     
                     

  • 相关阅读 更多 +
    排行榜 更多 +
    开心动动脑安卓版 v1.0 手机版

    开心动动脑安卓版 v1.0 手机版

    休闲益智 下载
    不良人破局手游下载

    不良人破局手游下载

    角色扮演 下载
    云海之下手游下载

    云海之下手游下载

    角色扮演 下载