模块开发: Difference between revisions

Line 551: Line 551:


==设置您自己的消息框/widget小组件 (可选)==
==设置您自己的消息框/widget小组件 (可选)==
'''何时''':如果您的模块需要在主页上展示一个或多个消息框。
'''何时''':如果您的模块附带提供在主页上展示的一个或多个消息框。


===设置您的消息框===
===设置您的消息框===
Line 577: Line 577:
您的消息框必须显示在可激活消息框的清单中。激活它们,然后前往'''主页'''并检查它们是否正确显示。
您的消息框必须显示在可激活消息框的清单中。激活它们,然后前往'''主页'''并检查它们是否正确显示。


==Define your own export (optional)==
==定义您自己的导出 (可选)==
'''When''': If your module provide new predefined database export profiles (for its own tables or for already existing tables of another module).
'''何时''':如果您的模块附带提供预定义的数据导出(针对自己的表或来自另一个Dolibarr模块的现有表)。


===导出===
===定义导出===
For this uncomment and modify arrays $this->export_xxx in your module descriptor file.
为此,请取消注释并修改模块描述符文件中的 $this->export_xxx 数组。


===Test your export===
===测试您的导出===
Go into menu Tools -> Export. Your export will appear in the list of available predefined exports (if your module is enabled).
前往菜单 '''工具->导出助手''' 。您的导出应显示在可用的预定义导出清单中(如果您的模块已激活)。选择它,您将看到在上一步时在表中定义的可能字段。选择几个字段并尝试生成导出文件。
Choose it, you must see list of all possible fields defined in the export arrays.
Choose on field and try to build an export file. If ok, try again with all fields.


==Define your CSS styles (optional)==
==设置CSS样式 (可选)==
'''When''': If in your PHP pages, you use class styles that are not defined inside Dolibarr themes CSS (not recommanded).
'''何时''':在PHP屏幕页面中,您使用的样式类不是Dolibarr主题的样式类(不推荐)。


===Create and declare your style sheet===
===创建并声明您的样式表===
Create a style sheet CSS named '''mymodule.css''' or '''mymodule.css.php''' and put it into directory '''htdocs/mymodule'''. You can have only one CSS file per module.
创建一个名为 '''mymodule.css''' 或 '''mymodule.css.php''' 的CSS样式文件,并将其放在 '''htdocs/mymodule''' 目录中。每个模块只能有一个CSS文件。
Remember it's better to use existing styles already available by default into Dolibarr (The CSS file used by Dolibarr is file '''themes/mytheme/''themename''.css.php'''. Create your own CSS file only if you need absolutely to add not already existing styles.
 
请记住,最好使用已有的Dolibarr样式(Dolibarr使用的CSS文件是'''themes/mytheme/''themename''.css.php''')。仅当您必须处理不存在的样式时,才创建特定于模块的CSS文件。
 
样式表准备就绪后,通过更改 '''$this->modules_parts''' 属性在模块描述符文件中声明样式表。
 
此处要输入的值必须是 CSS 文件 URL 的相对路径。
 
例如:


Once your style sheet is ready, declare it into your module descriptor file by modifying the property '''$this->modules_parts'''.
Value to put here must be a relative URL to your CSS file.
For example
<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
$this->module_parts = array('css' => array('/mymodule/css/mymodule.css.php'));
$this->module_parts = array('css' => array('/mymodule/css/mymodule.css.php'));
715

edits