CONTROL_USER::ctl_form PHP Метод

ctl_form() публичный Метод

public ctl_form ( )
    function ctl_form()
    {
        $_num_userId = fn_getSafe(fn_get("user_id"), "int", 0);
        if ($_num_userId > 0) {
            if (!isset($this->adminLogged["admin_allow"]["user"]["edit"]) && !$this->is_super) {
                return array("alert" => "x010303");
            }
            $_arr_userRow = $this->mdl_user->mdl_read($_num_userId);
            if ($_arr_userRow["alert"] != "y010102") {
                return $_arr_userRow;
            }
        } else {
            if (!isset($this->adminLogged["admin_allow"]["user"]["add"]) && !$this->is_super) {
                return array("alert" => "x010301");
            }
            $_arr_userRow = array("user_id" => 0, "user_mail" => "", "user_nick" => "", "user_note" => "", "user_status" => "enable", "user_contact" => array(), "user_extend" => array());
        }
        $_arr_tpl = array("userRow" => $_arr_userRow);
        $_arr_tplData = array_merge($this->tplData, $_arr_tpl);
        $this->obj_tpl->tplDisplay("user_form.tpl", $_arr_tplData);
        return array("alert" => "y010102");
    }

Usage Example

Пример #1
0
//验证是否已登录
include_once BG_PATH_CONTROL . "admin/ctl/user.class.php";
//载入用户控制器
$ctl_user = new CONTROL_USER();
//初始化用户
switch ($GLOBALS["act_get"]) {
    case "import":
        $arr_userRow = $ctl_user->ctl_import();
        //导入
        if ($arr_userRow["alert"] != "y010305") {
            header("Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $arr_userRow["alert"]);
            exit;
        }
        break;
    case "form":
        $arr_userRow = $ctl_user->ctl_form();
        //导入
        if ($arr_userRow["alert"] != "y010102") {
            header("Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $arr_userRow["alert"]);
            exit;
        }
        break;
    default:
        $arr_userRow = $ctl_user->ctl_list();
        //列出
        if ($arr_userRow["alert"] != "y010302") {
            header("Location: " . BG_URL_ADMIN . "ctl.php?mod=alert&act_get=show&alert=" . $arr_userRow["alert"]);
            exit;
        }
        break;
}