Ejemplo n.º 1
0
        if ($_SESSION[history] == 0) {
            $thisobj["Fields"]["button_dopres"] = make_button($CONF[url_base] . $CONF[dir_modules] . "prestazioni/pages/new_prestazione.php?app_id=" . $_GET[id] . "&Tipo=" . $result[type_app] . "&dataimpegno=" . $result[day] . "&contr_unif=" . $c_un . "&storico=" . $CONF[storico_impegni] . "&curiaimpegno=" . $result[cal_comp_desc] . "&tipoimpegno=" . $result[type_app] . "&curiapratica=" . $curia, CALENDAR_DOPRES);
        } else {
            $thisobj["Fields"]["button_dopres"] = CALENDAR_DOPRES;
        }
        $thisobj["Fields"]["button_prat"] = make_button($CONF[url_base] . $CONF[dir_modules] . "pratiche/pages/pratiche_show.php?id=" . $result[ref_prat], PRATICHE_PRAT);
        $thisobj["Fields"]["button_pres"] = make_button($CONF[url_base] . $CONF[dir_modules] . "prestazioni/pages/prestazioni_view.php?form_id=listprestaz&form_page=1&ref_id[text]=&ref_id[realval][]=" . $result[ref_prat], PRESTAZIONI_TITLE);
        $thisobj["Fields"]["button_scad"] = make_button($CONF[url_base] . $CONF[dir_modules] . "calendar/pages/app_view.php?form_id=listcont&form_page=1&ref_prat[text]=&ref_prat[realval][]=" . $result[ref_prat], PRATICHE_IMPEGN);
        $thisobj["Fields"]["button_doc"] = make_button($CONF[url_base] . $CONF[dir_modules] . "document/pages/documents_view.php?form_id=listdoc&form_page=1&ref_prat[text]=&ref_prat[realval][]=" . $result[ref_prat], DOCUMENT_TITLE);
        $thisobj["Fields"]["button_dbox"] = make_button($CONF[url_base] . $CONF[dir_modules] . "document/pages/dropbox_view.php?form_id=listdoc&form_page=1&ref_prat[text]=&ref_prat[realval][]=" . $result[ref_prat], DOCUMENT_TITLE_DROPBOX);
        $keymap[54] = $CONF[url_base] . $CONF[dir_modules] . "/pratiche/pages/pratiche_show.php?id=" . $result[ref_prat];
        $keymap[55] = $CONF[url_base] . $CONF[dir_modules] . "/prestazioni/pages/prestazioni_view.php?form_id=listprestaz&form_page=1&ref_id[text]=&ref_id[realval][]=" . $result[ref_prat];
        $keymap[56] = $CONF[url_base] . $CONF[dir_modules] . "/calendar/pages/app_view.php?form_id=listcont&form_page=1&ref_prat[text]=&ref_prat[realval][]=" . $result[ref_prat];
        $keymap[57] = $CONF[url_base] . $CONF[dir_modules] . "document/pages/documents_view.php?form_id=listdoc&form_page=1&ref_prat[text]=&ref_prat[realval][]=" . $result[ref_prat];
        print set_js_keyhandler($keymap);
        print draw_object($thisobj, intval($_GET[id]), $module);
    } else {
        $response[title] = FW_ERROR_NO_PERM;
        $response[text] = FW_ERROR_NO_PERM_TXT;
        $iserror = 1;
        print draw_response($response);
    }
}
$PAGE[PAGE_CONTENT] = ob_get_contents();
ob_end_clean();
template_define_elements();
final_render();
function fatto()
{
    echo "pippo";
}
Ejemplo n.º 2
0
function draw_object($object, $id, $module, $real_obj = "")
{
    global $DB, $CONF, $CUR_TEMPLATE;
    foreach (explode("||", $object[options]) as $value) {
        list($type, $val) = explode("::", $value);
        switch ($type) {
            case "perm":
                $perm = $val;
                break;
        }
    }
    if ($real_obj == "") {
        if ($perm == 0) {
            $rs = @$DB->Execute(str_replace("%[ID]%", $id, $object[sql_select]));
        } else {
            $rs = @$DB->Execute(perm_sql_read(str_replace("%[ID]%", $id, $object[sql_select]), $module));
        }
        //print perm_sql_read(str_replace("%[ID]%",$id,$object[sql_select]),$module);
        if (!$rs) {
            return 0;
        }
        if ($rs->RecordCount() != 1) {
            $response[title] = FW_ERROR_NO_OBJ;
            $response[text] = FW_ERROR_NO_OBJ_FOUND;
            return draw_response($response);
        }
        $this_object = $rs->FetchRow();
        log_event("S", $module, $id);
    } else {
        $this_object = $real_obj;
    }
    $obj_template_content = file_get_contents($CONF[path_base] . $CONF[dir_modules] . $module . "/" . $CONF[dir_template] . $CUR_TEMPLATE[name] . '/' . $object[object_template]);
    foreach ($object[Fields] as $fname => $ftitle) {
        list($val, $type) = explode("::", $ftitle);
        $cur = $this_object[$fname];
        if (isset($type)) {
            switch ($type) {
                case "low":
                    $val = strtolower($val);
                    break;
                case "up":
                    $val = strtoupper($val);
                    break;
                case "date":
                    list($yy, $mm, $dd) = explode('-', $cur);
                    if ($yy != "0000" && $mm != "00" && $dd != "00") {
                        $cur = date($CONF[date_format], mktime(7, 0, 0, $mm, $dd, $yy));
                    } else {
                        $cur = "";
                    }
                    break;
            }
        }
        if ($type[0] == "(") {
            $type = str_replace("(", "", $type);
            $type = str_replace(")", "", $type);
            foreach (explode("||", $type) as $v) {
                list($or, $re) = explode("=>", $v);
                if ($cur == $or) {
                    $cur = $re;
                }
            }
        }
        if ($type[0] == "[") {
            $type = str_replace("[", "", $type);
            $type = str_replace("]", "", $type);
            list($sql_q, $field_show) = explode(";;", $type);
            if (!strstr($cur, ",,")) {
                $sql_q = str_replace("%ID%", $cur, $sql_q);
                $type_query = @$DB->Execute($sql_q);
                $row_query = $type_query->FetchRow();
                $cur = $row_query[$field_show];
            } else {
                $newcur = "";
                foreach (explode(",,", $cur) as $curr) {
                    $sqln = str_replace("%ID%", $curr, $sql_q);
                    $type_query = @$DB->Execute($sqln);
                    $row_query = $type_query->FetchRow();
                    $newcur .= $row_query[$field_show] . ' ';
                }
                $cur = $newcur;
            }
        }
        if ($type[0] == "{") {
            $type = str_replace("{", "", $type);
            $type = str_replace("}", "", $type);
            list($sql_q, $field_show, $sep) = explode(";;", $type);
            $sql_q = str_replace("%ID%", $cur, $sql_q);
            $type_query = @$DB->Execute($sql_q);
            $cur = "";
            $cmul = 0;
            while (!$type_query->EOF) {
                if ($cmul > 0) {
                    $cur .= $sep;
                }
                $row_query = $type_query->FetchRow();
                $cur .= $row_query[$field_show];
                $cmul++;
            }
        }
        if (substr($type, 0, 6) == "func=>") {
            $type = str_replace("func=>", "", $type);
            $cur = $type($this_object);
        }
        if (ereg("^[0-9]+(\\.|,)[0-9]*\$", $cur)) {
            $cur = str_replace(".", ",", $cur);
        }
        $obj_template_content = str_replace("%[" . strtoupper($fname) . "-TITLE]%", $val, $obj_template_content);
        $obj_template_content = str_replace("%[" . strtoupper($fname) . "]%", $cur, $obj_template_content);
    }
    return $obj_template_content;
}