diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-27 13:06:44 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-27 13:06:44 +0300 |
| commit | d1338cbb59d0752155f17d94b0b9b073df95183f (patch) | |
| tree | 75b7fe87a47ee6961dc38263582117bb920fa1d4 /public/app/views/components/courses_menu.php | |
| parent | 38cc5c0c3abed6cfe4fbe0cbabec60a8ed64784d (diff) | |
| download | gyraf1gov-d1338cbb59d0752155f17d94b0b9b073df95183f.tar.gz gyraf1gov-d1338cbb59d0752155f17d94b0b9b073df95183f.tar.bz2 gyraf1gov-d1338cbb59d0752155f17d94b0b9b073df95183f.zip | |
content model; add petition to database
Diffstat (limited to 'public/app/views/components/courses_menu.php')
| -rw-r--r-- | public/app/views/components/courses_menu.php | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/public/app/views/components/courses_menu.php b/public/app/views/components/courses_menu.php deleted file mode 100644 index 6539f8c..0000000 --- a/public/app/views/components/courses_menu.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php -/** Categories Menu - * ----------------------------------------------------------------------------- - * sits in the (left) sidebar - * - * imported variables - * --- - * @param $categories (array) : the categories tree - * @param $open_path (array) : 'id's array of selected categories - * - * example call: - * (draw the categories-menu and set open the categories with ids 1 and 2) - * --- - * Render::template("section/categories_menu.php",[ - * 'categories' => $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 .= "<li> - <a href='/course/{$node['rec']['id']}' class='{$a_class}'> - <span class='label'>{$node['rec']['label']}</span> - <span class='toggler'>{$sign}</span> - </a> - <ul class='{$inner_class}'>" - . tree_li($node['childs'], $open_nodes, $l+1) - ."</ul> - </li>"; - - - } else { // else just write the li - - if (in_array(intval($node['rec']['id']), $open_nodes)) { - $u_in = "<u>"; - $u_out = "</u>"; - $a_class = "selected"; - - } else { - $u_in = ""; - $u_out = ""; - $a_class = ""; - - } - - $html .= "<li> - <a href='/course/{$node['rec']['id']}' class='{$a_class}'> - <span class='label'>{$node['rec']['label']}</span> - </a> - </li>"; - } - } - - return $html; - -} - - -// draw the menu (hidden on XS screens) -// ----------------------------------------------------------------------------- -echo "<h3>Διαθέσιμη ύλη</h3>"; -echo "<ul class='hidden-xs side-bar'>". tree_li($categories, $open_path) ."</ul>"; - - - -// 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) |
