Ejemplo n.º 1
0
function template_add_head_foot($temp, $header, $footer)
{
    global $role_id;
    global $ROLE_ADMIN, $ROLE_LEADER, $ROLE_EMPLOYED, $ROLE_ZALEC, $unit;
    $header = $header . ".tpl";
    $footer = $footer . ".tpl";
    $head = template_open($header);
    $foot = template_open($footer);
    if ($role_id) {
        switch ($role_id) {
            case $role_id >= $ROLE_ADMIN:
                $foot = str_replace("##IF_ADMIN##", "", $foot);
                $foot = str_replace("##IF_LEADER##", "", $foot);
                break;
            case $role_id <= $ROLE_ADMIN and $role_id >= $ROLE_LEADER:
                $foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
                break;
            case $role_id <= $ROLE_LEADER and $role_id >= $ROLE_EMPLOYED:
                $foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
                $foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
                break;
            default:
                $foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
                $foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
                $foot = template_clean_up_tags($foot, "##IF_EMPLOYED##", 1);
                //	$foot =  template_clean_up_tags($foot,"##IF_ZALEC##",1);
        }
    } else {
        $foot = template_clean_up_tags($foot, "##IF_ZALEC##", 1);
        $head = template_clean_up_tags($head, "##IF_USER##", 1);
        $foot = template_clean_up_tags($foot, "##IF_ADMIN##", 1);
        $foot = template_clean_up_tags($foot, "##IF_LEADER##", 1);
        $foot = template_clean_up_tags($foot, "##IF_EMPLOYED##", 1);
    }
    //pogoj za zacasno blokado-vizualno zalcu
    if ($unit == $ROLE_ZALEC) {
        $foot = template_clean_up_tags($foot, "##IF_ZALEC##", 1);
    }
    /////////////////
    return $head . "\n\n" . '<!-- end head -->' . $temp . "\n\n" . '<!-- end main template -->' . "\n\n" . ' <!-- start foot -->' . "\n\n" . $foot;
}
Ejemplo n.º 2
0
echo "do sem";
$sql = "SELECT * FROM roles";
//TitleGroup";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
    $names[] .= $res["name"];
    $values[] .= $res["id_role"];
}
$role_dropdown = html_drop_down_arrays("role_drop", $names, $values, "");
if ($_REQUEST['add'] == "Dodaj") {
    //echo $username."-".$password."-".$first."-".$last."-".$role_drop;
    if ($username and $password and $first and $last) {
        //pogledamo kaj imamo in ce je ze tak notr slucajn...
        $sql = "SELECT first FROM persons where first='{$first}' and last='{$last}'";
        $result = $db->fetchOne($sql);
        if ($result) {
            $message .= "Uporabnik ze obstaja";
        } else {
            // dejansko vnesemo
            $data = array('username' => $username, 'passwd' => $password, 'first' => $first, 'last' => $last, 'id_role' => $role_drop);
            $db->insert('persons', $data);
            $message .= "Uporabnik dodan..";
        }
    } else {
        $message .= "Izpolni vsa polja!";
    }
}
$tem = str_replace("##MESSAGE##", $message, $tem);
$tem = str_replace("##ROLE_DROPDOWN##", $role_dropdown, $tem);
$tem = template_clean_up_tags($tem, "##");
echo $tem;
$TITLE = "Editiranje";
$tem = template_open("scan_last_insert.tpl");
$tem = template_add_head_foot($tem, head, foot);
echo "scan zadnjega";
echo $did;
$edit = $_REQUEST['edit'];
if ($_REQUEST['edit'] == "edit") {
    for ($i = 0; $i < $count; $i++) {
        $data = array('person_assessor' => $did[$i]);
        $db->insert('LogInventory', $data);
    }
    /*
        //dejansko vnesemo
        $data = array(
            'person_assessor' => $did
    
    
        );
        $db->insert('LogInventory', $data);
    */
    //$message .= "Vnos je dodan";
    header("location:" . "scan_inventory.php");
    exit;
}
$tem = str_replace("##TEST##", $unit, $tem);
$tem = str_replace("##EAN##", $myname, $tem);
$tem = str_replace('##MESSAGE##', $message, $tem);
$tem = str_replace('##USER##', $identity, $tem);
$tem = str_replace('##TITLE##', $TITLE, $tem);
$tem = template_clean_up_tags($tem, '##');
echo $tem;