From 41d3b5fb68829bbc61ef13ed127dcfb86fa124a0 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Mon, 24 Apr 2023 12:47:53 +0300 Subject: frontend and backend design enhancements --- public/app/views/components/courses_menu.php | 97 ++++++++++++++++++++++++++++ public/app/views/components/top-bar.php | 17 ----- public/app/views/components/top_bar.php | 17 +++++ 3 files changed, 114 insertions(+), 17 deletions(-) create mode 100644 public/app/views/components/courses_menu.php delete mode 100644 public/app/views/components/top-bar.php create mode 100644 public/app/views/components/top_bar.php (limited to 'public/app/views/components') diff --git a/public/app/views/components/courses_menu.php b/public/app/views/components/courses_menu.php new file mode 100644 index 0000000..6539f8c --- /dev/null +++ b/public/app/views/components/courses_menu.php @@ -0,0 +1,97 @@ + $category_tree, + * 'open_path' => [1 ,2] + * ]); + * + * ----------------------------------------------------------------------------- + */ + +/** tree_ul + * creates (recursively) a nested ul-li tree of categories + * --- -- -- - - - + * @param $tree (array) : categories array formated as tree + * @param $open_nodes (array) : array of categor ids that shall be marked open/selected + * @return $html (string) + */ +function tree_li($tree, $open_nodes = [], $l = 0) +{ + $html = ""; + + foreach($tree as $node) { + + // if has childs ... + // write li ; traverse children recursively + if ((isset($node['childs'])) && ( $node['childs']!= [])) { + + if (in_array(intval($node['rec']['id']), $open_nodes)) { + $inner_class = "inner show"; + $sign = "–"; + $a_class = "has-childs selected"; + + } else { + $inner_class = "inner"; + $sign = "+"; + $a_class = "has-childs"; + } + + $html .= "
  • + + {$node['rec']['label']} + {$sign} + + +
  • "; + + + } else { // else just write the li + + if (in_array(intval($node['rec']['id']), $open_nodes)) { + $u_in = ""; + $u_out = ""; + $a_class = "selected"; + + } else { + $u_in = ""; + $u_out = ""; + $a_class = ""; + + } + + $html .= "
  • + + {$node['rec']['label']} + +
  • "; + } + } + + return $html; + +} + + +// draw the menu (hidden on XS screens) +// ----------------------------------------------------------------------------- +echo "

    Διαθέσιμη ύλη

    "; +echo ""; + + + +// TODO: +// draw menu for XS screens (for example, just the 1st-level categories) +// (maybe in an accordion so it won;t take too much area on small screens) diff --git a/public/app/views/components/top-bar.php b/public/app/views/components/top-bar.php deleted file mode 100644 index ed96e35..0000000 --- a/public/app/views/components/top-bar.php +++ /dev/null @@ -1,17 +0,0 @@ -
    - - 0, - 'title' => '', - 'parents' => [] - ]); - ?> - - - -
    \ No newline at end of file diff --git a/public/app/views/components/top_bar.php b/public/app/views/components/top_bar.php new file mode 100644 index 0000000..ed96e35 --- /dev/null +++ b/public/app/views/components/top_bar.php @@ -0,0 +1,17 @@ +
    + + 0, + 'title' => '', + 'parents' => [] + ]); + ?> + + + +
    \ No newline at end of file -- cgit v1.2.3