Example #1
0
<?php

require __DIR__ . "/../bourbon/performer.php";
require __DIR__ . "/../bourbon/band.php";
require __DIR__ . "/../bourbon/bandmate.php";
$status_message = '';
// Status messages, default to nothing
$form_error = null;
$p = new Performer();
$p->auth(null);
$b = new Bandmate();
$bandmateList = $b->getBandmateAsSelectWithPerformerId($p->getPerformerId());
$bd = new Band();
$bandList = $bd->getBandAsSelect();
// Handle Post Request
if (WEB::_req('POST')) {
    $msg = WEB::_imageUpload($_FILES['image']);
    if (!array_key_exists('error', $msg)) {
        // $performer_name, $performer_date_of_birth, $performer_bio, $performer_cover
        $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));
        if (is_null($form_error) && !is_null($performer_name) && !is_null($performer_date_of_birth) && $p->createPerformer($performer_name, $performer_date_of_birth, $performer_bio, $performer_cover)) {
            $status_message = WEB::_success('Performer Successfully Created!');
        } else {
            $status_message = WEB::_error('There is an error when you were creating the Performer. Please review the form below!', $form_error);
        }
        // Handle adding multiple Bands