Exemple #1
0
function themeSetup(&$smarty, $selectedMenu, $pdbACL, $pACL, $idUser)
{
    /* El tema elastixneo muestra hasta 7 items de menú de primer nivel, y 
     * coloca el resto en una lista desplegable a la derecha del último item. 
     * Se debe de garantizar que el item actualmente seleccionado aparezca en 
     * un menú de primer nivel que esté entre los 7 primeros, reordenando los 
     * items si es necesario. */
    $lang = get_language();
    $arrMainMenu = $smarty->get_template_vars('arrMainMenu');
    foreach ($arrMainMenu as $idMenu => $arrMenuItem) {
        $arrMainMenu[$idMenu]['icon'] = setIcon($idMenu);
    }
    $idMainMenuSelected = $smarty->get_template_vars('idMainMenuSelected');
    $MAX_ITEMS_VISIBLES = 7;
    if (count($arrMainMenu) > $MAX_ITEMS_VISIBLES) {
        // Se transfiere a arreglo numérico para manipular orden de enumeración
        $tempMenulist = array();
        $idxMainMenu = NULL;
        foreach ($arrMainMenu as $key => $value) {
            if ($key == $idMainMenuSelected) {
                $idxMainMenu = count($tempMenulist);
            }
            $tempMenulist[] = array($key, $value);
        }
        if (!is_null($idxMainMenu) && $idxMainMenu >= $MAX_ITEMS_VISIBLES) {
            $menuitem = array_splice($tempMenulist, $idxMainMenu, 1);
            array_splice($tempMenulist, $MAX_ITEMS_VISIBLES - 1, 0, $menuitem);
            $arrMainMenu = array();
            foreach ($tempMenulist as $menuitem) {
                $arrMainMenu[$menuitem[0]] = $menuitem[1];
            }
        }
        unset($tempMenulist);
    }
    $smarty->assign('arrMainMenu', $arrMainMenu);
    $smarty->assign("LANG", $lang);
    $smarty->assign(array("ABOUT_ELASTIX2" => _tr('About Elastix2'), "HELP" => _tr('HELP'), "USER_LOGIN" => $_SESSION['elastix_user'], "USER_ID" => $idUser, "CURRENT_PASSWORD_ALERT" => _tr("Please write your current password."), "NEW_RETYPE_PASSWORD_ALERT" => _tr("Please write the new password and confirm the new password."), "PASSWORDS_NOT_MATCH" => _tr("The new password doesn't match with retype password."), "CHANGE_PASSWORD" => _tr("Change Elastix Password"), "CURRENT_PASSWORD" => _tr("Current Password"), "NEW_PASSWORD" => _tr("New Password"), "RETYPE_PASSWORD" => _tr("Retype New Password"), "CHANGE_PASSWORD_BTN" => _tr("Change"), "MODULES_SEARCH" => _tr("Search modules"), "ADD_BOOKMARK" => _tr("Add Bookmark"), "REMOVE_BOOKMARK" => _tr("Remove Bookmark"), "ADDING_BOOKMARK" => _tr("Adding Bookmark"), "REMOVING_BOOKMARK" => _tr("Removing Bookmark"), "HIDING_IZQTAB" => _tr("Hiding left panel"), "SHOWING_IZQTAB" => _tr("Loading left panel"), "HIDE_IZQTAB" => _tr("Hide left panel"), "SHOW_IZQTAB" => _tr("Load left panel"), 'viewMenuTab' => getStatusNeoTabToggle($pdbACL, $idUser), 'MENU_COLOR' => getMenuColorByMenu($pdbACL, $idUser), 'IMG_BOOKMARKS' => menuIsBookmark($pdbACL, $idUser, $selectedMenu) ? 'bookmarkon.png' : 'bookmark.png', 'SHORTCUT' => loadShortcut($pdbACL, $idUser, $smarty), 'STATUS_STICKY_NOTE' => 'false', 'BREADCRUMB' => setBreadcrumb($arrMainMenu, $selectedMenu)));
    // se obtiene si ese menu tiene una nota agregada
    $statusStickyNote = getStickyNote($pdbACL, $idUser, $selectedMenu);
    if ($statusStickyNote['status'] && $statusStickyNote['data'] != "") {
        $smarty->assign('STATUS_STICKY_NOTE', 'true');
        if ($statusStickyNote['popup'] == 1) {
            $smarty->assign('AUTO_POPUP', '1');
        }
    }
}
Exemple #2
0
function handleJSON_get_sticky_note($smarty, $module_name)
{
    $jsonObject = new PaloSantoJSON();
    $id_menu = getParameter("id_menu");
    if (empty($id_menu)) {
        $jsonObject->set_status('ERROR');
        $jsonObject->set_error(_tr('Module not specified'));
    } else {
        global $arrConf;
        $pdbACL = new paloDB($arrConf['elastix_dsn']['acl']);
        $pACL = new paloACL($pdbACL);
        $idUser = $pACL->getIdUser($_SESSION['elastix_user']);
        $output = getStickyNote($pdbACL, $idUser, $id_menu);
        $jsonObject->set_status($output['status'] === TRUE ? 'OK' : 'ERROR');
        $jsonObject->set_error($output['msg']);
        $jsonObject->set_message($output['data']);
    }
    return $jsonObject->createJSON();
}