コード例 #1
0
if (isset($_GET['action']) && $_GET['action'] == "delete" && isset($_GET['id'])) {
    $experience = new Experience();
    $experience->id = (int) $_GET['id'];
    if ($experience->delete()) {
        $session->message("Experience deleted ");
        redirect_to($_SERVER['PHP_SELF'] . "?#" . $_GET['id']);
        die;
    } else {
        $message = join("<br />", $experience->errors);
    }
}
if (isset($_GET['action']) && $_GET['action'] == "add") {
    if (isset($_POST['bt_add'])) {
        $add_new = new Experience();
        $add_new->experience_name = $_POST['txt_experience_name'];
        $add_new->var_name = $add_new->mod_write_check($_POST['txt_experience_name']);
        $add_new->is_active = $_POST['txt_is_active'];
        if ($add_new->save()) {
            $session->message("New Year Experience added.");
            redirect_to($_SERVER['PHP_SELF']);
            die;
        } else {
            $message = join("<br />", $add_new->errors);
        }
    }
}
$experience = Experience::find_all();
$manage_lists = array();
if ($experience && is_array($experience)) {
    $i = 1;
    foreach ($experience as $list) {