Note that there are some explanatory texts on larger screens.

plurals
  1. PORecursive HTML ACL protected menu?
    primarykey
    data
    text
    <p>Is there any example of how to create recursive menu protected by ACL?</p> <p>Idea is to have printed traversal path to end-document with read access even if user don't have read access to parent node.</p> <p>Here is HTML code example of how it should looks:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="some_url"&gt;I have read access here&lt;/a&gt; &lt;ul&gt; &lt;li&gt;I don't have read access here - only print node name (traversal) &lt;ul&gt; &lt;li&gt;&lt;a href="some_url"&gt;I have read access here&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Acl have method has_read_permission( $node_id ) - return true/false</p> <p>I've managed to generate full recursive menu but non acl protected.</p> <p>PHP is server backend.</p> <p>DB table structure:</p> <pre><code>node_id | parent id | node_content </code></pre> <p>Thx</p> <p>P.S.</p> <p>PHP Code I use to generate non acl protected recursive menu (it is adopted to codeigniter framework):</p> <pre><code>&lt;?php defined('BASEPATH') OR exit('No direct script access allowed'); class Menu extends MY_Controller { public static $menu = array(); function index(){ $permited_objects=$this-&gt;session-&gt;userdata('permited_objects'); $session_email=$this-&gt;session-&gt;userdata('email'); self::$menu[] = "&lt;ul id=\"treemenu2\" class=\"treeview\"&gt;"; $this -&gt; _display_children(0, 0, $permited_objects); self::$menu[] = "&lt;/ul&gt;"; $menu_imploded = implode("", self::$menu); $menu_db = str_replace("&lt;ul&gt;&lt;/ul&gt;", " ", $menu_imploded); //write in db or return return $menu_db; } function _display_children($parent, $level) { $sql = "SELECT `title`, `doc_uid` FROM `documents` WHERE `parent_uid` = '" . $parent . "' order by `title` ASC"; try { $this -&gt; db -&gt; trans_start(); $query = $this -&gt; db -&gt; query($sql); $this -&gt; db -&gt; trans_complete(); } catch (Exception $e) { $this -&gt; _log_message('error', 'Model global\Generate_main_menu-&gt;execute() =&gt; ERROR=' . $e); } if ($level &gt; 0) self::$menu[] = "&lt;ul&gt;"; foreach ($query-&gt;result() as $row) { self::$menu[] = '&lt;li&gt;'; self::$menu[] = '&lt;a onclick="javascript: dms_display_document(\'' . $this-&gt;ec_crypt-&gt; encode($row -&gt; doc_uid) . '\');" href="#" &gt;'; self::$menu[] = $row -&gt; title; self::$menu[] = '&lt;/a&gt;'; $this -&gt; _display_children($row -&gt; doc_uid, $level + 1); } if ($level &gt; 0) { self::$menu[]='&lt;/ul&gt;'; } self::$menu[]='&lt;/li&gt;'; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload