Exemple #1
0
<?php

require __DIR__ . "/../bourbon/band.php";
require __DIR__ . "/../bourbon/bandmate.php";
require __DIR__ . "/../bourbon/performer.php";
require __DIR__ . "/../bourbon/label.php";
$status_message = '';
// Status messages, default to nothing
$form_error = null;
$bd = new Band();
$bd->auth(null);
$b = new Bandmate();
$bandmateList = $b->getBandmateAsSelectWithBandId(null);
$p = new Performer();
$performerList = $p->getPerformerAsSelect();
// Populate Genre Select List
$l = new Label();
$labelList = $l->getLabelAsSelect();
// Handle Post Request
if (WEB::_req('POST')) {
    $msg = WEB::_imageUpload($_FILES['image']);
    if (!array_key_exists('error', $msg)) {
        $band_name = WEB::_post('band_name');
        $band_formed_date = WEB::_post('band_formed_date');
        $band_break_up_date = WEB::_post('band_break_up_date');
        $band_cover = $msg['file_path'];
        $band_bio = WEB::_post('band_bio');
        $label_id = WEB::_post('label_id');
        // array($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio)
        $form_error = $bd->validateParams(array($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio, $label_id));
        if (is_null($form_error) && !is_null($band_name) && !is_null($band_formed_date) && $bd->createBand($band_name, $band_formed_date, $band_break_up_date, $band_cover, $band_bio, $label_id)) {