示例#1
0
    $status_message = WEB::_error('Performer couldn\'t be viewed. Check ID #!', null);
}
// Handle Post Request
if (WEB::_req('POST')) {
    $msg = WEB::_imageUpload($_FILES['image']);
    if (!array_key_exists('error', $msg)) {
        $performer_name = WEB::_post('performer_name');
        $performer_date_of_birth = WEB::_post('performer_date_of_birth');
        $performer_bio = WEB::_post('performer_bio');
        $performer_cover = $msg['file_path'];
        // Passed as: array($performer_name, performer_date_of_birth, performer_bio, performer_cover)
        $form_error = $p->validateParams(array($performer_name, $performer_date_of_birth, $performer_bio, $performer_cover));
        $updateStatus = true;
        if (is_null($form_error)) {
            if (!is_null($performer_name)) {
                $updateStatus = $p->updatePerformerName($performer_name);
            }
            if ($updateStatus && !is_null($performer_date_of_birth)) {
                $p->updatePerformerDateOfBirth($performer_date_of_birth);
            }
            if ($updateStatus) {
                $p->updatePerformerBio($performer_bio);
            }
            if ($updateStatus && !is_null($performer_cover)) {
                $p->updatePerformerCover($performer_cover);
            }
            if ($updateStatus) {
                $p->refresh();
                $status_message = WEB::_success('Performer Successfully updated!');
            } else {
                $status_message = WEB::_error('There is an error when you were updating the Performer.', null);