Exemplo n.º 1
0
 public function actionIndex()
 {
     $genreValues = range(0, 10);
     $modelGenre = new Genre();
     $genreData = $modelGenre->findAll();
     $this->render('index', array('genres' => $genreData, 'genreValues' => $genreValues));
 }
Exemplo n.º 2
0
 /**
  * Add a custom genre to the database or get its key if it exists
  * @param name str: the name of the genre to add
  * @return     int: the primary key added or found
  */
 public function addGenre($name)
 {
     //trim whitespace
     $name = trim($name);
     if (empty($name)) {
         $name = 'Uncategorized';
     }
     //is this name already in the collection?
     if (is_numeric($name) && $name < 127) {
         $result = $this->find($name);
     }
     if (is_numeric($name) && $name > 126) {
         $name = 'Uncategorized';
     }
     $q = Doctrine_Query::create()->select('g.id')->from('Genre g')->where('g.name = ?', $name);
     $result = $q->fetchOne();
     if (is_object($result) && $result->id > 0) {
         $retId = $result->id;
         unset($q, $result);
         return $retId;
     } else {
         $item = new Genre();
         $item->name = $name;
         $item->save();
         $id = $item->getId();
         $item->free();
         unset($item, $q, $result);
         return $id;
     }
 }
Exemplo n.º 3
0
 public function listAction()
 {
     $limit = 10;
     //查询数据
     $genre = new \Genre();
     $list = $genre->getList();
     //数据
     $page_html = $this->pageHtml($list);
     //分页html
     $this->view->setVars(['list' => $list, 'page_html' => $page_html]);
 }
Exemplo n.º 4
0
 public function save()
 {
     try {
         $model = new Genre();
         $this->data->genre->entry = 'gen_' . $this->data->genre->entry;
         $model->setData($this->data->genre);
         $model->save();
         $this->renderPrompt('information', 'OK', "editEntry('{$this->data->genre->entry}');");
     } catch (\Exception $e) {
         $this->renderPrompt('error', $e->getMessage());
     }
 }
Exemplo n.º 5
0
 public static function all()
 {
     $aGenres = array();
     $oCon = new Connection();
     $sSQL = "SELECT GenreID FROM tbgenres";
     $oResultSet = $oCon->query($sSQL);
     while ($aRow = $oCon->fetchArray($oResultSet)) {
         $iGenreID = $aRow["GenreID"];
         $oGenre = new Genre();
         $oGenre->load($iGenreID);
         $aGenres[] = $oGenre;
     }
     $oCon->close();
     return $aGenres;
 }
 public function run()
 {
     $genres = ['Action', 'Comedy', 'Family', 'History', 'Mystery', 'Sci-Fi'];
     foreach ($genres as $genre) {
         Genre::create(['name' => $genre, 'slug' => Str::slug($genre)]);
     }
 }
 public function actionUpdate($id)
 {
     self::validateAdmin();
     $platformList = Platform::getPlatformListByAdmin();
     $genreList = Genre::getGenresListByAdmin();
     $product = Products::getProductById($id);
     if (isset($_POST['submit'])) {
         $option['code'] = $_POST['code'];
         $option['name'] = $_POST['name'];
         $option['price'] = $_POST['price'];
         $option['platform_id'] = $_POST['platform_id'];
         $option['genre_id'] = $_POST['genre_id'];
         $option['brand'] = $_POST['brand'];
         $option['description'] = $_POST['description'];
         $option['availability'] = $_POST['availability'];
         $option['is_recomend'] = $_POST['is_recomend'];
         $option['is_new'] = $_POST['is_new'];
         $option['status'] = $_POST['status'];
         $errors = false;
         if (!isset($option['name']) || empty($option['name'])) {
             $errors[] = "Введите имя товара";
         }
         if ($errors == false) {
             Products::updateProduct($id, $option);
             if ($id) {
                 if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                     move_uploaded_file($_FILES['image']['tmp_name'], $_SERVER["DOCUMENT_ROOT"] . "/upload/images/products/(" . $id . ").png");
                 }
             }
         }
         header("Location: /evkazolinAdminka/product/");
     }
     require_once ROOT . '/views/admin_product/update.php';
     return true;
 }
