/**
 * 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
 *
 * @access public
 * @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)
 {
     if (!isset($this->_firstItem[$menu_name]) || !isset($this->_lastItem[$menu_name])) {
         $this->error("newVerticalMenu: the first/last item of the menu '{$menu_name}' is not defined; please check if you have parsed its menu data.");
         return 0;
     }
     $this->parseCommon($menu_name);
     $t = new Template();
     $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 Template();
     $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=\"moveLayerY('" . $this->tree[$cnt]["layer_label"] . "', " . $ordinateMargin . ") ; moveLayerX('" . $this->tree[$cnt]["layer_label"] . "') ; LMPopUp('" . $this->tree[$cnt]["layer_label"] . "', false);\"";
             } else {
                 $this->tree[$cnt]["onmouseover"] = " onmouseover=\"shutdown();\"";
             }
             $t->setVar(array("menu_name" => $menu_name, "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=\"moveLayerY('" . $this->tree[$cnt]["layer_label"] . "', " . $ordinateMargin . ") ; moveLayerX('" . $this->tree[$cnt]["layer_label"] . "') ; 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("menu_name" => $menu_name, "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;\" onmouseover=\"clearLMTO();\" onmouseout=\"setLMTO();\">\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.
 *
 * @access public
 * @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 Template();
     $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];
 }
Example #3
0
$db->baseDir = str_replace('/shell/', '/', $db->baseDir);
try {
    $db->cache = Zend\Cache\StorageFactory::factory($config->cache->toArray());
} catch (\Exception $e) {
    if (preg_match('/Cache directory \'(.*)\' not found or not a directory/', $e->getMessage(), $catches)) {
        mkdir($catches[1]);
        $db->cache = Zend\Cache\StorageFactory::factory($config->cache->toArray());
    } else {
        throw $e;
    }
}
$db->config = $config;
require __DIR__ . '/../lib/crm/Autoload.php';
crm\Autoload::getInstance();
$template = new Template(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, $config->template);
$template->setBlock('head', 'general/head.phtml');
$template->setBlock('header', 'general/header.phtml');
$template->setBlock('breadcrumbs', 'general/breadcrumbs.phtml');
$template->setBlock('navigation', 'general/navigation.phtml');
$template->setBlock('footer', 'general/footer.phtml');
$control = $template->createControl();
$control->setBaseDir(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'control');
$connected = true;
set_error_handler(create_function('', ''));
try {
    $db->getDriver()->getConnection()->connect();
} catch (\Exception $e) {
    $connected = false;
}
restore_error_handler();
if (!$connected) {