Sugarcrm支持产品指南糖开发人员糖开发人员指南10.0建筑学 Sugarpdf.

Sugarpdf.

概述

Sugarpdf. 的概述以及它与TC3d彩吧论坛有关的概述。 as 6.7.x版本,Sugar包括一个智能模板引擎   3d彩吧论坛经理 通过导航到管理员可以访问>3d彩吧论坛经理。 3d彩吧论坛管理器允许管理员为已部署的模块创建和管理模板,而无需编写自定义代码。以下部分仅特定于使用PHP创建自己的自定义TC3d彩吧论坛模板的开发人员。

3d彩吧论坛课程

用于在糖中产生3d彩吧论坛的各种类。

TC3d彩吧论坛.

糖用途 TC3d彩吧论坛. 4.6.013 library, located in ./vendor/tcpdf/, as the core engine to generate 3d彩吧论坛s. This library is extended by Sugarpdf.  核心应用程序使用核心应用程序以生成3d彩吧论坛。 

Sugarpdf.

Sugarpdf. class, located in ./include/Sugarpdf/Sugarpdf.php, extends the TC3d彩吧论坛. 班级。在此类中,我们覆盖了某些功能以集成糖功能。覆盖的一些关键方法如下所示: 

方法 描述
标题 覆盖以启用自定义徽标。
setfont. Overridden to allow for the loading of custom fonts. The custom fonts direction is defined by the K_PATH_CUSTOM_FONTS var. By default, this value is set to ./custom/vendor/tcpdf/fonts/
细胞 覆盖以应用prepaster_string()函数。这允许在发送到3d彩吧论坛之前清理串的能力。  

添加的一些重点其他方法如下所示:

方法 描述
倾斜 在调用显示方法之前预处理。旨在设置备用3d彩吧论坛文档属性,如边距,页脚,标题等。
展示 执行实际的3d彩吧论坛内容生成。这是应放置逻辑向3d彩吧论坛显示输出的位置。
过程 调用Predisplay和Display。
writecelltable. 使用TC3d彩吧论坛的单元格打印方法打印表的方法
withhtmltable 使用TC3d彩吧论坛的WriteHTML打印方法打印表的方法

Custom 3d彩吧论坛 classes that extend Sugarpdf. can be located in the following directories:

  • ./include/sugarpdf/sugarpdf/sugarpdf。<pdf view>.php
  • ./modules/<module>/sugarpdf/sugarpdf.<pdf view>.php
  • ./custom/modules/<module>/sugarpdf/sugarpdf.<pdf view>.php

3d彩吧论坛经理 classes that extend Sugarpdf. are located in the following directories:

  • ./include/sugarpdf/sugarpdf/sugarpdf。smarty.php
  • ./include/sugarpdf/sugarpdf/sugarpdf。pdfmanager.php
  • ./custom/include/sugarpdf/sugarpdf/sugarpdf.pdfmanager.php.

每个扩展类都将定义一个可访问以下URL参数的特定3d彩吧论坛视图:

  • 模块=<module>
  • 行动= Sugarpdf.
  • Sugarpdf. =<pdf view>

Within each custom 3d彩吧论坛 class, the display method will need to be redefined. If you would like, It is also possible to override other methods like 标题 . The process method of this class will be called from Viewsugarpdf.. When a 3d彩吧论坛 is being generated, the most relevant sugarpdf.<pdf action>.pdf 班级 is determined by the Sugarpdf. tory..

Viewsugarpdf.

Viewsugarpdf. class, located in ./include/MVC/View/ views/view.sugarpdf.php., is used to create the SugarViews that generate 3d彩吧论坛s. These views can be found and/or created in one of the following directory paths:

  • ./modules/<module>/ views/view.sugarpdf.php.
  • ./custom/modules/<module>/ views/view.sugarpdf.php.

通过以规定的格式导航到URL来调用SugarViews:

http://<url>/index.php?module=<module>&action=sugarpdf&sugarpdf=<pdf action>

AS 6.7,3d彩吧论坛主要使用3d彩吧论坛 Manager模板系统生成。要生成存储在3d彩吧论坛管理器中的3d彩吧论坛,您将以以下格式调用URL:

http://<url>/index.php?module<module>&record=<record id>&action=sugarpdf&sugarpdf=pdfmanager&pdf_template_id=<template id>  

Sugarpdf. tory.

