| Line 56... |
Line 56... |
| 56 |
* for documentation and/or possible extensions
|
56 |
* for documentation and/or possible extensions
|
| 57 |
*
|
57 |
*
|
| 58 |
* @param string[] $customFields Array of definition modifications to underlying structure
|
58 |
* @param string[] $customFields Array of definition modifications to underlying structure
|
| 59 |
*/
|
59 |
*/
|
| 60 |
public function __construct( $customFields = array() ) {
|
60 |
public function __construct( $customFields = array() ) {
|
| 61 |
$permissions = array();
|
61 |
$permissions = array(
|
| - |
|
62 |
// taken from jsfiddle.net/pynhA/2/
|
| - |
|
63 |
'html input fields' => array(
|
| - |
|
64 |
'permissions' => "<li><input type='checkbox' id='%s' name='%s' title='%s' ~~%s~~><label for='%s'>%s</label>\n</li>\n",
|
| - |
|
65 |
'permissions block' => "<fieldset class='login_permissions_group'>\n<legend>%s</legend>\n<ul class='login_permissions'>\n%s\n</ul></fieldset>"
|
| - |
|
66 |
)
|
| - |
|
67 |
);
|
| 62 |
$this->configuration = array_merge_recursive( $this->configuration, $permissions );
|
68 |
$this->configuration = array_merge_recursive( $this->configuration, $permissions );
|
| 63 |
parent::__construct( $customFields );
|
69 |
parent::__construct( $customFields );
|
| 64 |
} // constructor
|
70 |
} // constructor
|
| 65 |
|
71 |
|
| 66 |
|
72 |
|
| Line 99... |
Line 105... |
| 99 |
if ( $this->isAdmin() ) {
|
105 |
if ( $this->isAdmin() ) {
|
| 100 |
$values = $connection->getFullPermissions( $this->workingOn['id'] );
|
106 |
$values = $connection->getFullPermissions( $this->workingOn['id'] );
|
| 101 |
$category = array();
|
107 |
$category = array();
|
| 102 |
foreach ( $values as $thisEntry ) {
|
108 |
foreach ( $values as $thisEntry ) {
|
| 103 |
$field = $thisEntry['permission'];
|
109 |
$field = $thisEntry['permission'];
|
| 104 |
$temp = sprintf( $this->configuration['html input fields']['boolean'],
|
110 |
$temp = sprintf( $this->configuration['html input fields']['permissions'],
|
| 105 |
$thisEntry['description'],
|
111 |
$this->configuration['input prefix'] . $field, // id
|
| 106 |
$this->configuration['input prefix'] . $field,
|
112 |
$this->configuration['input prefix'] . $field, // name
|
| 107 |
'Place a check here to give the user permission',
|
113 |
'Place a check here to allow user to ' . $thisEntry['description'], // title
|
| 108 |
'',
|
114 |
$field, // replaced with 'checked' if set
|
| - |
|
115 |
$this->configuration['input prefix'] . $field, // for=
|
| 109 |
$field
|
116 |
$thisEntry['description'] // label
|
| 110 |
);
|
117 |
);
|
| 111 |
|
118 |
|
| 112 |
$category[$thisEntry['category']][] = preg_replace( "/~~$field~~/", $thisEntry['value'] ? 'checked' : '', $temp );
|
119 |
$category[$thisEntry['category']][] = preg_replace( "/~~$field~~/", $thisEntry['value'] ? 'checked' : '', $temp );
|
| 113 |
}
|
120 |
}
|
| 114 |
|
121 |
|
| 115 |
foreach ( $category as $name => $entries ) {
|
122 |
foreach ( $category as $name => $entries ) {
|
| 116 |
$return[] = $divDef . "<h3>$name</h3>" . implode( "\n", $entries ) . "</div>";
|
123 |
$return[] = sprintf( $this->configuration['html input fields']['permissions block'],
|
| - |
|
124 |
$name, // fieldset legend
|
| - |
|
125 |
implode( "\n", $entries ) // all the entries from first block
|
| - |
|
126 |
);
|
| 117 |
}
|
127 |
}
|
| 118 |
}
|
128 |
}
|
| 119 |
return implode( "\n", $return );
|
129 |
return implode( "\n", $return );
|
| 120 |
}
|
130 |
}
|
| 121 |
|
131 |
|