public static function show($film, $user)
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        $mov_title = $film->getTitre();
        $mov_id = $film->getId();
        echo <<<EOT
            <div class="well" style = "float: none; margin: 0 auto;">
                    <div style = "float: none; margin: 0 auto;">
                        <h3> Etes vous sur de vouloir supprimer {$mov_title}?</h3>
                    </div>
                    <div style = "float: none; margin: 0 auto;">
                        <a href="./index.php?page=FilmsView"><button class="btn btn-success">Annuler</button></a>
                        <a href="./index.php?form=DeleteForm"><button class="btn btn-danger">Supprimer</button></a>
                    </div>
            </div>
EOT;
        echo "</div>";
        //*** HTML ***
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show()
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        echo <<<EOT
        <div class="container">

      <form class="form-signin" action="./index.php?form=ConnexionForm" method="POST">
        <h2 class="form-signin-heading">Entrez vos identifiants</h2>
        <label for="username" class="sr-only">Email address</label>
        <input name = "username" type="text" id="username" class="form-control" placeholder="Identifiant" required autofocus>
        <label for="password" class="sr-only">Password</label>
        <input name = "password" type="password" id="password" class="form-control" placeholder="Mot de passe" required>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Se Connecter</button>
      </form>

    </div> <!-- /container -->

EOT;
        echo "</div>";
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show($listFilms)
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        //display films
        foreach ($listFilms as $film) {
            $mov_id = $film->getId();
            $mov_title = $film->getTitre();
            $mov_image = $film->getImage();
            $mov_description_short = $film->getDescription_short();
            echo <<<EOT
            <div class="well">
                    <h2><a href="./index.php?page=FilmView&id={$mov_id}">{$mov_title}</a></h2>
                    <div class="row">
                        <div class="col-sm-4 hidden-xs">
                            <img src="{$mov_image}" class="img-responsive">
                        </div>
                        <div class="col-sm-8 col-xs-12">
                            <p>{$mov_description_short}</p>
                        </div>
                    </div>
                </div>
EOT;
        }
        echo "</div>";
        //*** HTML ***
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show($listFilms)
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        echo <<<EOT
        <h1>Ma Vidéotheque</h1>
    <div class="tab-content">
        <div id="movies" class="tab-pane fade in active">
            <p>
                <table class="table">
                    <thead>
                        <tr>
                            <th>Title</th>
                            <th>Director</th>
                            <th>Released</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>
EOT;
        //display films
        foreach ($listFilms as $film) {
            $mov_id = $film->getId();
            $mov_title = $film->getTitre();
            $mov_director = $film->getDirector();
            $mov_year = $film->getYear();
            echo <<<EOT
            <tr>
                <td><a href="./index.php?page=FilmView&id={$mov_id}">{$mov_title}</a></td>
                    <td>{$mov_director}</td>
            <td>{$mov_year}</td>
            <td>
                <a href="./index.php?page=EditFilmView&id={$mov_id}" class="btn btn-primary btn-xs">
                    <span class="glyphicon glyphicon-pencil"></span>
                </a>
                <a href="./index.php?page=ConfirmDeleteView&id={$mov_id}" class="btn btn-danger btn-xs">
                    <span class="glyphicon glyphicon-remove"></span>
                </a>
            </td>
            </tr>
EOT;
        }
        //echo de fermeture de table
        echo '</tbody></table></p></div>';
        echo "</div>";
        //*** HTML ***
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show($film, $user)
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        $mov_id = $film->getId();
        $mov_title = $film->getTitre();
        $mov_director = $film->getDirector();
        $mov_year = $film->getYear();
        $mov_desription_long = $film->getDescription_long();
        $mov_image = $film->getImage();
        echo <<<EOT
        <div class="well">
            <h2>
                <a href="#">{$mov_title}</a>
            </h2>
            <div class="row">
                <div class="col-sm-4">
                    <img src="{$mov_image}" class = "img-responsive">
                </div>
                <div class="col-sm-8">
                    <p>
                        <b>Realisateur: </b>{$mov_director}
                    </p>
                    <p>
                        <b>Année: </b>{$mov_year}
                    </p>
                    <p>{$mov_desription_long}</p>
