quiz

quiz pass rate hard coded

  1. /**
  2.  * Check a user/quiz combo to see if the user passed the given quiz.
  3.  * A quiz is keyed by nid/vid, so you need both.
  4.  * This will return TRUE if the user has passed the quiz at least once, and

Fix for expected output xml

  1. <?php
  2. $qp = qp('<?xml version="1.0"? ><quiz><quizinfo/><resultSet/></quiz>', 'quizinfo')
  3.   ->append('<authorName>' . $name . '</authorname>')
  4.   // repeat above for as many elements as you need.
  5.   ->top() // Go back to the top of the document
  6.   ->find('resultSet'); // Search for resultSet section
  7.  
  8. // For each item in the results (wherever you get them), add a result entry
  9. foreach ($results as $result) {
  10.   $qp->branch()
  11.     ->append('<result/>')
  12.     ->find('result:last')
  13.     ->append('<authorName>' . $result->author . '</resultName>')
  14.    // Do that for as many elements as you need
  15. }
  16.  
  17. // Do this to write the output
  18. $qp->writeXML();
  19. ?>

quiz xml

  1. <quiz>
  2. <authorName>admin</authorName>
  3. <authorId>1</authorId>
  4. <title>Sample Quiz</title>
  5. <description>Just a Sample Quiz.</description>
  6. <nodeId>1</nodeId>
  7. <createDate>1244401610</createDate>
  8. <la

expected output xml

  1. <?xml version="1.0"?>
  2. <quiz>
  3.   <quizinfo>
  4.     <authorName>admin</authorName>
  5.     <authorId>1</authorId>
  6.     <title>Sample Quiz</title>
  7.     <nodeId>1</nodeId>
  8.     <createDate>06/21/2009 - 13:41<

Quiz QueryPath

  1. <?php
  2. require_once 'QueryPath/QueryPath.php';
  3.  
  4. $data = array(
  5.   array('name' => 'sivaji', 'resultId' => '12', 'startTime' => '06/21/2009 - 13:41', 'endTime' => '06/21/2009 - 13:41', 'score' => '23

quiz save

  1. ublic function save($is_new = FALSE) {
  2.     if (!isset($this->node->feedback)) {
  3.       $this->node->feedback = '';
  4.     }
  5.  
  6.     if ($is_new || $this->node->revision == 1) {
  7.       $sql = 'INSERT INT

quiz

  1. $item = array();
  2. $item['data'] = 'test';
  3. print isset($item['data']['description']) ? 'set' : 'not set';
  4. print empty($item['data']['description']) ? 'empty' : 'not empty';

Quiz Questions Import output

  1. Array
  2. (
  3.     [#type] => file
  4.     [#title] => Upload
  5.     [#size] => 30
  6.     [#description] => Upload the file that has quiz questions
  7.     [#post] => Array
  8.         (
  9.             [quiz_node] => 7

Quiz Questions Import

  1. <?php
  2. // $Id$
  3.  
  4. /**
  5.  * @file
  6.  * Questions Import
  7.  *
  8.  * This module allows you to import questions to quiz node in CSV format.
  9.  */
  10.  
  11. /**
  12.  * Implementation of hook_help().
  13.  */

Fix for quiz counter

  1.     drupal_access_denied();
  2.     return;
  3.   }
  4.   if(!isset($quiz)) {
  5.     drupal_not_found();
  6.     return;
  7.   }
  8.  
Syndicate content