示例#1
0
 /**
 * Method to preparare a vertical menu.
 *
 * This method processes items of a menu to prepare the corresponding
 * vertical menu code updating many variables; it returns the code
 * of the corresponding _firstLevelMenu
 *
 
 * @param string $menu_name the name of the menu whose items have to be processed
 * @param integer $ordinateMargin margin (in pixels) to set the position
 *   of a layer a bit above the ordinate of the "father" link
 * @return string
 */
 function newVerticalMenu($menu_name = "", $ordinateMargin = 12)
 {
     $this->_parseCommon($menu_name);
     $t = new LayersTemplate();
     $t->setFile("tplfile", $this->verticalMenuTpl);
     $t->setBlock("tplfile", "template", "template_blck");
     $t->setBlock("template", "vertical_menu_table", "vertical_menu_table_blck");
     $t->setVar("vertical_menu_table_blck", "");
     $t->setBlock("vertical_menu_table", "vertical_menu_cell", "vertical_menu_cell_blck");
     $t->setVar("vertical_menu_cell_blck", "");
     $t_sub = new LayersTemplate();
     $t_sub->setFile("tplfile", $this->subMenuTpl);
     $t_sub->setBlock("tplfile", "sub_menu_cell", "sub_menu_cell_blck");
     $this->_firstLevelMenu[$menu_name] = "";
     $this->moveLayers .= "\tvar " . $menu_name . "TOP = getOffsetTop('" . $menu_name . "');\n";
     $this->moveLayers .= "\tvar " . $menu_name . "LEFT = getOffsetLeft('" . $menu_name . "');\n";
     $this->moveLayers .= "\tvar " . $menu_name . "WIDTH = getOffsetWidth('" . $menu_name . "');\n";
     for ($cnt = $this->_firstItem[$menu_name]; $cnt <= $this->_lastItem[$menu_name]; $cnt++) {
         // this counter scans all nodes of the new menu
         if ($this->tree[$cnt]["not_a_leaf"]) {
             // geometrical parameters are assigned to the new layer, related to the above mentioned children
             if ($this->tree[$cnt]["child_of_root_node"]) {
                 $this->moveLayers .= "\tsetLeft('" . $this->tree[$cnt]["layer_label"] . "', " . $menu_name . "LEFT + " . $menu_name . "WIDTH);\n";
             }
             $this->tree[$cnt]["arrow"] = $this->forwardArrow;
             $this->moveLayers .= "\tif (IE4) setWidth('" . $this->tree[$cnt]["layer_label"] . "'," . $this->abscissaStep . ");\n";
         } else {
             $this->tree[$cnt]["arrow"] = "";
         }
         if ($this->tree[$cnt]["child_of_root_node"]) {
             if ($this->tree[$cnt]["not_a_leaf"]) {
                 $this->tree[$cnt]["onmouseover"] = " onmouseover=\"moveLayerX('" . $this->tree[$cnt]["layer_label"] . "') ; moveLayerY('" . $this->tree[$cnt]["layer_label"] . "', " . $ordinateMargin . ") ; LMPopUp('" . $this->tree[$cnt]["layer_label"] . "', false);\"";
             } else {
                 $this->tree[$cnt]["onmouseover"] = " onmouseover=\"shutdown();\"";
             }
             $t->setVar(array("ordinateStep" => $this->ordinateStep, "icontag" => $this->tree[$cnt]["icontag"], "link" => $this->tree[$cnt]["parsed_link"], "refid" => " id=\"ref" . $this->tree[$cnt]["layer_label"] . "\"", "onmouseover" => $this->tree[$cnt]["onmouseover"], "title" => $this->tree[$cnt]["parsed_title"], "target" => $this->tree[$cnt]["parsed_target"], "text" => $this->tree[$cnt]["text"], "arrow" => $this->tree[$cnt]["arrow"]));
             $this->_firstLevelMenu[$menu_name] .= $t->parse("vertical_menu_cell_blck", "vertical_menu_cell");
         } else {
             if ($this->tree[$cnt]["not_a_leaf"]) {
                 $this->tree[$cnt]["onmouseover"] = " onmouseover=\"moveLayerX('" . $this->tree[$cnt]["layer_label"] . "') ; moveLayerY('" . $this->tree[$cnt]["layer_label"] . "', " . $ordinateMargin . ") ; LMPopUp('" . $this->tree[$cnt]["layer_label"] . "', false);\"";
             } else {
                 $this->tree[$cnt]["onmouseover"] = " onmouseover=\"LMPopUp('" . $this->tree[$this->tree[$cnt]["father_node"]]["layer_label"] . "', true);\"";
             }
             $t_sub->setVar(array("ordinateStep" => $this->ordinateStep, "icontag" => $this->tree[$cnt]["icontag"], "link" => $this->tree[$cnt]["parsed_link"], "refid" => " id=\"ref" . $this->tree[$cnt]["layer_label"] . "\"", "onmouseover" => $this->tree[$cnt]["onmouseover"], "title" => $this->tree[$cnt]["parsed_title"], "target" => $this->tree[$cnt]["parsed_target"], "text" => $this->tree[$cnt]["text"], "arrow" => $this->tree[$cnt]["arrow"]));
             $this->tree[$this->tree[$cnt]["father_node"]]["layer_content"] .= $t_sub->parse("sub_menu_cell_blck", "sub_menu_cell");
         }
     }
     // end of the "for" cycle scanning all nodes
     $t->setVar("vertical_menu_cell_blck", $this->_firstLevelMenu[$menu_name]);
     $this->_firstLevelMenu[$menu_name] = $t->parse("vertical_menu_table_blck", "vertical_menu_table");
     $this->_firstLevelMenu[$menu_name] = "<div id=\"" . $menu_name . "\" style=\"position: relative; visibility: visible;\">\n" . "<script language=\"JavaScript\" type=\"text/javascript\">\n" . "<!--\n" . "if (IE) fixieflm(\"" . $menu_name . "\");\n" . "// -->\n" . "</script>" . $this->_firstLevelMenu[$menu_name] . "\n" . "</div>";
     $t->setVar("abscissaStep", $this->abscissaStep);
     $t->setVar(array("layer_label" => $menu_name, "vertical_menu_table_blck" => $this->_firstLevelMenu[$menu_name]));
     $this->_firstLevelMenu[$menu_name] = $t->parse("template_blck", "template");
     $this->_updateFooter($menu_name);
     return $this->_firstLevelMenu[$menu_name];
 }
 /**
 * Method to prepare a new Horizontal Plain Menu.
 *
 * This method processes items of a menu to prepare and return
 * the corresponding Horizontal Plain Menu code.
 *
 * @param string $menu_name the name of the menu whose items have to be processed
 * @return string
 */
 function newHorizontalPlainMenu($menu_name = "")
 {
     $horizontal_plain_menu_blck = "";
     $t = new LayersTemplate();
     $t->setFile("tplfile", $this->horizontalPlainMenuTpl);
     $t->setBlock("tplfile", "template", "template_blck");
     $t->setBlock("template", "horizontal_plain_menu_cell", "horizontal_plain_menu_cell_blck");
     $t->setVar("horizontal_plain_menu_cell_blck", "");
     $t->setBlock("horizontal_plain_menu_cell", "plain_menu_cell", "plain_menu_cell_blck");
     $t->setVar("plain_menu_cell_blck", "");
     for ($cnt = $this->_firstItem[$menu_name]; $cnt <= $this->_lastItem[$menu_name]; $cnt++) {
         if ($this->tree[$cnt]["level"] == 1 && $cnt > $this->_firstItem[$menu_name]) {
             $t->parse("horizontal_plain_menu_cell_blck", "horizontal_plain_menu_cell", true);
             $t->setVar("plain_menu_cell_blck", "");
         }
         $nbsp = "";
         for ($i = 1; $i < $this->tree[$cnt]["level"]; $i++) {
             $nbsp .= "&nbsp;&nbsp;&nbsp;";
         }
         $t->setVar(array("nbsp" => $nbsp, "link" => $this->tree[$cnt]["parsed_link"], "title" => $this->tree[$cnt]["parsed_title"], "target" => $this->tree[$cnt]["parsed_target"], "text" => $this->tree[$cnt]["parsed_text"]));
         $t->parse("plain_menu_cell_blck", "plain_menu_cell", true);
     }
     $t->parse("horizontal_plain_menu_cell_blck", "horizontal_plain_menu_cell", true);
     $this->_horizontalPlainMenu[$menu_name] = $t->parse("template_blck", "template");
     return $this->_horizontalPlainMenu[$menu_name];
 }