當前位置: 首頁>>代碼示例>>PHP>>正文


PHP asset::create_edit方法代碼示例

本文整理匯總了PHP中asset::create_edit方法的典型用法代碼示例。如果您正苦於以下問題:PHP asset::create_edit方法的具體用法?PHP asset::create_edit怎麽用?PHP asset::create_edit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在asset的用法示例。


在下文中一共展示了asset::create_edit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: asset_process_session_request


//.........這裏部分代碼省略.........
                $skey = $tview;
            } else {
                $skey = "request";
            }
            if (isset($_SESSION["_" . $tfolder][$skey][$req_key])) {
                $t["sqlvars"][$req_key] = $_SESSION["_" . $tfolder][$skey][$req_key];
            }
            if (isset($_SESSION[$req_key])) {
                $t["sqlvars"][$req_key] = $_SESSION[$req_key];
            }
            if (isset($_REQUEST[$req_key])) {
                $t["sqlvars"][$req_key] = $_REQUEST[$req_key];
                $_SESSION["_" . $tfolder][$skey][$req_key] = $_REQUEST[$req_key];
            }
            if (!isset($t["sqlvars"][$req_key]) and empty($t["sqlvarsnoquote"][$req_key])) {
                $t["sqlwhere"][$key] = "1=1";
            }
        }
    }
    if (!isset($_SESSION[$tname][$tview]["group"])) {
        $_SESSION[$tname][$tview]["group"] = $t["group"];
    }
    if (!isset($_SESSION[$tname][$tview]["groupby"])) {
        $_SESSION[$tname][$tview]["groupby"] = $t["groupby"];
    }
    if (isset($_REQUEST["group"])) {
        if ($_SESSION[$tname][$tview]["groupby"] == "") {
            $_SESSION[$tname][$tview]["groupby"] = $t["orderby"];
            $_SESSION[$tname][$tview]["group"] = $t["order"];
        } else {
            $_SESSION[$tname][$tview]["groupby"] = "";
            $_SESSION[$tname][$tview]["group"] = "";
        }
    }
    if (!isset($_REQUEST["plain"])) {
        $t["groupby"] = $_SESSION[$tname][$tview]["groupby"];
        $t["group"] = $_SESSION[$tname][$tview]["group"];
    } else {
        $t["groupby"] = "";
        $t["group"] = "";
    }
    if ($t["groupby"] != "" and isset($t["fields"][$t["groupby"]])) {
        $field = $t["fields"][$t["groupby"]];
        $field["WIDTH"] = 0;
        unset($t["fields"][$t["groupby"]]);
        unset($t["fields_query"][$t["groupby"]]);
        $t["fields"] = array_merge(array($t["groupby"] => $field), $t["fields"]);
        $t["fields_query"] = array_unique(array_merge(array($t["groupby"]), $t["fields_query"]));
    }
    _asset_process_pages($t["maxdatasets"]);
    if (!isset($t["views"][$tview]["NOSQLORDER"])) {
        $t["sqlorder"] = ($t["groupby"] != "" ? $t["groupby"] . " " . $t["group"] . "," : "") . $t["orderby"] . " " . $t["order"];
    }
    if (!isset($t["views"][$tview]["NOSQLLIMIT"]) and empty($_REQUEST["print_all"]) and (empty($_REQUEST["export"]) or !empty($_REQUEST["limit"]))) {
        $t["sqllimit"] = array(($t["page"] - 1) * $t["limit"], $t["limit"]);
    }
    if (!empty($_REQUEST["iframe"]) and isset($_REQUEST["session_remove_request"])) {
        $t["sqllimit"] = array();
    }
    // offline reading
    if (!empty($t["sqlvars"]["item"]) and $t["views"][$tview]["SCHEMA_MODE"] == "edit" and $t["maxdatasets"] == 0) {
        sys_warning("{t}Item(s) not found or access denied.{/t}");
    }
    if ($t["maxdatasets"] != 0) {
        _asset_get_rows();
    }
    if ((!empty($_REQUEST["form_submit_create"]) or !empty($_REQUEST["form_submit_edit"])) and $t["rights"]["write"] and $t["schema_mode"] != "") {
        $mode = $t["schema_mode"] == "edit" ? "edit" : "create";
        list($t["errors"], $defaults, $form_ids, $saved_ids) = asset::create_edit($tfolder, $tview, $mode);
        foreach ($t["limits"] as $key => $val) {
            if (in_array($val, $form_ids)) {
                unset($t["limits"][$key]);
            }
        }
        if (count($t["errors"]) == 0) {
            $t["limits"] = range(0, $t["limit"] - 1);
            if (!empty($_REQUEST["form_submit_return"])) {
                $arr = array_pop(array_slice($_SESSION["history"], -2, 1));
                if (empty($arr[2])) {
                    $arr[2] = "default";
                }
                sys_redirect("index.php?view=" . $arr[2] . "&" . sys::$urladdon);
            }
            if (!empty($_REQUEST["form_submit_go_edit"])) {
                $items = "";
                foreach ($saved_ids as $id) {
                    $items .= "&item[]=" . rawurlencode($id);
                }
                sys_redirect("index.php?view=edit" . $items . "&" . sys::$urladdon);
            }
        }
        foreach ($defaults as $id => $field) {
            foreach ($field as $field_name => $value) {
                $t["fields"][$field_name]["SIMPLE_DEFAULTS"][$id] = $value;
                $t["fields"][$field_name]["SIMPLE_DEFAULT"] = "";
            }
        }
    }
    sys::$smarty->assign_by_ref("t", $t);
}
開發者ID:drognisep,項目名稱:Simple-Groupware,代碼行數:101,代碼來源:funcs.php


注:本文中的asset::create_edit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。