예제 #1
0
/**
 * Generate User Menu Assigned by Profile.
 * @param type $id_profile
 * @return type
 */
function generateMenu($id_profile, $id_user)
{
    global $array_label;
    $query_result = getMenu($id_profile);
    $a_menu = array();
    $s_menu = array();
    if (mysql_num_rows($query_result) == 0) {
        array_push($a_menu, array("label" => $array_label['login_no_menu'], "id_group_phase" => 0));
        $a_temp = array("id_group_phase" => "0", "id_phase" => "0", "name" => $array_label['login_no_menu'], "total" => 0, "assigned" => 0);
        array_push($s_menu, $a_temp);
    } else {
        $temp = "";
        while ($showtablerow = mysql_fetch_array($query_result)) {
            $phase_label = $showtablerow['label'];
            $a_temp = array("id_group_phase" => $showtablerow['id_group_phase'], "id_phase" => $showtablerow['id_phase'], "name" => $showtablerow['name'], "total" => 0, "assigned" => 0);
            array_push($s_menu, $a_temp);
            if ($phase_label != $temp) {
                $temp = $phase_label;
                array_push($a_menu, array("label" => $showtablerow['label'], "id_group_phase" => $showtablerow['id_group_phase']));
            }
        }
        $s_menu = updateInstanceWork($s_menu, $id_user);
    }
    return array("a_menu" => $a_menu, "s_menu" => $s_menu);
}
예제 #2
0
<?php

include '../pf_service/pf_session_val.php';
include '../pf_service/pf_data_service.php';
$array_label = parse_ini_file("../pf_include/lang/labels" . $_SESSION['pf_local_lang'] . ".ini");
$a_menu = array();
$s_menu = array();
if (!isset($_SESSION['pf_a_menu']) || $_SESSION['pf_a_menu'] == null) {
    $menu = generateMenu($_SESSION['pf_id_profile'], $_SESSION['pf_id_user']);
    $_SESSION['pf_a_menu'] = $a_menu = $menu['a_menu'];
    $_SESSION['pf_s_menu'] = $s_menu = $menu['s_menu'];
} else {
    $a_menu = $_SESSION['pf_a_menu'];
    $s_menu = updateInstanceWork($_SESSION['pf_s_menu'], $_SESSION['pf_id_user']);
}