[Unordered list-based hierarchy tom@wwworldmedia.com**20050708160035] { hunk ./incl_hierarchy.phtml 5 - + + // + // Basic, useless Hierarchy + // hunk ./incl_hierarchy.phtml 66 + + + // + // Basic select-oriented hierarchy + // hunk ./incl_hierarchy.phtml 177 + sajax_handle_client_request(); + return true; + } + } + + + + // + // TreeHierarchy + // + class TreeHierarchy extends Hierarchy { + function HtmlTreeHierarchy() { + $this->Hierarchy(); + } + + function renderHeader() { + $html = "
"; + return $html; + } + + function renderLevel($n) { + $this->debug("renderLevel($n).."); + reset($this->levels); + + $n_plus_1 = $n + 1; + $lvl = $this->levels[$n]; + $v_h = htmlspecialchars($lvl["value"]); + $id = $lvl["field_id"]; + $callback = $lvl["callback"]; + + $is_first = $n == 0 ? 1 : 0; + $is_last = $n == count($this->levels)-1 ? 1 : 0; + + if (! $is_first) { + $prev_id = $this->levels[$n-1]["field_id"]; + $prev_level = $n - 1; + } else { + $prev_id = ""; + $prev_level = 0; + } + + if (! $is_last) { + $next_id = $this->levels[$n+1]["field_id"]; + $next_level = $n+1; + } else { + $next_id = ""; + $next_level = 0; + } + + $html = ""; + + if ($is_first) + $html .= ""; + + return $html; + } + + function renderFooter() { + $first_id = $this->levels[0]["field_id"]; + $html = " +
"; + return $html; + } + + function render() { + global $sajax_debug_mode; + + $n = 0; + // $sajax_debug_mode = true; + $html = $this->renderHeader(); + reset($this->levels); + foreach ($this->levels as $lvl) { + $html .= $this->renderLevel($n); + $n++; + } + $html .= $this->renderFooter(); + return $html; + } + + function handleRequest() { }