Пример #1
0
if (!empty($_POST)) {
    $sponsor->region_id($region_id);
    $sponsor->region_type($region_type);
    $sponsor->department_id(get_param('department_id'));
    $sponsor->sponsor_type(get_param('sponsor_type'));
    $sponsor->title(get_param('title'));
    $sponsor->name_first(get_param('name_first'));
    $sponsor->name_last(get_param('name_last'));
    $sponsor->name_middle(get_param('name_middle'));
    $sponsor->office(get_param('office'));
    $sponsor->phone(get_param('phone'));
    $sponsor->email(get_param('email'));
    $sponsor->bio(get_param('bio'));
    $sponsor->image(get_param('image'));
    if ($id) {
        $sponsor->update();
    } else {
        $id = $sponsor->insert();
    }
    redirect('sponsor');
}
$html = new HTML('admin');
$html->set_title("Edit this person's directory information");
$html->generate_header();
?>
    <style type="text/css">
    .sponsor_type {
        display:none;
    }
    </style>
         }
     }
     if ($newImage != "") {
         if (move_uploaded_file($_FILES["image"]["tmp_name"], $targetImage)) {
             $msg .= "The file " . basename($_FILES["image"]["name"]) . " has been uploaded.";
             $status = 'ok';
             if (file_exists(MEDIA_FILES_PATH . "sponsor-image/" . $oldImage)) {
                 unlink(MEDIA_FILES_PATH . "sponsor-image/" . $oldImage);
             }
             $uploadOk = 1;
         } else {
             $uploadOk = 0;
         }
     }
     if ($uploadOk == 1) {
         echo $sponsorObj->update();
     } else {
         $msg = " Sorry, there was an error uploading your sponsor logo. ERROR: " . $msg;
         $json = array("status" => 0, "msg" => $msg);
         $dbObj->close();
         //Close Database Connection
         header('Content-type: application/json');
         echo json_encode($json);
     }
 } else {
     $json = array("status" => 0, "msg" => $errorArr);
     $dbObj->close();
     //Close Database Connection
     header('Content-type: application/json');
     echo json_encode($json);
 }