Exemplo n.º 8
0
 public static function getPlannedEvents($date = null, Genre $oGenre = null, Gender $oGender = null)
 {
     $query = "SELECT Event.id\n\t\t\t\t\tFROM Event\n\t\t\t\t\tWHERE Event.season_nefub_id = '" . Season::getInstance()->nefub_id . "'\n\t\t\t\t\t ";
     if ($oGender) {
         $query .= " AND Event.gender_id " . $oGender->getId();
     }
     if ($oGenre) {
         $query .= " AND Event.genre_id " . $oGenre->getId();
     }
     if ($date) {
         $query .= " AND Event.date = '" . str_replace("'", '', $date) . "'";
     } else {
         $query .= ' AND DATE(Event.date) >= CURDATE()';
     }
     $query .= ' GROUP BY gender_id';
     $query .= ' ORDER BY Event.date ASC';
     return self::getAllFromQuery($query);
 }
Exemplo n.º 9
0
 private function showPreIndexPage($schedule)
 {
     $master = new Master();
     $info_message = $master->get_info();
     $is_able_to_entry = $schedule->is_in_time('entry', $this->current_time);
     $is_able_to_post_genre = $schedule->is_in_time('genre', $this->current_time);
     $entry = new Entry();
     $entry_data = $entry->get_data();
     $genre = new Genre();
     $genre_data = $genre->get_data();
     $this->view->assign('info_message', $info_message);
     $this->view->assign('entry_data', $entry_data);
     $this->view->assign('genre_data', $genre_data);
     $this->view->assign('is_able_to_entry', $is_able_to_entry);
     $this->view->assign('is_able_to_post_genre', $is_able_to_post_genre);
     $this->view->assign('root_url', ROOT_URL);
     $this->view->display('preindex.tpl');
 }
Exemplo n.º 10
0
 public function getById($id)
 {
     $dbh = new PDO($DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select naam , stamboomnaam, soort, ras, geboortedatum, chipnummer,\n           paspoortnummer,kleur, medbeeld, klantid\n           from dier , klant    where dierId=dier.id and klant.id = " . $id;
     $resultset = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["naam"]);
     $dbh = null;
     return $dier;
 }
Exemplo n.º 11
0
 public static function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "SELECT omschrijving FROM mvc_genres WHERE id = " . $id;
     $resultSet = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["omschrijving"]);
     $dbh = NULL;
     return $genre;
 }
Exemplo n.º 12
0
 public function getById($id)
 {
     $dbh = new PDO($DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select naam from dieren \n               where id = {$id}";
     $resultset = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $genre = Genre::create($id, $rij["naam"]);
     $dbh = null;
     return $dier;
 }
Exemplo n.º 13
0
 public function entryAction()
 {
     try {
         if (!$this->request->getPost()) {
             throw new Exception('こらっ');
         }
         $schedule = new Schedule();
         $is_able_to_post_genre = $schedule->is_in_time('genre', $this->current_time);
         if ($is_able_to_post_genre) {
             // ジャンルデータを登録
             $genre = new Genre();
             $genre->add($this->request->getPost(), $this->current_time, $this->ip, $this->host);
             header("Location: " . ROOT_URL . "/genre/thanks/");
         } else {
             throw new Exception('ジャンル応募期間ではありません');
         }
     } catch (Exception $e) {
         $this->displayErrorView($e->getMessage());
     }
 }
Exemplo n.º 14
0
 public function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select genre from mvc_genres where id = :id";
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':id' => $id));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     $genre = Genre::create($id, $rij["genre"]);
     $dbh = null;
     return $genre;
 }
 public function actionIndex()
 {
     $platforms = array();
     $platforms = Platform::getPlatformList();
     $genres = array();
     $genres = Genre::getGenreList();
     $productList = array();
     $productList = Products::getProducts(6);
     require_once ROOT . '/views/site/index.php';
     return true;
 }
