• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Quiz类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Quiz的典型用法代码示例。如果您正苦于以下问题:PHP Quiz类的具体用法?PHP Quiz怎么用?PHP Quiz使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Quiz类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: matapelajaran

 public function matapelajaran()
 {
     $klslevel = isset($_GET['klslevel']) ? addslashes($_GET['klslevel']) : 1;
     //$kls = new Kelas();
     //$kls->getByID($id);
     $mp = new Matapelajaran();
     $mp_id = isset($_GET['mp_id']) ? addslashes($_GET['mp_id']) : die('MP ID empty');
     $mp->getByID($mp_id);
     //get quizes
     $quiz = new Quiz();
     $whereClause = "quiz_guru_id = guru_id AND quiz_mp_id = '{$mp_id}' AND quiz_tingkatan = '{$klslevel}' ORDER BY quiz_create_date DESC";
     $arrTables = array("Guru");
     $arrQuiz = $quiz->getWhereFromMultipleTable($whereClause, $arrTables);
     //pr($arrQuiz);
     //get topicmaps
     $tm = new Topicmap();
     $whereClause = "tm_guru_id = guru_id AND tm_mp_id = '{$mp_id}'  AND tm_kelas_tingkatan  = '{$klslevel}' ORDER BY tm_updatedate DESC";
     $arrTables = array("Guru");
     $arrTM = $tm->getWhereFromMultipleTable($whereClause, $arrTables);
     //pr($arrTM);
     $return["mp"] = $mp;
     $return['kelas'] = $kls;
     $return['webClass'] = __CLASS__;
     $return['method'] = __FUNCTION__;
     $return['klslevel'] = $klslevel;
     $return['arrQuiz'] = $arrQuiz;
     $return['arrTM'] = $arrTM;
     Mold::both("elearning/mp_profile", $return);
     //pr($mp);
 }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:30,代码来源:Elearningweb.php


示例2: slide_presentation_quiz

function slide_presentation_quiz(Quiz $quiz, $name)
{
    global $tr;
    $manageCourse = new CourseManager();
    $c = $manageCourse->getById($quiz->getCourseId());
    return "<div class='sp-presentation-content'>\r\n            <div>\r\n                <h4><strong>" . $tr->__("Author") . "</strong>: " . $name . "</h4>\r\n                <h4><strong>" . $tr->__("Course") . "</strong>: " . $c->getName() . "</h4>\r\n                <h4><strong>" . $tr->__("Duration") . "</strong>: " . $quiz->getDuration() . " min</h4>\r\n            </div>\r\n            <h2>" . $quiz->getName() . "</h2>\r\n\r\n        </div>";
}
开发者ID:Cossumo,项目名称:studypress,代码行数:7,代码来源:player-quiz.controller.php


示例3: convert

 public function convert()
 {
     foreach (glob("Model/Json/*.json") as $filename) {
         $oldquiz = json_decode(file_get_contents($filename), true);
         $newquiz = new Quiz($oldquiz["name"], $oldquiz["description"]);
         foreach ($oldquiz["questions"] as $q) {
             $newquiz->addQuestion(new QuizQuestion($q["question"], $q["option"], $q["correct"]));
         }
         file_put_contents("Model/quizes/" . basename($filename) . ".bin", serialize($newquiz));
     }
 }
开发者ID:KevinUd2014,项目名称:Php_newProject,代码行数:11,代码来源:QuizDAL.php