Viewsugarpdf. class uses the Sugarpdf. tory. class, located in ./include/Sugarpdf/SugarpdfFactory.php, to find the most relevant sugarpdf.<pdf action>.pdf class which generates the 3d彩吧论坛 document for a given 3d彩吧论坛 view and module. If one is not found, then the core  Sugarpdf.  class is used.

Sugarpdf. tory. class loads the first class found for the specified 3d彩吧论坛 action as determined by the following order:

  • ./custom/modules/<module>/sugarpdf/sugarpdf.<pdf view>.php
  • ./modules/<module>/sugarpdf/sugarpdf.<pdf view>.php
  • ./custom/include/sugarpdf/sugarpdf/sugarpdf。<pdf view>.php
  • ./include/sugarpdf/sugarpdf/sugarpdf。<pdf view>.php
  • ./include/sugarpdf/sugarpdf.php.

Sugarpdf. helper.

Sugarpdf. helper., located in ./include/Sugarpdf/SugarpdfHelper.php, is included by Sugarpdf. 。这是一个实用程序文件,其中包含我们使用的许多功能来生成3d彩吧论坛。
可用功能是:

  • wr , wr , 伤害等等 :这些功能有助于创建HTML代码。
  • prepack_string. :此功能准备一个字符串,为3d彩吧论坛打印做好准备。
  • format_number_sugarpdf. :此函数是Format_Number()的副本,来自Force for Sugar3d彩吧论坛。

pdfmanagerhelper.

这  pdfmanagerhelper., located in ./modules/PdfManager/PdfManagerHelper.php, is primarily utilized by the pdfmanager Sugarpdf.  看法。此类文件包含用于访问3d彩吧论坛 Manager模板的方法。一些主要方法是:

  • getavailablemodules. :返回有可用模块的数组,可与3d彩吧论坛Manager一起使用。
  • Getfields. :占用模块名称并返回3d彩吧论坛Manager中此模块的字段列表和链接。
  • getpublisedtemplatesformodule :返回特定模块的可用模板的数组。

FontManager.

FontManager.class, located in ./include/Sugarpdf/FontManager.php, is a stand-alone class that manages all the fonts for TC3d彩吧论坛. . More information can be found in the 3d彩吧论坛字体  section below.

功能:

  • 列出OOB FONT目录和自定义字体目录的所有可用字体(它可以为SELECT标记创建一个格式化的列表)。
  • 通过读取字体PHP文件获取每个列出的字体(类型,大小,编码,...)的详细信息。
  • 从字体文件和度量文件向自定义字体目录添加新字体。
  • 从自定义字体目录中删除字体。

生成pdf.

To generate a custom 3d彩吧论坛 in Sugar, you will need to create a 3d彩吧论坛 view that extends the Sugarpdf. class. To accomplish this, create the file:

 ./custom/modules/<module>/sugarpdf/sugarpdf.<pdf view>.php

<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/Sugarpdf/Sugarpdf.php');

class <module>Sugarpdf<pdf view> extends Sugarpdf
{
    /**
     * Override
     */
    function process(){
        $this->preDisplay();
        $this->display();
        $this->buildFileName();
    }

    /**
     * Custom header
     */
    public function Header()
    {
        $this->SetFont(3d彩吧论坛_FONT_NAME_MAIN, 'B', 16);
        $this->MultiCell(0, 0, 'TC3d彩吧论坛 Header',0,'C');
        $this->drawLine();
    }

    /**
     * Custom header
     */
    public function Footer()
    {
        $this->SetFont(3d彩吧论坛_FONT_NAME_MAIN, '', 8);
        $this->MultiCell(0,0,'TC3d彩吧论坛 Footer', 0, 'C');
    }

    /**
     * Predisplay content
     */
    function preDisplay()
    {
        //Adds a predisplay page
        $this->AddPage();
        $this->SetFont(3d彩吧论坛_FONT_NAME_MAIN,'',3d彩吧论坛_FONT_SIZE_MAIN);
        $this->Ln();
        $this->MultiCell(0,0,'Predisplay Content',0,'C');
    }

    /**
     * Main content
     */
    function display()
    {
        //add a display page
        $this->AddPage();
        $this->SetFont(3d彩吧论坛_FONT_NAME_MAIN,'',3d彩吧论坛_FONT_SIZE_MAIN);
        $this->Ln();
        $this->MultiCell(0,0,'Display Content',0,'C');
    }

    /**
     * Build filename
     */
    function buildFileName()
    {
        $this->fileName = 'example.pdf';
    }