Exemplo n.º 16
0
 public function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select mvc_boeken.id as boek_id, titel, genre_id, genre  \n                    from mvc_boeken, mvc_genres  \n                    where genre_id = mvc_genres.id and mvc_boeken.id = :id";
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':id' => $id));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     $genre = Genre::create($rij["genre_id"], $rij["genre"]);
     $boek = Boek::create($rij["boek_id"], $rij["titel"], $genre);
     $dbh = null;
     return $boek;
 }
 public function actionGenre($genreId, $page = 1)
 {
     $platforms = array();
     $platforms = Platform::getPlatformList();
     $genres = array();
     $genres = Genre::getGenreList();
     $products = array();
     $products = Products::getProductsListByGenre($genreId, $page);
     $total = Products::getTotalProductInGenre($genreId);
     $pagination = new Pagination($total, $page, Products::SHOW_BY_DEFAULT, 'page-');
     require_once ROOT . '/views/catalog/category.php';
     return true;
 }
Exemplo n.º 18
0
 public static function getByTitel($titel)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "SELECT mvc_boeken.id as boekid, titel, genreid, omschrijving FROM mvc_boeken, mvc_genres WHERE genreid = mvc_genres.id AND titel = '" . $titel . "'";
     $resultSet = $dbh->query($sql);
     $rij = $resultSet->fetch();
     if (!$rij) {
         return null;
     } else {
         $genre = Genre::create($rij["genreid"], $rij["omschrijving"]);
         $boek = Boek::create($rij["boekid"], $rij["titel"], $genre);
         $dbh = NULL;
         return $boek;
     }
 }
 public function getByTitel($titel)
 {
     $sql = "select mvc_boeken.id as boek_id, titel, genre_id, genre from mvc_boeken, mvc_genres where titel = :titel";
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $stmt = $dbh->prepare($sql);
     $stmt->execute(array(':titel' => $titel));
     $rij = $stmt->fetch(PDO::FETCH_ASSOC);
     if (!$rij) {
         return null;
     } else {
         $genre = Genre::create($rij["genre_id"], $rij["genre"]);
         $boek = Boek::create($rij["boek_id"], $titel, $rij["genre"]);
         $dbh = null;
         return $boek;
     }
 }
Exemplo n.º 20
0
 /**
  * {@inheritDoc}
  */
 public static function fromObject($object)
 {
     $retval = new Album();
     $retval->ids = (array) $object->ids;
     $retval->title = $object->title;
     $retval->primaryArtists = Artist::fromObjectArray((array) $object->primaryArtists);
     $retval->guestArtists = Artist::fromObjectArray((array) $object->guestArtists);
     $retval->flags = $object->flags;
     $retval->duration = $object->duration;
     $retval->originalReleaseDate = $object->originalReleaseDate;
     $retval->rating = $object->rating;
     $retval->isPick = $object->isPick;
     $retval->genres = Genre::fromObjectArray((array) $object->genres);
     $retval->headlineReview = $object->headlineReview;
     $retval->classicalReview = ClassicalReview::fromObject($object->classicalReview);
     $retval->credits = Credit::fromObjectArray((array) $object->credits);
     $retval->tracks = Track::fromObjectArray((array) $object->tracks);
     $retval->styles = Style::fromObjectArray((array) $object->styles);
     return $retval;
 }