示例4: index

 public function index()
 {
     $totalQuizzesCount = Quiz::count();
     $totalUsersCount = User::count();
     $todayQuizzesCount = Quiz::whereRaw('DATE(created_at) = DATE(NOW())')->count();
     $todayUsersCount = User::whereRaw('DATE(created_at) = DATE(NOW())')->count();
     $overallActivities = QuizUserActivity::groupBy('type')->havingRaw("type in ('attempt', 'share')")->select('type', DB::raw('count(*) as count'))->get()->toArray();
     $overallStats = array();
     foreach ($overallActivities as $activity) {
         $overallStats[$activity['type']] = $activity['count'];
     }
     $overallStats['quizzes'] = $totalQuizzesCount;
     $overallStats['users'] = $totalUsersCount;
     $todayActivities = QuizUserActivity::whereRaw('DATE(created_at) = DATE(\'' . date('Y-m-d H:i:s') . '\')')->groupBy('type')->havingRaw("type in ('attempt', 'share')")->select('type', DB::raw('count(*) as count'))->get()->toArray();
     $todayStats = array();
     foreach ($todayActivities as $activity) {
         $todayStats[$activity['type']] = $activity['count'];
     }
     $todayStats['quizzes'] = $todayQuizzesCount;
     $todayStats['users'] = $todayUsersCount;
     //Filling stats vars that are not yet set
     self::fillNullStats($todayStats);
     self::fillNullStats($overallStats);
     View::share(array('overallStats' => $overallStats, 'todayStats' => $todayStats));
     $last30DaysActivity = self::getLastNDaysActivity(30, 'attempt');
     $last30DaysUserRegistrations = self::getLastNDaysUserRegistrations(30);
     View::share(array('last30DaysActivity' => json_encode($last30DaysActivity), 'last30DaysUserRegistrations' => json_encode($last30DaysUserRegistrations)));
     return View::make('admin/index');
 }
开发者ID:thunderclap560,项目名称:quizkpop,代码行数:29,代码来源:AdminController.php


示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($quiz_id)
 {
     try {
         DB::beginTransaction();
         $quiz = Quiz::find($quiz_id);
         foreach (Input::get('question') as $input_question) {
             $question_params = array("name" => $input_question['name']);
             $question_validator = Question::validate($question_params);
             if ($question_validator->fails()) {
                 throw new Exception("Question can't be saved");
             }
             $question = new Question($question_params);
             $question = $quiz->questions()->save($question);
             foreach ($input_question['options'] as $value) {
                 $option_params = array("name" => $value['name'], "is_correct" => array_key_exists("is_correct", $value) ? true : false);
                 $option_validator = Option::validate($option_params);
                 if ($option_validator->fails()) {
                     throw new Exception("Option can't be saved");
                 }
                 $option = new Option($option_params);
                 $option = $question->options()->save($option);
             }
         }
         DB::commit();
         return Redirect::to("quizzes/" . $quiz->id . '/questions');
     } catch (Exception $e) {
         DB::rollback();
         //throw new Exception($e);
         return Redirect::to('quizzes/' . $quiz->id . '/questions/create');
     }
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:36,代码来源:QuestionsController.php


示例6: getNewestQuizzesInCategory

 public function getNewestQuizzesInCategory($category)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "category = '" . $category . "'";
     $criteria->order = 'created_at DESC';
     $data = Quiz::model()->findAll($criteria);
     return $data;
 }
开发者ID:huynt57,项目名称:quizder,代码行数:8,代码来源:Quiz.php


示例7: takeQuiz

 public function takeQuiz()
 {
     //check if quiz can be taken by student,
     //based on the time and the ID number
     $page_title = 'Cannot Take Quiz';
     $page_content = View::make('no_quiz');
     $id_number = Session::get('id_number');
     $quiz_code = Session::get('quiz_code');
     $current_datetime = Carbon::now()->toDateTimeString();
     $quiz_schedule = QuizSchedule::where('quiz_code', '=', $quiz_code)->whereRaw(DB::raw("'{$current_datetime}' BETWEEN datetime_from AND datetime_to"))->first();
     if ($quiz_schedule) {
         $quiz_schedule_id = $quiz_schedule->id;
         $class_id = $quiz_schedule->class_id;
         $quiz_id = $quiz_schedule->quiz_id;
         $student = StudentClass::where('student_id', '=', $id_number)->where('class_id', '=', $class_id)->first();
         if ($student) {
             //when a student takes a quiz, a row is created on the
             //student_quizzes table, add the started_at, quiz_id, and student_id
             //when another student comes along and inputs the same id number
             //and quiz code, they won't be allowed since the quiz is already taken
             $student_quiz_count = StudentQuiz::where('student_id', '=', $id_number)->where('quiz_id', '=', $quiz_id)->count();
             if ($student_quiz_count === 0) {
                 //can take
                 //get quiz details and show it to the student
                 $quiz = Quiz::where('id', '=', $quiz_id)->first();
                 Session::put('quiz_id', $quiz_id);
                 Session::put('quiz_title', $quiz->title);
                 $items = QuizItem::where('quiz_id', '=', $quiz_id)->orderByRaw("RAND()")->get();
                 $item_ids = DB::table('quiz_items')->where('quiz_id', '=', $quiz_id)->lists('id');
                 $quiz_items_answers = DB::table('quiz_items_answers')->whereIn('quiz_item_id', $item_ids)->get();
                 $quiz_items_choices = DB::table('quiz_items_choices')->whereIn('quiz_item_id', $item_ids)->get();
                 $quiz_items = array();
                 foreach ($items as $item) {
                     $quiz_items[$item->id] = array('question' => $item->question);
                 }
                 foreach ($quiz_items_choices as $qic) {
                     $quiz_items[$qic->quiz_item_id]['choices'][] = $qic->choice;
                 }
                 $seconds = $quiz->minutes * 60 + 1;
                 $page_data = array('quiz' => $quiz, 'quiz_items' => $quiz_items, 'seconds' => $seconds);
                 //create student quiz
                 $student_quiz = new StudentQuiz();
                 $student_quiz->student_id = $id_number;
                 $student_quiz->quiz_id = $quiz_id;
                 $student_quiz->quiz_schedule_id = $quiz_schedule_id;
                 $student_quiz->started_at = Carbon::now()->toDateTimeString();
                 $student_quiz->save();
                 $page_title = 'Take Quiz';
                 $page_content = View::make('quiz', $page_data);
             }
         }
     }
     $this->layout->title = $page_title;
     $this->layout->quiz = true;
     $this->layout->content = $page_content;
 }
