本文整理汇总了PHP中MDB::insertCast方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB::insertCast方法的具体用法?PHP MDB::insertCast怎么用?PHP MDB::insertCast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB
的用法示例。
在下文中一共展示了MDB::insertCast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Step4
public static function Step4($modernLanguagesFlipped)
{
if (isset($_POST['imdbid']) && is_numeric($_POST['imdbid'])) {
$movie = new imdb($_POST['imdbid']);
$movie->setid($_POST['imdbid']);
$db = new MDB();
$cast = $movie->cast();
$i = 0;
// Insert all castmemebers
while (list($key, $value) = each($cast)) {
$db->insertCast($_POST['imdbid'], $value['imdb'], AddMovie::utf8ify($value['name']), ++$i);
if ($i > MAXNAMES) {
break;
}
}
$directors = $movie->director();
$writers = $movie->writing();
$producers = $movie->producer();
$crew = array_merge($directors, $writers, $producers);
$i = 0;
// Insert all crewmemebers
while (list($key, $value) = each($crew)) {
$db->insertCrew($_POST['imdbid'], $value['imdb'], AddMovie::utf8ify($value['name']), ++$i);
if ($i > MAXNAMES) {
break;
}
}
$genres = implode(',', $movie->genres());
$year = $movie->year();
$runtime = $movie->runtime();
if ($runtime == null) {
$runtime = 1;
if (isset($_POST['runtime']) && is_numeric($_POST['runtime'])) {
$runtime = $_POST['runtime'];
}
}
$title = AddMovie::utf8ify($movie->title());
$aka = $movie->alsoknow();
$englishTitle = '';
$rating = 1;
if (is_numeric($_POST['rating'])) {
$rating = $_POST['rating'];
}
if ($_POST['english-title'] != 'none') {
$englishTitle = AddMovie::utf8ify($aka[$_POST['english-title']]['title']);
//$englishTitle = trim($englishTitle, 1, strrpos($englishTitle, '"') - 1);
}
$language = 'en';
if (strlen($_POST['language']) == 2) {
$language = $_POST['language'];
}
$success = $db->insertMovie($_POST['imdbid'], $title, $englishTitle, $language, $genres, $year, $runtime, $rating);
if ($success) {
header('Location: ./?message=add-success');
} else {
header('Location: ./?message=add-error');
}
exit;
} else {
AddMovie::Step1('invalid-id');
}
}