Exemplo n.º 21
0
 public function run()
 {
     // first of all - try to guess if this dir should be
     // treated as an album or as a bunch of loose tracks
     // further this method is adding score to several attributes which will be migrated to production db-table
     $this->setHandleAsAlbum();
     #print_r($this->r);
     cliLog("handleAsAlbumScore " . $this->handleAsAlbumScore, 3, 'purple');
     #die();
     #if($this->tracks[0]['relativePath'] == 'newroot/crse002cd--Calibre-Musique_Concrete-2CD-CRSE002CD-2001-sour/101-calibre-deep_everytime.mp3') {
     #print_r($this->r); die();
     #}
     // extract some attributes from tracks
     // those will be used for album stuff
     $mergedFromTracks = array('artist' => array(), 'genre' => array(), 'label' => array(), 'catalogNr' => array());
     foreach (array_keys($mergedFromTracks) as $what) {
         foreach ($this->tracks as $idx => $rawTagData) {
             $mergedFromTracks[$what][] = $this->getMostScored($idx, $what);
         }
         $mergedFromTracks[$what][] = $this->getMostScored('album', $what);
         $mergedFromTracks[$what] = join(',', array_unique($mergedFromTracks[$what]));
     }
     $albumArtists = count(trimExplode(",", $mergedFromTracks['artist'])) > 3 ? 'Various Artists' : $mergedFromTracks['artist'];
     $a = new Album();
     $a->setArtistId(join(",", Artist::getIdsByString($albumArtists)));
     $a->setGenreId(join(",", Genre::getIdsByString($mergedFromTracks['genre'])));
     #$a->setLabelId(join(",", Label::getIdsByString($mergedFromTracks['label'])));
     $a->setCatalogNr($this->mostScored['album']['catalogNr']);
     $a->setRelativePath($this->getRelativeDirectoryPath());
     $a->setRelativePathHash($this->getRelativeDirectoryPathHash());
     $a->setAdded($this->getDirectoryMtime());
     $a->setFilemtime($this->getDirectoryMtime());
     $a->setTitle($this->mostScored['album']['title']);
     $a->setYear($this->mostScored['album']['year']);
     $a->setIsJumble($this->handleAsAlbum === TRUE ? 0 : 1);
     $a->setTrackCount(count($this->tracks));
     #print_r($a); die();
     $a->update();
     $albumId = $a->getId();
     // add the whole bunch of valid and indvalid attributes to albumindex table
     $this->updateAlbumIndex($albumId);
     foreach ($this->tracks as $idx => $rawTagData) {
         $t = $this->migrateNonGuessableData($rawTagData);
         $t->setArtistId($this->mostScored[$idx]['artist']);
         // currently the string insted of an artistId
         $t->setTitle($this->mostScored[$idx]['title']);
         $t->setFeaturedArtistsAndRemixers();
         # setFeaturedArtistsAndRemixers() is processing:
         # $t->setArtistId();
         # $t->setFeaturingId();
         # $t->setRemixerId();
         $t->setGenreId(join(",", Genre::getIdsByString($this->getMostScored($idx, 'genre'))));
         $t->setLabelId(join(",", Label::getIdsByString($this->getMostScored($idx, 'label'))));
         $t->setCatalogNr($this->mostScored[$idx]['catalogNr']);
         $t->setDisc($this->mostScored[$idx]['disc']);
         $t->setNumber($this->mostScored[$idx]['number']);
         $t->setComment($this->mostScored[$idx]['comment']);
         $t->setYear($this->mostScored[$idx]['year']);
         $t->setAlbumId($albumId);
         // make sure to use identical ids in table:rawtagdata and table:track
         \Slimpd\Track::ensureRecordIdExists($t->getId());
         $t->update();
         // make sure extracted images will be referenced to an album
         \Slimpd\Bitmap::addAlbumIdToTrackId($t->getId(), $albumId);
         #
         // add the whole bunch of valid and indvalid attributes to trackindex table
         $this->updateTrackIndex($t->getId(), $idx);
     }
     unset($this->r['album']);
     if ($this->handleAsAlbum === TRUE) {
         // try to guess if all tracks of this album has obviously invalid fixable attributes
     }
     return;
     print_r($this->r);
     #die();
 }
Exemplo n.º 22
0
?>
      </div>
    </div-->
    <div class="default-input__container">
      <div class="col-275">
        <?php 
echo $form->labelEx($model, 'genre_id', array('class' => 'default-input__label'));
?>
      </div>
      <div class="col-384">
        <?php 
//echo $form->textField($model,'url',array('class'=>'default__input','placeholder'=>'http://www.site.com'));
$model->genre_id = unserialize($model->genre_id);
?>
        <?php 
