本文整理汇总了PHP中Quiz::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Quiz::exists方法的具体用法?PHP Quiz::exists怎么用?PHP Quiz::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quiz
的用法示例。
在下文中一共展示了Quiz::exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Quiz
require '../modules/variables.php';
if (isset($_GET['id'])) {
// check if id is empty
if ($_GET['id'] == "") {
// tell user it is invalid
$url_id = 0;
} else {
// give the real id
$url_id = $_GET['id'];
}
} else {
// tell user id is missing
$url_id = 0;
}
$quiz = new Quiz($url_id);
$quiz_state = $quiz->exists();
if ($quiz_state) {
?>
<title>Quizroo Quiz: <?php
echo $quiz->quiz_name;
?>
</title>
<meta property="og:title" content="<?php
echo $quiz->quiz_name;
?>
" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php
echo $VAR_URL . "quiz_images/imgcrop.php?w=50&h=50&f=" . $quiz->quiz_picture;
?>
" />
示例2: Quiz
<?php
require '../modules/quizrooDB.php';
require '../modules/uploadFunctions.php';
require "../modules/quiz.php";
if (isset($_GET['step'])) {
// now check whether this quiz actually belongs to this user
if (isset($_GET['id'])) {
$quiz = new Quiz($_GET['id']);
if ($quiz->exists() && $quiz->isOwner($member->id)) {
$quiz_state = true;
// unpublish the quiz
$quiz->unpublish($member->id);
$unikey = $quiz->quiz_key;
} else {
$quiz_state = false;
unset($quiz);
}
} else {
$quiz_state = false;
unset($quiz);
}
if ($quiz_state) {
// THE FIRST STEP (Returning): Quiz Information
switch ($_GET['step']) {
case 1:
// populate the categories
$query_listCat = "SELECT cat_id, cat_name FROM q_quiz_cat";
$listCat = mysql_query($query_listCat, $quizroo) or die(mysql_error());
$row_listCat = mysql_fetch_assoc($listCat);
$totalRows_listCat = mysql_num_rows($listCat);
示例3: explode
}
} else {
// attempt to extract the other id parameter
$url_vars = explode('&', $_SERVER["QUERY_STRING"]);
$url_id = 0;
foreach ($url_vars as $test_id) {
if (is_numeric($test_id)) {
$url_id = $test_id;
break;
}
}
}
$valid = false;
$quiz = new Quiz($url_id);
// check if quiz exists
if ($quiz->exists()) {
// check if quiz has questions!
if ($quiz->numQuestions() > 0) {
$valid = true;
} else {
$valid = false;
}
}
if (!$valid) {
if ($quiz->exists()) {
header("Location: previewQuiz.php?id=" . $quiz->quiz_id);
} else {
header("Location: previewQuiz.php");
}
} else {
?>
示例4: Quiz
<?php
require "inc/header-php.php";
require "../modules/quiz.php";
require '../modules/variables.php';
$quiz = new Quiz($_POST['quiz_id']);
if (!$quiz->exists()) {
header("Location: previewQuiz.php");
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<![if !IE]><html xmlns="http://www.w3.org/1999/xhtml"><![endif]>
<!--[if lt IE 9]><html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"><![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Quizroo: <?php
echo $quiz->quiz_name;
?>
</title>
<?php
include "inc/header-css.php";
?>
<link href="css/quiz.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="fb-root"></div>
<?php
include "../modules/statusbar.php";
include "../modules/resultEngine.php";
include "inc/footer-js.php";
示例5: Quiz
<?php
require('../modules/quizrooDB.php');
require('../modules/quiz.php');
// check whether such a quiz exists
$quiz = new Quiz($_GET['id']);
if($quiz->exists()){
// check if member is the owner of this quiz
if($quiz->isOwner($member->id)){
// prepare the formatted status
switch($quiz->isPublished){
case 0: $status = '<span class="draft">Unpublished Draft</span>'; break;
case 1: $status = '<span class="published">Published</span>'; break;
case 2: $status = '<span class="modified">Unpublished Modification</span>'; break;
case 3: $status = '<span class="archived">Archived</span>'; break;
default: $status = 'Limbo :/'; break;
}
// get average options
// check the number of questions
$numQuestions = $quiz->getQuestions("count");
// check the number of options
$listQuestion = explode(',', $quiz->getQuestions());
$totalOptions = 0;
if($numQuestions != 0){
$questionState = true;
$optionState = true;
foreach($listQuestion as $question){
// check the number of options for this question