I am abit furth in the puzzle. I have found the class.topic.php which defines the getPublicHelpTopics function. So far on the function I have
the bit I don't understand is how this is filtering the tickets. Below is where my code is so far. I understand I need to pass the argument in, so I have setup 3, 1 for each department. The part of code I am really not understanding the the //resolve parent names part
static function getHelpTopics($publicOnly=false, $disabled=false, $itonly=false, $hronly=false, $finonly=false) { global $cfg; static $topics, $names = array();
if (!$names) { $sql = 'SELECT topic_id, topic_pid, ispublic, isactive, topic, dept_id FROM '.TOPIC_TABLE . ' ORDER BY `sort`'; $res = db_query($sql);
// Fetch information for all topics, in declared sort order $topics = array(); while (list($id, $pid, $pub, $act, $topic) = db_fetch_row($res)) $topics = array('pid'=>$pid, 'public'=>$pub, 'disabled'=>!$act, 'topic'=>$topic, 'dept_idid'=>$depid );
// Resolve parent names foreach ($topics as $id=>$info) { $name = $info; $loop = array($id=>true); $parent = false; while ($info && ($info = $topics[$info)) { $name = sprintf('%s / %s', $info, $name); if ($parent && $parent) // Cascade disabled flag $topics = true; if (isset($loop[$info)) break; $loop[$info = true; $parent = $info; } $names = $name; } }
// Apply requested filters $requested_names = array(); foreach ($names as $id=>$n) { $info = $topics; if ($publicOnly && !$info) continue; if (!$disabled && $info) continue; if ($disabled === self: && $info) $n .= " - ".__("(disabled)"); $requested_names = $n; }
return $requested_names; }
function getPublicHelpTopics() { return self:(true); }
function getAllHelpTopics() { return self:(false, true); } function getitHelpTopics() { return self:(true, false, 2); }