echo $form->checkBoxList($model, 'genre_id', CHtml::listData(Genre::model()->findAll('occ_id=:occ_id', array(':occ_id' => (int) $model->occupation_id)), 'id', 'name'), array('class' => 'default-input__radio'));
?>
        <?php 
echo $form->error($model, 'genre_id', array('style' => 'margin-top: 5px;'));
?>
      </div>
    </div>
    <!--div class="default-input__container">
      <div class="col-275">
        <?php 
echo $form->labelEx($model, 'price_h', array('class' => 'default-input__label'));
?>
      </div>
      <div class="col-384">
        <?php 
echo $form->textField($model, 'price_h', array('class' => 'default__input', 'placeholder' => 'укажите стоимость аренды'));
Exemplo n.º 23
0
	<div class="row">
		<?php 
echo $form->label($model, 'genre_2');
?>
        <?php 
echo $form->dropDownList($model, 'genre_2', Genre::All(), array('empty' => '- Choose - ', 'maxlength' => 10));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'genre_3');
?>
        <?php 
echo $form->dropDownList($model, 'genre_3', Genre::All(), array('empty' => '- Choose - ', 'maxlength' => 10));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'year');
?>
		<?php 
echo $form->textField($model, 'year');
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'description');
Exemplo n.º 24
0
        echo '<td><span class="tooltipster" title="' . $tip . '" data-set="' . $val . '_4">' . $pack4->price . 'грн <div class="cost-info"></div></span></td>';
    } else {
        if (is_object($pack3)) {
            $tip = "<div class='tooltip_cost_edit'>редактировать</div><div class='tooltip_cost_title'>" . Genre::getName($val) . "</div>\n                                <p class='tooltip_cost_text'>Описание услуги: </p>";
            echo '<td><span class="tooltipster" title="' . $tip . '" data-set="' . $val . '_4">0грн <div class="cost-info"></div></span></td>';
        } else {
            echo '<td><span data-set="' . $val . '_4">0грн</span></td>';
        }
    }
    $pack5 = Prices::model()->findByAttributes(array('genre_id' => $val, 'package' => 5));
    if (is_object($pack5)) {
        $tip = "<div class='tooltip_cost_edit'>редактировать</div><div class='tooltip_cost_title'>" . Genre::getName($val) . "</div>\n                            <p class='tooltip_cost_text'>Описание услуги: " . $pack5->about . "</p>";
        echo '<td><span class="tooltipster" title="' . $tip . '" data-set="' . $val . '_5">' . $pack5->price . 'грн <div class="cost-info"></div></span></td>';
    } else {
        if (is_object($pack4)) {
            $tip = "<div class='tooltip_cost_edit'>редактировать</div><div class='tooltip_cost_title'>" . Genre::getName($val) . "</div>\n                                <p class='tooltip_cost_text'>Описание услуги: </p>";
            echo '<td><span class="tooltipster" title="' . $tip . '" data-set="' . $val . '_5">0грн <div class="cost-info"></div></span></td>';
        } else {
            echo '<td><span data-set="' . $val . '_5">0грн</span></td>';
        }
    }
    echo '</tr>';
}
?>
        </table>
        
        </main>
        

      </div>
    </div>
Exemplo n.º 25
0
<?php

