/
Roles.php
87 lines (76 loc) · 2.19 KB
/
Roles.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?
class Model_Roles
extends Zupal_Domain_Abstract
implements Zend_Acl_Role_Interface
{
const ROLE_ADMIN = 'admin';
const ROLE_ANONYMOUS = 'anonymous';
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ table_class @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/**
* @see Zupal_Formset_Domain::get_table_class()
*/
public function tableClass () {
return 'Model_DbTable_Roles';
}
/**
* @see Zupal_Formset_Domain::get()
*
* @param unknown_type $pID
* @return Zupal_Domain_Abstract
*
*/
public function get ($pID = null, $pLoadFields = NULL) {
$out = new self($pID);
if ($pLoadFields && is_array($pLoadFields)):
$out->set_fields($pLoadFields);
endif;
return $out;
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ title_head @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/**
*
* @param <type> $pMax_chars = 5
* @return <type>
*/
public function title_head ($pMax_chars = 5, $pMax_Words = 3) {
$out = split(' ', $this->title);
foreach($out as $i => $v):
if ($i >= $pMax_Words):
break;
endif;
if (strlen($v) > $pMax_chars):
$out[$i] = substr($v, 0, $pMax_chars - 1) . '.';
endif;
endforeach;
return join(' ', $out);
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Instance @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
private static $_Instance = NULL;
/**
*
* @return Model_Users
*/
public static function getInstance() {
if (is_null(self::$_Instance)):
// process
self::$_Instance = new self();
endif;
return self::$_Instance;
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ fields @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
private static $_fields = NULL;
public static function fields() {
if (is_null(self::$_fields)):
// process
self::$_fields = array_keys(self::getInstance()->toArray());
endif;
return self::$_fields;
}
/* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@ interface @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
/**
* Returns the string identifier of the Role
*
* @return string
*/
public function getRoleId(){ return $this->identity(); }
}