10个回复
🛵
Xue Liangliang#11

3.3 model的扩展。

model的扩展文件命名与control类似,在ext/model/目录下面建立相应的以方法为名的文件,里面实现对应的查询功能。比如,我们 打算对misc的model新增一个方法,叫做foo,那么只需要在misc/ext/model/下面建立foo.php,代码如下:

public function foo()
{
      return 'foo';
 }
 

需要说明的是,这里面不不包含的起止符号,也不包含类的声明。就只是一个方法的声明。禅道框架在执行的时候,会自动将扩展目录下面的foo.php里面的代码,替换misc/model.php中的foo方法的代码。如果是新增的方法,则会追加到misc/model.php的代码中,最终生成一个合并之后的model类文件。

 

明白了, 那还是很好写的,明天试一下。

 

 

2012-05-02 19:25:03 Xue Liangliang 回帖
🛵
Xue Liangliang#12
如果我要写几个helper 函数封装ldap 访问的一些方法,放在什么地方比较好?
2012-05-02 19:40:31 Xue Liangliang 回帖
放在lib下面比较合适。
2012-05-02 20:00:13 王春生 回帖
🛵
Xue Liangliang#14

好的,我也这么想的,我准备就把mantis 那个ldap api OO一下, 我想了解一些这种library 级别的config 放在根目录下的config 里? 放一个ldap.php 就可以了? 但看了一下router.class.php 没看到自动load configRoot 下的任意文件的code. 不像扩展下的config 会自动load.  

 

我看了一下load class 可以用$this->app->loadClass('ldap') 来实现, 如果在扩展里面写,$this->app 也是可以访问到的哦? 这里是用的eval 实现还是用的include 模拟宏实现的? 具体code 没找, 如果wwccss 大侠有时间解释一下吧,谢谢了。

2012-05-02 20:19:42 Xue Liangliang 最后编辑 2012-05-02 20:19:42 Xue Liangliang 回帖
include实现的。扩展你可以考虑放在config/ext/下面,起个名字。或者放在user/ext/config/下面,都是可以的。看你怎么用了。
2012-05-02 22:07:31 王春生 回帖
LDAP接口应该提升并整合到ZenTaoPHP的标准框架里,以便统一认证更多的扩展应用。
2012-05-03 11:47:33 flywin 回帖
🛵
Xue Liangliang#17

做好了,放在我们公司的服务器上 http://www.thsmobile.com/download/ldap_exten.tgz

 

相对于根目录的结构如下, ldap.class.php 是从mantis 扣出来修改的, 可能license 有点问题是GPL的, 但我自己用,应该没有问题。 你们如果要加ldap发给其他用户,可能还得自己重写一下。

 

lib
└── ldap
    └── ldap.class.php
module
└── user
    └── ext
        ├── config
        │   └── ldap.php
        └── model
            └── ldap.php

 

可以Config 的参数:

 

/**
 * Specifies the LDAP or Active Directory server to connect to, and must be
 * provided as an URI
 * - Protocol is optional, can be one of ldap or ldaps, defaults to ldap
 * - Port number is optional, and defaults to 389. If this doesn't work, try
 *   using one of the following standard port numbers: 636 (ldaps); for Active
 *   Directory Global Catalog forest-wide search, use 3268 (ldap) or 3269 (ldaps)
 *
 * Examples of valid URI:
 *
 *   ldap.example.com
 *   ldap.example.com:3268
 *   ldap://ldap.example.com/
 *   ldaps://ldap.example.com:3269/
 *
 */
$config->ldap->ldap_server                      = 'ldap://ldap.example.com:389/';
/**
 * The LDAP Protocol Version, if 0, then the protocol version is not set.  For Active Directory use version 3.
 */
$config->ldap->ldap_protocol_version            = 3;
/**
 * Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not.
 * This maps to LDAP_OPT_REFERRALS ldap library option.  For Active Directory, this should be set to OFF.
 */
$config->ldap->ldap_follow_referrals            = 1;                                    //1 ON, 0 OFF
$config->ldap->ldap_root_dn                     = 'ou=www,dc=abc,dc=com';
$config->ldap->ldap_uid_field                   = 'sAMAccountName';                     // Use 'sAMAccountName' for Active Directory
$config->ldap->ldap_bind_dn                     = 'CN=admin,OU=admin,DC=abc,DC=com';
$config->ldap->ldap_bind_passwd                 = 'abcdef';
/**
* Search filter for acitve person only, !(userAccountControl:1.2.840.113556.1.4.803:=2) means active user in AD
*/
$config->ldap->ldap_organization                = '(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))';

2012-05-07 10:00:23 王春生 最后编辑 2012-05-07 10:00:23 Xue Liangliang 回帖
你可以发布到我们的插件平台吧。:)呵呵。你来发布没有关系的。就以GPL协议就行了。
2012-05-03 14:15:06 王春生 回帖
🛵
Xue Liangliang#19
晚上上传,你们再看看有没有不符合你们习惯的。
2012-05-03 15:53:30 Xue Liangliang 回帖
🛵
Xue Liangliang#20
我上传了,但是安装文档的格式都没了,可以修改吗?
2012-05-07 15:22:55 Xue Liangliang 回帖
联系我们
联系人
金娟/高级客户经理
电话(微信)
18562856230
QQ号码
1826606239
联系邮箱
jinjuan@chandao.com
相关帖子
返回顶部
客服头像
金娟
高级客户经理
客服微信
18562856230
1826606239
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。问题反馈反馈点击这里,让我们聆听您的建议与反馈。