/* @var $this BooksController */
/* @var $model Books */
$this->breadcrumbs = array('Books' => array('index'), 'Manage');
$this->menu = array(array('label' => 'List Books', 'url' => array('index')), array('label' => 'Create Books', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#books-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Manage Books</h1>

<p>
    You may optionaly enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
    or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php 
echo CHtml::link('Advanced Search', '#', array('class' => 'search-button'));
?>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'books-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'value' => '$data->id', 'filterHtmlOptions' => array('class' => 'filter_id')), 'name', array('name' => 'author_id', 'value' => '$data->author->name', 'filter' => Author::All()), array('name' => 'genre_1', 'value' => '$data->genre1->name', 'filter' => Genre::All()), array('name' => 'genre_2', 'value' => '$data->genre2->name', 'filter' => Genre::All()), array('name' => 'genre_3', 'value' => '$data->genre3->name', 'filter' => Genre::All()), array('name' => 'year', 'value' => '$data->year', 'filterHtmlOptions' => array('class' => 'filter_id')), array('class' => 'CButtonColumn'))));
Exemplo n.º 26
0
 /**
  * Populates the Venue object from the request
  * @return bean Venue
  */
 protected function getBeanFromRequest()
 {
     global $logger;
     $prgm = new Program($_REQUEST);
     $genre = new Genre();
     $genre->setOid($_REQUEST['primaryGenre']);
     $prgm->setPrimaryGenre($genre);
     if (isset($_REQUEST['defaultVenue'])) {
         $venue = new Venue();
         $venue->setOid($_REQUEST['defaultVenue']);
         $prgm->setDefaultVenue($venue);
         $prgm->setVenues(array($venue));
     }
     // categories
     $cats = array();
     if (isset($_REQUEST['audience'])) {
         foreach ($_REQUEST['audience'] as $oid) {
             $category = new Audience();
             $category->setOid($oid);
             $cats['audience'][] = $category;
         }
     }
     if (isset($_REQUEST['genre'])) {
         foreach ($_REQUEST['genre'] as $oid) {
             $category = new Genre();
             $category->setOid($oid);
             $cats['genre'][] = $category;
         }
     }
     if (isset($_REQUEST['series'])) {
         foreach ($_REQUEST['series'] as $oid) {
             $category = new Series();
             $category->setOid($oid);
             $cats['series'][] = $category;
         }
     }
     if (isset($cats['audience'])) {
         $logger->debug("Number of audience categories in the form: " . count($cats['audience']));
     }
     if (isset($cats['genre'])) {
         $logger->debug("Number of genre categories in the form: " . count($cats['genre']));
     }
     if (isset($cats['series'])) {
         $logger->debug("Number of series categories in the form: " . count($cats['series']));
     }
     if (isset($cats['audience']) || isset($cats['genre']) || isset($cats['series'])) {
         $prgm->setCategories($cats);
     }
     // related events
     $events = array();
     if (isset($_REQUEST['exhibition'])) {
         foreach ($_REQUEST['exhibition'] as $oid) {
             $exhibition = new Exhibition();
             $exhibition->setOid($oid);
             $events[] = $exhibition;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related exhibitions in the form: " . count($events));
         $prgm->setExhibitions($events);
     }
     $events = array();
     if (isset($_REQUEST['course'])) {
         foreach ($_REQUEST['course'] as $oid) {
             $course = new Course();
             $course->setOid($oid);
             $events[] = $course;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related courses in the form: " . count($events));
         $prgm->setCourses($events);
     }
     $activities = array();
     if (isset($_REQUEST['activityChanged']) && $_REQUEST['activityChanged']) {
         // parse delimited attributes as pipe-delimited '|' string
         $startTimes = explode('|', $_REQUEST['activityStartTime']);
         $endTimes = explode('|', $_REQUEST['activityEndTime']);
         $venues = explode('|', $_REQUEST['activityVenueList']);
         $status = explode('|', $_REQUEST['activityStatusList']);
         $tickets = explode('|', $_REQUEST['activityTicketList']);
         for ($index = 0; $index < count($venues); $index++) {
             $schedule = new Schedule();
             $stint = strtotime($startTimes[$index]);
             $etint = strtotime($endTimes[$index]);
             $schedule->setStartTime($stint);
             $schedule->setEndTime($etint);
             $venue = new Venue();
             $venue->setOid($venues[$index]);
             $activity = new Performance();
             $activity->setSchedule($schedule);
             $activity->setVenue($venue);
             $activity->setActivityStatus($status[$index]);
             $activity->setTicketCode($tickets[$index]);
             $activities[] = $activity;
         }
     }
     if (isset($activities)) {
         $logger->debug("Number of related performances in the form: " . count($activities));
         $prgm->setChildren($activities);
     }
     return $prgm;
 }
Exemplo n.º 27
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //Добавление нового жанра
    if (isset($_POST['add_genre'])) {
        Genre::add_genre($_POST['add_genre']);
    } elseif (isset($_POST['add_author'])) {
        Author::add_author($_POST['add_author']);
    }
    //Добавление книги
    if (!empty($_POST['author']) && !empty($_POST['title']) && !empty($_POST['genre']) && !empty($_POST['price']) && !empty($_POST['description'])) {
        if (!empty($_POST['id'])) {
            //Редактирование существующей книги
            Book::edit_book();
        } else {
            //Добавление новой книги
            Book::add_book();
        }
    } else {
        echo 'Заполните все поля формы "Добавить книгу"!';
    }
}
//Удаление книги
if (isset($_GET['edit']) && $_GET['edit'] == 2) {
    Book::delete_book($_GET['id']);
}
//Вывод сообщения по act.
switch ($_GET['act']) {
    case 1:
        echo 'Книга добавлена!';
        break;
Exemplo n.º 28
0
 /**
  * get_favorites
  * returns an array of your $type favorites
  */
 public function get_favorites($type)
 {
     $results = Stats::get_user(AmpConfig::get('popular_threshold'), $type, $this->id, 1);
     $items = array();
     foreach ($results as $r) {
         /* If its a song */
         if ($type == 'song') {
             $data = new Song($r['object_id']);
             $data->count = $r['count'];
             $data->format();
             $data->f_link;
             $items[] = $data;
         } elseif ($type == 'album') {
             $data = new Album($r['object_id']);
             //$data->count = $r['count'];
             $data->format();
             $items[] = $data;
         } elseif ($type == 'artist') {
             $data = new Artist($r['object_id']);
             //$data->count = $r['count'];
             $data->format();
             $data->f_name = $data->f_link;
             $items[] = $data;
         } elseif ($type == 'genre') {
             $data = new Genre($r['object_id']);
             //$data->count = $r['count'];
             $data->format();
             $data->f_name = $data->f_link;
             $items[] = $data;
         }
     }
     // end foreach
     return $items;
 }
Exemplo n.º 29
0
              
              <?php 
    $model_t->genre = unserialize($model_t->genre);
    ?>
              <div class="default-input__container" id="genre_show" style="display: <?php 
    echo $model_t->genre == '' ? 'none' : 'block';
    ?>
;">
                <div class="col-181">
                    <?php 
    echo $form->labelEx($model_t, 'genre', array('class' => 'default-input__label'));
    ?>
                </div>
                <div class="col-674">
                    <?php 
    echo $form->checkBoxList($model_t, 'genre', CHtml::listData(Genre::model()->findAll('occ_id=:occ_id', array(':occ_id' => (int) $model_t->occupation)), 'id', 'name'));
    ?>
                    <?php 
    echo $form->error($model_t, 'genre');
    ?>
                </div>
              </div>
              <div class="default-input__container">
                <div class="col-181">
                    <?php 
    echo $form->labelEx($model_t, 'date_end', array('class' => 'default-input__label pt4'));
    ?>
                </div>
                <div class="col-674">
                    <?php 
    echo $form->textField($model_t, 'date_end', array('id' => 'datepicker', 'class' => 'default__input tender__datepicker', 'placeholder' => '25 апреля 2014'));
Exemplo n.º 30
0
 protected static function convertEvent($nefubName, $date, Genre $oGenre, Gender $oGender)
 {
     $oEvent = Event::getByNefubName($nefubName, $date, $oGender);
     if (!$oEvent) {
         $oEvent = new Event();
         $oEvent->nefub_name = $nefubName;
         $oEvent->season_nefub_id = Season::getInstance()->nefub_id;
         $oEvent->date = $date;
         $oEvent->genre_id = $oGenre->getId();
         if ($oGender) {
             $oEvent->gender_id = $oGender->getId();
         }
     }
     $oEvent->save();
     return $oEvent;
 }