本文整理汇总了PHP中Movie::getAllMovies方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::getAllMovies方法的具体用法?PHP Movie::getAllMovies怎么用?PHP Movie::getAllMovies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::getAllMovies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($message = '')
{
$movie = new Movie();
$movies = $movie->getAllMovies();
if (count($movies) === 0) {
$movies = -1;
}
$this->registry->template->show('movies', array('movies' => $movies, 'type' => 'title', 'val' => '', 'message' => $message));
}
示例2: function
return $response;
});
$app->post('/login', function ($request, $response, $args) {
$data = $request->getParsedBody();
$user = new User(db::getInstance());
$result = $user->checkUser($data['username'], $data['password']);
if ($result === false) {
$response->write(json_encode(array('error' => array('message' => 'Wrong login information.'))));
} else {
$response->write(json_encode(array('token' => $result)));
}
return $response;
});
$app->get('/movies', function ($request, $response, $args) {
$movie = new Movie(db::getInstance());
$result = $movie->getAllMovies();
if ($result === false) {
$response->write(json_encode(array('error' => array('message' => 'No records found.'))));
} else {
$response->write(json_encode($result));
}
return $response;
})->add($auth_mw);
$app->get('/catmail/{email}', function ($request, $response, $args) {
$recipient = $args['email'];
//Unfortunately, mail transport is used instead of smtp, since smtp is unavailable for free on my server
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance();
$message->setSubject('Your subject')->setFrom(array('catmail@a-melnichuk-projects.hol.es' => 'Cat Mail'))->setTo(array($recipient))->setBody('<html>' . '<head></head>' . '<body>' . 'Here is an image of cute kitty: <img src="' . $message->embed(Swift_Image::fromPath('http://a-melnichuk-projects.hol.es/res/cutecat.jpg', 'image/jpeg')) . '" alt="Cat Pic" />' . 'It\'s adorable!' . '</body>' . '</html>', 'text/html')->attach(Swift_Attachment::fromPath('http://a-melnichuk-projects.hol.es/res/cutecat.jpg', 'image/jpeg'));
$result = $mailer->send($message);
示例3: getHTMLTable
<?php
// we now in presentation layer
// we will include business layer to load business logic
include 'model/movie.php';
// init Movie Model from Business Logic
$movie = new Movie();
// now load all Movies
$data = $movie->getAllMovies();
// prepare HTML Table
function getHTMLTable($tabledata)
{
$html = '<br />';
$html .= '<h1>Liste der bereits erstellten Filme:</h1>';
$html .= '<table id="moviestable">';
$html .= '<thead><tr>';
$html .= '<th>Filmtitel</th>';
$html .= '<th>Jahr</th>';
$html .= '<th>Sprache</th>';
$html .= '<th>Medium</th>';
$html .= '<th>E-Mail</th>';
$html .= '</tr></thead>';
foreach ($tabledata as $movie) {
$html .= '<tbody><tr>';
$html .= '<td>' . $movie['name'] . '</td>';
$html .= '<td>' . $movie['year'] . '</td>';
$html .= '<td>' . $movie['language'] . '</td>';
$html .= '<td>' . $movie['medium'] . '</td>';
$html .= '<td><a href="mailto:' . $movie['email'] . '">' . $movie['email'] . ' </a></td>';
$html .= '</tr></tbody>';
}