EOT;
        //if user est le meme que celui du film, afficher le bouton d'édition
        if ($film->getUser() != null) {
            if ($film->getUser()->equals($user)) {
                echo <<<EOT
                        <a href="./index.php?page=EditFilmView&id={$mov_id}" class='btn btn-primary'> <span class="glyphicon glyphicon- edit"></span> Éditer</a>
EOT;
            }
        }
        echo '</div>
            </div>
        </div>';
        //*** HTML ***
        echo "</div>";
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show()
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        echo <<<EOT
        <form class="form-horizontal" action="./index.php?form=InscriptionForm" method="POST">
        <fieldset>

        <!-- Form Name -->
        <legend>Inscription</legend>

        <!-- Text input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="nom">Nom</label>  
        <div class="col-md-4">
        <input id="nom" name="nom" placeholder="Nom" class="form-control input-md" required="" type="text">
            
        </div>
        </div>

        <!-- Text input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="prenom">Prenom</label>  
        <div class="col-md-4">
        <input id="prenom" name="prenom" placeholder="Prenom" class="form-control input-md" required="" type="text">
            
        </div>
        </div>

        <!-- Text input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="mail">Mail</label>  
        <div class="col-md-4">
        <input id="mail" name="mail" placeholder="Mail" class="form-control input-md" required="" type="text">
            
        </div>
        </div>

        <!-- Text input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="username">Login</label>  
        <div class="col-md-4">
        <input id="username" name="username" placeholder="Nom d'utilisateur" class="form-control input-md" required="" type="text">
            
        </div>
        </div>

        <!-- Password input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="password">Mot de Passe</label>
        <div class="col-md-4">
            <input id="password" name="password" placeholder="Mot de passe" class="form-control input-md" required="" type="password">
            
        </div>
        </div>

        <!-- Password input-->
        <div class="form-group">
        <label class="col-md-4 control-label" for="passwordConfirm">Confirmation</label>
        <div class="col-md-4">
            <input id="passwordConfirm" name="passwordConfirm" placeholder="Confirmer le mot de passe" class="form-control input-md" required="" type="password">
            
        </div>
        </div>

        <!-- Button -->
        <div class="form-group">
        <label class="col-md-4 control-label" for="valid"></label>
        <div class="col-md-4">
            <button type= "submit" id="valid" name="valid" class="btn btn-primary">Sign up</button>
        </div>
        </div>

        </fieldset>
        </form>

EOT;
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
    public static function show($film, $user)
    {
        // code HTML header
        echo '<!DOCTYPE html><html>';
        include 'Header.php';
        echo '<body>';
        echo "<div class='container'>";
        NavbarView::show();
        MessageView::show();
        if ($film == null) {
            $id = null;
            $titre = null;
            $description_short = null;
            $description_long = null;
            $director = null;
            $image = null;
            $year = null;
        } else {
            $id = $film->getId();
            $titre = $film->getTitre();
            $description_short = $film->getDescription_short();
            $description_long = $film->getDescription_long();
            $director = $film->getDirector();
            $image = $film->getImage();
            $year = $film->getYear();
        }
        echo <<<EOT
        <form class="form-horizontal" method="POST" action="./index.php?form=EditFilmForm" enctype="multipart/form-data">
            <fieldset>

            <!-- Form Name -->
            <legend>
EOT;
        if ($id == '') {
            echo 'Ajouter un film';
        } else {
            echo 'Modifier un film';
        }
        echo <<<EOT
        </legend>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_title">Titre</label>  
            <div class="col-md-4">
                <input id="mov_title" name="mov_title" placeholder="" class="form-control input-md" type="text" value ="{$titre}">    
            </div>
        </div>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_director">Réalisateur</label>  
            <div class="col-md-4">
                <input id="mov_director" name="mov_director" placeholder="" class="form-control input-md" type="text" value ="{$director}">    
            </div>
        </div>
        
        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_year">Annee</label>  
            <div class="col-md-4">
                <input id="mov_year" name="mov_year" placeholder="" class="form-control input-md" type="text" value ="{$year}">
            </div>
        </div>
        
        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_description_short">Synopsis</label>  
            <div class="col-md-4">
                <input id="mov_description_short" name="mov_description_short" placeholder="" class="form-control input-md" type="text" value ="{$description_short}">
            </div>
        </div>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_description_long">Description</label>  
            <div class="col-md-4">
                <input id="mov_description_long" name="mov_description_long" placeholder="" class="form-control input-md" type="text" value ="{$description_long}">
            </div>
        </div>

        <!-- Picture input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="mov_image">Image</label>  
            <div class="col-md-4">
                <input id="mov_image" name="mov_image" placeholder="" class="input-md" type="file" value ="{$image}">
            </div>
        </div>

           

        <!-- Button -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="valid"></label>  
            <div class="col-md-4">
                <button type = "submit" id="valid" name="valid" class="btn btn-primary">Sauvegarder</button>
            </div>
        </div>
        
        <input id="mov_id" name="mov_id" type="hidden" value ="{$id}">

        </fieldset>
       </form>
EOT;
        echo "</div>";
        include 'Footer.php';
        echo '</body>';
        echo '</html>';
    }
示例#8
0
 /**
  * Methode zum Anzeigen des Contents.
  *
  * @return String Content der Applikation.
  */
 public function Display()
 {
     $view = $this->NotFound();
     if (count($this->params) == 0 || $this->params[0] == "") {
         $view = new GenericView("settings");
         if (isset($this->request["changepass"])) {
             if ($this->request["Password1"] == $this->request["Password2"]) {
                 if (CheckPassword($this->request["Password1"])) {
                     $params = array();
                     $params["Id"] = GetActiveUser()->Id;
                     $params["PasswordHash"] = $this->request["Password1"];
                     if (AddOrUpdate("admins", $params)) {
                         DoLog("Das Passwort wurde erfolgreich geändert", LOG_LEVEL_INFO);
                     } else {
                         DoLog("Das Passwort konnte nicht geändert werden", LOG_LEVEL_SYSTEM_ERROR);
                     }
                 } else {
                     //log was done by CheckAdminPass
                 }
             } else {
                 DoLog("Die beiden Passwörter stimmen nicht überein", LOG_LEVEL_USER_ERROR);
             }
             if ($this->request["no-replace"] == true) {
                 exit;
             }
         }
         $view->assign('admins', GetAllOrderedBy("admins", "Id"));
     } else {
         if ($this->params[0] == "Admin") {
             $view = new GenericCrudView($this->params[1], array("add" => "edit"), "settings", "Admin");
             if ($this->params[1] == "add") {
                 if (isset($this->request["add"]) && $this->request["add"] == "true") {
                     unset($this->request["add"]);
                     $res = AddAdmin($this->request);
                     if ($res) {
                         $obj = GetById("admins", $res);
                         if ($obj !== false) {
                             DoLog("Admin wurde hinzugefügt, E-Mail wurde versendet.", LOG_LEVEL_INFO);
                         } else {
                             DoLog("Admin wurde hinzugefügt, E-Mail wurde versendet.", LOG_LEVEL_SYSTEM_ERROR);
                         }
                     }
                 }
                 $view->assign("obj", null);
             } else {
                 if ($this->params[1] == "edit") {
                     if (isset($this->request["edit"]) && $this->request["edit"] == "true") {
                         unset($this->request["edit"]);
                         $this->request["Id"] = $this->params[2];
                         $res = Update("admins", $this->request);
                         if ($res) {
                             DoLog("Admin wurde bearbeitet", LOG_LEVEL_INFO);
                         } else {
                             $view = new MessageView("Admin konnte nicht bearbeitet werden.", LOG_LEVEL_SYSTEM_ERROR);
                         }
                     }
                     $obj = GetById("admins", $this->params[2]);
                     if ($obj !== false) {
                         $view->assign("obj", $obj);
                     } else {
                         $view = new MessageView("Admin wurde nicht gefunden.", LOG_LEVEL_SYSTEM_ERROR);
                     }
                 } else {
                     if ($this->params[1] == "delete" && isset($this->params[2]) && is_numeric($this->params[2])) {
                         if (isset($this->request["delete"]) && $this->request["delete"] == "true") {
                             $res = DeleteById("admins", $this->params[2]);
                             if ($res) {
                                 $view = new MessageView("Admin wurde gelöscht", LOG_LEVEL_INFO);
                             } else {
                                 $view = new MessageView("Admin konnte nicht gelöscht werden.", LOG_LEVEL_SYSTEM_ERROR);
                             }
                         } else {
                             $obj = GetById("admins", $this->params[2]);
                             if ($obj !== false) {
                                 $view->assign("obj", $obj);
                             } else {
                                 $view = new MessageView("Admin wurde nicht gefunden.", LOG_LEVEL_SYSTEM_ERROR);
                             }
                         }
                     } else {
                         $view = $this->NotFound();
                     }
                 }
             }
         } else {
             if ($this->params[0] == "download") {
                 if ($this->params[1] == "database") {
                     DownloadDatabaseAndExit();
                 }
             }
         }
     }
     return $view->loadTemplate();
 }