<?php include 'base.php'; User::protect(); $section = 'band_gps'; include_class('band_gps'); if ($_POST['submit']) { // add news entry $gp = BandGuestPerformer::add($_POST); if (!db::isError($gp)) { header('Location: band_gp_edit.php?id=' . $gp->getID()); exit; } } $editors = array('description'); $page_title = 'Add Guest Performer'; include 'layout/header.php'; ?> <div id="breadcrumb"> <a href="index.php">Audition ></a> <a href="band.php">Manage Band ></a> <a href="band_gps.php">Guest Performers ></a> Add Guest Performer </div> <?php if (User::isAdmin()) { if (db::isError($gp)) { $gp->outputList(); } ?> <h1>add guest performer:</h1>
<?php include 'base.php'; User::protect(); $section = 'band_gps'; include_class('band_gps'); $gp = BandGuestPerformer::get($_GET['id']); if (!db::isError($gp)) { switch ($_GET['task']) { case 'update': $res = $gp->update($_POST); if (!db::isError($res)) { header('Location: band_gp_edit.php?id=' . $_GET['id']); } break; case 'deactivate': $res = $gp->deactivate(); if (!db::isError($res)) { header('Location: band_gp_edit.php?id=' . $_GET['id']); } break; case 'activate': $res = $gp->activate(); if (!db::isError($res)) { header('Location: band_gp_edit.php?id=' . $_GET['id']); } break; case 'delete': $res = $gp->remove(); if (!db::isError($res)) { header('Location: band_gps.php');
function add($postArray) { $db = new db(); $e = new Error(); $firstname = $db->sanitize_to_db($postArray['firstname']); if (!$firstname) { $e->add("A band member entry must contain a first name."); } $lastname = $db->sanitize_to_db($postArray['lastname']); $function = $db->sanitize_to_db($postArray['function']); if (!$function) { $e->add("A guest performer must serve a function."); } $description = $db->sanitize_to_db($postArray['description']); $website = $db->sanitize_to_db($postArray['website']); if ($e->hasErrors()) { return $e; } if (User::isAdmin()) { $r = @mysql_query("insert into Band_Guest_Performers (firstname, lastname, function, description, website, is_active) values ('{$firstname}','{$lastname}','{$function}','{$description}','{$website}'," . DEFAULT_ACTIVE . ")"); if (!$r) { return Error::MySQL(); } else { $gp = BandGuestPerformer::get(mysql_insert_id()); return $gp; } } else { return Error::create("Only an administrator may create guest performers."); } }
function getReleaseGuestPerformers() { $q = "select guest_performer_id from Releases_to_Guest_Performers where release_id = '{$this->ID}'"; $r = mysql_query($q); $gps = array(); while ($row = mysql_fetch_assoc($r)) { $gps[] = BandGuestPerformer::get($row['guest_performer_id']); } return $gps; }