开发者ID:anchetaWern,项目名称:shotgun,代码行数:56,代码来源:HomeController.php


示例8: actionDeleteRatingQuiz

 public function actionDeleteRatingQuiz()
 {
     $request = Yii::app()->request;
     try {
         $id = StringHelper::filterString($request->getPost('id'));
         if (Quiz::model()->delelteRatingQuiz($id)) {
             ResponseHelper::JsonReturnSuccess('');
         } else {
             ResponseHelper::JsonReturnError('');
         }
     } catch (Exception $ex) {
         ResponseHelper::JsonReturnError($ex->getMessage());
     }
 }
开发者ID:huynt57,项目名称:quizder,代码行数:14,代码来源:QuizController.php


示例9: update

 public function update($resource_id, $quiz_id)
 {
     $resource = Resource::find($resource_id);
     $validator = Quiz::validate(Input::all());
     if ($validator->fails()) {
         return Redirect::to('resources/' . $resource->id . '/quizzes/' . $quiz_id . '/edit')->withErrors($validator)->withInput(Input::all());
     } else {
         $quiz = $resource->quizzes()->find($quiz_id);
         $quiz->title = Input::get("title");
         $quiz->description = Input::get('description');
         $quiz->no_of_questions = Input::get('no_of_questions');
         $quiz->save();
         return Redirect::to('resources/' . $resource->id . '/quizzes')->with('success', 'you have succesfully updated the quiz');
     }
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:15,代码来源:QuizzesController.php


示例10: delete

 public function delete()
 {
     $quizId = Input::get('quizId', null);
     if (!$quizId) {
         return Response::error("Quiz not found");
     }
     try {
         $quiz = Quiz::findOrFail($quizId ? $quizId : $quizData['id']);
     } catch (ModelNotFoundException $e) {
         return Response::error("Error finding quiz with id " . $quizId);
     }
     if ($quiz->delete()) {
         return Response::json(array('success' => true));
     } else {
         return Response::error("Some error occured while deleting quiz : '" . $quizId->topic . "'");
     }
 }
开发者ID:thunderclap560,项目名称:quizkpop,代码行数:17,代码来源:AdminQuizesController.php


示例11: more

 public function more()
 {
     $user = User::with('Course', 'Gender', 'userType')->where('StudentID', Auth::user()->StudentID)->first();
     $adminGroupPages = GroupPage::where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     $groupPages = GroupPageMember::with('groupPages')->where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     if (Auth::user()->UserTypeID == 2) {
         $files = Files::where('delFlag', 0)->where('folderID', 0)->where('OwnerID', Auth::user()->StudentID)->get();
         $fileFolders = FilesFolder::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
         $activities = GroupPageActivity::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->get();
         $quizzes = Quiz::where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
     } else {
         $activities = GroupPageActivityGroup::with('groupPage', 'groupPageActivityFiles')->where('deadline', '>', date('Y-m-d H:i:s'))->whereExists(function ($q) {
             $q->select(DB::raw(0))->from('grouppagemember')->whereRaw('grouppagemember.grouppageID = grouppageactivitygroup.grouppageID')->where('StudentID', Auth::user()->StudentID)->whereRaw('grouppagemember.delFlag = 0');
         })->orderBy('deadline', 'ASC')->get();
         $quizzes = QuizGroupPage::with('groupPageMember', 'groupPage', 'quiz')->where('delFlag', 0)->whereNotExists(function ($q) {
             $q->select(DB::raw(0))->from('quiztaken', 'grouppagemember')->where('quiztaken.OwnerID', Auth::user()->StudentID)->whereRaw('quiztaken.quizID = quizgrouppage.quizID')->where('delFlag', 0);
         })->get();
     }
     return View::make('validated.more', compact('user', 'adminGroupPages', 'groupPages', 'files', 'fileFolders', 'activities', 'quizzes'));
 }
开发者ID:NoName1771,项目名称:QCPU-Social-Web-App,代码行数:20,代码来源:AppController.php


示例12: loadModel

 protected function loadModel($id)
 {
     /**
      * TODO или сделать в один запрос?
      */
     $criteria = new CDbCriteria();
     $criteria->compare('t.active', Quiz::STATUS_ACTIVE);
     /** @var $quiz Quiz */
     $quiz = Quiz::model()->findByPk($id, $criteria);
     if ($quiz === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $criteria = new CDbCriteria(array('with' => 'answers', 'order' => 't.sequence ASC, answers.sequence ASC'));
     $criteria->compare('t.id_quiz', $id);
     $questions = QuizQuestion::model()->findAll($criteria);
     if (empty($questions)) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $quiz->addRelatedRecord('questions', $questions, false);
     return $quiz;
 }
开发者ID:Cranky4,项目名称:npfs,代码行数:21,代码来源:DefaultController.php


示例13: while

            }
            ?>
</div></td>
  </tr>
</table>
</div>			
<?php 
            $result++;
        } while ($row_getQuery = mysql_fetch_assoc($getQuery));
    }
} elseif (isset($_GET['delete'])) {
    // delete the result
    require 'member.php';
    require 'quiz.php';
    // also pass in the member id for security check
    $quiz = new Quiz($_GET['id']);
    $member = new Member();
    if (!$quiz->removeResult($_GET['result'], $member->id)) {
        echo "Delete not authorized";
    }
} else {
    $result = $_GET['resultNumber'];
    $unikey = $_GET['unikey'];
    $count = 1;
    ?>
<div id="r<?php 
    echo $result;
    ?>
" class="resultWidget">
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
开发者ID:Jessicasoon,项目名称:ProjectKentRidgeV2,代码行数:31,代码来源:createResultObject.php


示例14: build_quiz_questions

 /**
  * Build the Quiz-Questions
  * @param int $courseId Internal course ID
  */
 public function build_quiz_questions($courseId = 0)
 {
     $table_qui = Database::get_course_table(TABLE_QUIZ_TEST);
     $table_rel = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
     $table_que = Database::get_course_table(TABLE_QUIZ_QUESTION);
     $table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
     // Building normal tests.
     $sql = "SELECT * FROM {$table_que}\n                WHERE c_id = {$courseId} ";
     $result = Database::query($sql);
     while ($obj = Database::fetch_object($result)) {
         // find the question category
         // @todo : need to be adapted for multi category questions in 1.10
         $question_category_id = TestCategory::getCategoryForQuestion($obj->id, $courseId);
         // build the backup resource question object
         $question = new QuizQuestion($obj->id, $obj->question, $obj->description, $obj->ponderation, $obj->type, $obj->position, $obj->picture, $obj->level, $obj->extra, $question_category_id);
         $sql = 'SELECT * FROM ' . $table_ans . '
                 WHERE c_id = ' . $courseId . ' AND question_id = ' . $obj->id;
         $db_result2 = Database::query($sql);
         while ($obj2 = Database::fetch_object($db_result2)) {
             $question->add_answer($obj2->id, $obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
             if ($obj->type == MULTIPLE_ANSWER_TRUE_FALSE) {
                 $table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
                 $sql = 'SELECT * FROM ' . $table_options . '
                         WHERE c_id = ' . $courseId . ' AND question_id = ' . $obj->id;
                 $db_result3 = Database::query($sql);
                 while ($obj3 = Database::fetch_object($db_result3)) {
                     $question_option = new QuizQuestionOption($obj3);
                     $question->add_option($question_option);
                 }
             }
         }
         $this->course->add_resource($question);
     }
     // Building a fictional test for collecting orphan questions.
     // When a course is emptied this option should be activated (true).
     $build_orphan_questions = !empty($_POST['recycle_option']);
     // 1st union gets the orphan questions from deleted exercises
     // 2nd union gets the orphan questions from question that were deleted in a exercise.
     $sql = " (\n                    SELECT question_id, q.* FROM {$table_que} q INNER JOIN {$table_rel} r\n                    ON (q.c_id = r.c_id AND q.id = r.question_id)\n                    INNER JOIN {$table_qui} ex\n                    ON (ex.id = r.exercice_id AND ex.c_id = r.c_id )\n                    WHERE ex.c_id = {$courseId} AND ex.active = '-1'\n                 )\n                 UNION\n                 (\n                    SELECT question_id, q.* FROM {$table_que} q left\n                    OUTER JOIN {$table_rel} r\n                    ON (q.c_id = r.c_id AND q.id = r.question_id)\n                    WHERE q.c_id = {$courseId} AND r.question_id is null\n                 )\n                 UNION\n                 (\n                    SELECT question_id, q.* FROM {$table_que} q\n                    INNER JOIN {$table_rel} r\n                    ON (q.c_id = r.c_id AND q.id = r.question_id)\n                    WHERE r.c_id = {$courseId} AND (r.exercice_id = '-1' OR r.exercice_id = '0')\n                 )\n        ";
     $result = Database::query($sql);
     if (Database::num_rows($result) > 0) {
         $build_orphan_questions = true;
         $orphanQuestionIds = array();
         while ($obj = Database::fetch_object($result)) {
             // Orphan questions
             if (!empty($obj->question_id)) {
                 $obj->id = $obj->question_id;
             }
             // Avoid adding the same question twice
             if (!isset($this->course->resources[$obj->id])) {
                 // find the question category
                 // @todo : need to be adapted for multi category questions in 1.10
                 $question_category_id = TestCategory::getCategoryForQuestion($obj->id, $courseId);
                 $question = new QuizQuestion($obj->id, $obj->question, $obj->description, $obj->ponderation, $obj->type, $obj->position, $obj->picture, $obj->level, $obj->extra, $question_category_id);
                 $sql = "SELECT * FROM {$table_ans}\n                            WHERE c_id = {$courseId} AND question_id = " . $obj->id;
                 $db_result2 = Database::query($sql);
                 if (Database::num_rows($db_result2)) {
                     while ($obj2 = Database::fetch_object($db_result2)) {
                         $question->add_answer($obj2->id, $obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
                     }
                     $orphanQuestionIds[] = $obj->id;
                 }
                 $this->course->add_resource($question);
             }
         }
     }
     if ($build_orphan_questions) {
         $obj = array('id' => -1, 'title' => get_lang('OrphanQuestions', ''), 'type' => 2);
         $newQuiz = new Quiz((object) $obj);
         if (!empty($orphanQuestionIds)) {
             foreach ($orphanQuestionIds as $index => $orphanId) {
                 $order = $index + 1;
                 $newQuiz->add_question($orphanId, $order);
             }
         }
         $this->course->add_resource($newQuiz);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:82,代码来源:CourseBuilder.class.php


示例15: 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);
开发者ID:hienvuong,项目名称:Quizroo,代码行数:31,代码来源:createQuizMain.php


示例16: date

    }
    if (!empty($_REQUEST['expire_Meridian'])) {
        $_REQUEST['expire_Hour'] = date('H', strtotime($_REQUEST['expire_Hour'] . ':00 ' . $_REQUEST['expire_Meridian']));
    }
    $quiz_data["datePub"] = TikiLib::make_time($quiz_data["publish_Hour"], $quiz_data["publish_Minute"], 0, $quiz_data["publish_Month"], $quiz_data["publish_Day"], $quiz_data["publish_Year"]);
    $quiz_data["dateExp"] = TikiLib::make_time($quiz_data["expire_Hour"], $quiz_data["expire_Minute"], 0, $quiz_data["expire_Month"], $quiz_data["expire_Day"], $quiz_data["expire_Year"]);
    $fields = array('nQuestion', 'shuffleAnswers', 'shuffleQuestions', 'multiSession', 'additionalQuestions', 'limitDisplay', 'timeLimited', 'canRepeat', 'additionalQuestions', 'forum');
    foreach ($fields as $field) {
        fetchYNOption($quiz_data, $quiz_data, $field);
    }
    return $quiz_data;
}
if (isset($_REQUEST["save"])) {
    check_ticket('edit-quiz-question');
    $quiz_data = quiz_data_load();
    $quizNew = new Quiz();
    $quizNew->data_load($quiz_data);
    // if the id is 0, use just save the new data
    // otherwise we compare the data to what was there before.
    if ($quiz->id == 0 || $quizNew != $quiz) {
        $quizlib->quiz_store($quizNew);
        // tell user changes were stored (new quiz stored with id of x or quiz x modified), return to list of admin quizzes
    }
    die;
    echo "line: " . __LINE__ . "<br>";
    echo "Sorry, this is only a prototype at present.<br>";
    // Fixme, this doesn't work for a brand-new quiz because the quizId is zero!
    if ($cat_objid != 0) {
        $cat_href = "tiki-quiz.php?quizId=" . $cat_objid;
        $cat_name = $_REQUEST["name"];
        $cat_desc = substr($_REQUEST["description"], 0, 200);
开发者ID:rjsmelo,项目名称:tiki,代码行数:31,代码来源:tiki-quiz_edit.php


示例17: isset

<?php

$filterId = isset($_GET['filter']) ? intval($_GET['filter']) : null;
$filter = new Filter($filterId);
if (empty($filter->id)) {
    Ajax::outputError('Invalid report');
}
$quiz = new Quiz($filter->quiz_id);
if (!$quiz->hasAccess()) {
    Ajax::outputError('Invalid report');
}
$filter->delete();
Ajax::output($filterId);
开发者ID:robertpop,项目名称:NS,代码行数:13,代码来源:delete-filter.php


示例18: parseTextField

 function parseTextField($input)
 {
     global $wqInputId;
     $wqInputId++;
     $title = $state = $size = $maxlength = $class = $style = $value = $disabled = $a_inputBeg = $a_inputEnd = $big = '';
     # determine size and maxlength of the input.
     if (array_key_exists(3, $input)) {
         $size = $input[3];
         if ($size < 3) {
             $size = 'size="1"';
         } elseif ($size < 12) {
             $size = 'size="' . ($size - 2) . '"';
         } else {
             $size = 'size="' . ($size - 1) . '"';
         }
         $maxlength = 'maxlength="' . $input[3] . '"';
     }
     # Syntax error if there is no input text.
     if (empty($input[1])) {
         $value = 'value="???"';
         $state = 'error';
     } else {
         if ($this->mBeingCorrected) {
             $value = trim($this->mRequest->getVal($wqInputId));
             $a_inputBeg = '<a class="input" href="#nogo"><span class="correction">';
             $state = 'NA';
             $title = 'title="' . wfMsgHtml('quiz_colorNA') . '"';
         }
         $class = 'class="numbers"';
         foreach (preg_split('` *\\| *`', trim($input[1]), -1, PREG_SPLIT_NO_EMPTY) as $possibility) {
             if ($state == '' || $state == 'NA' || $state == 'wrong') {
                 if (preg_match('`^(-?\\d+\\.?\\d*)(-(-?\\d+\\.?\\d*)| (\\d+\\.?\\d*)(%))?$`', str_replace(',', '.', $possibility), $matches)) {
                     if (array_key_exists(5, $matches)) {
                         $strlen = $size = $maxlength = '';
                     } elseif (array_key_exists(3, $matches)) {
                         $strlen = strlen($matches[1]) > strlen($matches[3]) ? strlen($matches[1]) : strlen($matches[3]);
                     } else {
                         $strlen = strlen($matches[1]);
                     }
                     if ($this->mBeingCorrected && !empty($value)) {
                         $value = str_replace(',', '.', $value);
                         if (is_numeric($value) && (array_key_exists(5, $matches) && $value >= $matches[1] - $matches[1] * $matches[4] / 100 && $value <= $matches[1] + $matches[1] * $matches[4] / 100 || array_key_exists(3, $matches) && $value >= $matches[1] && $value <= $matches[3] || $value == $possibility)) {
                             $state = 'right';
                             $title = 'title="' . wfMsgHtml('quiz_colorRight') . '"';
                         } else {
                             $state = 'wrong';
                             $title = 'title="' . wfMsgHtml('quiz_colorWrong') . '"';
                         }
                     }
                 } else {
                     $strlen = preg_match('` \\(i\\)$`', $possibility) ? mb_strlen($possibility) - 4 : mb_strlen($possibility);
                     $class = 'class="words"';
                     if ($this->mBeingCorrected && !empty($value)) {
                         if ($value == $possibility || preg_match('`^' . $value . ' \\(i\\)$`i', $possibility) || !$this->mCaseSensitive && preg_match('`^' . $value . '$`i', $possibility)) {
                             $state = 'right';
                             $title = 'title="' . wfMsgHtml('quiz_colorRight') . '"';
                         } else {
                             $state = 'wrong';
                             $title = 'title="' . wfMsgHtml('quiz_colorWrong') . '"';
                         }
                     }
                 }
                 if (array_key_exists(3, $input) && $strlen > $input[3]) {
                     # The textfield is too short for the answer
                     $state = 'error';
                     $value = "&lt;_{$possibility}_ &gt;";
                 }
             }
             if ($this->mBeingCorrected) {
                 $a_inputBeg .= "{$possibility}<br />";
             }
         }
         $value = empty($value) ? '' : 'value="' . str_replace('"', '&quot;', $value) . '"';
         if ($this->mBeingCorrected) {
             $a_inputBeg .= '</span>';
             $a_inputEnd = '</a>';
             $big = '<em>&#9660;</em>';
         }
     }
     if ($state == 'error' || $this->mBeingCorrected) {
         global $wgContLang;
         $border = $wgContLang->isRTL() ? 'border-right' : 'border-left';
         $style = "style=\"{$border}:3px solid " . Quiz::getColor($state) . '; "';
         $this->setState(empty($value) ? 'new_NA' : $state);
         if ($state == 'error') {
             $size = '';
             $maxlength = '';
             $disabled = 'disabled="disabled"';
             $title = 'title="' . wfMsgHtml('quiz_colorError') . '"';
         }
     }
     return $output = "{$a_inputBeg}<span {$style}><input {$class} type=\"text\" name=\"{$wqInputId}\" {$title} {$size} {$maxlength} {$value} {$disabled} autocomplete=\"off\" />{$big}</span>{$a_inputEnd}";
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:93,代码来源:Quiz.class.php


示例19: Quiz

<?php

require '../modules/quizrooDB.php';
require '../modules/uploadFunctions.php';
require "../modules/quiz.php";
// 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;
    }
} else {
    $quiz_state = false;
}
if ($quiz_state) {
    if (isset($_GET['step'])) {
        $step = $_GET['step'];
    } else {
        $step = 1;
    }
    switch ($step) {
        // THE FIRST STEP (Returning): Quiz Information
        default:
        case 1:
            // populate the categories
            $query_listCat = "SELECT cat_id, cat_name FROM q_quiz_cat";
开发者ID:Jessicasoon,项目名称:ProjectKentRidgeV2,代码行数:31,代码来源:modifyQuizMain.php


示例20: Quiz

<?php

include 'config.php';
include 'quiz.php';
$quiz = new Quiz();
$quiz->process($_GET[QUESTION_QUERY_PARAM], $_GET[ANSWER_QUERY_PARAM]);
开发者ID:peeinears,项目名称:youtube-quiz-maker,代码行数:6,代码来源:index.php



注:本文中的Quiz类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Quota类代码示例发布时间:2022-05-23
下一篇:
PHP QuickSearchDefaults类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap