54 array &$page_storage = [],
55 array $fields = [
'page_id',
'page_title',
'menu_title',
'parent',
'position',
'visibility',
'admin_groups']
58 global $LEPTON_CORE_all_pages;
62 $bUserHasAdminRights = LEPTON_core::userHasAdminRights();
64 $aUserGroups = LEPTON_CORE::getValue(
"groups_id",
"string",
"session",
",");
67 $aRequiredKeys = [
'page_id',
'parent',
'visibility',
'admin_groups'];
69 foreach ($aRequiredKeys as $mustBe)
71 if (!in_array($mustBe, $fields))
77 $select_fields =
"`".implode(
"`,`", $fields).
"`";
79 $LEPTON_CORE_all_pages = [];
81 "SELECT ".$select_fields.
" FROM `".TABLE_PREFIX.
"pages` ORDER BY `parent`,`position`",
83 $LEPTON_CORE_all_pages
87 foreach ($LEPTON_CORE_all_pages as &$ref)
89 $ref[
'admin_groups'] = explode(
",", $ref[
'admin_groups']);
93 if ($bUserHasAdminRights ==
true)
95 foreach ($LEPTON_CORE_all_pages as &$ref)
97 $ref[
'userAllowed'] =
true;
102 foreach ($LEPTON_CORE_all_pages as &$ref)
104 $ref[
'userAllowed'] = !empty(array_intersect($aUserGroups, $ref[
'admin_groups']));
108 if (in_array(
"viewing_groups", $fields))
110 foreach ($LEPTON_CORE_all_pages as &$ref)
112 $ref[
'viewing_groups'] = explode(
",", $ref[
'viewing_groups']);
128 global $LEPTON_CORE_all_pages, $TEXT;
130 foreach($LEPTON_CORE_all_pages as &$ref) {
132 if ($ref[
'parent'] > $aNum)
137 if ($ref[
'parent'] == $aNum)
140 switch( $ref[
'visibility'] )
144 $ref[
'status_icon'] =
"visible_16.png";
145 $ref[
'status_text'] = $TEXT[
'PUBLIC'];
146 $ref[
'status_uiicon'] =
'unhide';
150 $ref[
'status_icon'] =
"private_16.png";
151 $ref[
'status_text'] = $TEXT[
'PRIVATE'];
152 $ref[
'status_uiicon'] =
'user';
156 $ref[
'status_icon'] =
"keys_16.png";
157 $ref[
'status_text'] = $TEXT[
'REGISTERED'];
158 $ref[
'status_uiicon'] =
'sign in';
162 $ref[
'status_icon'] =
"hidden_16.png";
163 $ref[
'status_text'] = $TEXT[
'HIDDEN'];
164 $ref[
'status_uiicon'] =
'hide';
168 $ref[
'status_icon'] =
"none_16.png";
169 $ref[
'status_text'] = $TEXT[
'NONE'];
170 $ref[
'status_uiicon'] =
'lock';
174 $ref[
'status_icon'] =
"deleted_16.png";
175 $ref[
'status_text'] = $TEXT[
'DELETED'];
176 $ref[
'status_uiicon'] =
'recycle red';
180 die(
LEPTON_tools::display(
"Error: [20012] ".$ref[
'visibility'].
" unknown!",
"pre",
"ui message red"));
185 $ref[
'subpages'] = [];
188 if (isset($ref[
'link']))
190 $ref[
'link'] = PAGES_DIRECTORY.$ref[
'link'].PAGE_EXTENSION;
193 $aRefArray[] = &$ref;
page_tree(int $root_id=0, array &$page_storage=[], array $fields=['page_id', 'page_title', 'menu_title', 'parent', 'position', 'visibility', 'admin_groups'])
LEPTON_CORE_make_list(int $aNum, array &$aRefArray)