问题描述
在我们公司,我必须扩展现有 Drupal 7 网站的功能.以下是要求:
In our company I have to extend the functionality of existing Drupal 7 website. Here are the requirements:
- 企业需要使用上传到 Drupal 站点的文档通知所有员工,就不同的主题.(我已经实现了这个要求.)
企业需要知道哪些员工已阅读文档,哪些尚未阅读.他们需要这样的报告:
- The business needs to inform all staff members, on different topics using uploaded to the Drupal site documents. (I already implemented this requirement.)
The business needs to know, which staff members have read a document and which still have not.They need a report like this:
文件 1 25/50(50 名工作人员中的 25 名仍未阅读文件)
Document 1 25/50 (25 from 50 staff members still didn't read the file)
文件 2 50/50(所有工作人员都阅读了文件)等.
Document 2 50/50 (all staff members did read the file), etc.
为了满足第二个业务需求,我需要一个可以跟踪特定用户活动的模块(在我的例子中,单击链接下载文件,这意味着文件已被读取).模块必须能够创建与上述类似的报告.(所有员工都有一个具有特定角色的 drupal 帐户.)
In order to fulfill the second business requirement, I need a module which can track specific user's activity (in my case click on a link to download a file, which means the file is read). The module(s) have to be able to create a report like the one above.(All staff members have a drupal account with a specific role.)
是否有任何我可以使用的drupal 模块或者它的一部分.或者要求太自定义",我必须创建自己的模块.
Is there any drupal module I can use or maybe a part of it. Or the requirements are too 'custom' and I have to create my own module.
推荐答案
我几乎完全创建了您需要的功能.我很乐意在此过程中为您提供帮助.
I created almost exactly the feature you need. I would be glad to help you in the process.
我确实开发了一个完整的自定义模块.我可以告诉你,你需要不同的东西:
I developed indeed a full custom module. And I could tell you that you will need different things:
- 数据库中用于存储数据的自定义表
- 将存储在数据库中的名为track"或action"的自定义实体
- 当您想要跟踪用户的操作时,实施正确的挂钩来创建跟踪
- 使用自定义查询和适当权限显示您存储在数据库中的曲目的自定义页面或块
要实现所有这些,我建议您查看以下文档:
To achieve all that, I suggest you to take a look at these pieces of documentation:
- https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_schema/7
- https://www.drupal.org/node/878784
- https://api.drupal.org/api/drupal/includes!module.inc/group/hooks/7
- https://www.drupal.org/node/1343708
- http://befused.com/drupal/page-programatically
- https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_permission/7
希望它会有所帮助.
这篇关于跟踪用户的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!