Skip to content

Commit

Permalink
Release 0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
hertsch committed Aug 2, 2011
1 parent 051ee7a commit 5da0ffa
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
38 changes: 31 additions & 7 deletions class.frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,21 +261,42 @@ public function startQuestion() {
// Frage zufaellig auswaehlen, Datum wird nicht beruecksichtigt
if ($this->useGroupID > 0) {
// Frage aus bestimmter Gruppe auswaehlen
$SQL = sprintf( "SELECT * FROM %s WHERE %s='%s' AND %s='%s' ORDER BY RAND() LIMIT 1",
$dbEdQuestions->getTableName(),
dbEducatedQuestions::field_status,
dbEducatedQuestions::status_active,
dbEducatedQuestions::field_group,
$this->useGroupID);
$SQL = sprintf( "SELECT %s FROM %s WHERE %s='%s' AND %s='%s'",
dbEducatedQuestions::field_id,
$dbEdQuestions->getTableName(),
dbEducatedQuestions::field_status,
dbEducatedQuestions::status_active,
dbEducatedQuestions::field_group,
$this->useGroupID);
}
else {
// Frage aus beliebiger Gruppe
$SQL = sprintf( "SELECT * FROM %s WHERE %s='%s' ORDER BY RAND() LIMIT 1",
$SQL = sprintf( "SELECT * FROM %s WHERE %s='%s'",
$dbEdQuestions->getTableName(),
dbEducatedQuestions::field_status,
dbEducatedQuestions::status_active);
}

// Fragen auswaehlen
if (!$dbEdQuestions->sqlExec($SQL, $result)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbEdQuestions->getError()));
return false;
}
$all_questions = array();
foreach ($result as $q) $all_questions[] = $q[dbEducatedQuestions::field_id];
$used_questions = isset($_SESSION['MC_QUESTIONS_USED']) ? $_SESSION['MC_QUESTIONS_USED'] : array();
$free_questions = array_diff($all_questions, $used_questions);
if (count($free_questions) == 0) {
$free_questions = $all_questions;
$used_questions = array();
}

$SQL = sprintf( "SELECT * FROM %s WHERE FIND_IN_SET(%s, '%s') ORDER BY RAND() LIMIT 1",
$dbEdQuestions->getTableName(),
dbEducatedQuestions::field_id,
implode(',', $free_questions));


$question = array();
if (!$dbEdQuestions->sqlExec($SQL, $question)) {
$this->setError(sprintf('[%s - %s] %s', __METHOD__, __LINE__, $dbEdQuestions->getError()));
Expand All @@ -287,6 +308,9 @@ public function startQuestion() {
return false;
}
$question = $question[0];
// SESSION setzen
$used_questions[] = $question[dbEducatedQuestions::field_id];
$_SESSION['MC_QUESTIONS_USED'] = $used_questions;
}
else {
// Frage aus einem Datumsbereich zufaellig auswaehlen
Expand Down
50 changes: 23 additions & 27 deletions info.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,39 @@
<?php

/**
* multipleEducated - create quizzes like "Bildungshappen" for WebsiteBaker
* multipleEducated
*
* @author Ralf Hertsch (ralf.hertsch@phpmanufaktur.de)
* @link http://phpmanufaktur.de/cms/topics/multipleeducated.php
* @copyright 2009 - 2010
* @link http://phpmanufaktur.de
* @copyright 2011
* @license GNU GPL (http://www.gnu.org/licenses/gpl.html)
* @version $Id$
*
* 0.10
* 2009-06-24
* First BETA Release
*
* 0.11
* 2010-04-08
* Second BETA Release
*
* 0.12
* 2010-07-18
* Release Candidate
*
* 0.13
* 2010-09-17
* Small Bugfixes
*
* 0.14
* 2010-10-19
* Changed deprecated functions in class.backend.php
* Added support for english language (EN.php)
* Changed database interface from dbConnect to dbConnect_LE
* Removed included Dwoo and use it as external addon
*
* FOR VERSION- AND RELEASE NOTES PLEASE LOOK AT INFO.TXT!
*/

// try to include LEPTON class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION')) include(WB_PATH.'/framework/class.secure.php');
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php')) {
include($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php');
} else {
$subs = explode('/', dirname($_SERVER['SCRIPT_NAME'])); $dir = $_SERVER['DOCUMENT_ROOT'];
$inc = false;
foreach ($subs as $sub) {
if (empty($sub)) continue; $dir .= '/'.$sub;
if (file_exists($dir.'/framework/class.secure.php')) {
include($dir.'/framework/class.secure.php'); $inc = true; break;
}
}
if (!$inc) trigger_error(sprintf("[ <b>%s</b> ] Can't include LEPTON class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
// end include LEPTON class.secure.php

$module_directory = 'educated';
$module_name = 'multipleEducated';
$module_function = 'tool';
$module_version = '0.14';
$module_version = '0.15';
$module_status = 'Stable';
$module_platform = '2.8.x';
$module_author = 'Ralf Hertsch, Berlin (Germany)';
Expand Down
2 changes: 1 addition & 1 deletion info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

Release 0.15
2011-08-02

Changed shuffling now avoid repetual questions
Grant compatibillity for LEPTON CMS

Release 0.14
Expand Down

0 comments on commit 5da0ffa

Please sign in to comment.