/**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function signup()
 {
     $user = Band::model()->findByAttributes(array('name_band' => $this->name));
     //create model in the models folder
     if ($user != null) {
         // user already exist
         $this->addError('name', 'This name already exists');
         return false;
     } else {
         if ($this->name == null) {
             $this->addError('name', 'Name cannot be blank');
             return false;
         } else {
             if ($this->password == null) {
                 $this->addError('password', 'Password cannot be blank');
                 return false;
             } else {
                 if ($this->genre == null) {
                     $this->addError('genre', 'Genre cannot be blank');
                     return false;
                 }
             }
         }
     }
     $_band = new Band();
     $_band->page_band = $this->page;
     $_band->name_band = $this->name;
     $_band->password_band = $this->password;
     $_band->genre_band = $this->genre;
     $_band->email_band = $this->email;
     $_band->desc_band = $this->desc;
     $_band->save();
     return true;
 }
 public function signup()
 {
     $user = new Band();
     $user->name_band = $this->username;
     $user->code_band = $this->password;
     $user->save();
     ///return !$this->errorCode;
 }
Exemple #3
0
 public function action_add_band()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $band = new Band(null);
         if ($_POST['name'] != "") {
             $band->set_name_band($_POST['name']);
         } else {
             $this->_error_msg = "Il y a une erreur dans le nom du groupe. <br> ";
             $this->_error_form = true;
         }
         if (is_numeric($_POST['anneeF']) and preg_match("/^[0-2][0-9]{3}+\$/", $_POST['anneeF']) == 1) {
             $band->set_date_form_band($_POST['anneeF']);
         } else {
             $this->_error_msg .= "Il y a une erreur dans la date de formation (Format : AAAA).<br> ";
             $this->_error_form = true;
         }
         if (is_numeric($_POST['anneeD']) or $_POST['anneeD'] == "") {
             $band->set_date_disband_band($_POST['anneeD']);
         }
         if ($this->_error_form == false) {
             $band->set_id_user_lif($user->get_id_user_lif());
             $band->add();
             return Redirect::to_action('band');
         } else {
             return Redirect::to_action('band@add')->with('error', true)->with('form', $_POST)->with('error_msg', $this->_error_msg);
         }
     }
 }
Exemple #4
0
 public function action_add()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $kind = Kind::all();
         $form = Session::get('form');
         $band_selected = null;
         $id_band = null;
         if (isset($_POST['band'])) {
             $band_selected = $_POST['band'];
         }
         if (isset($form['id_group'])) {
             $band_selected = $form['id_group'];
         }
         if (isset($_POST['id_group'])) {
             $band_selected = $_POST['id_group'];
         }
         if (isset($form)) {
             $album_selected = $form['album'];
         } else {
             $album_selected = null;
         }
         if (isset($band_selected)) {
             $album = Album::get_from_id($band_selected);
             if (count($album) != 0) {
                 $album_for_select = array();
                 foreach ($album as $value) {
                     $album_for_select[$value->id_album] = $value->name_album;
                 }
                 if (isset($_POST['id_band'])) {
                     $band_selected = $_POST['band'];
                 }
                 if (isset($_POST['band'])) {
                     $band_selected = $_POST['band'];
                 }
             } else {
                 $album_for_select = null;
                 $this->_error_msg = "Ce groupe n'a pas d'album, veuillez l'ajouter! </br>";
             }
         } else {
             $album_for_select = null;
         }
         $band = Band::all();
         $band_for_select = array();
         foreach ($band as $value) {
             $band_for_select[$value->attributes['id_band']] = $value->attributes['name_band'];
         }
         return View::make('content.song.add')->with('band', $band_for_select)->with('band_selected', $band_selected)->with('album_selected', $album_selected)->with('album', $album_for_select)->with('msg', $this->_error_msg)->with('kinds', $kind);
     }
 }
Exemple #5
0
 public function action_add()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $band = Band::all();
         $band_for_select = array();
         foreach ($band as $value) {
             $band_for_select[$value->attributes['id_band']] = $value->attributes['name_band'];
         }
         return View::make('content.album.add')->with('band', $band_for_select);
     }
 }
 public function downgrade(Request $request, $course_id)
 {
     $course = Course::find($course_id);
     $user = User::find($request->user_id);
     $user_id = $request->user_id;
     $user->courses()->updateExistingPivot($course_id, ['level' => 0]);
     $test = CourseUser::where('user_id', $user_id)->where('level', 1)->count();
     if ($test == 0 && $user->level->level == 2) {
         if (!empty(Band::where('user_id', $user_id)->first())) {
             $user->level_id = 2;
         } else {
             $user->level_id = 1;
         }
         makeModification('users', printUserLinkV2($user) . ' is no longer a teacher.');
         $user->save();
     }
     CourseModification::create(['author_id' => Auth::user()->id, 'user_id' => $user_id, 'course_id' => $id, 'value' => 5]);
     Flash::success("{$user->first_name} {$user->last_name} est maintenant un élève du cours ucfirst({$course->name})");
     return redirect('admin/courses/' . $course->slug . '/members');
 }
 public function deactivateBand($memberID, $bandID, $dbConnection)
 {
     $success = false;
     try {
         $bandDetails = new Band();
         $bandDetails->setVariable(Band::BAND_ID, $bandID);
         $bandDetails->setVariable(Band::ACTIVE, 2);
         $success = BandDao::updateBand($memberID, $bandDetails, $dbConnection);
     } catch (Exception $ex) {
         echo 'Caught exception: ', $ex->getMessage(), "\n";
         $success = false;
     }
     return $success;
 }
Exemple #8
0
<?php

$band = new Band();
if (isset($_GET['band_id'])) {
    $band->getBand($_GET['band_id'], 10);
} else {
    $band->getBandAll(90, false);
}
Exemple #9
0
<?php

require __DIR__ . "/bourbon/band.php";
$status_message = '';
// Status messages, default to nothing
// List View
$bd = new Band();
// Handle Pagination of Bands
$numOfBands = $bd->bandCount();
$page = WEB::_get('pg');
if ($page === null) {
    $page = 0;
}
// Get Band Data List (Used to display data in the table - see below)
$bandList = $bd->getBandAsList($page);
// Handle Deleteing from this view...
if (WEB::_action('delete')) {
    if ($bd->deleteBandById(WEB::_get('delete'))) {
        $status_message = WEB::_success('Band was deleted successfully!');
        $bandList = $bd->getBandAsList($page);
    } else {
        $status_message = WEB::_error('Band couldn\'t be deleted! Make sure you are not trying to delete an Band who has associated Performers!', null);
    }
}
?>

<!-- // Begin Genre Template (List View) -->

<?php 
include __DIR__ . "/bourbon/template/header.php";
?>
Exemple #10
0
<?php

require_once __DIR__ . "/../bourbon/band.php";
require_once __DIR__ . "/../bourbon/bandmate.php";
$bd = new Band();
$bd->init(WEB::_get('id'));
$b = new Bandmate();
$performerList = $b->getListOfPerformerWithBandId($bd->getBandId());
?>


<?php 
if (!$bd->valid()) {
    ?>
	<!-- // Invalid Record -->
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h4 class="modal-title">Invalid Band</h4>
	</div>
	<div class="modal-body">
		<p>It looks like you were trying to access a band that we no longer have.</p>
	</div>
<?php 
} else {
    ?>
	<!-- // Valid Record -->
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		<h4 class="modal-title"><strong><?php 
    echo $bd->getBandName();
    ?>
 private function extractBandSearchObject(&$result)
 {
     $band = null;
     try {
         if ($result[BandSearchDao::BAND_ID_FIELD] !== null) {
             $band = new Band();
             $band->setVariable(Band::BAND_ID, $result[BandSearchDao::BAND_ID_FIELD]);
             $band->setVariable(Band::NAME, $result[BandSearchDao::BAND_NAME_FIELD]);
             $band->setVariable(Band::SUMMARY, $result[BandSearchDao::SUMMARY_FIELD]);
             $band->setVariable(LocationConstants::REGION_ID, $result[BandSearchDao::REGION_ID_FIELD]);
             $band->setVariable(LocationConstants::CITY_ID, $result[BandSearchDao::CITY_ID_FIELD]);
             $band->setVariable(LocationConstants::STATE_ID, $result[BandSearchDao::STATE_ID_FIELD]);
             $band->setVariable(LocationConstants::COUNTRY_ID, $result[BandSearchDao::COUNTRY_ID_FIELD]);
         }
     } catch (PDOException $ex) {
         echo "extractBandSearchObject error: " . $ex->getMessage();
     }
     return $band;
 }
Exemple #12
0
//
use Javanile\SchemaDB\Storable;
//
$db->setPrefix('o2m_');
//
$db->drop('*', 'confirm');
//
class Band extends Storable
{
    public $name = '';
    public $songs = '<<Song*>>';
}
//
class Song extends Storable
{
    public $title = '';
}
//
$newBand = new Band(['name' => 'Beatles', 'songs' => ['Let it Beee', 'Yellow mom']]);
//
echo '<pre>';
var_dump($newBand);
echo '</pre>';
//
$id = $newBand->store();
//
$oldBand = Band::load($id);
//
echo '<pre>';
var_dump($oldBand);
echo '</pre>';
Exemple #13
0
    echo "</tr>";
}
?>
              </tbody>
            </table>
        </div>

    <!-- Page Content -->
    <div class="container">
        <!-- Sección de los locales -->
        <div class="row">
            <?php 
$local = new Local();
$local->getLocalAll(6, true);
?>
        <div class="row">
        <div class="col-lg-12">
                <h2 class="page-header">Banda</h2>
            </div>
        <?php 
$band = new Band();
$band->getBandAll(4);
?>
        </div>
        <hr>
    </div>
    <script>
    $('.carousel').carousel({
        interval: 5000 //changes the speed
    })
    </script>
Exemple #14
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)) {
                        $res = 'Sorry, we were not able to update that band rating at this time';
                    }
                } else {
                    $res = 'We do not have the information we need to update';
                }
                break;
            default:
                $res = 'Sorry, action request not understood';
        }
    } else {
        $res = "Error, please set an action param to do anything, or you are requesting something you should not";
    }
} elseif (!empty($_GET)) {
    //handle get requests
    if (!empty($_GET['action'])) {
        switch ($_GET['action']) {
            case 'bands':
                $band = new Band(null);
                $res = json_encode($band->grab_all_bands());
                break;
            default:
                $res = 'Sorry, action not understood';
        }
    } else {
        $res = 'Please set action param for GET request';
    }
} else {
    $res = "Error, request not understood";
}
echo $res;
//the response
<?php

if ($bandId == 'new') {
    $bandInsert = new BandInsert();
    $band = new Band();
} else {
    $bandUpdate = new BandUpdate($bandId);
    $bands = new Bands($bandId);
    $band = new Band($bands->getBand());
}
$bandDelete = new BandDelete($band);
?>

<form enctype="multipart/form-data" class="box bands" method="post" action="<?php 
echo BASEPATH . DS . $page . DS . $tab . DS . $bandId;
?>
" name="bandform">
	<ul class="layout">
		<li>
			<label for="band_name">Name: </label>
			<input id="band_name" class="band_input" type="text" value="<?php 
echo $band->getName();
?>
" name="name" autocomplete="off" placeholder="Bandname eingeben" required />
		</li>
		<li>
			<label for="band_desc">Beschreibung: </label>
			<textarea id="band_desc" class="band_input" rows="5" name="desc" placeholder="kurze Bandbeschreibung eintippen" required /><?php 
echo $band->getDesc();
?>
</textarea>
Exemple #17
0
{
    public $name = '';
    public $covers = '<<Song**>>';
}
//
class Song extends Storable
{
    public $title = '';
}
//
$newBand1 = new Band(['name' => 'Beatles', 'covers' => ['Let it Beee', 'Yellow mom']]);
//
$newBand2 = new Band(['name' => 'Led Zeppa', 'covers' => ['Let it Beee', 'Strait to time']]);
//
echo '<pre>';
var_dump($newBand1, $newBand2);
echo '</pre>';
//
$id1 = $newBand1->store();
//
$oldBand1 = Band::load($id1);
//
$id2 = $newBand2->store();
//
$oldBand2 = Band::load($id2);
//
echo '<pre>';
var_dump($oldBand1, $oldBand2);
echo '</pre>';
//
$db->dump('*');
 public function extractBandObject(&$result, $skeleton = false)
 {
     $band = null;
     try {
         if ($result[BandDao::BAND_ID_FIELD] !== null) {
             $band = new Band();
             $band->setVariable(Band::BAND_ID, $result[BandDao::BAND_ID_FIELD]);
             $band->setVariable(Band::NAME, $result[BandDao::BAND_NAME_FIELD]);
             $band->setVariable(Band::SUMMARY, $result[BandDao::SUMMARY_FIELD]);
             if (!$skeleton) {
                 $band->setVariable(Band::DESCRIPTION, $result[BandDao::DESCRIPTION_FIELD]);
                 $band->setVariable(Band::INSPIRATION, $result[BandDao::INSPIRATION_FIELD]);
                 $band->setVariable(Band::WEBSITE, $result[BandDao::WEBSITE_FIELD]);
                 $band->setVariable(Band::CONTACT_INFORMATION, $result[BandDao::CONTACT_INFORMATION_FIELD]);
                 $band->setVariable(Band::FACEBOOK_URL, $result[BandDao::FACEBOOK_FIELD]);
                 $band->setVariable(Band::MYSPACE_URL, $result[BandDao::MYSPACE_FIELD]);
                 $band->setVariable(Band::TWITTER_URL, $result[BandDao::TWITTER_FIELD]);
                 $band->setVariable(Band::CREATED_BY, $result[BandDao::CREATED_BY_FIELD]);
                 $band->setVariable(Band::CREATED_DATE, $result[BandDao::CREATED_DATE_FIELD]);
                 $band->setVariable(Band::MODIFIED_BY, $result[BandDao::MODIFIED_BY_FIELD]);
                 $band->setVariable(Band::MODIFIED_DATE, $result[BandDao::MODIFIED_DATE_FIELD]);
                 $band->setVariable(Band::ACTIVE, $result[BandDao::ACTIVE_FIELD]);
             }
             $band->setVariable(LocationConstants::REGION_ID, $result[BandDao::REGION_ID_FIELD]);
             $band->setVariable(LocationConstants::CITY_ID, $result[BandDao::CITY_ID_FIELD]);
             $band->setVariable(LocationConstants::STATE_ID, $result[BandDao::STATE_ID_FIELD]);
             $band->setVariable(LocationConstants::COUNTRY_ID, $result[BandDao::COUNTRY_ID_FIELD]);
         }
     } catch (PDOException $ex) {
         echo "extractMemberObject error: " . $ex->getMessage();
     }
     return $band;
 }
?>

<ul class="adm-bands layout">
	<a href="<?php 
echo BASEPATH . DS . $page . DS . $tab . DS;
?>
new">
		<li class="box">
			<h3 class="glow"><i class="fa fa-plus-circle"></i> Neue Band erstellen</h3>
		</li>
	</a>

<?php 
for ($i = 0; $i < $bands->getTotalBands(); $i++) {
    //create an band instance for every iteration
    $band = new Band($bands->getBand($i));
    ?>
	<a href="<?php 
    echo BASEPATH . DS . $page . DS . $tab . DS;
    echo $band->getId();
    ?>
">
		<li class="box">
			<h3 class="glow"><?php 
    echo $band->getName();
    ?>
</h3>
		</li>
	</a>
<?php 
}
Exemple #20
0
<?php

require __DIR__ . "/../bourbon/record.php";
require __DIR__ . "/../bourbon/genre.php";
require __DIR__ . "/../bourbon/band.php";
$status_message = '';
// Status messages, default to nothing
$r = new Record();
$r->auth(null);
$r->init(WEB::_get('id'));
// Populate Genre Select List
$g = new Genre();
$genreList = $g->getGenreAsSelect();
// Populate Band Select List
$bd = new Band();
$bandList = $bd->getBandAsSelect();
if (!$r->valid()) {
    $status_message = WEB::_error('Record 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)) {
        $band_id = WEB::_post('band_id');
        $record_current_value = WEB::_post('record_current_value');
        $record_size = WEB::_post('record_size');
        $record_original_price = WEB::_post('record_original_price');
        $record_release_date = WEB::_post('record_release_date');
        $record_name = WEB::_post('record_name');
        $record_description = WEB::_post('record_description');
        $record_condition = WEB::_post('record_condition');
Exemple #21
0
<h2><?php 
echo $getexe;
?>
</h2>

<?php 
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    $create = new Band();
    $create->ExeCreate($data);
    if ($create->getResult()) {
        $phpServer = filter_input(INPUT_SERVER, 'PHP_SELF');
        header('Location: ' . basename($phpServer) . '?exe=band/create&id=' . $create->getResult());
    } else {
        WSError($create->getError()[0], $create->getError()[1]);
    }
}
?>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    
</script>
<form name="PostForm" action="" method="post" enctype="multipart/form-data">
    <label>Name:</label>
    <input type="text" name="name" value="<?php 
if (isset($data)) {
    echo $data['name'];
}
?>
">
    <br><br>
<?php

//testing band.php class
include_once "band.php";
echo '<pre>';
$band = new Band('JimmyJam');
//var_dump($band->add_rating(1));
//var_dump($band->update_band());
//var_dump($band->update_rating_and_votes(4,19));
//var_dump($band->grab_all_bands());
var_dump($band->calculate_rating());
//test insert band
//var_dump($band->insert_band(2,4));
Exemple #23
0
 public function for_song()
 {
     $error = array();
     $song_clem = DB::connection('clem')->query('SELECT title, album, artist, albumartist, year, genre, filename,track FROM songs');
     foreach ($song_clem as $value) {
         /* AJOUT D'ARTISTES */
         if (trim($value->artist) != '') {
             $band = new Band(null, 1, utf8_encode($value->artist), null, null);
             try {
                 $band->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'artiste :' . $e->getMessage() . '<br>';
                 break;
             }
         }
         /* AJOUT D'ALBUM */
         if (trim($value->album) != '') {
             $name_band = Band::from_name_band(utf8_encode($value->artist));
             $album = new Album(null, $name_band[0]->id_band, 1, utf8_encode($value->album), $value->year);
             try {
                 $album->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'album: ' . $e->getMessage() . '<br>';
                 break;
             }
         }
         if (trim($value->title) != '') {
             $album = Album::from_name_album(utf8_encode($value->album));
             $song = new song(null, 1, utf8_encode($value->title), $value->year, null, $value->filename, $value->track);
             $song->set_id_kind(explode(';', $value->genre));
             $song->id_album = $album[0]->id_album;
             try {
                 $song->add();
             } catch (Exception $e) {
                 $this->_error_msg .= 'chanson: ' . $e->getMessage() . '<br>';
                 break;
             }
         }
     }
     // var_dump($song_clem);
 }
 public function actionNewGeneral()
 {
     $user = Yii::app()->user->name;
     $resultData = new Band();
     $resultData = Band::model()->findAllBySql('SELECT id_band FROM tband WHERE name_band = "' . $user . '"');
     $rider = new Rider();
     $rider->name_rider = "";
     $rider->id_band = $resultData[0]->id_band;
     $rider->save();
     $this->redirect(array("general", array('id' => $rider->id_rider)));
 }
}
$pages = ceil($bands->getTotalBands() / PERPAGE);
$pagination = array();
for ($i = 0; $i < $pages; $i++) {
    $pagination[] = $i + 1;
}
?>

<div class="row">
	<div class="content67">
		<h2>Bands bei uns im Hexenhaus</h2>
		<hr>
		<ul class="bands layout">
			<?php 
for ($i = ($pagenum - 1) * PERPAGE; $i < $bands->getTotalBands() && $i < $pagenum * PERPAGE; $i++) {
    $band = new Band($bands->getBand($i));
    ?>
			<li class="box">

				<div class="leftdiv left">
					<a target="_blank" href="<?php 
    echo $band->getLink();
    ?>
">
						<img src="<?php 
    echo $band->getThumb();
    ?>
" alt="<?php 
    echo $band->getName();
    ?>
">
Exemple #26
0
<div class="content form_create">

    <article>

        <header>
            <h1>Atualizar Banda:</h1>
        </header>

        <?php 
$data = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$bandid = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
if (!empty($data['SendPostForm'])) {
    unset($data['SendPostForm']);
    //require('_models/AdminCategory.class.php');
    $update = new Band();
    $update->ExeUpdate($bandid, $data);
    WSError($update->getError()[0], $update->getError()[1]);
} else {
    $read = new Read();
    $read->ExeRead("band", "WHERE id = :id", "id={$bandid}");
    if (!$read->getResult()) {
        header('Location: panel.php?exe=band/index');
    } else {
        $data = $read->getResult()[0];
    }
}
//$checkCreate = filter_input(INPUT_GET, 'create', FILTER_VALIDATE_BOOLEAN);
//if($checkCreate && empty($cadastra)):
//    $tipo = ( empty($data['category_parent']) ? 'seção' : 'categoria');
//    WSErro("A {$tipo} <b>{$data['category_title']}</b> foi cadastrada com sucesso no sistema! Continue atualizando a mesma!", WS_ACCEPT);