puhua.net

View My GitHub Profile

27 March 2020

iTop Data Model Toolkit下载

Toolkit下载地址

iTop 架构

iTop architecture

iTop 文件结构

iTop file structure

插件 Extensions 与 模块 Modules

如果my-module是模块的名称,则module文件夹将包含以下文件:
extension.xml XML定义文件 module.my-module.php 模块定义文件。必须包含模块的名称、版本、依赖 datamodel.my-module.xml XML中的数据模型。可以包含classes、menus、profiles的定义 model.my-module.php main.my-module.php PHP代码和实用程序。对于某些包含大量PHP代码的模块,提取PHP代码并在此单独的文件中对其进行编辑比将代码嵌入XML中要容易得多。 images en.dict.my-module.php 本地化字典文件

开发流程

  1. Create an empty module
  2. Install a development instance of iTop, including your empty module in the “extensions” folder
  3. Install the toolkit on your developement instance
  4. Edit your extension module and validate it with the toolkit
  5. Apply the changes made to your extension module to the “production” environment
  6. Test your module with some sample data. In case of troubles, fix them by iterating at point 4.

Creating a module

generate an empty module

XML参考

XML Data Model Reference

XML数据模型文件可用于定义:

  • classes - 使用安装程序或工具包“编译”时将生成实际的PHP类
  • menus - 插入到iTop页面左侧的应用程序菜单中
  • profiles - 管理对iTop对象的访问权限
  • branding

插件API

Extensions API

ORM API

用户权限API

定制客户门户

Customize the Customer Portal

本地化

How to translate

OQL语句语法

OQL Statements Syntax

工单的申请人

SELECT Person WHERE id= :this->caller_id

工单的处理人

SELECT Person WHERE id= :this->agent_id

与工单相关联的联系人,排除申请人和处理人。

SELECT Person 
	JOIN lnkContactToTicket AS L ON L.contact_id = Person.id 
	WHERE Person.notify = 'yes'
	AND L.ticket_id = :this->id 
	AND (L.contact_id != :this->caller_id)
	AND (L.contact_id != :this->agent_id) 

拥有帮助台角色的所有用户

SELECT Person AS p
	JOIN User AS u ON u.contactid = p.id
	JOIN URP_UserProfile AS up ON up.userid = u.id 
	WHERE u.status = 'enabled'
	AND p.notify = 'yes'
	AND up.profileid = 4
	AND u.org_id = :this->org_id 

某团队的成员

SELECT Person AS p 
	JOIN lnkPersonToTeam AS pt ON pt.person_id=p.id 
	JOIN Team AS t ON pt.team_id=t.id
	WHERE t.name = 'Team Name'

有电话信息的客户联系人

SELECT Contact AS c
	JOIN Organization AS child ON c.org_id = child.id
	JOIN Organization AS root ON child.parent_id BELOW root.id
	WHERE root.friendlyname = 'TheProvider'
UNION
SELECT Person AS p
	JOIN Organization AS o ON p.org_id = o.id
	WHERE o.friendlyname = 'TheCustomer' AND p.phone != ''

启用状态的用户请求工单、事件工单、变更工单

SELECT UserRequest WHERE status NOT IN ('rejected', 'resolved', 'closed')
UNION
SELECT Incident WHERE status NOT IN ('rejected', 'resolved', 'closed')
UNION
SELECT Change WHERE status NOT IN ('rejected', 'closed')