Пример #1
0
 public function fetch()
 {
     $sql = 'SELECT * FROM Composers';
     $return = [];
     // uiteindelijk resultaat zoiets als 'SELECT $scope FROM $table WHERE $choice <optional> AND $choice2 </optional> etc.
     foreach ($this->con->query($sql) as $row) {
         $composer = new composers();
         $composer->setId($row["ID"]);
         $composer->setComposerLastname($row["ComposerLastname"]);
         $composer->setComposerFirstname($row["ComposerFirstname"]);
         $composer->setDateOfBirth($row["DateOfBirth"]);
         $composer->setPlaceOfBirth($row["PlaceOfBirth"]);
         $composer->setBirthCountry($row["BirthCountry"]);
         $composer->setDeceased($row["Deceased"]);
         $return[] = $composer;
         /*
         print $row['ID'] . "\t";
         print $row['ComposerFirstname'] . "\t";
         print $row['ComposerLastname'] . "\t";
         print $row['DateOfBirth'] . "\t";
         print $row['PlaceOfBirth'] . "\t";
         print $row['BirthCountry'] . "\t";
         print $row['Deceased'] . "\n";
         */
     }
     return $return;
 }
Пример #2
0
 public function run()
 {
     if (!isset($_POST["action"])) {
         return;
     }
     if ($_POST["action"] == "addComposer") {
         $composer = new composers();
         $composer->setComposerFirstname($_POST["ComposerFirstname"]);
         $composer->setComposerLastname($_POST["ComposerLastname"]);
         $composer->setDateOfBirth($_POST["DateOfBirth"]);
         $composer->setPlaceOfBirth($_POST["PlaceOfBirth"]);
         $composer->setBirthCountry($_POST["BirthCountry"]);
         $composer->setDeceased($_POST["Deceased"]);
         $composer->add();
     } elseif ($_POST["action"] == "updateComposer") {
         $composer = new composers();
         $composer->setComposerFirstname($_POST["ComposerFirstname"]);
         $composer->setComposerLastname($_POST["ComposerLastname"]);
         $composer->setDateOfBirth($_POST["DateOfBirth"]);
         $composer->setPlaceOfBirth($_POST["PlaceOfBirth"]);
         $composer->setBirthCountry($_POST["BirthCountry"]);
         $composer->setDeceased($_POST["Deceased"]);
         $composer->setID($_POST["id"]);
         $composer->update();
     } elseif ($_POST["action"] == "addSong") {
         $song = new Songs();
         $song->setComposersID($_POST["ComposersID"]);
         $song->setMusicalForm($_POST["MusicalForm"]);
         $song->setTitle($_POST["Title"]);
         $song->setOpus($_POST["Opus"]);
         $song->setMovement($_POST["Movement"]);
         $song->setLength($_POST["Length"]);
         $song->setDifficulty($_POST["Difficulty"]);
         $song->setWantToPlay($_POST["WantToPlay"]);
         $song->setConcertReady($_POST["ConcertReady"]);
         $song->add();
     } elseif ($_POST["action"] == "updateSong") {
         $song = new Songs();
         $song->setComposersID($_POST["ComposersID"]);
         $song->setMusicalForm($_POST["MusicalForm"]);
         $song->setTitle($_POST["Title"]);
         $song->setOpus($_POST["Opus"]);
         $song->setMovement($_POST["Movement"]);
         $song->setLength($_POST["Length"]);
         $song->setDifficulty($_POST["Difficulty"]);
         $song->setWantToPlay($_POST["WantToPlay"]);
         $song->setConcertReady($_POST["ConcertReady"]);
         $song->setID($_POST["id"]);
         $song->update();
     }
 }
Пример #3
0
 /**
  * makes sure variables for composer editing are fetched properly
  */
 public function editComposer()
 {
     $composer = new composers();
     if (array_key_exists('id', $_GET)) {
         $this->vars['composer'] = $composer->fetchByID($_GET['id']);
     }
 }
Пример #4
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 'on');
$config = parse_ini_file(realpath('config.ini'));
require_once 'lib/Model/composers.php';
require_once 'lib/Model/musicalForms.php';
$data = ["Albeniz", "Bach", "Bartok", "Beethoven", "Busoni", "Brahms", "Chopin", "Debussy", "Franck", "Haydn", "Joplin", "Mendelssohn", "Mozart", "Mussorgsky", "Paderewski", "Prokofiev", "Rachmaninoff", "Ravel", "Rimski-Korsakov", "Rubinstein", "Saint-Saëns", "Satie", "Scarlatti", "Schubert", "Schumann", "Scriabin", "Shostakovich", "Sibelius", "Tchaikovsky", "Liszt"];
foreach ($data as $ComposerLastname) {
    $form = new composers();
    $form->setComposerLastname($ComposerLastname);
    $form->add();
    echo "Added: " . $ComposerLastname . "<br>";
}
/*
                    <option value="1"> Albeniz </option>
                    <option value="Bach"> Bach </option>
                    <option value="Bartok"> Bartok </option>
                    <option value="Beethoven"> Beethoven </option>
                    <option value="Busoni"> Busoni </option>
                    <option value="Brahms"> Brahms </option>
                    <option value="Chopin"> Chopin </option>
                    <option value="Debussy"> Debussy </option>
                    <option value="Franck"> Franck </option>
                    <option value="Haydn"> Haydn </option>
                    <option value="Joplin"> Joplin </option>
                    <option value="Mendelssohn"> Mendelssohn </option>
                    <option value="Mozart"> Mozart </option>
                    <option value="Mussorgsky"> Mussorgsky </option>
                    <option value="Paderewski"> Paderewski </option>
                    <option value="Prokofiev"> Prokofiev </option>