    /**
     * This method draw an horizontal line with a specific style.
     */
    protected function drawLine()
    {
        $this->SetLineStyle(array('width' => 0.85 / $this->getScaleFactor(), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(220, 220, 220)));
        $this->MultiCell(0, 0, '', 'T', 0, 'C');
    }
}

This file will contain the markup for the 3d彩吧论坛. The main things to note are the 标题 (), Footer() and 展示 () methods as they contain most of the styling and display logic. The method buildFileName() will generate the document's name when downloaded by the user.

一旦到位,导航到管理员> Repair >快速修复和重建。现在将通过导航到浏览器中的以下URL来访问3d彩吧论坛:

http://{sugar url}/index.php?module=<module>&action=sugarpdf&sugarpdf=<pdf action>

3d彩吧论坛设置

本节将概述如何配置3d彩吧论坛设置。这些设置确定宽度,高度,图像,3d彩吧论坛元数据和UI配置在:

Admin > 3d彩吧论坛 Manager > Edit Report 3d彩吧论坛 Template 

设置

这 default 3d彩吧论坛 settings for TC3d彩吧论坛 can be found in ./include/Sugarpdf/sugarpdf_default.php. You can add additional custom settings by creating the following file:

./custom/include/sugarpdf/sugarpdf_default.php.

<?php

$sugarpdf_default["3d彩吧论坛_NEW_SETTING"] = "Value";

您应该注意此处指定的值将是默认值。编辑后,更新值存储在“Sugarpdf”类别下的“数据库配置”表中,以及匹配设置名称的名称。

category: sugarpdf
name: pdf_new_setting
value: Value

显示和编辑设置

可以通过导航至Sugar UI在Solure UI中编辑选择一组设置:

  Admin > 3d彩吧论坛 Manager > Edit Report 3d彩吧论坛 Template

这 settings here are managed in the file ./modules/Configurator/metadata/SugarpdfSettingsdefs.php. A brief description of the settings parameters are listed below:

  • 标签 :这是设置的显示标签。
  • info_label. :悬停信息文本的显示标签。
  • 价值 : The 3d彩吧论坛 Setting.
  • 班级 :确定设置所在的面板。可能的值是“基本”和“徽标”。 '高级'目前不是可用的价值。
  • 类型 :确定设置显示窗口小部件。可能的值是:'图像','文本','百分比','multipelect','bool','password'和'file'。

Custom settings can be added to this page by creating ./custom/modules/configurator/metadata/sugarpdfsettingsdefs.php. and specifying a new setting index. An example is below:

./custom/modules/configurator/metadata/sugarpdfsettingsdefs.php.

<?php

    //Retrieve setting info from db
    defineFromConfig("3d彩吧论坛_NEW_SETTING", $sugarpdf_default["3d彩吧论坛_NEW_SETTING"]);

    //Add setting display
    $SugarpdfSettings['sugarpdf_pdf_new_setting'] = array(
        " 标签 " => $mod_strings["LBL_3d彩吧论坛_NEW_SETTING_TITLE"],
        " info_label. " => $mod_strings["LBL_3d彩吧论坛_NEW_SETTING_INFO"],
        " 价值 " => 3d彩吧论坛_NEW_SETTING,
        " 班级 " => "basic",
        " 类型 " => "text",
    );

You should note that the $SugarpdfSettings index should following the format sugarpdf_pdf_<setting name>. If your setting does not follow this format, it will not be saved or retrieved from the database correctly.

定义设置后,您需要为UI设置定义显示文本。

./custom/modules/configurator/language/en_us.lang.php.

完成后,导航到管理员> Repair >快速修复和重建。这将重建显示文本的语言文件。

3d彩吧论坛字体

这 stock fonts for TC3d彩吧论坛 are stored in the directory ./vendor/tcpdf/fonts/. If you would like to add additional fonts to the system, they should be added to the ./custom/vendor/tcpdf/fonts/ directory.

字体缓存

这 font list is built by the font manager with the listFontFiles() or getSelectFontList() methods. The list is then saved in the cache as ./cache/Sugarpdf/cachedFontList.php. This caching process prevents unnecessary parsing of the fonts folder. The font cache is automatically cleared when the delete() or add() methods are used. When you create a module loader package to install fonts you will have to call the clearCachedFile() method in a post_execute and post_uninstall action in the manifest.php to clear the font cache.

最后修改:2020-03-16 17:00:15