public function test_for_table_inheritance() { $Event = new Event(array('description' => 'Uncategorized Event')); $this->assertTrue($Event->save()); $Concert = new Concert(array('description' => 'Madonna at Barcelona')); $this->assertTrue($Concert->save()); $OpenHouseMeeting = new OpenHouseMeeting(array('description' => 'Networking event at Akelos')); $this->assertTrue($OpenHouseMeeting->save()); $this->assertEqual($OpenHouseMeeting->get('type'), 'Open house meeting'); $this->assertTrue($OpenHouseMeeting = $Event->findFirstBy('description', 'Networking event at Akelos')); $this->assertEqual($OpenHouseMeeting->get('description'), 'Networking event at Akelos'); $this->assertEqual($OpenHouseMeeting->getType(), 'OpenHouseMeeting'); }
<?php $login = new ModelLogin(); $concert = new Concert(); foreach ($concert->getConciertoAll(null, "aceptado") as $row) { echo HTML::open_div(array("class" => "col-lg-6")); echo HTML::title("h3", "Concierto de " . $login->getUserDataCampo($row['musico_id'], "usuario_nombre") . " en " . $login->getUserDataCampo($row['local_id'], "usuario_nombre")); echo HTML::label("concierto_fecha", "Fecha:"); echo $row['concierto_fecha']; echo HTML::br(2); echo HTML::label("concierto_precio", "Precio entrada:"); echo $row['concierto_precio'] . "€"; echo HTML::br(2); echo HTML::label("concierto_duracion", "Duración concierto:"); echo $row['concierto_duracion'] . " min"; echo HTML::br(2); echo HTML::label("concierto_asistentes", "Aforo:"); echo $row['concierto_asistentes']; echo HTML::close_div(); }
<?php $login = new ModelLogin(); $concert = new Concert(); if ($login->isUserLoggedIn() && ($login->isMusico() || $login->isLocal())) { if ($login->isLocal()) { echo HTML::title("h3", "Concierto de " . $login->getUserDataCampo($_SESSION['band_id_concierto'], "usuario_nombre")); } if ($login->isMusico()) { echo HTML::title("h3", "Concierto en el local " . $login->getUserDataCampo($_SESSION['local_id_concierto'], "usuario_nombre")); } echo HTML::open_form(ROUTER::create_action_url("event/concert"), "POST", "form_new_concert"); echo HTML::label("concierto_precio", "Precio de concierto"); echo HTML::input("text", "concierto_precio", null, array("placeholder" => "xx€")); echo HTML::br(2); echo HTMl::label("concierto_fecha", "Fecha del concierto:"); echo HTML::input("text", "concierto_fecha", null, array("placeholder" => "dia/mes/año")); echo HTML::br(2); echo HTML::label("concierto_duracion", "Duración del concierto"); echo HTML::input("text", "concierto_duracion", null, array("placeholder" => "minutos")); echo HTML::br(2); echo HTML::label("concierto_aforo", "Aforo"); echo HTML::input("text", "concierto_aforo", null); echo HTML::br(2); echo HTML::input("submit", "form_new_concert", "Crear concierto"); echo HTML::close_form(); } else { if (isset($_GET['verification_code'])) { } else { echo "Loggeate como músico o local para crear un concierto!"; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Concert the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Concert::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $login = new ModelLogin(); $concert = new Concert(); echo HTML::title("h3", "Todos tus eventos"); ?> <table class="table table-hover"> <thead> <tr> <th>Fecha</th> <?php if ($login->isLocal()) { ?> <th>Musico</th> <?php } else { ?> <th>Local</th> <?php } ?> <th>Precio</th> <th>Aforo</th> <th>Estado</th> <th>Opciones</th> </tr> </thead> <tbody> <?php foreach ($concert->getConciertoUser($login->getUserId()) as $row) { echo "<tr>";