diff --git a/attempt.php b/attempt.php new file mode 100644 index 0000000..1905f17 --- /dev/null +++ b/attempt.php @@ -0,0 +1,271 @@ +get_record('course', array('id' => $cm->course))) { + print_error('coursemisconf'); + } + if (! $game = $DB->get_record('game', array('id' => $cm->instance))) { + print_error('invalidcoursemodule'); + } + } else { + if (! $game = $DB->get_record('game', array('id' => $q))) { + print_error('invalidgameid', 'game'); + } + if (! $course = $DB->get_record('course', array('id' => $game->course))) { + print_error('invalidcourseid'); + } + if (! $cm = get_coursemodule_from_instance('game', $game->id, $course->id)) { + print_error('invalidcoursemodule'); + } + } + + /// Check login and get context. + require_login($course->id, false, $cm); + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + require_capability('mod/game:view', $context); + + /// Cache some other capabilites we use several times. + $canattempt = has_capability('mod/game:attempt', $context); + $canreviewmine = has_capability('mod/game:reviewmyattempts', $context); + + /// Create an object to manage all the other (non-roles) access rules. + $timenow = time(); + //$accessmanager = new game_access_manager(game::create($game->id, $USER->id), $timenow); + + /// If no questions have been set up yet redirect to edit.php + //if (!$game->questions && has_capability('mod/game:manage', $context)) { + // redirect($CFG->wwwroot . '/mod/game/edit.php?cmid=' . $cm->id); + //} + + /// Log this request. + add_to_log($course->id, 'game', 'view', "view.php?id=$cm->id", $game->id, $cm->id); + + /// Initialize $PAGE, compute blocks + $PAGE->set_url('/mod/game/view.php', array('id' => $cm->id)); + + $edit = optional_param('edit', -1, PARAM_BOOL); + if ($edit != -1 && $PAGE->user_allowed_editing()) { + $USER->editing = $edit; + } + + $PAGE->requires->yui2_lib('event'); + + // Note: MDL-19010 there will be further changes to printing header and blocks. + // The code will be much nicer than this eventually. + $title = $course->shortname . ': ' . format_string($game->name); + + if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) { + $buttons = '
'. + ''. + ''. + '
'; + $PAGE->set_button($buttons); + } + + $PAGE->set_title($title); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); + } + + function game_do_attempt( $id, $game, $action, $course, $context) + { + global $OUTPUT; + + $forcenew = optional_param('forcenew', false, PARAM_BOOL); // Teacher has requested new preview + $endofgame = optional_param('endofgame', false, PARAM_BOOL); + $pos = optional_param('pos', 0, PARAM_INT); + $num = optional_param('num', 0, PARAM_INT); + $q = optional_param('q', 0, PARAM_INT); + $attemptid = optional_param('attemptid', 0, PARAM_INT); + $g = optional_param('g', '', PARAM_RAW); + $finishattempt = optional_param('finishattempt', '', PARAM_TEXT); + $answer = optional_param('answer', '', PARAM_TEXT); + $continue = false; + +/// Print the main part of the page + switch( $action) + { + case 'crosscheck': + $attempt = game_getattempt( $game, $detail); + $g = game_cross_unpackpuzzle( $g); + game_cross_continue( $id, $game, $attempt, $detail, $g, $finishattempt, $context); + break; + case 'crossprint': + $attempt = game_getattempt( $game, $detail); + game_cross_play( $id, $game, $attempt, $detail, '', true, false, false, true, $context); + break; + case 'sudokucheck': //the student tries to answer a question + $attempt = game_getattempt( $game, $detail); + game_sudoku_check_questions( $id, $game, $attempt, $detail, $finishattempt, $course, $context); + $continue = true; + break; + case 'sudokucheckg': //the student tries to guess a glossaryenry + $attempt = game_getattempt( $game, $detail); + $endofgame = array_key_exists( 'endofgame', $_GET); + $continue = game_sudoku_check_glossaryentries( $id, $game, $attempt, $detail, $endofgame, $course); + $continue = true; + break; + case 'sudokucheckn': //the user tries to guess a number + $attempt = game_getattempt( $game, $detail); + game_sudoku_check_number( $id, $game, $attempt, $detail, $pos, $num, $context); + $continue = false; + break; + case 'cryptexcheck': //the user tries to guess a question + $attempt = game_getattempt( $game, $detail); + game_cryptex_check( $id, $game, $attempt, $detail, $q, $answer, $context); + break; + case 'bookquizcheck': //the student tries to answer a question + $attempt = game_getattempt( $game, $detail); + game_bookquiz_check_questions( $id, $game, $attempt, $detail, $context); + break; + case 'snakescheck': //the student tries to answer a question + $attempt = game_getattempt( $game, $detail); + game_snakes_check_questions( $id, $game, $attempt, $detail, $context); + break; + case 'snakescheckg': //the student tries to answer a question from glossary + $attempt = game_getattempt( $game, $detail); + game_snakes_check_glossary( $id, $game, $attempt, $detail, $context); + break; + case 'hiddenpicturecheck': //the student tries to answer a question + $attempt = game_getattempt( $game, $detail); + $continue = game_hiddenpicture_check_questions( $id, $game, $attempt, $detail, $finishattempt, $context); + break; + case 'hiddenpicturecheckg': //the student tries to guess a glossaryenry + $attempt = game_getattempt( $game, $detail); + game_hiddenpicture_check_mainquestion( $id, $game, $attempt, $detail, $endofgame, $context); + break; + default: + $continue = true; + break; + } + if( $continue){ + game_create( $game, $id, $forcenew, $course, $context); + } +/// Finish the page + echo $OUTPUT->footer(); + } + + + function game_create( $game, $id, $forcenew, $course, $context) + { + global $USER, $CFG, $DB; + + $attempt = game_getattempt( $game, $detail); + $chapterid = optional_param('chapterid', 0, PARAM_INT); + $newletter = optional_param('newletter', '', PARAM_ALPHA); + $action2 = optional_param('action2', '', PARAM_ALPHA); + + switch( $game->gamekind) + { + case 'cross': + game_cross_continue( $id, $game, $attempt, $detail, '', $forcenew, $context); + break; + case 'hangman': + game_hangman_continue( $id, $game, $attempt, $detail, $newletter, $action2, $context); + break; + case 'millionaire': + game_millionaire_continue( $id, $game, $attempt, $detail, $context); + break; + case 'bookquiz': + game_bookquiz_continue( $id, $game, $attempt, $detail, $chapterid, $context); + break; + case 'sudoku': + game_sudoku_continue( $id, $game, $attempt, $detail, '', $context); + break; + case 'cryptex': + game_cryptex_continue( $id, $game, $attempt, $detail, $forcenew, $context); + break; + case 'snakes': + game_snakes_continue( $id, $game, $attempt, $detail, $context); + break; + case 'hiddenpicture': + game_hiddenpicture_continue( $id, $game, $attempt, $detail, $context); + break; + default: + print_error( "Game {$game->gamekind} not found"); + break; + } + } + +function game_cross_unpackpuzzle( $g) +{ + $ret = ""; + $len = textlib::strlen( $g); + while( $len) + { + for( $i=0; $i < $len; $i++) + { + $c = textlib::substr( $g, $i, 1); + if( $c >= '1' and $c <= '9'){ + if( $i > 0){ + //found escape character + if( textlib::substr( $g, $i-1, 1) == '/'){ + $g = textlib::substr( $g, 0, $i-1).textlib::substr( $g, $i); + $i--; + $len--; + continue; + } + } + break; + } + } + + if( $i < $len){ + //found the start of a number + for( $j=$i+1; $j < $len; $j++) + { + $c = textlib::substr( $g, $j, 1); + if( $c < '0' or $c > '9'){ + break; + } + } + $count = textlib::substr( $g, $i, $j-$i); + $ret .= textlib::substr( $g, 0, $i) . str_repeat( '_', $count); + + $g = textlib::substr( $g, $j); + $len = textlib::strlen( $g); + + }else + { + $ret .= $g; + break; + } + } + + return $ret; +} diff --git a/backup/moodle2/backup_game_activity_task.class.php b/backup/moodle2/backup_game_activity_task.class.php new file mode 100644 index 0000000..05e8729 --- /dev/null +++ b/backup/moodle2/backup_game_activity_task.class.php @@ -0,0 +1,70 @@ +. + +/** + * @package mod_game + * @subpackage backup-moodle2 + * class backup_game_activity_task + * @author + * @version $Id: backup_game_activity_task.class.php,v 1.2 2012/07/25 11:16:04 bdaloukas Exp $ + * @package game + **/ + +require_once($CFG->dirroot . '/mod/game/backup/moodle2/backup_game_stepslib.php'); // Because it exists (must) +require_once($CFG->dirroot . '/mod/game/backup/moodle2/backup_game_settingslib.php'); // Because it exists (optional) + +/** + * game backup task that provides all the settings and steps to perform one + * complete backup of the activity + */ +class backup_game_activity_task extends backup_activity_task { + + /** + * Define (add) particular settings this activity can have + */ + protected function define_my_settings() { + // No particular settings for this activity + } + + /** + * Define (add) particular steps this activity can have + */ + protected function define_my_steps() { + // Game only has one structure step + $this->add_step(new backup_game_activity_structure_step('game_structure', 'game.xml')); + } + + /** + * Code the transformations to perform in the activity in + * order to get transportable (encoded) links + */ + static public function encode_content_links($content) { + global $CFG; + + $base = preg_quote($CFG->wwwroot,"/"); + + // Link to the list of gamess + $search="/(".$base."\/mod\/game\/index.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@GAMEINDEX*$2@$', $content); + + // Link to game view by moduleid + $search="/(".$base."\/mod\/game\/view.php\?id\=)([0-9]+)/"; + $content= preg_replace($search, '$@GAMEVIEWBYID*$2@$', $content); + + return $content; + } +} diff --git a/backup/moodle2/backup_game_settingslib.php b/backup/moodle2/backup_game_settingslib.php new file mode 100644 index 0000000..ab78ff4 --- /dev/null +++ b/backup/moodle2/backup_game_settingslib.php @@ -0,0 +1,27 @@ +. + +/** + * @package moodlecore + * @subpackage backup-moodle2 + * @copyright 2010 onwards YOUR_NAME_GOES_HERE {@link YOUR_URL_GOES_HERE} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + + // This activity has not particular settings but the inherited from the generic + // backup_activity_task so here there isn't any class definition, like the ones + // existing in /backup/moodle2/backup_settingslib.php (activities section) diff --git a/backup/moodle2/backup_game_stepslib.php b/backup/moodle2/backup_game_stepslib.php new file mode 100644 index 0000000..fb26b80 --- /dev/null +++ b/backup/moodle2/backup_game_stepslib.php @@ -0,0 +1,214 @@ +. + +/** + * @package mod_game + * @subpackage backup-moodle2 + * @author bdaloukas + * @version $Id: backup_game_stepslib.php,v 1.5 2012/07/25 11:16:04 bdaloukas Exp $ + */ + +/** + * Define all the backup steps that will be used by the backup_game_activity_task + */ + +/** + * Define the complete game structure for backup, with file and id annotations + */ +class backup_game_activity_structure_step extends backup_activity_structure_step { + + protected function define_structure() { + + // To know if we are including userinfo + $userinfo = $this->get_setting_value('userinfo'); + + // Define each element separated + $game = new backup_nested_element('game', array('id'), array( + 'name', 'sourcemodule', 'timeopen', 'timeclose', 'quizid', + 'glossaryid', 'glossarycategoryid', 'questioncategoryid', 'bookid', + 'gamekind', 'param1', 'param2', 'param3', + 'param4', 'param5', 'param6', 'param7', 'param8', 'param9', + 'shuffle', 'timemodified', 'toptext', 'bottomtext', + 'grademethod', 'grade', 'decimalpoints', 'popup', + 'review', 'attempts', 'glossaryid2', 'glossarycategoryid2', + 'language', 'subcategories' + )); + + $exporthtmls = new backup_nested_element('game_export_htmls'); + $exporthtml = new backup_nested_element('game_export_html', array('id'), array( + 'filename', 'title', 'checkbutton', 'printbutton', 'inputsize', 'maxpicturewidth', 'maxpictureheight')); + + $exportjavames = new backup_nested_element('game_export_javames'); + $exportjavame = new backup_nested_element('game_export_javame', array('id'), array( + 'filename', 'icon', 'createdby', 'vendor', 'name', 'description', 'version', 'maxpicturewidth', 'maxpictureheight')); + + $grades = new backup_nested_element('game_grades'); + $grade = new backup_nested_element('game_grade', array('id'), array( + 'userid', 'score', 'timemodified')); + + $repetitions = new backup_nested_element('game_repetitions'); + $repetition = new backup_nested_element('game_repetition', array('id'), array( + 'userid', 'questionid', 'glossaryentryid', 'repetitions')); + + $attempts = new backup_nested_element('game_attempts'); + $attempt = new backup_nested_element('game_attempt', array('id'), array( + 'userid', 'timestart','timefinish', 'timelastattempt', 'lastip', + 'lastremotehost', 'preview', 'attempt','score', 'attempts', 'language')); + + $querys = new backup_nested_element('game_queries'); + $query = new backup_nested_element('game_query', array('id'), array( + 'gamekind', 'userid','sourcemodule', 'questionid', 'glossaryentryid', + 'questiontext', 'score', 'timelastattempt','studentanswer', 'col', 'row', + 'horizontal', 'answertext', 'correct', 'attachment', 'answerid', 'tries')); + + $bookquizs = new backup_nested_element('game_bookquizs'); + $bookquiz = new backup_nested_element('game_bookquiz', array('id'), array('lastchapterid')); + + $bookquiz_chapters = new backup_nested_element('game_bookquiz_chapters'); + $bookquiz_chapter = new backup_nested_element('game_bookquiz_chapter', array('id'), array( 'chapterid')); + + $bookquiz_questions = new backup_nested_element('game_bookquiz_questions'); + $bookquiz_question = new backup_nested_element('game_bookquiz_question', array('id'), array( + 'chapterid', 'questioncategoryid')); + + $crosss = new backup_nested_element('game_crosss'); + $cross = new backup_nested_element('game_cross', array('id'), array( + 'cols', 'rows', 'words', 'wordsall', 'createscore', 'createtries', + 'createtimelimit', 'createconnectors', 'createfilleds', 'createspaces', 'triesplay')); + + $cryptexs = new backup_nested_element('game_cryptexs'); + $cryptex = new backup_nested_element('game_cryptex', array('id'), array('letters')); + + $hangmans = new backup_nested_element('game_hangmans'); + $hangman = new backup_nested_element('game_hangman', array('id'), array( + 'queryid', 'letters', 'allletters', 'try', 'maxtries', 'finishedword', + 'corrects', 'iscorrect')); + + $hiddenpictures = new backup_nested_element('game_hiddenpictures'); + $hiddenpicture = new backup_nested_element('game_hiddenpicture', array('id'), array('correct', 'wrong', 'found')); + + $millionaires = new backup_nested_element('game_millionaires'); + $millionaire = new backup_nested_element('game_millionaire', array('id'), array('queryid', 'state', 'level')); + + $snakes = new backup_nested_element('game_snakes'); + $snake = new backup_nested_element('game_snake', array('id'), array('snakesdatabaseid', 'position', 'queryid', 'dice')); + + $sudokus = new backup_nested_element('game_sudokus'); + $sudoku = new backup_nested_element('game_sudoku', array('id'), array('level', 'data', 'opened', 'guess')); + + // Build the tree + $game->add_child($bookquiz_questions); + $bookquiz_questions->add_child($bookquiz_question); + + $game->add_child( $exporthtmls); + $exporthtmls->add_child( $exporthtml); + + $game->add_child( $exportjavames); + $exportjavames->add_child( $exportjavame); + + $game->add_child( $grades); + $grades->add_child( $grade); + + $game->add_child( $repetitions); + $repetitions->add_child( $repetition); + + // All these source definitions only happen if we are including user info + if ($userinfo) { + $game->add_child( $attempts); + $attempts->add_child( $attempt); + + $attempts->add_child( $querys); + $querys->add_child( $query); + + $attempts->add_child( $bookquizs); + $bookquizs->add_child( $bookquiz); + + $game->add_child($bookquiz_chapters); + $bookquiz_chapters->add_child($bookquiz_chapter); + + $attempts->add_child( $crosss); + $crosss->add_child( $cross); + + $attempts->add_child( $cryptexs); + $cryptexs->add_child( $cryptex); + + $attempts->add_child( $hangmans); + $hangmans->add_child( $hangman); + + $attempts->add_child( $hiddenpictures); + $hiddenpictures->add_child( $hiddenpicture); + + $attempts->add_child( $millionaires); + $millionaires->add_child( $millionaire); + + $attempts->add_child( $snakes); + $snakes->add_child( $snake); + + $attempts->add_child( $sudokus); + $sudokus->add_child( $sudoku); + } + + // Define sources + $game->set_source_table('game', array('id' => backup::VAR_ACTIVITYID)); + $bookquiz_question->set_source_table('game_bookquiz_questions', array('gameid' => backup::VAR_ACTIVITYID)); + $exporthtml->set_source_table('game_export_html', array('id' => backup::VAR_ACTIVITYID)); + $exportjavame->set_source_table('game_export_javame', array('id' => backup::VAR_ACTIVITYID)); + + // All the rest of elements only happen if we are including user info + if ($userinfo) { + $grade->set_source_table('game_grades', array('gameid' => backup::VAR_ACTIVITYID)); + $repetition->set_source_table('game_repetitions', array('gameid' => backup::VAR_ACTIVITYID)); + + $attempt->set_source_table('game_attempts', array( 'gameid' => backup::VAR_ACTIVITYID)); + $attempt->set_source_table('game_queries', array( 'attemptid' => backup::VAR_PARENTID)); + + $bookquiz->set_source_table('game_bookquiz', array( 'id' => backup::VAR_ACTIVITYID)); + $bookquiz_chapter->set_source_table('game_bookquiz_chapters', array( 'id' => backup::VAR_PARENTID)); + + $cross->set_source_table('game_cross', array( 'id' => backup::VAR_PARENTID)); + $cryptex->set_source_table('game_cryptex', array( 'id' => backup::VAR_PARENTID)); + $hangman->set_source_table('game_hangman', array( 'id' => backup::VAR_PARENTID)); + $hiddenpicture->set_source_table('game_hiddenpicture', array( 'id' => backup::VAR_PARENTID)); + $millionaire->set_source_table('game_millionaire', array( 'id' => backup::VAR_PARENTID)); + $snake->set_source_table('game_snakes', array( 'id' => backup::VAR_PARENTID)); + $sudoku->set_source_table('game_sudoku', array( 'id' => backup::VAR_PARENTID)); + } + // Define id annotations + $attempt->annotate_ids('user', 'userid'); + $grade->annotate_ids('user', 'userid'); + $repetition->annotate_ids('user', 'userid'); + $repetition->annotate_ids('question', 'questionid'); + $repetition->annotate_ids('glossary_entry', 'glossaryentryid'); + $query->annotate_ids('user', 'userid'); + $query->annotate_ids('question', 'questionid'); + $query->annotate_ids('glossary_enrty', 'glossaryentryid'); + $query->annotate_ids('question_answer', 'answerid'); + + $bookquiz_question->annotate_ids('book_chapter', 'chapterid'); + $bookquiz_question->annotate_ids('question_category', 'questioncategoryid'); + $bookquiz_chapter->annotate_ids('book_chapter', 'chapterid'); + $hangman->annotate_ids('game_query', 'queryid'); + $millionaire->annotate_ids('game_query', 'queryid'); + + // Define file annotations + $game->annotate_files('mod_game', 'snakes_file', null); // This file area hasn't itemid + $game->annotate_files('mod_game', 'snakes_board', null); // This file area hasn't itemid + + // Return the root element (game), wrapped into standard activity structure + return $this->prepare_activity_structure( $game); + } +} diff --git a/backup/moodle2/restore_game_activity_task.class.php b/backup/moodle2/restore_game_activity_task.class.php new file mode 100644 index 0000000..81b9134 --- /dev/null +++ b/backup/moodle2/restore_game_activity_task.class.php @@ -0,0 +1,233 @@ +. + +/** + * @package mod_game + * @subpackage backup-moodle2 + * @author bdaloukas + * @version $Id: restore_game_activity_task.class.php,v 1.3 2012/07/25 11:16:04 bdaloukas Exp $ + */ + +defined('MOODLE_INTERNAL') || die(); +require_once($CFG->dirroot . '/mod/game/backup/moodle2/restore_game_stepslib.php'); // Because it exists (must) + +/** + * game restore task that provides all the settings and steps to perform one + * complete restore of the activity + */ +class restore_game_activity_task extends restore_activity_task { + + /** + * Define (add) particular settings this activity can have + */ + protected function define_my_settings() { + // No particular settings for this activity + } + + /** + * Define (add) particular steps this activity can have + */ + protected function define_my_steps() { + // Game only has one structure step + $this->add_step(new restore_game_activity_structure_step('game_structure', 'game.xml')); + } + + /** + * Define the contents in the activity that must be + * processed by the link decoder + */ + static public function define_decode_contents() { + $contents = array(); + + $contents[] = new restore_decode_content('game', array('toptext'), 'game'); + $contents[] = new restore_decode_content('game', array('bottomtext'), 'game'); + + return $contents; + } + + /** + * Define the decoding rules for links belonging + * to the activity to be executed by the link decoder + */ + static public function define_decode_rules() { + $rules = array(); + + return $rules; + } + + /** + * Define the restore log rules that will be applied + * by the {@link restore_logs_processor} when restoring + * game logs. It must return one array + * of {@link restore_log_rule} objects + */ + static public function define_restore_log_rules() { + $rules = array(); + + $rules[] = new restore_log_rule('game', 'add', 'view.php?id={course_module}', '{game}'); + $rules[] = new restore_log_rule('game', 'update', 'view.php?id={course_module}', '{game}'); + $rules[] = new restore_log_rule('game', 'view', 'view.php?id={course_module}', '{game}'); + $rules[] = new restore_log_rule('game', 'choose', 'view.php?id={course_module}', '{game}'); + $rules[] = new restore_log_rule('game', 'choose again', 'view.php?id={course_module}', '{game}'); + $rules[] = new restore_log_rule('game', 'report', 'report.php?id={course_module}', '{game}'); + + return $rules; + } + + /** + * Define the restore log rules that will be applied + * by the {@link restore_logs_processor} when restoring + * course logs. It must return one array + * of {@link restore_log_rule} objects + * + * Note this rules are applied when restoring course logs + * by the restore final task, but are defined here at + * activity level. All them are rules not linked to any module instance (cmid = 0) + */ + static public function define_restore_log_rules_for_course() { + $rules = array(); + + // Fix old wrong uses (missing extension) + $rules[] = new restore_log_rule('game', 'view all', 'index?id={course}', null, + null, null, 'index.php?id={course}'); + $rules[] = new restore_log_rule('game', 'view all', 'index.php?id={course}', null); + + return $rules; + } + + public function after_restore() { + // Do something at end of restore + global $DB; + + // Get the blockid + $gameid = $this->get_activityid(); + + // Extract Game configdata and update it to point to the new glossary + $rec = $DB->get_record_select( 'game', 'id='.$gameid, null, + 'id,quizid,glossaryid,glossarycategoryid,questioncategoryid,bookid,glossaryid2,glossarycategoryid2'); + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'quiz', $rec->quizid); + if( $ret != false) + $rec->quizid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary', $rec->glossaryid); + if( $ret != false) + $rec->glossaryid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary_categories', $rec->glossarycategoryid); + if( $ret != false) + $rec->glossarycategoryid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'question_categories', $rec->questioncategoryid); + if( $ret != false) + $rec->questioncategoryid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'book', $rec->bookid); + if( $ret != false) + $rec->bookid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary', $rec->glossaryid2); + if( $ret != false) + $rec->glossaryid2 = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary_categories', $rec->glossarycategoryid); + if( $ret != false) + $rec->glossarycategoryid = $ret->newitemid; + + $DB->update_record( 'game', $rec); + + //game_repetitions + $recs = $DB->get_records_select( 'game_repetitions', 'gameid='.$gameid, null, '', + 'id,questionid,glossaryentryid'); + if( $recs != false){ + foreach( $recs as $rec){ + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'question', $rec->questionid); + if( $ret != false) + $rec->questionid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary_entry', $rec->glossaryentryid); + if( $ret != false) + $rec->glossaryentryid = $ret->newitemid; + + $DB->update_record( 'game_repetitions', $rec); + } + } + + //game_queries + $recs = $DB->get_records_select( 'game_queries', 'gameid='.$gameid, null, '', + 'id,questionid,glossaryentryid,answerid'); + if( $recs != false){ + foreach( $recs as $rec){ + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'question', $rec->questionid); + if( $ret != false) + $rec->questionid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'glossary_entry', $rec->glossaryentryid); + if( $ret != false) + $rec->glossaryentryid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'question_answers', $rec->glossaryentryid); + if( $ret != false) + $rec->answerid = $ret->newitemid; + + $DB->update_record( 'game_queries', $rec); + } + } + + //bookquiz + $recs = $DB->get_records_select( 'game_bookquiz', 'id='.$gameid, null, '', 'id,lastchapterid'); + if( $recs != false){ + foreach( $recs as $rec){ + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'book_chapters', $rec->lastchapterid); + if( $ret != false) + $rec->lastchapterid = $ret->newitemid; + + $DB->update_record( 'game_bookquiz', $rec); + } + } + + //bookquiz_chapters + $sql = "SELECT gbc.* FROM {game_bookquiz_chapters} gbc LEFT JOIN {game_attempts} a ON gbc.attemptid = a.id WHERE a.gameid=$gameid"; + $recs = $DB->get_records_sql( $sql); + if( $recs != false){ + foreach( $recs as $rec){ + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'book_chapters', $rec->chapterid); + if( $ret != false) + $rec->chapterid = $ret->newitemid; + + $DB->update_record( 'game_bookquiz_chapter', $rec); + } + } + + //bookquiz_questions + $recs = $DB->get_records_select( 'game_bookquiz_questions', 'id='.$gameid, null, '', 'id,chapterid,questioncategoryid'); + if( $recs != false){ + foreach( $recs as $rec){ + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'book_chapters', $rec->chapterid); + if( $ret != false) + $rec->chapterid = $ret->newitemid; + + $ret = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'book_chapters', $rec->questioncategoryid); + if( $ret != false) + $rec->questioncategoryid = $ret->newitemid; + + $DB->update_record( 'game_bookquiz_questions', $rec); + } + } + + } +} diff --git a/backup/moodle2/restore_game_stepslib.php b/backup/moodle2/restore_game_stepslib.php new file mode 100644 index 0000000..08d8f7d --- /dev/null +++ b/backup/moodle2/restore_game_stepslib.php @@ -0,0 +1,267 @@ +. + +/** + * @package mod_game + * @subpackage backup-moodle2 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Define all the restore steps that will be used by the restore_game_activity_task + */ + +/** + * Structure step to restore one game activity + */ +class restore_game_activity_structure_step extends restore_activity_structure_step { + + protected function define_structure() { + + $paths = array(); + $userinfo = $this->get_setting_value('userinfo'); + + $paths[] = new restore_path_element('game', '/activity/game'); + $paths[] = new restore_path_element('game_export_html', '/activity/game/game_export_htmls/game_export_html'); + $paths[] = new restore_path_element('game_export_javame', '/activity/game/game_export_htmls/game_export_javame'); + $paths[] = new restore_path_element('game_bookquiz_question', '/activity/game/game_bookquiz_questions/game_bookquiz_question'); + if ($userinfo) { + $paths[] = new restore_path_element('game_grade', '/activity/game/game_grades/game_grade'); + $paths[] = new restore_path_element('game_repetition', '/activity/game/game_repetiotions/game_repetition'); + $paths[] = new restore_path_element('game_attempt', '/activity/game/game_attempts/game_attempt'); + $paths[] = new restore_path_element('game_query', '/activity/game/game_querys/game_query'); + $paths[] = new restore_path_element('game_bookquiz', '/activity/game/game_bookquizs/game_bookquiz'); + $paths[] = new restore_path_element('game_bookquiz_chapter', '/activity/game/game_bookquiz_chapters/game_bookquiz_chapter'); + $paths[] = new restore_path_element('game_cross', '/activity/game/game_crosss/game_cross'); + $paths[] = new restore_path_element('game_cryptex', '/activity/game/game_cryptexs/game_cryptex'); + $paths[] = new restore_path_element('game_hangman', '/activity/game/game_hangmans/game_hangman'); + $paths[] = new restore_path_element('game_hiddenpicture', '/activity/game/game_hiddenpictures/game_hiddenpicture'); + $paths[] = new restore_path_element('game_millionaire', '/activity/game/game_millionaires/game_millionaire'); + $paths[] = new restore_path_element('game_snake', '/activity/game/game_snakes/game_snake'); + $paths[] = new restore_path_element('game_sudoku', '/activity/game/game_sudokus/game_sudoku'); + } + + // Return the paths wrapped into standard activity structure + return $this->prepare_activity_structure($paths); + } + + protected function process_game($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + $data->course = $this->get_courseid(); + $data->timemodified = $this->apply_date_offset($data->timemodified); + + // insert the game record + $newitemid = $DB->insert_record('game', $data); + + // immediately after inserting "activity" record, call this + $this->apply_activity_instance($newitemid); + } + + protected function process_game_export_html($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_export_html', $data); + } + + protected function process_game_export_javame($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_export_javame', $data); + } + + protected function process_game_grade($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + + $data->gameid = $this->get_new_parentid('game'); + $data->userid = $this->get_mappingid('user', $data->userid); + + $DB->insert_record('game_grades', $data); + } + + protected function process_game_repetition($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + + $data->gameid = $this->get_new_parentid('game'); + $data->userid = $this->get_mappingid('user', $data->userid); + + $DB->insert_record('game_repetitions', $data); + } + + protected function process_game_attempt($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + + $data->gameid = $this->get_new_parentid('game'); + $data->userid = $this->get_mappingid('user', $data->userid); + + if( !isset( $data->timestart)) + $data->timestart = 0; + if( !isset( $data->timefinish)) + $data->timefinish = 0; + if( !isset( $data->timelastattempt)) + $data->timelastattempt = 0; + + $data->timestart = $this->apply_date_offset($data->timestart); + $data->timefinish = $this->apply_date_offset($data->timefinish); + $data->timelastattempt = $this->apply_date_offset($data->timelastattempt); + + $newitemid = $DB->insert_record('game_attempts', $data); + $this->set_mapping('game_attempt', $oldid, $newitemid); + } + + protected function process_game_query($data) { + global $DB; + + $data = (object)$data; + $oldid = $data->id; + + $data->gameid = $this->get_new_parentid('game'); + $data->attemptid = get_mappingid('game_attempt', $data->attemptid); + $data->userid = $this->get_mappingid('user', $data->userid); + + $newitemid = $DB->insert_record('game_queries', $data); + $this->set_mapping('game_query', $oldid, $newitemid); + } + + protected function process_game_bookquiz($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_bookquiz', $data); + } + + protected function process_game_bookquiz_chapter($data) { + global $DB; + + $data = (object)$data; + + $data->gameid = $this->get_new_parentid('game'); + + $DB->insert_record('game_bookquiz_chapters', $data); + } + + protected function process_game_bookquiz_question($data) { + global $DB; + + $data = (object)$data; + + $data->gameid = $this->get_new_parentid('game'); + + $DB->insert_record('game_bookquiz_questions', $data); + } + + protected function process_game_cross($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_cross', $data); + } + + protected function process_game_cryptex($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_cryptex', $data); + } + + protected function process_game_hangman($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + $data->queryid = $this->get_mappingid('game_query', $data->queryid); + + $DB->insert_record('game_hangman', $data); + } + + protected function process_game_hiddenpicture($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_hiddenpicture', $data); + } + + protected function process_game_millionaire($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + $data->queryid = $this->get_mappingid('game_query', $data->queryid); + + $DB->insert_record('game_millionaire', $data); + } + + protected function process_game_snake($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + $data->queryid = $this->get_mappingid('game_query', $data->queryid); + + $DB->insert_record('game_snakes', $data); + } + + protected function process_game_sudoku($data) { + global $DB; + + $data = (object)$data; + + $data->id = $this->get_new_parentid('game'); + + $DB->insert_record('game_sudoku', $data); + } + + protected function after_execute() { + // Add Game related files, no need to match by itemname (just internally handled context) + $this->add_related_files('mod_game', 'snakes_file', null); + $this->add_related_files('mod_game', 'snakes_board', null); + } +} diff --git a/bookquiz/importodt.php b/bookquiz/importodt.php new file mode 100644 index 0000000..e2907fa --- /dev/null +++ b/bookquiz/importodt.php @@ -0,0 +1,866 @@ +bookid; + if( $bookid == 0){ + print_error( get_string( 'bookquiz_not_select_book', 'game')); + } + + if ($form = data_submitted()) + { /// Filename + + if (empty($_FILES['newfile'])) + { // file was just uploaded + notify(get_string("uploadproblem") ); + } + + if ((!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0)) + { + notify(get_string("uploadnofilefound") ); + } else + { // Valid file is found + if ( readdata( $course->id, 'game', $dirtemp, $r_levels, $r_titles, $r_texts, $dirfordelete)) + { // first try to reall all of the data in + if( $overwrite){ + game_bookquiz_deletebook( $course->id, $bookid); + } + $pageobjects = extract_data( $course->id, 'book', $bookid, $dirtemp, $subchapter, $r_levels, $r_titles, $r_texts); // parse all the html files into objects + clean_temp( $dirfordelete); // all done with files so dump em + + $objects = game_bookquiz_create_objects( $pageobjects, $bookid); // function to preps the data to be sent to DB + + if( !game_bookquiz_save_objects($objects)) + { // sends it to DB + print_error('could not save'); + } + }else + print_error('could not get data'); + + print_continue("{$CFG->wwwroot}/mod/game/view.php?id=$cm->id"); + echo $OUTPUT->footer($course); + exit; + } + } + + /// Print upload form + + print_heading_with_help( get_string( "bookquiz_import_odt", "game"), "importodt", "game"); + + echo $OUTPUT->box_start('center'); + ?> +
+ + + + + + + + + + + + +
+ : + + +
+ : + +
+
  + " /> +
+
+ box_end(); + + echo $OUTPUT->footer($course); + +// START OF FUNCTIONS + +//the r_basedir variable contains the directory where the temp files are +//At the end the directory must be deleted +function readdata( $courseid, $modname, &$r_basedir, &$r_levels, &$r_titles, &$r_texts, &$dirfordelete) +{ +// this function expects a odt file to be uploaded. Then it parses +// the content.xml to determine. +// Then copies the image + global $CFG; + + // create a random upload directory in temp + $newdir = $CFG->dataroot."/temp/$modname"; + if (!file_exists( $newdir)) + mkdir( $newdir); + + $i = 1; + srand((double)microtime()*1000000); + while(true) + { + $r_basedir = "$modname/$i-".rand(0,10000); + $newdir = $CFG->dataroot.'/temp/'.$r_basedir; + if (!file_exists( $newdir)) + { + mkdir( $newdir); + $newdir .= '/'; + break; + } + $i++; + } + $dirfordelete = $r_basedir; + $r_basedir .= '/'; + + $zipfile = $_FILES["newfile"]["name"]; + $tempzipfile = $_FILES["newfile"]["tmp_name"]; + + // create our directory + $path_parts = pathinfo($zipfile); + $dirname = substr($zipfile, 0, strpos($zipfile, '.'.$path_parts['extension'])); // take off the extension + if (!file_exists($newdir.$dirname)){ + mkdir($newdir.$dirname); + } + + // move our uploaded file to temp/game + move_uploaded_file( $tempzipfile, $newdir.$zipfile); + + //if the file ends with .lnk then use .odt instead + if( substr( $zipfile, -4) == ".lnk") + $zipfile = substr( $zipfile, 0, -4).".odt"; + + // unzip it! + unzip_file ( $newdir.$zipfile, $newdir.$dirname, false); + + $r_basedir .= $dirname; // update the base + $newdir .= $dirname; + + // this is the file where we get the names of the files for the slides (in the correct order too) + $content = $newdir.'/content.xml'; + $data = file_get_contents( $content); + + $content = $newdir.'/styles.xml'; + if (file_exists( $content)){ + $datastyle = file_get_contents( $content); + }else + { + $datastyle = ''; + } + + oo_game_convert_ver2( $data, $datastyle, $r_levels, $r_titles, $r_texts); + + return true; +} + + + //////////////////////// + function oo_game_convert_ver2( $data, $datastyle, &$r_levels, &$r_titles, &$r_texts) + { + $r_levels = array(); + $r_titles = array(); + $r_texts = array(); + + // we have tables, encode it here so all ', '', $data); + $data = preg_replace('##es', "base64_encode('\\1')", $data); + } + + $styles = array(); + game_bookquiz_convert_ver2_computestyles( $datastyle, $styles, true); + game_bookquiz_convert_ver2_computestyles( $data, $styles, false); + + game_bookquiz_splitsections($data, $positions, $inputs, $titles, $titleframes, $texts); + for( $i=0; $i < count( $positions); $i++) + { + preg_match_all( "#text:outline-level=\"([0-9]*)\"#es", $inputs[ $i], $matches); + $levels = $matches[ 1]; + if( count( $levels) > 0){ + $level = $levels[ 0]; + }else + { + $level = 0; + } + + $r_levels[] = $level; + $r_titles[] = strip_tags( $titles[ $i]); + + $textframe = game_bookquiz_convert($titleframes[ $i], $styles, $images); + $text = game_bookquiz_convert($texts[ $i], $styles, $images); + if( $textframe != ''){ + $text = $textframe.'
'.$text; + } + + echo "
".$titles[ $i]."
".$text."\r\n\r\n\r\n\r\n"; + + $r_texts[] = $text; + } + } + +function extract_data( $courseid, $modname, $id, $basedir, $subchapter, $levels, $titles, $texts) +{ + global $CFG; + global $matches; + + $dirtemp = $CFG->dataroot.'/temp/'.$basedir; + + for($i=0; $i < count( $levels); $i++){ + echo $levels[ $i]." ".$titles[ $i]."
"; + } + + $extractedpages = array(); + + // directory for images + make_mod_upload_directory( $courseid); // make sure moddata is made + make_upload_directory( $courseid.'/moddata/'.$modname, false); + make_upload_directory( $courseid.'/moddata/'.$modname."/".$id, false); // we store our images in a subfolder in here + + $imagedir = $CFG->dataroot.'/'.$courseid.'/moddata/'.$modname."/".$id; + + if ($CFG->slasharguments) + $imagelink = $CFG->wwwroot.'/file.php/'.$courseid.'/moddata/'.$modname."/".$id; + else + $imagelink = $CFG->wwwroot.'/file.php?file=/'.$courseid.'/moddata/'.$modname."/".$id; + + // try to make a unique subfolder to store the images + $i = 1; + while(true) + { + $newdir = $imagedir.'/'.$i; + if (!file_exists( $newdir)) + { + // ok doesnt exist so make the directory and update our paths + mkdir( $newdir); + $imagedir = $newdir; + $imagelink = $imagelink.'/'.$i; + break; + } + $i++; + } + + for( $i=0; $i < count( $titles); $i++) + { + // start building our page + $page = new stdClass; + $page->title = $titles[ $i]; + $page->content = $texts[ $i]; + //$page->source = $path_parts['basename']; // need for book only + $page->subchapter = ( $levels[ $i] >= 2); + + //check if the nexts are subchapters + for( $j=$i+1; $j < count( $titles); $j++){ + if( $levels[ $j] > 2){ + $page->content .= '
'.$titles[ $j].'
'.$texts[ $j]; + $i = $j; + continue; + } + break; + } + + preg_match_all('#="Pictures/([a-z .A-Z_0-9]*)"#es', $page->content, $imgs); + + foreach ($imgs[1] as $img) + { + $src = $dirtemp.'/Pictures/'.$img; + $dest = $imagedir.'/'.$img; + rename( $src, $dest); + + $page->content = str_replace( "Pictures/$img", $imagelink."/".$img, $page->content); + } + + // add the page to the array; + $extractedpages[] = $page; + + } // end $pages foreach loop + + return $extractedpages; +} + +/** + Clean up the temp directory +*/ +function clean_temp( $base) +{ + global $CFG; + + // this function is broken, use it to clean up later + // should only clean up what we made as well because someone else could be importing ppt as well + $dir = $CFG->dataroot.'/temp/'.$base; + + remove_dir( $dir); + //game_full_rmdir( $dir); +} + + +/** + Creates objects an chapter object that is to be inserted into the database +*/ + +function game_bookquiz_create_objects( $pageobjects, $bookid) +{ + global $DB; + + $chapters = array(); + + $lastpagenum = $DB->get_field('book_chapters', 'MAX(pagenum) as num', array( 'bookid' => $bookid)); + + foreach ($pageobjects as $pageobject) + { + $chapter = new stdClass; + + // same for all chapters + $chapter->bookid = $bookid; + $chapter->pagenum = ++$lastpagenum; + $chapter->timecreated = time(); + $chapter->timemodified = time(); + $chapter->subchapter = 0; + + if ($pageobject->title == '') + $chapter->title = "Page $count"; // no title set so make a generic one + else + $chapter->title = addslashes($pageobject->title); + + $chapter->subchapter = $pageobject->subchapter; + + $content = str_replace("\n", '', $pageobject->content); + $content = str_replace("\r", '', $content); + $content = str_replace(' ', '', $content); // puts in returns? + $content = '

'.$content.'

'; + + $chapter->content = addslashes( $content); + + $chapters[] = $chapter; + } + + return $chapters; +} + +/** + Save the chapter objects to the database +*/ +function game_bookquiz_save_objects($chapters) +{ + global $DB; + + // nothing fancy, just save them all in order + foreach ($chapters as $chapter) + { + if (!$newid=$DB->insert_record('book_chapters', $chapter)) { + print_error('Could not insert to table book_chapters'); + } + } + + return true; +} + +//splits the data to +function game_bookquiz_splitsections($data, &$positions, &$inputs, &$titles, &$titleframes, &$texts) +{ + preg_match_all('#(.*?)#es', $data, $matches, PREG_OFFSET_CAPTURE); + + $in = $matches[ 1] ; + $title = $matches[ 2]; + + $positions = array(); + $inputs = array(); + $titles = array(); + + $oldposition = 0; + $oldlen = 0; + for($i=0; $i < count( $in); $i++) + { + $inputs[] = $in[ $i][ 0]; + + $newposition = $in[ $i][ 1]; + $positions[] = $newposition; + + $titlenet = $title[ $i][ 0]; + $titleframe = ''; + + //frames inside header + preg_match_all('#(.*?)#es', $titlenet, $titlematches, PREG_OFFSET_CAPTURE); + $frames = $titlematches[ 2]; + if( count( $frames) > 0){ + for($j=0; $j < count( $frames); $j++) + { + $titleframe .= $frames[ $j][ 0]; + $titlenet = substr( $titlenet, $frames[ $j][ 1] + strlen( $frames[ $j][ 0]) + 13); + } + } + + $titles[] = $titlenet; + $titleframes[] = $titleframe; + + if( $i > 0){ + $texts[] = substr( $data, $oldposition+$oldlen, $newposition - $oldposition - $oldlen); + } + + $oldlen = strlen( $title[ $i][ 0]) + strlen( $in[ $i][ 0]) + 10; + $oldposition = $newposition; + + } + $newposition = strlen( $data); + $texts[] = substr( $data, $oldposition+$oldlen, $newposition - $oldposition - $oldlen); +} + + function game_bookquiz_convert( $data, $styles, &$images) + { + $images = array(); + + // get data + preg_match_all('#(.*?)#es', $data, $text); + $originals = $text[ 0]; + $names = $text[ 1]; + $texts = $text[ 2]; + + for( $i=0; $i < count( $texts); $i++) + { + $name = $names[ $i]; + $text = $texts[ $i]; + + //repairs draw:frame + $pattern = "##es"; + preg_match_all( $pattern, $text, $matches); + if( count( $matches[ 1]) ){ + $new = game_bookquiz_convert_image( $matches, $styles, $images); + $data = str_replace( $originals[ $i], $new, $data); + }else IF($name == 'RKRK') + { + $new = game_bookquiz_convert_RKRK( $text); + $data = str_replace( $originals[ $i], $new, $data); + }else + { + $new = '

'.game_bookquiz_convert_text( $text, $styles).'

'; + $data = str_replace( $originals[ $i], $new, $data); + } + } + + // repairs text:span text:style-name + preg_match_all( '#(.*?)#es', $data, $text); + $originals = $text[ 0]; + $names = $text[ 1]; + $texts = $text[ 2]; + for( $i=0; $i < count( $texts); $i++) + { + $name = $names[ $i]; + $text = $texts[ $i]; + + $pattern = "##es"; + preg_match_all( $pattern, $text, $matches); + if( count( $matches[ 1]) ){ + $new = game_bookquiz_convert_image( $matches, $styles, $images); + $data = str_replace( $originals[ $i], $new, $data); + }else IF($name == 'RKRK') + { + $new = game_bookquiz_convert_RKRK( $text); + $data = str_replace( $originals[ $i], $new, $data); + }else + { + $new = "'.game_bookquiz_convert_text( $text, $styles).''; + $data = str_replace( $originals[ $i], $new, $data); + } + } + + // repairs text:a + preg_match_all( '#(.*?)#es', $data, $text); + $originals = $text[ 0]; + $hrefs = $text[ 2]; + $texts = $text[ 3]; + for( $i=0; $i < count( $texts); $i++) + { + $href = $hrefs[ $i]; + $text = $texts[ $i]; + + $new = "$text"; + $data = str_replace( $originals[ $i], $new, $data); + } + + //repair text:list + preg_match_all( '#(.*?)#es', $data, $text); + $originals = $text[ 0]; + $names = $text[ 1]; + $texts = $text[ 2]; + + for( $i=0; $i < count( $texts); $i++) + { + $new = '
    '.$texts[ $i].'
'; + $data = str_replace( $originals[ $i], $new, $data); + + //I have to repair the listitems + preg_match_all( '#(.*?)#es', $data, $listitems); + $originallistitems = $listitems[ 0]; + $items = $listitems[ 1]; + for( $j=0; $j < count( $items); $j++){ + $new = '
  • '.$items[ $j]; + $data = str_replace( $originallistitems[ $j], $new, $data); + + } + } + + $data = str_replace( '', '
    ', $data); + + + + return $data; + } + + function game_bookquiz_convert_text( $text, $styles) + { + $pattern = "#(.*?)#es"; + preg_match_all( $pattern, $text, $matches); + + $originals = $matches[ 0]; + $names = $matches[ 1]; + $spantexts = $matches[ 2]; + + for( $i=0; $i < count( $names); $i++) + { + $name = $names[ $i]; + $style = $styles[ $name]; + + $new = "".$spantexts[ $i].""; + $text = str_replace( $originals[ $i], $new, $text); + } + + return $text; + } + + function game_bookquiz_convert_image( $matches, $xmlstyles, &$images) + { + $ret = ''; + + $styles = $matches[ 1]; + $pictures = $matches[ 3]; + + for( $j=0; $j < count( $pictures); $j++){ + $style = $styles[ $j]; + + $ret .= '
    '; + $images[] = $pictures[$j]; + } + + return $ret; + } + + function game_bookquiz_convert_RKRK( $text) + { + $table = base64_decode($text); + $table = stripslashes($table); + $table = strtr($table, array('' => '', '' => '', '' => '', '' => '', '' => '', '' => '', '>' => ">\n", '' => '')); + + //preg_match_all('#table:name="([a-z A-Z_0-9]*)" table:style-name="([a-z A-Z_0-9]*)">#es', $table, $repl); + preg_match_all('#table:name="(.*?)" table:style-name="(.*?)">#es', $table, $repl); + foreach($repl[0] as $val) + { + //$table = str_replace($val, '
    ', $table); + $table = str_replace($val, '', $table); + } + //preg_match_all('##es', $table, $repl); + preg_match_all('##es', $table, $repl); + foreach($repl[0] as $key => $val) + { + $table = str_replace($val, '', $table); + } + preg_match_all('##es', $table, $repl); + foreach($repl[0] as $val) + { + $table = str_replace($val, '', $table); + } + //preg_match_all('##es', $table, $repl); + preg_match_all('##es', $table, $repl); + foreach($repl[0] as $val) + { + $table = str_replace($val, '
    ', $table); + } + //maybe there are a lot of pictures inside a table + preg_match_all('#xlink:href="Pictures/([a-z.A-Z_0-9]*)"#es', $table, $repl); + foreach( $repl[ 1] as $picture) + { + $table = str_replace('', '', $table); + } + if( strpos( $table,"
    ") === false) + $table .= "
    "; + + $ret = '
    '.$table.'
    '; + + return $ret; + } +/* + function game_bookquiz_oo_unzip($file, $dir) + { + unzip_file ( $file, $dir, false); + + $dir .= '/'; + if( file_exists( $dir.'content.xml')){ + $content = file_get_contents( $dir.'content.xml'); + }else + { + $content = ''; + } + + if( file_exists( $dir.'styles.xml')){ + $contentstyles = file_get_contents( $dir.'styles.xml'); + }else + { + $contentstyles = ''; + } + + $img = array(); + $handle = opendir($dir.'Pictures'); + while (false!==($item = readdir($handle))) { + if($item != '.' && $item != '..') { + if(!is_dir($dir.'/'.$item)) { + $img[ $item] = file_get_contents( $dir.'/'.$item); + }else{ + unlink($dir.'/'.$item); + } + } + } + } +*/ + function old_game_bookquiz_oo_unzip($file, $save, $dir) + { + IF($zip = game_zip_open($file)) + { + while ($zip_entry = game_zip_read($zip)) + { + $filename = game_zip_entry_name($zip_entry); + + IF($filename == 'content.xml' and game_zip_entry_open($zip, $zip_entry, "r")) + { + $content = game_zip_entry_read($zip_entry, game_zip_entry_filesize($zip_entry)); + game_zip_entry_close($zip_entry); + } + + IF( $filename == 'styles.xml' and game_zip_entry_open($zip, $zip_entry, "r")) + { + $contentstyles = game_zip_entry_read($zip_entry, game_zip_entry_filesize($zip_entry)); + game_zip_entry_close($zip_entry); + } + + IF(ereg('Pictures/', $filename) and !ereg('Object', $filename) and game_zip_entry_open($zip, $zip_entry, "r")) + { + $img[$filename] = game_zip_entry_read($zip_entry, game_zip_entry_filesize($zip_entry)); + game_zip_entry_close($zip_entry); + } + } + IF(isset($content)) + { + IF($save == false) + return array($content, $img); + else + { + file_put_contents("$dir/content.xml", $content); + IF(isset($contentstyles)){ + file_put_contents("$dir/styles.xml", $contentstyles); + } + + IF(is_array($img)) + { + IF(!is_dir("$dir/Pictures")) + mkdir( "$dir/Pictures"); + + foreach($img as $key => $val) + file_put_contents("$dir/$key", $val); + } + } + } + } + } + + function game_bookquiz_deletebook( $courseid, $bookid) + { + global $CFG; + + if( !delete_records( 'book_chapters', 'bookid', $bookid)){ + print_error( "Can't delete records from book_chapters bookid=$bookid"); + } + + game_full_rmdir( "$CFG->dataroot/$courseid/moddata/book/$bookid"); + + } + + function game_bookquiz_convert_ver2_computestyles( $data, &$styles, $isstyle) + { + preg_match_all('#(.*?)#es', $data, $style); + + $stylenames = $style[ 1]; + $styleinfos = $style[ 2]; + $styledatas = $style[ 3]; + for($i=0; $i < count( $stylenames); $i++){ + $name = $stylenames[ $i]; + + $change = false; + for(;;){ + $pos1 = strpos( $styledatas[ $i], 'style:parent-style-name'); + $pos2 = strpos( $styledatas[ $i], '/>'); + if( ($pos1 === false) or ($pos2 === false)){ + break; + } + if( $pos1 > $pos2){ + break; + } + //is a parent style + $s = substr( $styledatas[ $i], 0, $pos2+2); + game_bookquiz_convertstyle_parent( $s, $styles); + + $styledatas[ $i] = substr( $styledatas[ $i], $pos2 + 2); + $change = true; + } + if( $change){ + //Must to recompute name, styledatas, styleinfos + preg_match_all('#(.*?)#es', $data, $style); + $name = $style[ 1][ 0]; + $styleinfos[ $i] = $style[ 2][ 0]; + $styledatas[ $i] = $style[ 3][ 0]; + } + + $styles[ $name] = game_bookquiz_convertstyle( $styledatas[ $i], $styleinfos[ $i], $styles); + } + } + + function game_bookquiz_convertstyle_parent( $data, &$styles) + { + $styleitems = array(); + + preg_match_all( '#(.*?)style:name="(.*?)"(.*?)style:parent-style-name="(.*?)"(.*?)#es', $data, $infos); + $names = $infos[ 2]; + $parents = $infos[ 4]; + if( count( $parents)){ + if( array_key_exists( $parents[ 0], $styles)){ + //is a child style. Must to copy the properties of the parent style + $a = explode( ';', $styles[ $parents[ 0]]); + foreach( $a as $s){ + $pos = strpos( $s, ':'); + $key = substr( $s, 0, $pos); + $item = substr( $s, $pos + 1); + if( $item == ''){ + continue; + } + $styleitems[ $key] = $item; + } + } + $name = $names[ 0]; + } + + $style = ''; + foreach( $styleitems as $key => $item){ + $style .= ';'.$key.':'.$item; + } + $styles[ $name] = substr( $style, 1); + } + + function game_bookquiz_convertstyle( $data, $styleinfo, $styles) + { + $styleitems = array(); + + preg_match_all( '##es', $data, $infos); + $lines = $infos[ 1]; + if( count( $lines)){ + $line = $lines[ 0]; //print_object( $lines); + + if( $line != ''){ + game_bookquiz_convertstyle_paragraph( $line, $styleitems); + } + } + + preg_match_all( '##es', $data, $infos); + $lines = $infos[ 1]; + if( count( $lines)){ + $line = $lines[ 0]; + + if( $line != ''){ + game_bookquiz_convertstyle_textproperties( $line, $styleitems); + } + } + + if( count( $styleitems) == 0){ + return ''; + } + + $style = ''; + foreach( $styleitems as $key => $item){ + $style .= ';'.$key.':'.$item; + } + + return substr( $style, 1); + } + + function game_bookquiz_convertstyle_paragraph( $line, &$styleitems) + { + preg_match_all( '#(.*?)=(.*?) #es', $line.' ', $datas); + $data1 = $datas[ 1]; + $data2 = $datas[ 2]; + + $ret = ''; + for( $i=0; $i < count( $data1); $i++){ + $eq1 = $data1[ $i]; + $eq2 = $data2[ $i]; + + if( (substr( $eq2, 0, 1) == '"') and (substr( $eq2, -1, 1) == '"')){ + $eq2 = substr( $eq2, 1, -1); + } + + switch( $eq1){ + case 'fo:text-align': + $styleitems[ 'align'] = $eq2; + //print_object( $styleitems); + break; + case 'fo:background-color': + $styleitems[ 'background-color'] = $eq2; + break; + } + } + } + + function game_bookquiz_convertstyle_textproperties( $line, &$styleitems) + { + preg_match_all( '#(.*?)=(.*?) #es', $line.' ', $datas); + $data1 = $datas[ 1]; + $data2 = $datas[ 2]; + + $ret = ''; + for( $i=0; $i < count( $data1); $i++){ + $eq1 = $data1[ $i]; + $eq2 = $data2[ $i]; + + if( (substr( $eq2, 0, 1) == '"') and (substr( $eq2, -1, 1) == '"')){ + $eq2 = substr( $eq2, 1, -1); + } + + switch( $eq1){ + case 'fo:font-size': + case 'fo:color': + case 'fo:background-color': + case 'fo:font-style': + case 'fo:font-weight': + $styleitems[ substr( $eq1, 3)] = $eq2; + break; + case 'style_text_underline_style': + if( $eq2 == 'solid'){ + $styleitems[ 'text-decoration'] = 'underline'; + } + break; + } + } + } diff --git a/bookquiz/importppt.php b/bookquiz/importppt.php new file mode 100644 index 0000000..9d63925 --- /dev/null +++ b/bookquiz/importppt.php @@ -0,0 +1,468 @@ +get_record('course', array( 'id' => $cm->course))) { + print_error('Course is misconfigured'); + } + + // allows for adaption for multiple modules + if(! $modname = $DB->get_field('modules', 'name', array( 'id' => $cm->module))) { + print_error('Could not find module name'); + } + + if (! $mod = $DB->get_record($modname, array( "id" => $cm->instance))) { + print_error('Course module is incorrect'); + } + + require_login($course->id, false); + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + require_capability('mod/lesson:edit', $context); + + $strimportppt = get_string("importppt", "lesson"); + $strlessons = get_string("modulenameplural", "lesson"); + + echo $OUTPUT->heading("$strimportppt", " $strimportppt", "id\">$strlessons -> wwwroot}/mod/$modname/view.php?id=$cm->id\">".format_string($mod->name,true)."-> $strimportppt"); + + if ($form = data_submitted()) { /// Filename + + if (empty($_FILES['newfile'])) { // file was just uploaded + notify(get_string("uploadproblem") ); + } + + if ((!is_uploaded_file($_FILES['newfile']['tmp_name']) or $_FILES['newfile']['size'] == 0)) { + notify(get_string("uploadnofilefound") ); + + } else { // Valid file is found + + if ($rawpages = readdata($_FILES, $course->id, $modname)) + { // first try to reall all of the data in + $pageobjects = extract_data($rawpages, $course->id, $mod->name, $modname); // parse all the html files into objects + clean_temp(); // all done with files so dump em + + $mod_create_objects = $modname.'_create_objects'; + $mod_save_objects = $modname.'_save_objects'; + + $objects = $mod_create_objects($pageobjects, $mod->id); // function to preps the data to be sent to DB + + if(! $mod_save_objects($objects, $mod->id, $pageid)) { // sends it to DB + print_error( 'could not save'); + } + } else { + print_error('could not get data'); + } + + echo "
    "; + print_continue("{$CFG->wwwroot}/mod/$modname/view.php?id=$cm->id"); + echo $OUTPUT->footer($course); + exit; + } + } + + /// Print upload form + + print_heading_with_help($strimportppt, "importppt", "lesson"); + + echo $OUTPUT->box_start('center'); + echo "
    "; + echo "id\" />\n"; + echo "\n"; + echo ""; + + echo ""; + + echo "
    "; + print_string("upload"); + echo ":"; + echo ""; + echo "
     "; + echo ""; + echo "
    "; + echo "
    "; + echo $OUTPUT->box_end(); + + echo $OUTPUT->footer($course); + +// START OF FUNCTIONS + +function readdata($file, $courseid, $modname) { +// this function expects a zip file to be uploaded. Then it parses +// outline.htm to determine the slide path. Then parses each +// slide to get data for the content + + global $CFG; + + // create an upload directory in temp + make_upload_directory('temp/'.$modname); + + $base = $CFG->dataroot."/temp/$modname/"; + + $zipfile = $_FILES["newfile"]["name"]; + $tempzipfile = $_FILES["newfile"]["tmp_name"]; + + // create our directory + $path_parts = pathinfo($zipfile); + $dirname = substr($zipfile, 0, strpos($zipfile, '.'.$path_parts['extension'])); // take off the extension + if (!file_exists($base.$dirname)) { + mkdir($base.$dirname); + } + + // move our uploaded file to temp/lesson + move_uploaded_file($tempzipfile, $base.$zipfile); + + // unzip it! + unzip_file($base.$zipfile, $base, false); + + $base = $base.$dirname; // update the base + + // this is the file where we get the names of the files for the slides (in the correct order too) + $outline = $base.'/outline.htm'; + + $pages = array(); + + if (file_exists($outline) and is_readable($outline)) { + $outlinecontents = file_get_contents($outline); + $filenames = array(); + preg_match_all("/javascript:GoToSld\('(.*)'\)/", $outlinecontents, $filenames); // this gets all of our files names + + // file $pages with the contents of all of the slides + foreach ($filenames[1] as $file) { + $path = $base.'/'.$file; + if (is_readable($path)) { + $pages[$path] = file_get_contents($path); + } else { + return false; + } + } + } else { + // cannot find the outline, so grab all files that start with slide + $dh = opendir($base); + while (false !== ($file = readdir($dh))) { // read throug the directory + if ('slide' == substr($file, 0, 5)) { // check for name (may want to check extension later) + $path = $base.'/'.$file; + if (is_readable($path)) { + $pages[$path] = file_get_contents($path); + } else { + return false; + } + } + } + + ksort($pages); // order them by file name + } + + if (empty($pages)) { + return false; + } + + return $pages; +} + +function extract_data($pages, $courseid, $lessonname, $modname) { + // this function attempts to extract the content out of the slides + // the slides are ugly broken xml. and the xml is broken... yeah... + + global $CFG; + global $matches; + + $extratedpages = array(); + + // directory for images + make_mod_upload_directory($courseid); // make sure moddata is made + make_upload_directory($courseid.'/moddata/'.$modname, false); // we store our images in a subfolder in here + + $imagedir = $CFG->dataroot.'/'.$courseid.'/moddata/'.$modname; + + if ($CFG->slasharguments) { + $imagelink = $CFG->wwwroot.'/file.php/'.$courseid.'/moddata/'.$modname; + } else { + $imagelink = $CFG->wwwroot.'/file.php?file=/'.$courseid.'/moddata/'.$modname; + } + + // try to make a unique subfolder to store the images + $lessonname = str_replace(' ', '_', $lessonname); // get rid of spaces + $i = 0; + while(true) { + if (!file_exists($imagedir.'/'.$lessonname.$i)) { + // ok doesnt exist so make the directory and update our paths + mkdir($imagedir.'/'.$lessonname.$i); + $imagedir = $imagedir.'/'.$lessonname.$i; + $imagelink = $imagelink.'/'.$lessonname.$i; + break; + } + $i++; + } + + foreach ($pages as $file => $content) { + // to make life easier on our preg_match_alls, we strip out all tags except + // for div and img (where our content is). We want div because sometimes we + // can identify the content in the div based on the div's class + + $tags = '
    '; // should also allow + $string = strip_tags($content,$tags); + //echo s($string); + + $matches = array(); + // this will look for a non nested tag that is closed + // want to allow (maybe more) tags but when we do that + // the preg_match messes up. + preg_match_all("/(<([\w]+)[^>]*>)([^<\\2>]*)(<\/\\2>)/", $string, $matches); + //(<([\w]+)[^>]*>)([^<\\2>]*)(<\/\\2>) original pattern + //(<(div+)[^>]*>)[^() work in progress + + $path_parts = pathinfo($file); + $file = substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')); // get rid of the extension + + $imgs = array(); + // this preg matches all images + preg_match_all("/]*(src\=\"(".$file."\_image[^>^\"]*)\"[^>]*)>/i", $string, $imgs); + + // start building our page + $page = new stdClass; + $page->title = ''; + $page->contents = array(); + $page->images = array(); + $page->source = $path_parts['basename']; // need for book only + + // this foreach keeps the style intact. Found it doesn't help much. But if you want back uncomment + // this foreach and uncomment the line with the comment imgstyle in it. Also need to comment out + // the $page->images[]... line in the next foreach + /*foreach ($imgs[1] as $img) { + $page->images[] = ''; + }*/ + foreach ($imgs[2] as $img) { + copy($path_parts['dirname'].'/'.$img, $imagedir.'/'.$img); + $page->images[] = ""; // comment out this line if you are using the above foreach loop + } + for($i = 0; $i < count($matches[1]); $i++) { // go through all of our div matches + + $class = isolate_class($matches[1][$i]); // first step in isolating the class + + // check for any static classes + switch ($class) { + case 'T': // class T is used for Titles + $page->title = $matches[3][$i]; + break; + case 'B': // I would guess that all bullet lists would start with B then go to B1, B2, etc + case 'B1': // B1-B4 are just insurance, should just hit B and all be taken care of + case 'B2': + case 'B3': + case 'B4': + $page->contents[] = build_list('
      ', $i, 0); // this is a recursive function that will grab all the bullets and rebuild the list in html + break; + default: + if ($matches[3][$i] != ' ') { // odd crap generated... sigh + if (substr($matches[3][$i], 0, 1) == ':') { // check for leading : ... hate MS ... + $page->contents[] = substr($matches[3][$i], 1); // get rid of : + } else { + $page->contents[] = $matches[3][$i]; + } + } + break; + } + } + + // add the page to the array; + $extratedpages[] = $page; + + } // end $pages foreach loop + + return $extratedpages; +} + +/** +A recursive function to build a html list +*/ +function build_list($list, &$i, $depth) { + global $matches; // not sure why I global this... + + while($i < count($matches[1])) { + + $class = isolate_class($matches[1][$i]); + + if (strstr($class, 'B')) { // make sure we are still working with bullet classes + if ($class == 'B') { + $this_depth = 0; // calling class B depth 0 + } else { + // set the depth number. So B1 is depth 1 and B2 is depth 2 and so on + $this_depth = substr($class, 1); + if (!is_numeric($this_depth)) { + print_error( 'Depth not parsed!'); + } + } + if ($this_depth < $depth) { + // we are moving back a level in the nesting + break; + } + if ($this_depth > $depth) { + // we are moving in a lvl in nesting + $list .= '
        '; + $list = build_list($list, $i, $this_depth); + // once we return back, should go to the start of the while + continue; + } + // no depth changes, so add the match to our list + if ($cleanstring = ppt_clean_text($matches[3][$i])) { + $list .= '
      • '.ppt_clean_text($matches[3][$i]).'
      • '; + } + $i++; + } else { + // not a B class, so get out of here... + break; + } + } + // end the list and return it + $list .= '
      '; + return $list; + +} + +/** +Given an html tag, this function will +*/ +function isolate_class($string) { + if($class = strstr($string, 'class=')) { // first step in isolating the class + $class = substr($class, strpos($class, '=')+1); // this gets rid of
      + return substr($class, 0, strpos($class, '>')); + } + } else { + // no class defined in the tag + return ''; + } +} + +/** +This function strips off the random chars that ppt puts infront of bullet lists +*/ +function ppt_clean_text($string) { + $chop = 1; // default: just a single char infront of the content + + // look for any other crazy things that may be infront of the content + if (strstr($string, '<') and strpos($string, '<') == 0) { // look for the < in the sting and make sure it is in the front + $chop = 4; // increase the $chop + } + // may need to add more later.... + + $string = substr($string, $chop); + + if ($string != ' ') { + return $string; + } else { + return false; + } +} + +/** + Clean up the temp directory +*/ +function clean_temp() { + global $CFG; + // this function is broken, use it to clean up later + // should only clean up what we made as well because someone else could be importing ppt as well + //delDirContents($CFG->dataroot.'/temp/lesson'); +} + + +/** + Creates objects an chapter object that is to be inserted into the database +*/ +function book_create_objects($pageobjects, $bookid) { + + $chapters = array(); + $chapter = new stdClass; + + // same for all chapters + $chapter->bookid = $bookid; + $chapter->pagenum = $DB->count_records('book_chapters', array( 'bookid' => $bookid))+1; + $chapter->timecreated = time(); + $chapter->timemodified = time(); + $chapter->subchapter = 0; + + $i = 1; + foreach ($pageobjects as $pageobject) { + $page = prep_page($pageobject, $i); // get title and contents + $chapter->importsrc = addslashes($pageobject->source); // add the source + $chapter->title = $page->title; + $chapter->content = $page->contents; + $chapters[] = $chapter; + + // increment our page number and our counter + $chapter->pagenum = $chapter->pagenum + 1; + $i++; + } + + return $chapters; +} + +/** + Builds the title and content strings from an object +*/ +function prep_page($pageobject, $count) { + if ($pageobject->title == '') { + $page->title = "Page $count"; // no title set so make a generic one + } else { + $page->title = addslashes($pageobject->title); + } + + $page->contents = ''; + + // nab all the images first + foreach ($pageobject->images as $image) { + $image = str_replace("\n", '', $image); + $image = str_replace("\r", '', $image); + $image = str_replace("'", '"', $image); // imgstyle + + $page->contents .= addslashes($image); + } + // go through the contents array and put

      tags around each element and strip out \n which I have found to be uneccessary + foreach ($pageobject->contents as $content) { + $content = str_replace("\n", '', $content); + $content = str_replace("\r", '', $content); + $content = str_replace(' ', '', $content); // puts in returns? + $content = '

      '.$content.'

      '; + $page->contents .= addslashes($content); + } + return $page; +} + +/** + Save the chapter objects to the database +*/ +function book_save_objects($chapters, $bookid, $pageid='0') { + global $DB; + + // nothing fancy, just save them all in order + foreach ($chapters as $chapter) { + if (!$chapter->id = $DB->insert_record('book_chapters', $chapter)) { + print_error('Could not update your book'); + } + } + return true; +} diff --git a/bookquiz/play.php b/bookquiz/play.php new file mode 100644 index 0000000..5eebbb7 --- /dev/null +++ b/bookquiz/play.php @@ -0,0 +1,370 @@ +lastchapterid = 0; + $bookquiz->id = $attempt->id; + $bookquiz->bookid = $game->bookid; + + if( !game_insert_record( 'game_bookquiz', $bookquiz)){ + print_error( 'game_bookquiz_continue: error inserting in game_bookquiz'); + } + + return game_bookquiz_play( $id, $game, $attempt, $bookquiz, 0, $context); +} + +function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $context) +{ + global $DB, $OUTPUT, $cm; + + if( $bookquiz->lastchapterid == 0){ + game_bookquiz_play_computelastchapter( $game, $bookquiz); + + if( $bookquiz->lastchapterid == 0){ + print_error( get_string( 'bookquiz_empty', 'game')); + } + } + if( $chapterid == 0){ + $chapterid = $bookquiz->lastchapterid; + }else + { + if( ($DB->set_field( 'game_bookquiz', 'lastchapterid', $chapterid, array( 'id' => $bookquiz->id))) == false){ + print_error( "Can't update table game_bookquiz with lastchapterid to $chapterid"); + } + } + + $book = $DB->get_record( 'book', array('id' => $game->bookid)); + if( !$chapter = $DB->get_record( 'book_chapters', array('id' => $chapterid))){ + print_error('Error reading book chapters.'); + } + $select = "bookid = $game->bookid AND hidden = 0"; + $chapters = $DB->get_records_select('book_chapters', $select, null, 'pagenum', 'id, pagenum, subchapter, title, hidden'); + + $okchapters = array(); + if( ($recs = $DB->get_records( 'game_bookquiz_chapters', array( 'attemptid' => $attempt->id))) != false){ + foreach( $recs as $rec){ + //1 means correct answer + $okchapters[ $rec->chapterid] = 1; + } + } + //2 means current + //$okchapters[ $chapterid] = 2; + $showquestions = false; + $a = array( 'gameid' => $game->id, 'chapterid' => $chapterid); + if( ($questions = $DB->get_records( 'game_bookquiz_questions', $a)) === false){ + if( !array_key_exists( $chapterid, $okchapters)){ + $okchapters[ $chapterid] = 1; + $newrec = new stdClass(); + $newrec->attemptid = $attempt->id; + $newrec->chapterid = $chapterid; + + if( !$DB->insert_record( 'game_bookquiz_chapters', $newrec)){ + print_error( "Can't insert to table game_bookquiz_chapters"); + } + } + }else + { + //Have to select random one question + $questionid = game_bookquiz_selectrandomquestion( $questions); + if( $questionid != 0){ + $showquestions = true; + } + } + + +/// prepare chapter navigation icons +$previd = null; +$nextid = null; +$found = 0; +$scoreattempt = 0; +foreach ($chapters as $ch) { + $scoreattempt++; + if ($found) { + $nextid= $ch->id; + break; + } + if ($ch->id == $chapter->id) { + $found = 1; + } + if (!$found) { + $previd = $ch->id; + } +} +if ($ch == current($chapters)) { + $nextid = $ch->id; +} +if( count( $chapters)){ + $scoreattempt = ($scoreattempt-1) / count( $chapters); +} + +$chnavigation = ''; + + +if ($previd) { + $chnavigation .= ''.get_string('navprev', 'book').''; +} else { + $chnavigation .= ''; +} + +$nextbutton = ''; +if ($nextid) { + if( !$showquestions){ + $chnavigation .= ''.get_string('navnext', 'book').''; + $nextbutton = '
      '; + $nextbutton .= '
      '; + $nextbutton .= ''."\r\n"; + $nextbutton .= ''."\r\n"; + $nextbutton .= ''; + $nextbutton .= '
      '; + $showquestions = false; + game_updateattempts_maxgrade( $game, $attempt, $scoreattempt, 0); + } +} else { + game_updateattempts_maxgrade( $game, $attempt, 1, 0); + $sec = ''; + if( !isset( $cm)) + $cm = get_coursemodule_from_id('game', $game->id); + if ($section = $DB->get_record('course_sections', array( 'id' => $cm->section))) { + $sec = $section->section; + } + + if (! $cm = $DB->get_record('course_modules', array( 'id' => $id))) { + print_error("Course Module ID was incorrect id=$id"); + } + $chnavigation .= ''.get_string('navexit', 'book').''; +} + +require( 'toc.php'); +$tocwidth = '10%'; + + if( $showquestions){ + if( $game->param3 == 0) + game_bookquiz_showquestions( $id, $questionid, $chapter->id, $nextid, $scoreattempt, $game, $context); + } + + +?> + + + + + + + + + + + + + +
      + + + + + +
      +
      + box_start('generalbox'); + echo $toc; + echo $OUTPUT->box_end(); + ?> + + box_start('generalbox'); + $content = ''; + if (!$book->customtitles) { + if ($currsubtitle == ' ') { + $content .= '

      '.$currtitle.'

      '; + } else { + $content .= '

      '.$currtitle.'
      '.$currsubtitle.'

      '; + } + } + $content .= $chapter->content; + + $nocleanoption = new object(); + $nocleanoption->noclean = true; + echo '
      '; + if( $nextbutton != ''){ + echo $nextbutton; + } + echo format_text($content, FORMAT_HTML, $nocleanoption, $id); + if( $nextbutton != ''){ + echo $nextbutton; + } + + echo '
      '; + echo $OUTPUT->box_end(); + /// lower navigation + echo '

      '.$chnavigation.'

      '; + ?> +
      + +param3 != 0) + game_bookquiz_showquestions( $id, $questionid, $chapter->id, $nextid, $scoreattempt, $game, $context); + } +} + +function game_bookquiz_play_computelastchapter( $game, &$bookquiz) +{ + global $DB; + + $pagenum = $DB->get_field( 'book_chapters', 'min(pagenum) as p', array('bookid' => $game->bookid)); + if( $pagenum){ + $bookquiz->lastchapterid = $DB->get_field( 'book_chapters', 'id', array('bookid' => $game->bookid, 'pagenum' => $pagenum)); + + if( $bookquiz->lastchapterid){ + //update the data in table game_bookquiz + if( ($DB->set_field( 'game_bookquiz', 'lastchapterid', $bookquiz->lastchapterid, array('id' => $bookquiz->id))) == false){ + print_error( "Can't update table game_bookquiz with lastchapterid to $bookquiz->lastchapterid"); + } + } + } +} + +function game_bookquiz_showquestions( $id, $questionid, $chapterid, $nextchapterid, $scoreattempt, $game, $context) +{ + $onlyshow = false; + $showsolution = false; + + $questionlist = $questionid; + $questions = game_sudoku_getquestions( $questionlist); + + global $CFG; + + /// Start the form + echo "wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + if( ($onlyshow === false) and ($showsolution === false)){ + echo "
      \n"; + } + + // Add a hidden field with the quiz id + echo '
      '; + echo '\n"; + echo ''; + echo ''; + echo ''; + echo ''; + + /// Print all the questions + + // Add a hidden field with questionids + echo '\n"; + + $number=0; + foreach ($questions as $question) { + game_print_question( $game, $question, $context); + } + echo "
      "; + + // Finish the form + echo '
      '; + if( ($onlyshow === false) and ($showsolution === false)){ + echo "
      \n"; + } + + echo "\n"; +} + +function game_bookquiz_selectrandomquestion( $questions) +{ + global $DB; + + $categorylist = ''; + if( $questions == false){ + return 0; + } + + foreach( $questions as $rec){ + $categorylist .= ',' . $rec->questioncategoryid; + } + $select = 'category in ('.substr( $categorylist, 1). ") AND qtype in ('shortanswer', 'truefalse', 'multichoice')"; + if( ($recs = $DB->get_records_select( 'question', $select, null, '', 'id,id')) == false){ + return 0; + } + $a = array(); + foreach( $recs as $rec){ + $a[ $rec->id] = $rec->id; + } + + if( count( $a) == 0){ + return 0; + }else + { + return array_rand( $a); + } +} + +function game_bookquiz_check_questions( $id, $game, $attempt, $bookquiz, $context) +{ + global $USER, $DB; + + $scoreattempt = optional_param('scoreattempt', 0, PARAM_INT); + $responses = data_submitted(); + + $questionlist = $responses->questionids; + + $questions = game_sudoku_getquestions( $questionlist); + $grades = game_grade_questions( $questions); + + $scorequestion = 0; + $scoreattempt = 0; + + $chapterid = required_param('chapterid', PARAM_INT); + $nextchapterid = required_param('nextchapterid', PARAM_INT); + + foreach($questions as $question) { + if( !array_key_exists( $question->id, $grades)){ + //no answered + continue; + } + $grade = $grades[ $question->id]; + if( $grade->grade < 0.5){ + continue; + } + + //found one correct answer + if( !$DB->get_field( 'game_bookquiz_chapters', 'id', array( 'attemptid' => $attempt->id, 'chapterid' => $chapterid))) + { + $newrec = new stdClass(); + $newrec->attemptid = $attempt->id; + $newrec->chapterid = $chapterid; + if( !$DB->insert_record( 'game_bookquiz_chapters', $newrec, false)){ + print_object( $newrec); + print_error( "Can't insert to table game_bookquiz_chapters"); + } + } + //Have to go to next page. + $bookquiz->lastchapterid = $nextchapterid; + $scorequestion = 1; + break; + } + + $query = new stdClass(); + $query->id = 0; + $query->attemptid = $attempt->id; + $query->gameid = $game->id; + $query->userid = $USER->id; + $query->sourcemodule = 'question'; + $query->questionid = $question->id; + $query->glossaryentryid = 0; + $query->questiontext = $question->questiontext; + $query->timelastattempt = time(); + game_update_queries( $game, $attempt, $query, $scorequestion, ''); + + game_updateattempts( $game, $attempt, $scoreattempt, 0); + + game_bookquiz_continue( $id, $game, $attempt, $bookquiz, $bookquiz->lastchapterid, $context); +} diff --git a/bookquiz/questions.php b/bookquiz/questions.php new file mode 100644 index 0000000..5e9ae70 --- /dev/null +++ b/bookquiz/questions.php @@ -0,0 +1,180 @@ +bookid == 0){ + print_error( get_string( 'bookquiz_not_select_book', 'game')); + } + + if ($form = data_submitted()) + { /// Filename + $ids = explode( ',', $form->ids); + game_bookquiz_save( $game->id, $game->bookid, $ids, $form); + + redirect("{$CFG->wwwroot}/mod/game/bookquiz/questions.php?id=$cm->id", '', 0); + } + + /// Print upload form + + $OUTPUT->heading( $course->fullname); + + $select = "gameid={$game->id}"; + $categories = array(); + if( ($recs = $DB->get_records_select( 'game_bookquiz_questions', $select, null, '', 'chapterid,questioncategoryid')) != false){ + foreach( $recs as $rec){ + $categories[ $rec->chapterid] = $rec->questioncategoryid; + } + } + + $context = get_context_instance(50, $COURSE->id); + $select = " contextid in ($context->id)"; + + $a = array(); + if( $recs = $DB->get_records_select( 'question_categories', $select, null, 'id,name')){ + foreach( $recs as $rec){ + $s = $rec->name; + if( ($count = $DB->count_records( 'question', array( 'category' => $rec->id))) != 0){ + $s .= " ($count)"; + } + $a[ $rec->id] = $s; + } + } + + $sql = "SELECT chapterid, COUNT(*) as c ". + "FROM {game_bookquiz_questions} gbq,{question} q ". + "WHERE gbq.questioncategoryid=q.category ". + "AND gameid=$game->id ". + "GROUP BY chapterid"; + $numbers = array(); + if( ($recs = $DB->get_records_sql( $sql)) != false){ + foreach( $recs as $rec){ + $numbers[ $rec->chapterid] = $rec->c; + } + } + + echo '
      '; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo "\r\n"; + $ids = ''; + if( ($recs =$DB->get_records( 'book_chapters', array('bookid' => $game->bookid), 'pagenum', 'id,title')) != false) + { + foreach( $recs as $rec){ + echo ''; + echo ''; + echo ''; + + echo ''; + + echo "\r\n"; + + $ids .= ','.$rec->id; + } + } +?> +
      '.get_string( 'bookquiz_chapters', 'game').'
      '.get_string( 'bookquiz_categories', 'game').'
      '.get_string( 'bookquiz_numquestions', 'game').'
      '.$rec->title.''; + if( array_key_exists( $rec->id, $categories)) + $categoryid = $categories[ $rec->id]; + else + $categoryid = 0; + echo game_showselectcontrol( 'categoryid_'.$rec->id, $a, $categoryid, ''); + echo ''; + if( array_key_exists( $rec->id, $numbers)){ + echo '
      '.$numbers[ $rec->id].'
      '; + }else + { + echo ' '; + } + echo '
      +
      + + + + +
      +" /> +
      + +
      +footer($course); + +function game_bookquiz_save( $gameid, $bookid, $ids, $form) +{ + global $DB; + + $questions = array(); + $recids = array(); + if( ($recs = $DB->get_records( 'game_bookquiz_questions', array( 'gameid' => $gameid), '', 'id,chapterid,questioncategoryid')) != false){ + foreach( $recs as $rec){ + $questions[ $rec->chapterid] = $rec->questioncategoryid; + $recids[ $rec->chapterid] = $rec->id; + } + } + + foreach( $ids as $chapterid){ + $name = 'categoryid_'.$chapterid; + $categoryid = $form->$name; + + if( !array_key_exists( $chapterid, $questions)){ + + if( $categoryid == 0){ + continue; + } + + $rec = new stdClass(); + $rec->gameid = $gameid; + $rec->chapterid = $chapterid; + $rec->questioncategoryid = $categoryid; + + if (($newid=$DB->insert_record('game_bookquiz_questions', $rec)) == false) { + print_object( $rec); + print_error( "Can't insert to game_bookquiz_questions"); + } + continue; + } + + $cat = $questions[ $chapterid]; + if( $cat == $categoryid){ + $recids[ $chapterid] = 0; + continue; + } + + if( $categoryid == 0){ + if( !delete_records( 'game_bookquiz_questions', 'id', $recids[ $chapterid])){ + print_error( "Can't delete game_bookquiz_questions"); + } + }else + { + unset( $updrec); + $updrec->id = $recids[ $chapterid]; + $updrec->questioncategoryid = $categoryid; + if (($DB->update_record( 'game_bookquiz_questions', $updrec)) == false) { + print_object( $rec); + print_error( "Can't update game_bookquiz_questions"); + } + } + + $recids[ $chapterid] = 0; + } + + foreach( $recids as $chapterid => $id){ + if( $id == 0){ + continue; + } + } +} diff --git a/bookquiz/toc.php b/bookquiz/toc.php new file mode 100644 index 0000000..9b72832 --- /dev/null +++ b/bookquiz/toc.php @@ -0,0 +1,135 @@ +numbering) { + case NUM_NONE: + $toc .= '
      '; + break; + case NUM_NUMBERS: + $toc .= '
      '; + break; + case NUM_BULLETS: + $toc .= '
      '; + break; + case NUM_INDENTED: + $toc .= '
      '; + break; +} + + +if ($print) { ///TOC for printing + $toc .= ''; + if ($book->customtitles) { + $toc .= '

      '.get_string('toc', 'book').'

      '; + } else { + $toc .= '

      '.get_string('toc', 'book').'

      '; + } + $titles = array(); + $toc .= '
        '; + foreach($chapters as $ch) { + $title = trim(strip_tags($ch->title)); + if (!$ch->hidden) { + if (!$ch->subchapter) { + $nch++; + $ns = 0; + $toc .= ($first) ? '
      • ' : '
    • '; + if ($book->numbering == NUM_NUMBERS) { + $title = "$nch $title"; + } + } else { + $ns++; + $toc .= ($first) ? '
      • ' : '
      • '; + if ($book->numbering == NUM_NUMBERS) { + $title = "$nch.$ns $title"; + } + } + $titles[$ch->id] = $title; + $toc .= ''.$title.''; + $toc .= (!$ch->subchapter) ? '
          ' : ''; + $first = 0; + } + } + $toc .= '
      '; +} else { //normal students view + $toc .= '
        '; + foreach($chapters as $ch) { + $title = trim(strip_tags($ch->title)); + if (!$ch->hidden) { + if (!$ch->subchapter) { + $nch++; + $ns = 0; + $toc .= ($first) ? '
      • ' : '
    • '; + if ($book->numbering == NUM_NUMBERS) { + $title = "$nch $title"; + } + $prevtitle = $title; + } else { + $ns++; + $toc .= ($first) ? '
      • ' : '
      • '; + if ($book->numbering == NUM_NUMBERS) { + $title = "$nch.$ns $title"; + } + } + if ($ch->id == $chapter->id) { + $toc .= ''.$title.''; + if ($ch->subchapter) { + $currtitle = $prevtitle; + $currsubtitle = $title; + } else { + $currtitle = $title; + $currsubtitle = ' '; + } + } else { + if( array_key_exists( $ch->id, $okchapters)){ + $toc .= ''.$title.''; + }else + { + $toc .= htmlspecialchars($title); + } + } + $toc .= (!$ch->subchapter) ? '
          ' : ''; + $first = 0; + } + } + $toc .= '
      '; +} + +$toc .= '
    • '; + +$toc = str_replace('
        ', '', $toc); //cleanup of invalid structures + +?> diff --git a/bookquiz/view.php b/bookquiz/view.php new file mode 100644 index 0000000..4d02d93 --- /dev/null +++ b/bookquiz/view.php @@ -0,0 +1,202 @@ +get_record('course', array( 'id'=> $cm->course))) { + print_error('Course is misconfigured'); +} + +if (!$book = $DB->get_record('book', array( 'id' => $cm->instance))) { + print_error('Course module is incorrect'); +} + +require_course_login($course, true, $cm); + +$context = get_context_instance(CONTEXT_MODULE, $cm->id); + +/// read chapters +$select = $allowedit ? "bookid = $book->id" : "bookid = $book->id AND hidden = 0"; +$chapters = $DB->get_records_select('book_chapters', $select, null, 'pagenum', 'id, pagenum, subchapter, title, hidden'); + +/// check chapterid and read chapter data +if ($chapterid == '0') { // go to first chapter if no given + foreach($chapters as $ch) { + if ($allowedit) { + $chapterid = $ch->id; + break; + } + if (!$ch->hidden) { + $chapterid = $ch->id; + break; + } + } +} + + +if (!$chapter = $DB->get_record('book_chapters', array('id' => $chapterid))) { + print_error('Error reading book chapters.'); +} + +//check all variables +unset($id); +unset($chapterid); + +/// chapter is hidden for students +if (!$allowedit && $chapter->hidden) { + print_error('Error reading book chapters.'); +} + +/// chapter not part of this book! +if ($chapter->bookid != $book->id) { + print_error('Chapter not part of this book!'); +} +// ========================================================================= +// security checks END +// ========================================================================= + +add_to_log($course->id, 'book', 'view', 'view.php?id='.$cm->id.'&chapterid='.$chapter->id, $book->id, $cm->id); + + +///read standard strings +$strbooks = get_string('modulenameplural', 'book'); +$strbook = get_string('modulename', 'book'); +$strTOC = get_string('TOC', 'book'); + +/// prepare header +if ($course->category) { + $navigation = ''.$course->shortname.' ->'; +} else { + $navigation = ''; +} + +$buttons = $allowedit ? ''. + '
        '.update_module_button($cm->id, $course->id, $strbook).' '.book_edit_button($cm->id, $course->id, $chapter->id).'
        ' + : ' '; + + +/// prepare chapter navigation icons +$previd = null; +$nextid = null; +$found = 0; +foreach ($chapters as $ch) { + if ($found) { + $nextid= $ch->id; + break; + } + if ($ch->id == $chapter->id) { + $found = 1; + } + if (!$found) { + $previd = $ch->id; + } +} +if ($ch == current($chapters)) { + $nextid = $ch->id; +} +$chnavigation = ''; +echo "previd=$previd nextid=$nextid
        "; + +if ($previd) { + $chnavigation .= ''.get_string('navprev', 'book').''; +} else { + $chnavigation .= ''; +} + +if ($nextid) { + $chnavigation .= ''.get_string('navnext', 'book').''; +} else { + $sec = ''; + if ($section = $DB->get_record('course_sections', array( 'id' => $cm->section))) { + $sec = $section->section; + } + $chnavigation .= ''.get_string('navexit', 'book').''; +} + +echo "chnavigation=$chnavigation
        "; + +/// prepare print icons +if ($book->disableprinting) { + $printbook = ''; + $printchapter = ''; +} else { + $printbook = ''.get_string('printbook', 'book').''; + $printchapter = ''.get_string('printchapter', 'book').''; +} + + +// ===================================================== +// Book display HTML code +// ===================================================== +echo "OK"; +?> + + + + + + + + + + + + + +
        + + + + + +
        +
        + box_start('generalbox'); + echo $toc; + echo $OUTPUT->box_end(); + if ($allowedit && $edit) { + echo '
        '; + helpbutton('faq', get_string('faq','book'), 'book', true, true); + echo '
        '; + } + ?> +
        + box_start('generalbox'); + $content = ''; + if (!$book->customtitles) { + if ($currsubtitle == ' ') { + $content .= '

        '.$currtitle.'

        '; + } else { + $content .= '

        '.$currtitle.'
        '.$currsubtitle.'

        '; + } + } + $content .= $chapter->content; + + $nocleanoption = new object(); + $nocleanoption->noclean = true; + echo '
        '; + echo format_text($content, FORMAT_HTML, $nocleanoption, $course->id); + echo '
        '; + echo $OUTPUT->box_end(); + /// lower navigation + echo '

        '.$chnavigation.'

        '; + ?> +
        + +footer($course); + +?> diff --git a/cross/cross_class.php b/cross/cross_class.php new file mode 100644 index 0000000..e1fb65e --- /dev/null +++ b/cross/cross_class.php @@ -0,0 +1,745 @@ +m_reps = array(); + foreach( $reps as $word => $r){ + $this->m_reps[ game_upper( $word)] = $r; + } + + $this->m_average_reps=0; + foreach( $reps as $r) + $this->m_average_reps += $r; + if( count( $reps)) + $this->m_average_reps /= count( $reps); + + $this->m_input_answers = array(); + foreach( $answers as $word => $answer){ + $this->m_input_answers[ game_upper( $word)] = $answer; + } + + $this->m_words = array(); + + $maxlen = 0; + foreach( $this->m_input_answers as $word => $answer) + { + $len = textlib::strlen( $word); + if( $len > $maxlen){ + $maxlen = $len; + } + } + + $N20 = $maxlen; + + $this->m_N20min = round( $N20 - $N20/4); + $this->m_N20max = round( $N20 + $N20/4); + if( $this->m_N20max > $maxcols and $maxcols > 0){ + $this->m_N20max = $maxcols; + } + if( $this->m_N20min > $this->m_N20max){ + $this->m_N20min = $this->m_N20max; + } + + $this->m_words = array(); + foreach( $this->m_input_answers as $word => $answer) + { + $len =textlib::strlen( $word); + + if( $len <= $this->m_N20max){ + $this->m_words[] = game_upper( $word); + } + } + + $this->randomize(); + + return count( $this->m_words); + } + + function randomize() + { + $n = count( $this->m_words); + for($j=0; $j <= $n/4; $j++) + { + $i = array_rand( $this->m_words); + + $this->swap( $this->m_words[ $i], $this->m_words[ 0]); + } + } + + function computedata( &$crossm, &$crossd, &$letters, $maxwords) + { + $t1 = time(); + + $ctries = 0; + $m_best_score = 0; + + $m_best_connectors = $m_best_filleds = $m_best_spaces = 0; + $m_best_N20 = 0; + + $nochange = 0; + for(;;) + { + //selects the size of the cross + $N20 = mt_rand( $this->m_N20min, $this->m_N20max); + + if( !$this->computenextcross( $N20, $t1, $ctries, $maxwords, $nochange)) + break; + + $ctries++; + + if (time() - $t1 > $this->m_time_limit - 3){ + break; + } + + if( $nochange > 10) + break; + } + $this->computepuzzleinfo( $this->m_best_N20, $this->m_best_cross_pos, $this->m_best_cross_dir, $this->m_best_cross_word, false); + + set_time_limit( 30); + + return $this->savepuzzle( $crossm, $crossd, $ctries, time()-$t1); + } + + function computenextcross( $N20, $t1, $ctries, $maxwords, &$nochange) + { + $MAXW = $N20; + + $N21 = $N20 + 1; + $N22 = $N20 + 2; + $N2222 = $N22 * $N22; + + $base_puzzle = str_repeat('0', $N22) . + str_repeat('0' . str_repeat('.', $N20) . '0', $N20) . + str_repeat('0', $N22); + + $cross_pos = array(); + $cross_dir = array(); + $cross_word = array(); + + $magics = array(); + for ($n = 2; $n < $N21; $n++) + { + $a = array(); + for ($r = 2; $r < ($n + 2); $r++) + $a[] = $r; + + uasort($a, array( $this, 'cmp_magic')); + $magics[ $n] = $a; + } + + uasort($this->m_words, array( $this, 'cmp')); + + $words = ';' . implode(';', $this->m_words) . ';'; + + $puzzle = $base_puzzle; + + $row = mt_rand(3, max( 3, $N20-3)); + $col = mt_rand(3, max( 3, $N20-3)); + $pos = $N22 * $row + $col; + + $poss = array(); + $ret = $this->scan_pos($pos, 'h', true, $puzzle, $words, $magics, $poss, $cross_pos, $cross_dir, $cross_word, $N20); + + while ($s = sizeof($poss)) + { + $p = array_shift($poss); + + if ($this->scan_pos($p[0], $p[1], false, $puzzle, $words, $magics, $poss, $cross_pos, $cross_dir, $cross_word, $N20)){ + $n_words = count( $cross_word); + if( $maxwords){ + if( $n_words >= $maxwords){ + break; + } + } + } + if (time() - $t1 > $this->m_time_limit - 3){ + return false; + } + } + + $n_words = count( $cross_word); + $score = $this->computescore( $puzzle, $N20, $N22, $N2222, $n_words, $n_connectors, $n_filleds, $cSpaces, $cross_word); + + if ($score > $this->m_best_score) + { + $this->m_best_cross_pos = $cross_pos; + $this->m_best_cross_dir = $cross_dir; + $this->m_best_cross_word = $cross_word; + $this->m_best_puzzle = $puzzle; + + $this->m_bests = array('Words' => "$n_words * 5 = " . ($n_words * 5), + 'Connectors' => "$n_connectors * 3 = " . ($n_connectors * 3), + 'Filled in spaces' => $n_filleds, + "N20" => $N20 + ); + + $this->m_best_score = $score; + + $this->m_best_connectors = $n_connectors; + $this->m_best_filleds = $n_filleds; + $this->m_best_spaces = $cSpaces; + $this->m_best_N20 = $N20; + $nochange = 0; + }else + { + $nochange++; + } + + return true; +} + + function computescore( $puzzle, $N20, $N22, $N2222, $n_words, &$n_connectors, &$n_filleds, &$cSpaces, $cross_word) + { + $n_connectors = $n_filleds = 0; + $puzzle00 = str_replace('.', '0', $puzzle); + + $used=0; + for ($n = 0; $n < $N2222; $n++) + { + if ($puzzle00[$n]){ + $used ++; + + if (($puzzle00[$n - 1] or $puzzle00[$n + 1]) and ($puzzle00[$n - $N22] or $puzzle00[$n + $N22])){ + $n_connectors++; + } else{ + $n_filleds++; + } + } + } + + $cSpaces = substr_count( $puzzle, "."); + $score = ($n_words * 5) + ($n_connectors * 3) + $n_filleds; + + $sum_rep = 0; + foreach( $cross_word as $word){ + $word = textlib::substr( $word, 1, -1); + + if( array_key_exists( $word, $this->m_reps)) + $sum_rep += $this->m_reps[ $word] - $this->m_average_reps; + } + + return $score-10*$sum_rep; + } + + + function computepuzzleinfo( $N20, $cross_pos, $cross_dir, $cross_word, $bPrint=false) + { + $bPrint=false; + $N22 = $N20 + 2; + + $this->m_mincol = $N22; + $this->m_maxcol = 0; + $this->m_minrow = $N22; + $this->m_maxrow = 0; + $this->m_cletter = 0; + + if( count( $cross_word) == 0){ + return; + } + + if( $bPrint) + echo "

        PuzzleInfo N20=$N20 words=".count($cross_word)."
        "; + for($i = 0; $i < count($cross_pos); $i++) + { + $pos = $cross_pos[ $i]; + $col = $pos % $N22; + $row = floor( $pos / $N22); + $dir = $cross_dir[ $i]; + + $len = textlib::strlen($cross_word[ $i])-3; + + if( $bPrint) + echo "col=$col row=$row dir=$dir word=".$cross_word[ $i]."
        "; + + $this->m_cletter += $len; + + if( $col < $this->m_mincol) + $this->m_mincol = $col; + + if( $row < $this->m_minrow) + $this->m_minrow = $row; + + if( $dir == 'h') + $col += $len; + else + $row += $len; + + if( $col > $this->m_maxcol) + $this->m_maxcol = $col; + if( $row > $this->m_maxrow) + $this->m_maxrow = $row; + } + + if( $bPrint) + echo "mincol={$this->m_mincol} maxcol={$this->m_maxcol} minrow={$this->m_minrow} maxrow={$this->m_maxrow}
        "; + + if( $this->m_mincol > $this->m_maxcol) + $this->m_mincol = $this->m_maxcol; + if( $this->m_minrow > $this->m_maxrow) + $this->m_minrow = $this->m_maxrow; + } + + + function savepuzzle( &$crossm, &$crossd, $ctries, $time) + { + $N22 = $this->m_best_N20 + 2; + + $cols = $this->m_maxcol - $this->m_mincol + 1; + $rows = $this->m_maxrow - $this->m_minrow + 1; + + //if( $cols < $rows) + // $bSwapColRow = 1; + //else + $bSwapColRow = 0; + + if( $bSwapColRow) + { + Swap( $cols, $rows); + Swap( $this->m_mincol, $this->m_minrow); + Swap( $this->m_maxcol, $this->m_maxrow); + } + + $crossm = new stdClass(); + $crossm->datebegin = time(); + $crossm->time = $time; + $crossm->cols = $cols; + $crossm->rows = $rows; + $crossm->words = count( $this->m_best_cross_pos); + $crossm->wordsall = count( $this->m_input_answers); + + $crossm->createscore = $this->m_best_score; + $crossm->createtries = $ctries; + $crossm->createtimelimit = $this->m_time_limit; + $crossm->createconnectors = $this->m_best_connectors; + $crossm->createfilleds = $this->m_best_filleds; + $crossm->createspaces = $this->m_best_spaces; + + for($i = 0; $i < count($this->m_best_cross_pos); $i++) + { + $pos = $this->m_best_cross_pos[ $i]; + + $col = $pos % $N22; + $row = floor( ($pos-$col) / $N22); + + $col += - $this->m_mincol + 1; + $row += - $this->m_minrow + 1; + + $dir = $this->m_best_cross_dir[ $i]; + $word = $this->m_best_cross_word[ $i]; + $word = substr( $word, 1, strlen( $word)-2); + + $rec = new stdClass(); + + $rec->col = $col; + $rec->row = $row; + $rec->horizontal = ($dir == "h" ? 1 : 0); + + $rec->answertext = $word; + $rec->questiontext = $this->m_input_answers[ $word]; + + if( $rec->horizontal) + $key = sprintf( 'h%10d %10d', $rec->row, $rec->col); + else + $key = sprintf( 'v%10d %10d', $rec->col, $rec->row); + + $crossd[ $key] = $rec; + } + if( count( $crossd) > 1){ + ksort( $crossd); + } + + return (count( $crossd) > 0); + } + + function swap( &$a, &$b) + { + $temp = $a; + $a = $b; + $b = $temp; + } + + function displaycross($puzzle, $N20) + { + $N21 = $N20 + 1; + $N22 = $N20 + 2; + $N2222 = $N22 * $N22; + $N2221 = $N2222 - 1; + $N2200 = $N2222 - $N22; + + $ret = ""; + for ($n = 0;; $n ++) { + $c = textlib::substr( $puzzle, $n, 1); + + if (($m = $n % $N22) == 0 or $m == $N21 or $n < $N22 or $n > $N2200) { + $ret .= ""; + } elseif ( $c == '0') { + $ret .= ""; + } elseif ($c == '.') { + $ret .= ""; + } else { + if ((textlib::substr( $puzzle, $n - 1, 1) > '0' or + textlib::substr( $puzzle, $n + 1, 1) > '0') and + (textlib::substr( $puzzle, $n - $N22, 1) > '0' + or textlib::substr( $puzzle, $n + $N22, 1) > '0')) { + $ret .= ""; + } else { + $ret .= ""; + } + } + + if ($n == $N2221) { + return "$ret
        $c$c
        "; + } elseif ($m == $N21) { + $ret .= ""; + } + } + return $ret.''; + } + + + function scan_pos($pos, $dir, $val_blanc, &$puzzle, &$words, &$magics, &$poss, &$cross_pos, &$cross_dir, &$cross_word, $N20) + { + $MAXW = $N20; + + $N22 = $N20 + 2; + $N2222 = $N22 * $N22; + + if ($dir == 'h'){ + $inc = 1; + if ($pos + $inc >= $N2222){ + return false; + } + $oinc = $N22; + $new_dir = 'v'; + }else + { + $inc = $N22; + if ($pos + $inc >= $N2222){ + return false; + } + $oinc = 1; + $new_dir = 'h'; + } + + $regex = textlib::substr( $puzzle, $pos, 1); + if ( ($regex == '0' or $regex == '.') and (! $val_blanc)){ + return false; + } + + if ((textlib::substr( $puzzle, $pos - $inc, 1) > '0')){ + return false; + } + + if ((textlib::substr( $puzzle, $pos + $inc, 1) > '0')){ + return false; + } + + $left = $right = 0; + for ($limit_a = $pos - $inc; ($w = textlib::substr( $puzzle, $limit_a, 1)) !== '0'; $limit_a -= $inc) + { + if ($w == '.' and ((textlib::substr( $puzzle, $limit_a - $oinc, 1) > '0') or (textlib::substr( $puzzle, $limit_a + $oinc, 1) > '0'))){ + break; + } + + if (++$left == $MAXW){ + $left --; + break; + } + + $regex = $w . $regex; + } + + for ($limit_b = $pos + $inc; ($w = textlib::substr( $puzzle, $limit_b, 1)) !== '0'; $limit_b += $inc) + { + if ($w== '.' and ((textlib::substr( $puzzle, $limit_b - $oinc, 1) > '0') or (textlib::substr( $puzzle, $limit_b + $oinc, 1) > '0'))){ + break; + } + + if (++$right == $MAXW){ + $right--; + break; + } + + $regex .= $w; + } + + if (($len_regex = textlib::strlen($regex)) < 2){ + return false; + } + + foreach ($magics[$len_regex] as $m => $lens) + { + $ini = max(0, ($left + 1) - $lens); + $fin = $left; + + $pos_p = max($limit_a + $inc, $pos - (($lens - 1 ) * $inc)); + + for($pos_c = $ini; $pos_c <= $fin; $pos_c++, $pos_p += $inc) + { + if (textlib::substr( $puzzle, $pos_p - $inc, 1) > '0'){ + continue; + } + + $w = textlib::substr($regex, $pos_c, $lens); + + if( !$this->my_preg_match( $w, $words, $word)) + continue; + + $larr0 = $pos_p + ((textlib::strlen( $word) - 2) * $inc); + + if ($larr0 >= $N2222){ + continue; + } + + if (textlib::substr( $puzzle, $larr0, 1) > '0'){ + continue; + } + + $words = str_replace( $word, ';', $words); + + $len = textlib::strlen( $word) ; + for ($n = 1, $pp = $pos_p; $n < $len - 1; $n++, $pp += $inc) + { + $this->setchar( $puzzle, $pp, textlib::substr( $word , $n, 1)); + + if ($pp == $pos) + continue; + + $c = textlib::substr( $puzzle, $pp, 1); + $poss[] = array($pp, $new_dir, ord( $c)); + } + + $cross_pos[] = $pos_p; + $cross_dir[] = ($new_dir == 'h' ? 'v' : 'h'); + $cross_word[] = $word; + + $this->setchar( $puzzle, $pos_p - $inc, '0'); + $this->setchar( $puzzle, $pp, '0'); + + return true; + } + } + + return false; + } + + function my_preg_match( $w, $words, &$word) + { + $a = explode( ";", $words); + $len_w = textlib::strlen( $w); + foreach( $a as $test) + { + if( textlib::strlen( $test) != $len_w) + continue; + + for( $i=0; $i <$len_w; $i++) + { + if( textlib::substr( $w, $i, 1) == '.') + continue; + if( textlib::substr( $w, $i, 1) != textlib::substr( $test, $i, 1) ) + break; + } + if( $i < $len_w) + continue; + $word = ';'.$test.';'; + + return true; + } + return false; + } + + + function setchar( &$s, $pos, $char) + { + $ret = ""; + + if( $pos > 0) + $ret .= textlib::substr( $s, 0, $pos); + + $s = $ret . $char . textlib::substr( $s, $pos+1, textlib::strlen( $s)-$pos-1); + } + + function showhtml_base( $crossm, $crossd, $showsolution, $showhtmlsolutions, $showstudentguess, $context, $game) + { + $this->m_LegendH = array(); + $this->m_LegendV = array(); + + $sRet = "CrosswordWidth = {$crossm->cols};\n"; + $sRet .= "CrosswordHeight = {$crossm->rows};\n"; + + $sRet .= "Words=".count( $crossd).";\n"; + $sWordLength = ""; + $sguess = ""; + $ssolutions = ''; + $shtmlsolutions = ''; + $sWordX = ""; + $sWordY = ""; + $sClue = ""; + $LastHorizontalWord = -1; + $i = -1; + $LegendV = array(); + $LegendH = array(); + + if( $game->glossaryid) + { + $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); + $contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); + } + foreach ($crossd as $rec) + { + if( $rec->horizontal == false and $LastHorizontalWord == -1){ + $LastHorizontalWord = $i; + } + + $i++; + + $sWordLength .= ",".textlib::strlen( $rec->answertext); + if( $rec->questionid != 0) + { + $q = game_filterquestion(str_replace( '\"', '"', $rec->questiontext), $rec->questionid, $context->id, $game->course); + $rec->questiontext = game_repairquestion( $q); + }else + { + //glossary + $q = game_filterglossary(str_replace( '\"', '"', $rec->questiontext), $rec->glossaryentryid, $contextglossary->id, $game->course); + $rec->questiontext = game_repairquestion( $q); + } + + $sClue .= ',"'.game_tojavascriptstring( game_filtertext( $rec->questiontext, 0))."\"\r\n"; + if( $showstudentguess) + $sguess .= ',"'.$rec->studentanswer.'"'; + else + $sguess .= ",''"; + $sWordX .= ",".($rec->col-1); + $sWordY .= ",".($rec->row-1); + if( $showsolution){ + $ssolutions .= ',"'.$rec->answertext.'"'; + }else + { + $ssolutions .= ',""'; + } + + if( $showhtmlsolutions){ + $shtmlsolutions .= ',"'.base64_encode( $rec->answertext).'"'; + } + + $attachment = ''; + //if( game_issoundfile( $rec->attachment)){ + // $attachment = game_showattachment( $rec->attachment); + //} + + $s = $rec->questiontext.$attachment; + if( $rec->horizontal){ + if( array_key_exists( $rec->row, $LegendH)){ + $LegendH[ $rec->row][] = $s; + }else + { + $LegendH[ $rec->row] = array( $s); + } + }else + { + if( array_key_exists( $rec->col, $LegendV)){ + $LegendV[ $rec->col][] = $s; + }else + { + $LegendV[ $rec->col] = array( $s); + } + } + } + + $letters = get_string( 'lettersall', 'game'); + + $this->m_LegendH = array(); + foreach( $LegendH as $key => $value) + { + if( count( $value) == 1) + $this->m_LegendH[ $key] = $value[ 0]; + else + { + for( $i=0; $i < count( $value); $i++) + { + $this->m_LegendH[ $key.textlib::substr( $letters, $i, 1)] = $value[ $i]; + } + } + } + + $this->m_LegendV = array(); + foreach( $LegendV as $key => $value) + { + if( count( $value) == 1) + $this->m_LegendV[ $key] = $value[ 0]; + else + { + for( $i=0; $i < count( $value); $i++) + { + $this->m_LegendV[ $key.textlib::substr( $letters, $i, 1)] = $value[ $i]; + } + } + } + + ksort( $this->m_LegendH); + ksort( $this->m_LegendV); + + $sRet .= "WordLength = new Array( ".textlib::substr( $sWordLength, 1).");\n"; + $sRet .= "Clue = new Array( ".textlib::substr( $sClue, 1).");\n"; + $sguess = str_replace( ' ', '_', $sguess); + $sRet .= "Guess = new Array( ".textlib::substr( $sguess, 1).");\n"; + $sRet .= "Solutions = new Array( ".textlib::substr( $ssolutions, 1).");\n"; + if( $showhtmlsolutions){ + $sRet .= "HtmlSolutions = new Array( ".textlib::substr( $shtmlsolutions, 1).");\n"; + } + $sRet .= "WordX = new Array( ".textlib::substr( $sWordX, 1).");\n"; + $sRet .= "WordY = new Array( ".textlib::substr( $sWordY, 1).");\n"; + $sRet .= "LastHorizontalWord = $LastHorizontalWord;\n"; + + return $sRet; + } + + + function cmp($a, $b) { + return textlib::strlen($b) - textlib::strlen($a); + } + + + function cmp_magic($a, $b) { + return (textlib::strlen($a) + mt_rand(0, 3)) - (textlib::strlen($b) - mt_rand(0, 1)); + } +} diff --git a/cross/crossdb_class.php b/cross/crossdb_class.php new file mode 100644 index 0000000..9aad2c6 --- /dev/null +++ b/cross/crossdb_class.php @@ -0,0 +1,244 @@ +id = $id; + $crossm->sourcemodule = $game->sourcemodule; + + $this->delete_records( $id); + + if (!(game_insert_record( "game_cross", $crossm))){ + print_error( 'Insert page: new page game_cross not inserted'); + } + + foreach( $crossd as $rec) + { + $rec->attemptid = $id; + $rec->questiontext = addslashes( $rec->questiontext); + + $rec->gamekind = $game->gamekind; + $rec->gameid = $game->id; + $rec->userid = $USER->id; + $rec->sourcemodule = $game->sourcemodule; + + if (!$DB->insert_record( 'game_queries', $rec)){ + print_error( 'Insert page: new page game_queries not inserted'); + } + game_update_repetitions($game->id, $USER->id, $rec->questionid, $rec->glossaryentryid); + } + + return true; + } + + function delete_records( $id) + { + global $DB; + + if( !$DB->delete_records( 'game_queries', array( 'attemptid' => $id))){ + print_error( "Can't delete from game_queries attemptid=$id"); + } + if( !$DB->delete_records( 'game_cross', array( 'id' => $id))){ + print_error( "Can't delete from game_cross id=$id"); + } + } + + + function loadcross( $g, &$done, &$html, $game, $attempt, $crossrec, $onlyshow, $showsolution, &$finishattempt, $showhtmlsolutions, &$language, $showstudentguess, $context) + { + global $DB; + + $info = ''; + $correctLetters = 0; + $allLetters = 0; + $wrongLetters = 0; + $html = ''; + $done = false; + + if( $g == ""){ + $game_questions = false; + } + + $this->m_mincol = $this->m_minrow = 0; + $this->m_maxcol = $crossrec->cols; + $this->m_maxrow = $crossrec->rows; + + if( $g == ""){ + $g = str_repeat( ' ', $this->m_maxcol * $this->m_maxrow); + } + + $load = false; + + $puzzle = str_repeat('.', $this->m_maxrow * $this->m_maxcol); + if ($recs = $DB->get_records( 'game_queries', array( 'attemptid' => $crossrec->id))) + { + $a = array(); + foreach ($recs as $rec) + { + if( $rec->horizontal) + $key = sprintf( 'h%10d %10d', $rec->row, $rec->col); + else + $key = sprintf( 'v%10d %10d', $rec->col, $rec->row); + + $a[ $key] = $rec; + } + + ksort( $a); + $b = array(); + $correctletters = $wrongletters = $restletters = 0; + + foreach( $a as $rec){ + $this->updatecrossquestions( $rec, $g, $pos, $correctletters, $wrongletters, $restletters, $game, $attempt, $crossrec); + $b[] = $rec; + + if( ($rec->col != 0) and ($rec->row != 0)){ + $load = true; + } + if( $language == ''){ + $language = game_detectlanguage( $rec->answertext); + } + } + $info = $this->game_cross_computecheck( $correctletters, $wrongletters, $restletters, $game, $attempt, $done, $onlyshow, $showsolution, $finishattempt); + $html = $this->showhtml_base( $crossrec, $b, $showsolution, $showhtmlsolutions, $showstudentguess, $context, $game); + } + + if( $load == false) + { + $finishattempt = true; + } + + return $info; + } + +function game_cross_computecheck( $correctletters, $wrongletters, $restletters, $game, $attempt, &$done, $onlyshow, $showsolution, $finishattempt) +{ + $ret = ''; + + if( $correctletters == 0 and $wrongletters == 0){ + return $ret; + } + + $and = get_string( 'and', 'game'); + + $a = array(); + if( $correctletters) + $a[] = $correctletters.' '.( $correctletters > 1 ? get_string( 'cross_corrects', 'game') :get_string( 'cross_correct', 'game')); + if( $wrongletters) + $a[] = $wrongletters.' '.( $wrongletters > 1 ? get_string( 'cross_errors', 'game') : get_string( 'cross_error', 'game')); + + if( $correctletters > 1 or $wrongletters > 1) { + $ret = get_string( 'cross_found_many', 'game'); + }else + { + $ret = get_string( 'cross_found_one', 'game'); + } + + $i = 0; + foreach( $a as $msg) + { + $i++; + + if( $i == 1){ + $ret .= ' '.$msg; + }else if( $i == count($a)) + { + $ret .= ' '.get_string( 'and', 'game').' '.$msg; + }else + { + $ret .= ', '.$msg; + } + } + + $done = ( $restletters == 0 ? true : false); + + if( $finishattempt == false){ + if( $onlyshow or $showsolution){ + return $ret; + } + }else{ + $done = 1; + } + + $grade = $correctletters / ($correctletters + $restletters); + $ret .= '
        '.get_string( 'grade', 'game').' '.round( $grade * 100).' %'; + + game_updateattempts( $game, $attempt, $grade, $done); + + return $ret; +} + + //rec is a record of cross_questions + function updatecrossquestions( &$rec, &$g, &$pos, &$correctletters, &$wrongletters, &$restletters, $game, $attempt, $crossrec) + { + global $DB, $USER; + + $word = $rec->answertext; + $len = textlib::strlen( $word); + $guess = textlib::substr( $g, $pos, $len); + $len_guess = textlib::strlen( $guess);; + $pos += $len; + + $is_empty = true; + for($i = 0; $i < $len; $i++) + { + if( $i < $len_guess) + $letterguess = textlib::substr( $guess, $i, 1); + else + $letterguess = " "; + + if( $letterguess != ' ') + $is_empty = false; + + $letterword= textlib::substr( $word, $i, 1); + if( $letterword != $letterguess) + { + if( ($letterguess != ' ' and $letterguess != '_') or ($letterword == ' ')){ + $wrongletters++; + } + game_setchar( $guess, $i, '_'); + $restletters++; + }else if( $letterguess == ' '){ + if( $guess == $word){ + $correctletters++; + }else + { + $wrongletters++; + game_setchar( $guess, $i, '_'); + } + }else + { + $correctletters++; + } + } + + if( $is_empty){ + return; + } + if( ($rec->studentanswer == $guess )){ + return; + } + + $rec->studentanswer = $guess; + + $updrec = new stdClass(); + $updrec->studentanswer = $guess; + $updrec->id = $rec->id; + if (!$DB->update_record( 'game_queries', $updrec, $rec->id)){ + print_error( 'Update game_queries: not updated'); + } + + $score = $correctletters / $len; + game_update_queries( $game, $attempt, $rec, $score, $guess); + } +} + diff --git a/cross/play.php b/cross/play.php new file mode 100644 index 0000000..c669ebb --- /dev/null +++ b/cross/play.php @@ -0,0 +1,1128 @@ +id, $crossm); + game_updateattempts( $game, $attempt, 0, 0); + return game_cross_play( $id, $game, $attempt, $crossm, '', false, false, false, false, false, false, false, true, $context); +} + +function game_cross_new( $game, $attemptid, &$crossm) +{ + global $DB, $USER; + + $cross = new CrossDB(); + + $questions = array(); + $infos = array(); + + $answers = array(); + $recs = game_questions_shortanswer( $game); + if( $recs == false){ + print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); + } + $infos = array(); + $reps = array(); + foreach( $recs as $rec){ + if( $game->param7 == false){ + if( textlib::strpos( $rec->answertext, ' ')){ + continue; //spaces not allowed + } + } + + $rec->answertext = game_upper( $rec->answertext); + $answers[ $rec->answertext] = game_repairquestion( $rec->questiontext); + $infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid, $rec->attachment); + + $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + $reps[ $rec->answertext] = $rec2->r; + } + } + + $cross->setwords( $answers, $game->param1, $reps); + + //game->param2 is maximum words in crossword + if( $cross->computedata( $crossm, $crossd, $lettets, $game->param2)){ + $new_crossd = array(); + foreach( $crossd as $rec) + { + $info = $infos[ $rec->answertext]; + if( $info != false){ + $rec->sourcemodule = $info[ 0]; + $rec->questionid = $info[ 1]; + $rec->glossaryentryid = $info[ 2]; + $rec->attachment = $info[ 3]; + } + $new_crossd[] = $rec; + } + $cross->savecross( $game, $crossm, $new_crossd, $attemptid); + } + + if( count( $crossd) == 0){ + print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); + } +} + +function showlegend( $legend, $title) +{ + if( count( $legend) == 0) + return; + + echo "
        $title
        "; + foreach( $legend as $key => $line) + echo game_filtertext( "$key: $line
        ", 0); +} + +function game_cross_play( $id, $game, $attempt, $crossrec, $g, $onlyshow, $showsolution, $endofgame, $print, $checkbutton, $showhtmlsolutions, $showhtmlprintbutton,$showstudentguess, $context) +{ + global $CFG, $DB; + + $cross = new CrossDB(); + + $language = $attempt->language; + $info = $cross->loadcross( $g, $done, $html, $game, $attempt, $crossrec, $onlyshow, $showsolution, $endofgame, $showhtmlsolutions, $attempt->language,$showstudentguess, $context); + + if( $language != $attempt->language){ + if( !$DB->set_field( 'game_attempts', 'language', $attempt->language, array( 'id' => $attempt->id))){ + print_error( "game_cross_play: Can't set language"); + } + } + + if( $done or $endofgame){ + if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { + print_error("Course Module ID was incorrect id=$id"); + } + + if( $endofgame == false){ + echo ''.get_string( 'win', 'game').'
        '; + } + echo '
        '; + echo "wwwroot}/mod/game/attempt.php?id=$id&forcenew=1\">".get_string( 'nextgame', 'game').'         '; + }else if( $info != ''){ + echo "
        $info
        "; + } + + if( $attempt->language != '') + $wordrtl = game_right_to_left( $attempt->language); + else + $wordrtl = right_to_left(); + $reverseprint = ($wordrtl != right_to_left()); + if( $reverseprint) + $textdir = 'dir="'.($wordrtl ? 'rtl' : 'ltr').'"'; + else + $textdir = ''; + +?> + + + + +'; +}else{ + echo ''; +} + + if( $game->toptext != ''){ + echo $game->toptext.'
        '; + } +?> + +

        + +
        + This interactive crossword puzzle requires JavaScript and a reasonably recent web browser, such as Internet Explorer 5.5 + or later, Netscape 7, Mozilla, Firefox, or Safari. If you have disabled web page scripting, please re-enable it and refresh + the page. +
        + + +

        + +param3 == 2){ + echo "\r\n"; + game_cross_show_welcome( $game); + echo "\r\n"; + echo "\r\n"; + } +?> + + + + +param3 == 2){ + echo ''; + game_cross_show_legends( $cross); + }else{ + game_cross_show_welcome( $game); + } +?> + +
         
        > + + + +     
        + + +'; + + echo ''; + + echo '     '; + + echo '     '; + + echo "

        \r\n"; + } + + if( $showhtmlsolutions or $showhtmlprintbutton){ + echo '
        '; + } + + if( $showhtmlsolutions){ + echo ''; + } + + if( $showhtmlprintbutton){ + if( $showhtmlsolutions){ + echo "    "; + } + echo ''; + } + + if( $game->param3 == 2){ + echo '     '; + game_cross_show_welcome( $game); + }else{ + game_cross_show_legends( $cross); + } + + if( $game->bottomtext != ''){ + echo '

        '.$game->bottomtext; + } + + +if( $attempt != false){ + if( $attempt->timefinish == 0 and $endofgame == 0) + { + ?> + + + + + + + +param3 <> 2){ + game_cross_show_welcome0( $game); + }else{ + game_cross_show_welcome1(); + } + +} + +function game_cross_show_welcome0( $game){ +?> + + + + + + + + + + + + + + + + + + + +'; + ShowLegend( $cross->m_LegendH, get_string( 'cross_across', 'game')); + ShowLegend( $cross->m_LegendV, get_string( 'cross_down', 'game')); + echo ''; +} diff --git a/cryptex/cryptexdb_class.php b/cryptex/cryptexdb_class.php new file mode 100644 index 0000000..d2d3ea4 --- /dev/null +++ b/cryptex/cryptexdb_class.php @@ -0,0 +1,229 @@ +id = $id; + + $newrec = new stdClass(); + $newrec->id = $id; + $newrec->letters = $letters; + + if (!($cryptexid = game_insert_record( "game_cryptex", $newrec))){ + print_error( 'Insert page: new page game_cryptex not inserted'); + } + + return $newrec; + } + + + function computeletters( $crossm, $crossd) + { + $letters = ''; + $cols = $crossm->cols + 1; + $letters = str_repeat('.', $crossm->cols).'#'; + $letters = str_repeat($letters, $crossm->rows) ; + + $freqs1 = array(); + $count1 = $count2 = 0; + foreach( $crossd as $rec) + { + $pos = $rec->col - 1 + ($rec->row-1) * $cols; + $s = $rec->answertext; + $len = textlib::strlen( $s); + + $a = array(); + for( $i=0; $i < $len; $i++){ + $a[] = textlib::substr( $s, $i, 1); + } + + for( $i=0; $i < $len; $i++){ + $this->setchar( $letters, $pos, $a[ $i]); + $pos += ( $rec->horizontal ? 1 : $cols); + + $freqs1[ ++$count1] = $a[ $i]; + if( $i+1 < $len){ + $freqs2[ ++$count2] = $a[ $i].$a[ $i+1]; + } + } + } + + $len = textlib::strlen( $letters); + $spaces = 0; + for( $i=0; $i < $len; $i++){ + if( textlib::substr( $letters, $i, 1) == '.'){ + $spaces++; + } + } + + $step = 1; + while( $spaces) + { + if( $step == 1){ + $step = 2; + $i = array_rand( $freqs1); + $this->insertchar( $letters, $crossm->cols, $crossm->rows, $freqs1[ $i], $spaces); + }else + { + $step=1; + $i = array_rand( $freqs2); + $this->insertchars( $letters, $crossm->cols, $crossm->rows, $freqs2[ $i], $spaces); + } + } + + $ret_letters = ""; + for( $row=0; $row < $crossm->rows; $row++){ + $ret_letters .= textlib::substr( $letters, $cols * $row, ($cols-1)); + } + + + return $ret_letters; + } + + function displaycryptex( $cols, $rows, $letters, $mask, $showsolution, $textdir) + { + echo ""; + for( $row=0; $row < $rows; $row++) + { + echo ""; + for( $col=0; $col < $cols; $col++){ + $pos = $cols * $row+$col; + $c = textlib::substr( $letters, $pos, 1); + $m = textlib::substr( $mask, $pos, 1); + + if( $showsolution and $m > '0'){ + echo ""; + }else if( $m == '1'){ + echo ""; + }else + { + echo ""; + } + } + echo "\r\n"; + } + echo "
        ".$c."".$c."".$c."
        "; + } + + function insertchar( &$letters, $cols, $rows, $char, &$spaces) + { + $len = textlib::strlen( $letters); + for( $i=0; $i < $len; $i++){ + if( textlib::substr( $letters, $i, 1) == '.'){ + $this->setchar( $letters, $i, $char); + $spaces--; + return; + } + } + } + + function insertchars( &$letters, $cols, $rows, $char, &$spaces) + { + $len = textlib::strlen( $letters); + for( $i=0; $i < $len; $i++){ + if( textlib::substr( $letters, $i, 1) == '.' and textlib::substr( $letters, $i+1, 1) == '.' ){ + $this->setchar( $letters, $i, textlib::substr( $char, 0, 1)); + $this->setchar( $letters, $i+1, textlib::substr( $char, 1, 1)); + $spaces-=2; + return true; + } + if( textlib::substr( $letters, $i, 1) == '.' and textlib::substr( $letters, $i+$cols+1, 1) == '.' ){ + $this->setchar( $letters, $i, textlib::substr( $char, 0, 1)); + $this->setchar( $letters, $i + $cols+1, textlib::substr( $char, 1, 1)); + $spaces-=2; + return true; + } + } + + return false; + } + + function gethash( $word) + { + $x = 37; + $len = count( textlib::strlen( $word)); + + for($i=0; $i < $len; $i++){ + $x = $x xor ord( textlib::substr( $word, $i, 1)); + } + + return $x; + } + + function loadcryptex( $crossm, &$mask, &$corrects, &$language) + { + global $DB; + + $questions = array(); + $corrects = array(); + + $mask = str_repeat( '0', $crossm->cols * $crossm->rows); + + if ($recs = $DB->get_records( 'game_queries', array( 'attemptid' => $crossm->id))) + { + foreach ($recs as $rec) + { + if( $rec->questiontext == ''){ + $rec->questiontext = ' '; + } + $key = $this->gethash( $rec->questiontext).'-'.$rec->answertext.'-'.$rec->id; + $questions[ $key] = $rec; + + $word = $rec->answertext; + $pos = $crossm->cols * ($rec->row-1)+($rec->col-1); + $len = textlib::strlen( $word); + $found = ($rec->answertext == $rec->studentanswer); + + for( $i=0; $i < $len; $i++) + { + $c = ( $found ? '1' : '2'); + + if( textlib::substr( $mask, $pos, 1) != '1'){ + game_setchar( $mask, $pos, $c); + } + + $pos += ($rec->horizontal ? 1 : $crossm->cols); + } + + if( $found){ + $corrects[ $rec->id] = 1; + } + + if( $language == ''){ + $language = game_detectlanguage( $rec->answertext); + } + } + ksort( $questions); + } + + return $questions; + } + + + function setwords( $answers, $maxcols, $reps) + { + return Cross::setwords( $answers, $maxcols, $reps); + } + + function computedata( &$crossm, &$crossd, &$letters, $maxwords) + { + if( !cross::computedata( $crossm, $crossd, $letters, $maxwords)){ + return false; + } + + $letters = $this->computeletters( $crossm, $crossd); + + return true; + } +} + + diff --git a/cryptex/play.php b/cryptex/play.php new file mode 100644 index 0000000..7603957 --- /dev/null +++ b/cryptex/play.php @@ -0,0 +1,332 @@ +get_record( 'game_cross', array( 'id' => $attempt->id)); + return game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, false, false, false, $context); + } + + if( $attempt === false){ + $attempt = game_addattempt( $game); + } + + $cryptex = new CryptexDB(); + + $questions = array(); + $infos = array(); + + $answers = array(); + $recs = game_questions_shortanswer( $game); + if( $recs == false){ + print_error( get_string( 'no_words', 'game')); + } + + $infos = array(); + $reps = array(); + foreach( $recs as $rec){ + if( $game->param7 == false){ + if( textlib::strpos( $rec->answertext, ' ')){ + continue; //spaces not allowed + } + } + + $rec->answertext = game_upper( $rec->answertext); + $answers[ $rec->answertext] = game_repairquestion( $rec->questiontext); + $infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid); + + $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + $reps[ $rec->answertext] = $rec2->r; + } + } + + $cryptex->setwords( $answers, $game->param1, $reps); + + if( $cryptex->computedata( $crossm, $crossd, $letters, $game->param2)){ + $new_crossd = array(); + foreach( $crossd as $rec) + { + if( array_key_exists( $rec->answertext, $infos)){ + $info = $infos[ $rec->answertext]; + + $rec->id = 0; + $rec->sourcemodule = $info[ 0]; + $rec->questionid = $info[ 1]; + $rec->glossaryentryid = $info[ 2]; + } + game_update_queries( $game, $attempt, $rec, 0, ''); + $new_crossd[] = $rec; + } + $cryptexrec = $cryptex->savecryptex( $game, $crossm, $new_crossd, $attempt->id, $letters); + } + + game_updateattempts( $game, $attempt, 0, 0); + + return game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, false, false, false, $context); +} + +function cryptex_showlegend( $legend, $title) +{ + if( count( $legend) == 0) + return; + + echo "
        $title
        "; + foreach( $legend as $key => $line) + echo "$key: $line
        "; +} + + +//q means game_queries.id +function game_cryptex_check( $id, $game, $attempt, $cryptexrec, $q, $answer, $context) +{ + global $DB; + + if( $attempt === false){ + game_cryptex_continue( $id, $game, $attempt, $cryptexrec, false); + return; + } + + $crossm = $DB->get_record_select( 'game_cross', "id=$attempt->id"); + $query = $DB->get_record_select( 'game_queries', "id=$q"); + + $answer1 = trim( game_upper( $query->answertext)); + $answer2 = trim( game_upper( $answer)); + + $len1 = textlib::strlen( $answer1); + $len2 = textlib::strlen( $answer2); + $equal = ( $len1 == $len2); + if( $equal){ + for( $i=0; $i < $len1; $i++) + { + if( textlib::substr( $answer1, $i, 1) != textlib::substr( $answer2, $i, 1)) + { + $equal = true; + break; + } + } + } + if( $equal == false) + { + game_update_queries( $game, $attempt, $query, 0, $answer2, true); + game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, true, false, false, $context); + return; + } + + game_update_queries( $game, $attempt, $query, 1, $answer2); + + $onlyshow=false; + $showsolution=false; + game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, true, $onlyshow, $showsolution, $context); +} + +function game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, $updateattempt=false, $onlyshow=false, $showsolution=false, $context) +{ + global $DB; + + global $CFG; + + if( $game->toptext != ''){ + echo $game->toptext.'
        '; + } + + echo '
        '; + + $cryptex = new CryptexDB(); + $language = $attempt->language; + $questions = $cryptex->loadcryptex( $crossm, $mask, $corrects, $attempt->language); + + if( $language != $attempt->language){ + if( !$DB->set_field( 'game_attempts', 'language', $attempt->language, array( 'id' => $attempt->id))){ + print_error( "game_cross_play: Can't set language"); + } + } + + if( $attempt->language != '') + $wordrtl = game_right_to_left( $attempt->language); + else + $wordrtl = right_to_left(); + $reverseprint = ($wordrtl != right_to_left()); + if( $reverseprint) + $textdir = 'dir="'.($wordrtl ? 'rtl' : 'ltr').'"'; + else + $textdir = ''; + + $len = textlib::strlen( $mask); + + //count1 means there is a guested letter + //count2 means there is a letter that not guessed + $count1 = $count2 = 0; + for($i=0; $i < $len; $i++) + { + $c = textlib::substr( $mask, $i, 1); + if( $c == '1'){ + $count1++; + }else if( $c == '2') + { + $count2++; + } + } + if( $count1 + $count2 == 0){ + $gradeattempt = 0; + }else + { + $gradeattempt = $count1 / ($count1 + $count2); + } + $finished = ($count2 == 0); + + if( ($finished === false) && ($game->param8 > 0)) + { + $found = false; + foreach ( $questions as $q) + { + if ( $q->tries < $game->param8) + $found = true; + } + if( $found == false) + $finished = true; //rich max tries + } + + if( $updateattempt){ + game_updateattempts( $game, $attempt, $gradeattempt, $finished); + } + + if( ($onlyshow == false) and ($showsolution == false)){ + if( $finished){ + game_cryptex_onfinished( $id, $game, $attempt, $cryptexrec); + } + } + +?> + +'; + echo ''; + $cryptex->displaycryptex( $crossm->cols, $crossm->rows, $cryptexrec->letters, $mask, $showsolution, $textdir); +?> + + +  + + +
        +
        ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1000}).css(a(this).offset()).appendTo("body")})},stop:function(b,c){a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});a.ui.plugin.add("draggable","opacity",{start:function(c,d){var b=a(d.helper),e=a(this).data("draggable").options;if(b.css("opacity")){e._opacity=b.css("opacity")}b.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;if(d._opacity){a(c.helper).css("opacity",d._opacity)}}});a.ui.plugin.add("draggable","scroll",{start:function(c,d){var b=a(this).data("draggable");if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){b.overflowOffset=b.scrollParent.offset()}},drag:function(d,e){var c=a(this).data("draggable"),f=c.options,b=false;if(c.scrollParent[0]!=document&&c.scrollParent[0].tagName!="HTML"){if(!f.axis||f.axis!="x"){if((c.overflowOffset.top+c.scrollParent[0].offsetHeight)-d.pageY=0;v--){var s=g.snapElements[v].left,n=s+g.snapElements[v].width,m=g.snapElements[v].top,A=m+g.snapElements[v].height;if(!((s-y=p&&n<=k)||(m>=p&&m<=k)||(nk))&&((e>=g&&e<=c)||(d>=g&&d<=c)||(ec));break;default:return false;break}};a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,g){var b=a.ui.ddmanager.droppables[e.options.scope];var f=g?g.type:null;var h=(e.currentItem||e.element).find(":data(droppable)").andSelf();droppablesLoop:for(var d=0;d
        ').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f
        ');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e
      ');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;/* + * jQuery UI Selectable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.selectable",a.extend({},a.ui.mouse,{_init:function(){var b=this;this.element.addClass("ui-selectable");this.dragged=false;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]);c.each(function(){var d=a(this);var e=d.offset();a.data(this,"selectable-item",{element:this,$element:d,left:e.left,top:e.top,right:e.left+d.outerWidth(),bottom:e.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=c.addClass("ui-selectee");this._mouseInit();this.helper=a(document.createElement("div")).css({border:"1px dotted black"}).addClass("ui-selectable-helper")},destroy:function(){this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy()},_mouseStart:function(d){var b=this;this.opos=[d.pageX,d.pageY];if(this.options.disabled){return}var c=this.options;this.selectees=a(c.filter,this.element[0]);this._trigger("start",d);a(c.appendTo).append(this.helper);this.helper.css({"z-index":100,position:"absolute",left:d.clientX,top:d.clientY,width:0,height:0});if(c.autoRefresh){this.refresh()}this.selectees.filter(".ui-selected").each(function(){var e=a.data(this,"selectable-item");e.startselected=true;if(!d.metaKey){e.$element.removeClass("ui-selected");e.selected=false;e.$element.addClass("ui-unselecting");e.unselecting=true;b._trigger("unselecting",d,{unselecting:e.element})}});a(d.target).parents().andSelf().each(function(){var e=a.data(this,"selectable-item");if(e){e.$element.removeClass("ui-unselecting").addClass("ui-selecting");e.unselecting=false;e.selecting=true;e.selected=true;b._trigger("selecting",d,{selecting:e.element});return false}})},_mouseDrag:function(i){var c=this;this.dragged=true;if(this.options.disabled){return}var e=this.options;var d=this.opos[0],h=this.opos[1],b=i.pageX,g=i.pageY;if(d>b){var f=b;b=d;d=f}if(h>g){var f=g;g=h;h=f}this.helper.css({left:d,top:h,width:b-d,height:g-h});this.selectees.each(function(){var j=a.data(this,"selectable-item");if(!j||j.element==c.element[0]){return}var k=false;if(e.tolerance=="touch"){k=(!(j.left>b||j.rightg||j.bottomd&&j.righth&&j.bottom=0;b--){this.items[b].item.removeData("sortable-item")}},_mouseCapture:function(e,f){if(this.reverting){return false}if(this.options.disabled||this.options.type=="static"){return false}this._refreshItems(e);var d=null,c=this,b=a(e.target).parents().each(function(){if(a.data(this,"sortable-item")==c){d=a(this);return false}});if(a.data(e.target,"sortable-item")==c){d=a(e.target)}if(!d){return false}if(this.options.handle&&!f){var g=false;a(this.options.handle,d).find("*").andSelf().each(function(){if(this==e.target){g=true}});if(!g){return false}}this.currentItem=d;this._removeCurrentsFromItems();return true},_mouseStart:function(e,f,b){var g=this.options,c=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(e);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");a.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(e);this.originalPageX=e.pageX;this.originalPageY=e.pageY;if(g.cursorAt){this._adjustOffsetFromHelper(g.cursorAt)}this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};if(this.helper[0]!=this.currentItem[0]){this.currentItem.hide()}this._createPlaceholder();if(g.containment){this._setContainment()}if(g.cursor){if(a("body").css("cursor")){this._storedCursor=a("body").css("cursor")}a("body").css("cursor",g.cursor)}if(g.opacity){if(this.helper.css("opacity")){this._storedOpacity=this.helper.css("opacity")}this.helper.css("opacity",g.opacity)}if(g.zIndex){if(this.helper.css("zIndex")){this._storedZIndex=this.helper.css("zIndex")}this.helper.css("zIndex",g.zIndex)}if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){this.overflowOffset=this.scrollParent.offset()}this._trigger("start",e,this._uiHash());if(!this._preserveHelperProportions){this._cacheHelperProportions()}if(!b){for(var d=this.containers.length-1;d>=0;d--){this.containers[d]._trigger("activate",e,c._uiHash(this))}}if(a.ui.ddmanager){a.ui.ddmanager.current=this}if(a.ui.ddmanager&&!g.dropBehaviour){a.ui.ddmanager.prepareOffsets(this,e)}this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(e);return true},_mouseDrag:function(f){this.position=this._generatePosition(f);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs){this.lastPositionAbs=this.positionAbs}if(this.options.scroll){var g=this.options,b=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if((this.overflowOffset.top+this.scrollParent[0].offsetHeight)-f.pageY=0;d--){var e=this.items[d],c=e.item[0],h=this._intersectsWithPointer(e);if(!h){continue}if(c!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=c&&!a.ui.contains(this.placeholder[0],c)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],c):true)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(e)){this._rearrange(f,e)}else{break}this._trigger("change",f,this._uiHash());break}}this._contactContainers(f);if(a.ui.ddmanager){a.ui.ddmanager.drag(this,f)}this._trigger("sort",f,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(c,d){if(!c){return}if(a.ui.ddmanager&&!this.options.dropBehaviour){a.ui.ddmanager.drop(this,c)}if(this.options.revert){var b=this;var e=b.placeholder.offset();b.reverting=true;a(this.helper).animate({left:e.left-this.offset.parent.left-b.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-b.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){b._clear(c)})}else{this._clear(c,d)}return false},cancel:function(){var b=this;if(this.dragging){this._mouseUp();if(this.options.helper=="original"){this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else{this.currentItem.show()}for(var c=this.containers.length-1;c>=0;c--){this.containers[c]._trigger("deactivate",null,b._uiHash(this));if(this.containers[c].containerCache.over){this.containers[c]._trigger("out",null,b._uiHash(this));this.containers[c].containerCache.over=0}}}if(this.placeholder[0].parentNode){this.placeholder[0].parentNode.removeChild(this.placeholder[0])}if(this.options.helper!="original"&&this.helper&&this.helper[0].parentNode){this.helper.remove()}a.extend(this,{helper:null,dragging:false,reverting:false,_noFinalSort:null});if(this.domPosition.prev){a(this.domPosition.prev).after(this.currentItem)}else{a(this.domPosition.parent).prepend(this.currentItem)}return true},serialize:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};a(b).each(function(){var e=(a(d.item||this).attr(d.attribute||"id")||"").match(d.expression||(/(.+)[-=_](.+)/));if(e){c.push((d.key||e[1]+"[]")+"="+(d.key&&d.expression?e[1]:e[2]))}});return c.join("&")},toArray:function(d){var b=this._getItemsAsjQuery(d&&d.connected);var c=[];d=d||{};b.each(function(){c.push(a(d.item||this).attr(d.attribute||"id")||"")});return c},_intersectsWith:function(m){var e=this.positionAbs.left,d=e+this.helperProportions.width,k=this.positionAbs.top,j=k+this.helperProportions.height;var f=m.left,c=f+m.width,n=m.top,i=n+m.height;var o=this.offset.click.top,h=this.offset.click.left;var g=(k+o)>n&&(k+o)f&&(e+h)m[this.floating?"width":"height"])){return g}else{return(f0?"down":"up")},_getDragHorizontalDirection:function(){var b=this.positionAbs.left-this.lastPositionAbs.left;return b!=0&&(b>0?"right":"left")},refresh:function(b){this._refreshItems(b);this.refreshPositions()},_connectWith:function(){var b=this.options;return b.connectWith.constructor==String?[b.connectWith]:b.connectWith},_getItemsAsjQuery:function(b){var l=this;var g=[];var e=[];var h=this._connectWith();if(h&&b){for(var d=h.length-1;d>=0;d--){var k=a(h[d]);for(var c=k.length-1;c>=0;c--){var f=a.data(k[c],"sortable");if(f&&f!=this&&!f.options.disabled){e.push([a.isFunction(f.options.items)?f.options.items.call(f.element):a(f.options.items,f.element).not(".ui-sortable-helper"),f])}}}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper"),this]);for(var d=e.length-1;d>=0;d--){e[d][0].each(function(){g.push(this)})}return a(g)},_removeCurrentsFromItems:function(){var d=this.currentItem.find(":data(sortable-item)");for(var c=0;c=0;e--){var m=a(l[e]);for(var d=m.length-1;d>=0;d--){var g=a.data(m[d],"sortable");if(g&&g!=this&&!g.options.disabled){f.push([a.isFunction(g.options.items)?g.options.items.call(g.element[0],b,{item:this.currentItem}):a(g.options.items,g.element),g]);this.containers.push(g)}}}}for(var e=f.length-1;e>=0;e--){var k=f[e][1];var c=f[e][0];for(var d=0,n=c.length;d=0;d--){var e=this.items[d];if(e.instance!=this.currentContainer&&this.currentContainer&&e.item[0]!=this.currentItem[0]){continue}var c=this.options.toleranceElement?a(this.options.toleranceElement,e.item):e.item;if(!b){e.width=c.outerWidth();e.height=c.outerHeight()}var f=c.offset();e.left=f.left;e.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers){this.options.custom.refreshContainers.call(this)}else{for(var d=this.containers.length-1;d>=0;d--){var f=this.containers[d].element.offset();this.containers[d].containerCache.left=f.left;this.containers[d].containerCache.top=f.top;this.containers[d].containerCache.width=this.containers[d].element.outerWidth();this.containers[d].containerCache.height=this.containers[d].element.outerHeight()}}},_createPlaceholder:function(d){var b=d||this,e=b.options;if(!e.placeholder||e.placeholder.constructor==String){var c=e.placeholder;e.placeholder={element:function(){var f=a(document.createElement(b.currentItem[0].nodeName)).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!c){f.style.visibility="hidden"}return f},update:function(f,g){if(c&&!e.forcePlaceholderSize){return}if(!g.height()){g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10))}if(!g.width()){g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=a(e.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);e.placeholder.update(b,b.placeholder)},_contactContainers:function(d){for(var c=this.containers.length-1;c>=0;c--){if(this._intersectsWith(this.containers[c].containerCache)){if(!this.containers[c].containerCache.over){if(this.currentContainer!=this.containers[c]){var h=10000;var g=null;var e=this.positionAbs[this.containers[c].floating?"left":"top"];for(var b=this.items.length-1;b>=0;b--){if(!a.ui.contains(this.containers[c].element[0],this.items[b].item[0])){continue}var f=this.items[b][this.containers[c].floating?"left":"top"];if(Math.abs(f-e)this.containment[2]){d=this.containment[2]+this.offset.click.left}if(e.pageY-this.offset.click.top>this.containment[3]){c=this.containment[3]+this.offset.click.top}}if(h.grid){var g=this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1];c=this.containment?(!(g-this.offset.click.topthis.containment[3])?g:(!(g-this.offset.click.topthis.containment[2])?f:(!(f-this.offset.click.left=0;c--){if(a.ui.contains(this.containers[c].element[0],this.currentItem[0])&&!e){f.push((function(g){return function(h){g._trigger("receive",h,this._uiHash(this))}}).call(this,this.containers[c]));f.push((function(g){return function(h){g._trigger("update",h,this._uiHash(this))}}).call(this,this.containers[c]))}}}for(var c=this.containers.length-1;c>=0;c--){if(!e){f.push((function(g){return function(h){g._trigger("deactivate",h,this._uiHash(this))}}).call(this,this.containers[c]))}if(this.containers[c].containerCache.over){f.push((function(g){return function(h){g._trigger("out",h,this._uiHash(this))}}).call(this,this.containers[c]));this.containers[c].containerCache.over=0}}if(this._storedCursor){a("body").css("cursor",this._storedCursor)}if(this._storedOpacity){this.helper.css("opacity",this._storedOpacity)}if(this._storedZIndex){this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex)}this.dragging=false;if(this.cancelHelperRemoval){if(!e){this._trigger("beforeStop",d,this._uiHash());for(var c=0;c *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1000}})})(jQuery);;/* + * jQuery UI Accordion 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Accordion + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.accordion",{_init:function(){var d=this.options,b=this;this.running=0;if(d.collapsible==a.ui.accordion.defaults.collapsible&&d.alwaysOpen!=a.ui.accordion.defaults.alwaysOpen){d.collapsible=!d.alwaysOpen}if(d.navigation){var c=this.element.find("a").filter(d.navigationFilter);if(c.length){if(c.filter(d.header).length){this.active=c}else{this.active=c.parent().parent().prev();c.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(d.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){a(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||d.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");a("").addClass("ui-icon "+d.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(d.icons.header).toggleClass(d.icons.headerSelected);if(a.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(e){return b._keydown(e)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!a.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(d.event){this.headers.bind((d.event)+".accordion",function(e){return b._clickHandler.call(b,e,this)})}},destroy:function(){var c=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(c.autoHeight||c.fillHeight){b.css("height","")}},_setData:function(b,c){if(b=="alwaysOpen"){b="collapsible";c=!c}a.widget.prototype._setData.apply(this,arguments)},_keydown:function(e){var g=this.options,f=a.ui.keyCode;if(g.disabled||e.altKey||e.ctrlKey){return}var d=this.headers.length;var b=this.headers.index(e.target);var c=false;switch(e.keyCode){case f.RIGHT:case f.DOWN:c=this.headers[(b+1)%d];break;case f.LEFT:case f.UP:c=this.headers[(b-1+d)%d];break;case f.SPACE:case f.ENTER:return this._clickHandler({target:e.target},e.target)}if(c){a(e.target).attr("tabIndex","-1");a(c).attr("tabIndex","0");c.focus();return false}return true},resize:function(){var e=this.options,d;if(e.fillSpace){if(a.browser.msie){var b=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}d=this.element.parent().height();if(a.browser.msie){this.element.parent().css("overflow",b)}this.headers.each(function(){d-=a(this).outerHeight()});var c=0;this.headers.next().each(function(){c=Math.max(c,a(this).innerHeight()-a(this).height())}).height(Math.max(0,d-c)).css("overflow","auto")}else{if(e.autoHeight){d=0;this.headers.next().each(function(){d=Math.max(d,a(this).outerHeight())}).height(d)}}},activate:function(b){var c=this._findActive(b)[0];this._clickHandler({target:c},c)},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===false?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,f){var d=this.options;if(d.disabled){return false}if(!b.target&&d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var h=this.active.next(),e={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:h},c=(this.active=a([]));this._toggle(c,h,e);return false}var g=a(b.currentTarget||f);var i=g[0]==this.active[0];if(this.running||(!d.collapsible&&i)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!i){g.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);g.next().addClass("ui-accordion-content-active")}var c=g.next(),h=this.active.next(),e={options:d,newHeader:i&&d.collapsible?a([]):g,oldHeader:this.active,newContent:i&&d.collapsible?a([]):c.find("> *"),oldContent:h.find("> *")},j=this.headers.index(this.active[0])>this.headers.index(g[0]);this.active=i?a([]):g;this._toggle(c,h,e,i,j);return false},_toggle:function(b,i,g,j,k){var d=this.options,m=this;this.toShow=b;this.toHide=i;this.data=g;var c=function(){if(!m){return}return m._completed.apply(m,arguments)};this._trigger("changestart",null,this.data);this.running=i.size()===0?b.size():i.size();if(d.animated){var f={};if(d.collapsible&&j){f={toShow:a([]),toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}else{f={toShow:b,toHide:i,complete:c,down:k,autoHeight:d.autoHeight||d.fillSpace}}if(!d.proxied){d.proxied=d.animated}if(!d.proxiedDuration){d.proxiedDuration=d.duration}d.animated=a.isFunction(d.proxied)?d.proxied(f):d.proxied;d.duration=a.isFunction(d.proxiedDuration)?d.proxiedDuration(f):d.proxiedDuration;var l=a.ui.accordion.animations,e=d.duration,h=d.animated;if(!l[h]){l[h]=function(n){this.slide(n,{easing:h,duration:e||700})}}l[h](f)}else{if(d.collapsible&&j){b.toggle()}else{i.hide();b.show()}c(true)}i.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();b.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(b){var c=this.options;this.running=b?0:--this.running;if(this.running){return}if(c.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});a.extend(a.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(j,h){j=a.extend({easing:"swing",duration:300},j,h);if(!j.toHide.size()){j.toShow.animate({height:"show"},j);return}if(!j.toShow.size()){j.toHide.animate({height:"hide"},j);return}var c=j.toShow.css("overflow"),g,d={},f={},e=["height","paddingTop","paddingBottom"],b;var i=j.toShow;b=i[0].style.width;i.width(parseInt(i.parent().width(),10)-parseInt(i.css("paddingLeft"),10)-parseInt(i.css("paddingRight"),10)-(parseInt(i.css("borderLeftWidth"),10)||0)-(parseInt(i.css("borderRightWidth"),10)||0));a.each(e,function(k,m){f[m]="hide";var l=(""+a.css(j.toShow[0],m)).match(/^([\d+-.]+)(.*)$/);d[m]={value:l[1],unit:l[2]||"px"}});j.toShow.css({height:0,overflow:"hidden"}).show();j.toHide.filter(":hidden").each(j.complete).end().filter(":visible").animate(f,{step:function(k,l){if(l.prop=="height"){g=(l.now-l.start)/(l.end-l.start)}j.toShow[0].style[l.prop]=(g*d[l.prop].value)+d[l.prop].unit},duration:j.duration,easing:j.easing,complete:function(){if(!j.autoHeight){j.toShow.css("height","")}j.toShow.css("width",b);j.toShow.css({overflow:c});j.complete()}})},bounceslide:function(b){this.slide(b,{easing:b.down?"easeOutBounce":"swing",duration:b.down?1000:200})},easeslide:function(b){this.slide(b,{easing:"easeinout",duration:700})}}})})(jQuery);;/* + * jQuery UI Dialog 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * ui.core.js + * ui.draggable.js + * ui.resizable.js + */ +(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||" ",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("
      ")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("
      ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(f){var d=this;if(false===d._trigger("beforeclose",f)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",f)}):d.uiDialog.hide()&&d._trigger("close",f));c.ui.dialog.overlay.resize();d._isOpen=false;if(d.options.modal){var e=0;c(".ui-dialog").each(function(){if(this!=d.uiDialog[0]){e=Math.max(e,c(this).css("z-index"))}});c.ui.dialog.maxZ=e}},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||" ");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.2",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){if(c.ui.dialog.overlay.instances.length){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})}},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("
      ").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove();var e=0;c.each(this.instances,function(){e=Math.max(e,this.css("z-index"))});this.maxZ=e},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e
      ");if(!c.values){c.values=[this._valueMin(),this._valueMin()]}if(c.values.length&&c.values.length!=2){c.values=[c.values[0],c.values[0]]}}else{this.range=a("
      ")}this.range.appendTo(this.element).addClass("ui-slider-range");if(c.range=="min"||c.range=="max"){this.range.addClass("ui-slider-range-"+c.range)}this.range.addClass("ui-widget-header")}if(a(".ui-slider-handle",this.element).length==0){a('
      ').appendTo(this.element).addClass("ui-slider-handle")}if(c.values&&c.values.length){while(a(".ui-slider-handle",this.element).length').appendTo(this.element).addClass("ui-slider-handle")}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(d){d.preventDefault()}).hover(function(){if(!c.disabled){a(this).addClass("ui-state-hover")}},function(){a(this).removeClass("ui-state-hover")}).focus(function(){if(!c.disabled){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");a(this).addClass("ui-state-focus")}else{a(this).blur()}}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(d){a(this).data("index.ui-slider-handle",d)});this.handles.keydown(function(i){var f=true;var e=a(this).data("index.ui-slider-handle");if(b.options.disabled){return}switch(i.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:f=false;if(!b._keySliding){b._keySliding=true;a(this).addClass("ui-state-active");b._start(i,e)}break}var g,d,h=b._step();if(b.options.values&&b.options.values.length){g=d=b.values(e)}else{g=d=b.value()}switch(i.keyCode){case a.ui.keyCode.HOME:d=b._valueMin();break;case a.ui.keyCode.END:d=b._valueMax();break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g==b._valueMax()){return}d=g+h;break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g==b._valueMin()){return}d=g-h;break}b._slide(i,e,d);return f}).keyup(function(e){var d=a(this).data("index.ui-slider-handle");if(b._keySliding){b._stop(e,d);b._change(e,d);b._keySliding=false;a(this).removeClass("ui-state-active")}});this._refreshValue()},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy()},_mouseCapture:function(d){var e=this.options;if(e.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();var h={x:d.pageX,y:d.pageY};var j=this._normValueFromMouse(h);var c=this._valueMax()-this._valueMin()+1,f;var k=this,i;this.handles.each(function(l){var m=Math.abs(j-k.values(l));if(c>m){c=m;f=a(this);i=l}});if(e.range==true&&this.values(1)==e.min){f=a(this.handles[++i])}this._start(d,i);k._handleIndex=i;f.addClass("ui-state-active").focus();var g=f.offset();var b=!a(d.target).parents().andSelf().is(".ui-slider-handle");this._clickOffset=b?{left:0,top:0}:{left:d.pageX-g.left-(f.width()/2),top:d.pageY-g.top-(f.height()/2)-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};j=this._normValueFromMouse(h);this._slide(d,i,j);return true},_mouseStart:function(b){return true},_mouseDrag:function(d){var b={x:d.pageX,y:d.pageY};var c=this._normValueFromMouse(b);this._slide(d,this._handleIndex,c);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._handleIndex=null;this._clickOffset=null;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(d){var c,h;if("horizontal"==this.orientation){c=this.elementSize.width;h=d.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{c=this.elementSize.height;h=d.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}var f=(h/c);if(f>1){f=1}if(f<0){f=0}if("vertical"==this.orientation){f=1-f}var e=this._valueMax()-this._valueMin(),i=f*e,b=i%this.options.step,g=this._valueMin()+i-b;if(b>(this.options.step/2)){g+=this.options.step}return parseFloat(g.toFixed(5))},_start:function(d,c){var b={handle:this.handles[c],value:this.value()};if(this.options.values&&this.options.values.length){b.value=this.values(c);b.values=this.values()}this._trigger("start",d,b)},_slide:function(f,e,d){var g=this.handles[e];if(this.options.values&&this.options.values.length){var b=this.values(e?0:1);if((this.options.values.length==2&&this.options.range===true)&&((e==0&&d>b)||(e==1&&d1){this.options.values[b]=e;this._refreshValue(c);if(!d){this._change(null,b)}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(b)}else{return this.value()}}else{return this._values()}},_setData:function(b,d,c){a.widget.prototype._setData.apply(this,arguments);switch(b){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled")}else{this.handles.removeAttr("disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue(c);break;case"value":this._refreshValue(c);break}},_step:function(){var b=this.options.step;return b},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_values:function(b){if(arguments.length){var c=this.options.values[b];if(cthis._valueMax()){c=this._valueMax()}return c}else{return this.options.values}},_valueMin:function(){var b=this.options.min;return b},_valueMax:function(){var b=this.options.max;return b},_refreshValue:function(c){var f=this.options.range,d=this.options,l=this;if(this.options.values&&this.options.values.length){var i,h;this.handles.each(function(p,n){var o=(l.values(p)-l._valueMin())/(l._valueMax()-l._valueMin())*100;var m={};m[l.orientation=="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[c?"animate":"css"](m,d.animate);if(l.options.range===true){if(l.orientation=="horizontal"){(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({left:o+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({width:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}else{(p==0)&&l.range.stop(1,1)[c?"animate":"css"]({bottom:(o)+"%"},d.animate);(p==1)&&l.range[c?"animate":"css"]({height:(o-lastValPercent)+"%"},{queue:false,duration:d.animate})}}lastValPercent=o})}else{var j=this.value(),g=this._valueMin(),k=this._valueMax(),e=k!=g?(j-g)/(k-g)*100:0;var b={};b[l.orientation=="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);(f=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:e+"%"},d.animate);(f=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-e)+"%"},{queue:false,duration:d.animate});(f=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:e+"%"},d.animate);(f=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-e)+"%"},{queue:false,duration:d.animate})}}}));a.extend(a.ui.slider,{getter:"value values",version:"1.7.2",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}})})(jQuery);;/* + * jQuery UI Tabs 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.tabs",{_init:function(){if(this.options.deselectable!==undefined){this.options.collapsible=this.options.deselectable}this._tabify(true)},_setData:function(b,c){if(b=="selected"){if(this.options.collapsible&&c==this.options.selected){return}this.select(c)}else{this.options[b]=c;if(b=="deselectable"){this.options.collapsible=c}this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+a.data(b)},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+a.data(this.list[0]));return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(c,b){return{tab:c,panel:b,index:this.anchors.index(c)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(n){this.list=this.element.children("ul:first");this.lis=a("li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return a("a",this)[0]});this.panels=a([]);var p=this,d=this.options;var c=/^#.+/;this.anchors.each(function(r,o){var q=a(o).attr("href");var s=q.split("#")[0],u;if(s&&(s===location.toString().split("#")[0]||(u=a("base")[0])&&s===u.href)){q=o.hash;o.href=q}if(c.test(q)){p.panels=p.panels.add(p._sanitizeSelector(q))}else{if(q!="#"){a.data(o,"href.tabs",q);a.data(o,"load.tabs",q.replace(/#.*$/,""));var w=p._tabId(o);o.href="#"+w;var v=a("#"+w);if(!v.length){v=a(d.panelTemplate).attr("id",w).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(p.panels[r-1]||p.list);v.data("destroy.tabs",true)}p.panels=p.panels.add(v)}else{d.disabled.push(r)}}});if(n){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(d.selected===undefined){if(location.hash){this.anchors.each(function(q,o){if(o.hash==location.hash){d.selected=q;return false}})}if(typeof d.selected!="number"&&d.cookie){d.selected=parseInt(p._cookie(),10)}if(typeof d.selected!="number"&&this.lis.filter(".ui-tabs-selected").length){d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}d.selected=d.selected||0}else{if(d.selected===null){d.selected=-1}}d.selected=((d.selected>=0&&this.anchors[d.selected])||d.selected<0)?d.selected:0;d.disabled=a.unique(d.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(q,o){return p.lis.index(q)}))).sort();if(a.inArray(d.selected,d.disabled)!=-1){d.disabled.splice(a.inArray(d.selected,d.disabled),1)}this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");if(d.selected>=0&&this.anchors.length){this.panels.eq(d.selected).removeClass("ui-tabs-hide");this.lis.eq(d.selected).addClass("ui-tabs-selected ui-state-active");p.element.queue("tabs",function(){p._trigger("show",null,p._ui(p.anchors[d.selected],p.panels[d.selected]))});this.load(d.selected)}a(window).bind("unload",function(){p.lis.add(p.anchors).unbind(".tabs");p.lis=p.anchors=p.panels=null})}else{d.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))}this.element[d.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");if(d.cookie){this._cookie(d.selected,d.cookie)}for(var g=0,m;(m=this.lis[g]);g++){a(m)[a.inArray(g,d.disabled)!=-1&&!a(m).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled")}if(d.cache===false){this.anchors.removeData("cache.tabs")}this.lis.add(this.anchors).unbind(".tabs");if(d.event!="mouseover"){var f=function(o,i){if(i.is(":not(.ui-state-disabled)")){i.addClass("ui-state-"+o)}};var j=function(o,i){i.removeClass("ui-state-"+o)};this.lis.bind("mouseover.tabs",function(){f("hover",a(this))});this.lis.bind("mouseout.tabs",function(){j("hover",a(this))});this.anchors.bind("focus.tabs",function(){f("focus",a(this).closest("li"))});this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var b,h;if(d.fx){if(a.isArray(d.fx)){b=d.fx[0];h=d.fx[1]}else{b=h=d.fx}}function e(i,o){i.css({display:""});if(a.browser.msie&&o.opacity){i[0].style.removeAttribute("filter")}}var k=h?function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.hide().removeClass("ui-tabs-hide").animate(h,h.duration||"normal",function(){e(o,h);p._trigger("show",null,p._ui(i,o[0]))})}:function(i,o){a(i).closest("li").removeClass("ui-state-default").addClass("ui-tabs-selected ui-state-active");o.removeClass("ui-tabs-hide");p._trigger("show",null,p._ui(i,o[0]))};var l=b?function(o,i){i.animate(b,b.duration||"normal",function(){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");e(i,b);p.element.dequeue("tabs")})}:function(o,i,q){p.lis.removeClass("ui-tabs-selected ui-state-active").addClass("ui-state-default");i.addClass("ui-tabs-hide");p.element.dequeue("tabs")};this.anchors.bind(d.event+".tabs",function(){var o=this,r=a(this).closest("li"),i=p.panels.filter(":not(.ui-tabs-hide)"),q=a(p._sanitizeSelector(this.hash));if((r.hasClass("ui-tabs-selected")&&!d.collapsible)||r.hasClass("ui-state-disabled")||r.hasClass("ui-state-processing")||p._trigger("select",null,p._ui(this,q[0]))===false){this.blur();return false}d.selected=p.anchors.index(this);p.abort();if(d.collapsible){if(r.hasClass("ui-tabs-selected")){d.selected=-1;if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){l(o,i)}).dequeue("tabs");this.blur();return false}else{if(!i.length){if(d.cookie){p._cookie(d.selected,d.cookie)}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this));this.blur();return false}}}if(d.cookie){p._cookie(d.selected,d.cookie)}if(q.length){if(i.length){p.element.queue("tabs",function(){l(o,i)})}p.element.queue("tabs",function(){k(o,q)});p.load(p.anchors.index(this))}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(a.browser.msie){this.blur()}});this.anchors.bind("click.tabs",function(){return false})},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var c=a.data(this,"href.tabs");if(c){this.href=c}var d=a(this).unbind(".tabs");a.each(["href","load","cache"],function(e,f){d.removeData(f+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){if(a.data(this,"destroy.tabs")){a(this).remove()}else{a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}});if(b.cookie){this._cookie(null,b.cookie)}},add:function(e,d,c){if(c===undefined){c=this.anchors.length}var b=this,g=this.options,i=a(g.tabTemplate.replace(/#\{href\}/g,e).replace(/#\{label\}/g,d)),h=!e.indexOf("#")?e.replace("#",""):this._tabId(a("a",i)[0]);i.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var f=a("#"+h);if(!f.length){f=a(g.panelTemplate).attr("id",h).data("destroy.tabs",true)}f.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(c>=this.lis.length){i.appendTo(this.list);f.appendTo(this.list[0].parentNode)}else{i.insertBefore(this.lis[c]);f.insertBefore(this.panels[c])}g.disabled=a.map(g.disabled,function(k,j){return k>=c?++k:k});this._tabify();if(this.anchors.length==1){i.addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){b._trigger("show",null,b._ui(b.anchors[0],b.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[c],this.panels[c]))},remove:function(b){var d=this.options,e=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();if(e.hasClass("ui-tabs-selected")&&this.anchors.length>1){this.select(b+(b+1=b?--g:g});this._tabify();this._trigger("remove",null,this._ui(e.find("a")[0],c[0]))},enable:function(b){var c=this.options;if(a.inArray(b,c.disabled)==-1){return}this.lis.eq(b).removeClass("ui-state-disabled");c.disabled=a.grep(c.disabled,function(e,d){return e!=b});this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]))},disable:function(c){var b=this,d=this.options;if(c!=d.selected){this.lis.eq(c).addClass("ui-state-disabled");d.disabled.push(c);d.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[c],this.panels[c]))}},select:function(b){if(typeof b=="string"){b=this.anchors.index(this.anchors.filter("[href$="+b+"]"))}else{if(b===null){b=-1}}if(b==-1&&this.options.collapsible){b=this.options.selected}this.anchors.eq(b).trigger(this.options.event+".tabs")},load:function(e){var c=this,g=this.options,b=this.anchors.eq(e)[0],d=a.data(b,"load.tabs");this.abort();if(!d||this.element.queue("tabs").length!==0&&a.data(b,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(e).addClass("ui-state-processing");if(g.spinner){var f=a("span",b);f.data("label.tabs",f.html()).html(g.spinner)}this.xhr=a.ajax(a.extend({},g.ajaxOptions,{url:d,success:function(i,h){a(c._sanitizeSelector(b.hash)).html(i);c._cleanup();if(g.cache){a.data(b,"cache.tabs",true)}c._trigger("load",null,c._ui(c.anchors[e],c.panels[e]));try{g.ajaxOptions.success(i,h)}catch(j){}c.element.dequeue("tabs")}}))},abort:function(){this.element.queue([]);this.panels.stop(false,true);if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup()},url:function(c,b){this.anchors.eq(c).removeData("cache.tabs").data("load.tabs",b)},length:function(){return this.anchors.length}});a.extend(a.ui.tabs,{version:"1.7.2",getter:"length",defaults:{ajaxOptions:null,cache:false,cookie:null,collapsible:false,disabled:[],event:"click",fx:null,idPrefix:"ui-tabs-",panelTemplate:"
      ",spinner:"Loading…",tabTemplate:'
    • #{label}
    • '}});a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(d,f){var b=this,g=this.options;var c=b._rotate||(b._rotate=function(h){clearTimeout(b.rotation);b.rotation=setTimeout(function(){var i=g.selected;b.select(++i')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('
      '))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$(''+appendText+"");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDatenew Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)0&&iValue="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j0&&iValue-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormatmaxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDrawmaxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?''+prevText+"":(hideIfNoPrevNext?"":''+prevText+""));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?''+nextText+"":(hideIfNoPrevNext?"":''+nextText+""));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'":"");var buttonPanel=(showButtonPanel)?'
      '+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'":"")+(isRTL?"":controls)+"
      ":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="=5?' class="ui-datepicker-week-end"':"")+'>'+dayNamesMin[day]+""}calender+=thead+"";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDatemaxDate);tbody+='";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+""}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="
      =currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():" "):(unselectable?''+printDate.getDate()+"":'=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+""))+"
      "+(isMultiMonth?""+((numMonths[0]>0&&col==numMonths[1]-1)?'
      ':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?" ":"")}if(secondary||!changeYear){html+=''+drawYear+""}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?" ":"")+monthHtml}html+="";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&datemaxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$})(jQuery);;/* + * jQuery UI Progressbar 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * ui.core.js + */ +(function(a){a.widget("ui.progressbar",{_init:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this._valueMin(),"aria-valuemax":this._valueMax(),"aria-valuenow":this._value()});this.valueDiv=a('
      ').appendTo(this.element);this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow").removeData("progressbar").unbind(".progressbar");this.valueDiv.remove();a.widget.prototype.destroy.apply(this,arguments)},value:function(b){if(b===undefined){return this._value()}this._setData("value",b);return this},_setData:function(b,c){switch(b){case"value":this.options.value=c;this._refreshValue();this._trigger("change",null,{});break}a.widget.prototype._setData.apply(this,arguments)},_value:function(){var b=this.options.value;if(bthis._valueMax()){b=this._valueMax()}return b},_valueMin:function(){var b=0;return b},_valueMax:function(){var b=100;return b},_refreshValue:function(){var b=this.value();this.valueDiv[b==this._valueMax()?"addClass":"removeClass"]("ui-corner-right");this.valueDiv.width(b+"%");this.element.attr("aria-valuenow",b)}});a.extend(a.ui.progressbar,{version:"1.7.2",defaults:{value:0}})})(jQuery);;/* + * jQuery UI Effects 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||(function(d){d.effects={version:"1.7.2",save:function(g,h){for(var f=0;f');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(d.isFunction(arguments[0])||typeof arguments[0]=="boolean")){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/* + * jQuery UI Effects Fold 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * effects.core.js + */ +(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);;/* + * jQuery UI Effects Highlight 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * effects.core.js + */ +(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/* + * jQuery UI Effects Pulsate 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * effects.core.js + */ +(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);; \ No newline at end of file diff --git a/export/html/snakes/js/snakes-mod.js b/export/html/snakes/js/snakes-mod.js new file mode 100644 index 0000000..2d54238 --- /dev/null +++ b/export/html/snakes/js/snakes-mod.js @@ -0,0 +1,473 @@ +/*This code was originally based on code by +Husain Limdiyawala(MSc IT DA-IICT)*/ + + + +$(document).ready(function () { + + +}); + + +//Global Variables +var totblocks=0; +var data=""; +var currentblock=0; +var position=0; +var lastposition = new Array(); +var randomno=0; +var tots= new Array(); +var l=0; +var srcsnake=new Array(4); +var destsnake=new Array(4); + +var ladsrc = new Array(3); +var laddest = new Array(3); +var quest = new Array(); //available questions along with multiple answers +var COR_answered = new Array(); //record all questions (along with answers) the user responded CORRECTLY +var WRO_answered = new Array(); //record all questions (along with answers) the user responded WRONGLY + + + +//var door = new Array(1) + +var user = new Array(); + +//var pythons = new Array(1); + +//Constract table with questions and answers and pick question to display + +quest[0]="Spell 1"; +quest[1]="one"; +quest[2]="two"; +quest[3]="three"; +quest[4]="Spell 2"; +quest[5]="two"; +quest[6]="three"; +quest[7]="four"; +quest[8]="Spell 3"; +quest[9]="three"; +quest[10]="two"; +quest[11]="four"; +quest[12]="Spell 4"; +quest[13]="four"; +quest[14]="three"; +quest[15]="one"; +z=0; +for (z=0;quest[z]!=null;z++); +allQuest=z/4; + + +function selectQuest(all) +{ +pickOne = Math.floor((Math.random() * all)); +return pickOne; +} + + + + +//The Below Function will hide all the snakes + +function hideAll() +{ + document.getElementById("img1").style.display = "none"; + document.getElementById("img2").style.display = "none"; + document.getElementById("img3").style.display = "none"; + document.getElementById("img4").style.display = "none"; + + document.getElementById("lad1").style.display = "none"; + document.getElementById("lad2").style.display = "none"; + document.getElementById("lad3").style.display = "none"; +} + + +//The Below Function will Render The Main Board + +function paintBoard(a) +{ + totblocks = (a*a); + if((a*a) % 2 == 0) + { + currentblock = (a*a) - a + 1; + for(j=0;j<(a/2);j++) + { + + for(i=0;i" + currentblock + ""; + currentblock++; + } + currentblock -= (a+1); + + for(i=0;i" + currentblock + ""; + currentblock--; + } + currentblock -= (a-1); + } + } + else + { + + currentblock = (a*a); + for(j=0;j<(a/2);j++) + { + + + for(i=0;i" + currentblock + ""; + currentblock--; + } + + currentblock -= (a-1); + + if(currentblock < 2) + break; + + for(i=0;i" + currentblock + ""; + currentblock++; + } + currentblock -= (a+1); + } + } + document.getElementById("cont").style.width = (a*52+52) + "px" + + + document.getElementById("cont").innerHTML = data; + $("#cont").slideDown("slow"); + $("#cont").effect("shake",3000); + $("img:hidden").fadeIn(5000); + + if(a == 6) + { + + + registerSnake(158,196,"img1",14,3,0); + registerSnake(62,183,"img2",27,24,1); + registerSnake(175,18,"img3",18,4,2); + registerSnake(10,45,"img4",32,23,3); + + registerLadder(27,132,"lad1",28,34,0); + registerLadder(90,22,"lad2",19,30,1); + registerLadder(179,137,"lad3",2,16,2); + + //registerDoor("5",5,0); + //registerDoor("21",21,1) + + //registerPython("15",15,0) + } + + + else if(a == 8) + { + + + registerSnake(300,380,"img1",44,29,0); + registerSnake(180,550,"img2",51,46,1); + registerSnake(290,50,"img3",41,40,2); + registerSnake(500,280,"img4",27,22,3); + + registerLadder(350,515,"lad1",19,35,0); + registerLadder(180,230,"lad2",43,54,1); + registerLadder(80,350,"lad3",53,60,2); + + //registerDoor("14",14,0); + //registerDoor("26",26,1) + + //registerPython("32",32,0) + } + + +} + +//The below Function will simulate throwing of a dice + +function throwDice(i) +{ + + randomno = Math.floor((Math.random() * 6)) + 1; + document.getElementById("diceimg").src = "images/dice_" + randomno + ".PNG"; + document.getElementById("diceimg").style.display = "block"; + if(lastposition[i]>0) + { + document.getElementById(lastposition[i]).style.background = "url(images/square52.png)"; + + } + tots[i] += randomno; + + if(totblocks - tots[i] >= 0) + { + + lastposition[i] = tots[i]; + document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; + } + else + { + + tots[i] -= randomno; + document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; + } + +} + +//The below Function Checks The Snake Biting for a user + +function snakescheck(k) +{ + i=0; + + for(i=0;i<=srcsnake.length;i++) + { + + if(srcsnake[i] == tots[k]) + { + alert("Ωχ! Σε τσίμπησε φίδι στο τετράγωνο " + srcsnake[i] + " και θα πρέπει να γυρίσεις στο τετράγωνο " + destsnake[i] + ", εκτός κι αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); + document.getElementById(destsnake[i]).style.background = "url(images/pawn1.png)"; + document.getElementById(tots[k]).style.background = "url(images/square52.png)"; + lastposition[k] = destsnake[i]; + tots[k] = destsnake[i]; + break; + } + } + + if(!checkWin(k)) + alert("???d?se?!S???a??t???a!"); +} + +//The below function checks the ladders for a user + + function laddercheck(k) +{ + i=0; + + for(i=0;i<=ladsrc.length;i++) + { + + if(ladsrc[i] == tots[k]) + { + alert("Υπάρχει μια σκάλα στο τετράγωνο " + ladsrc[i] + " και θα σας οδηγήσει κατευθείαν στο τετράγωνο " + laddest[i] +"αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); + document.getElementById(laddest[i]).style.background = "url(images/pawn1.png)"; + document.getElementById(tots[k]).style.background = "url(images/square52.png)"; + lastposition[k] = laddest[i]; + tots[k] = laddest[i]; + break; + } + } + if(!checkWin(k)) + alert("You have won!"); +} + +//The below function checks the existence of doors + +/*function doorcheck(k) +{ + i=0; + + for(i=0;i<=door.length;i++) + { + + if(door[i] == tots[k]) + { + + + var randomdoor = Math.floor((Math.random() * totblocks)) + 1; + alert("Magic Door Entered!! You are redirected to " + randomdoor); + document.getElementById(randomdoor).style.background = "url(images/pawn.png) #000000"; + document.getElementById(tots[k]).style.background = "url(images/door.png) #000000"; + lastposition[k] = randomdoor; + tots[k] = randomdoor; + + } + } + if(!checkWin(k)) + alert("You Have Won!!"); +} */ + +//The below Function checks for pythons + +function pythoncheck(k) +{ + i=0; + + for(i=0;i
    • brisketai sto tetragwno " + tots[l] + "
    • "; +// + Question(); + document.getElementById("status").innerHTML = "
      • O Paiktis " + (l+1) + "
      • vrisketai sto tetragwno " + tots[l] + "
      "; + } + else + document.getElementById("status").innerHTML = "
      • Molis exases...
      "; + + if(l == lastposition.length-1) + l = 0; + else + l++; + + +} + +//The below function regulates the play + +function doit(i) +{ + + throwDice(i); + + if(checkWin(i)) + { + + //doorcheck(i); + snakescheck(i); + laddercheck(i); + //pythoncheck(i); + } + else + alert("ÏëïêëÞñùóåò ôçí ðßóôá, óõã÷áñçôÞñéá!!!"); +} + +//The below function checks whether the player has won or not + +function checkWin(i) +{ + if(tots[i] == totblocks) + return false; + else + return true; + +} + +//The below function will disable both the combobox + +function disableField() +{ + document.getElementById("players").disabled = "disabled"; + document.getElementById("boardtype").disabled = "disabled"; + +} + +function Question() +{ + picked=selectQuest(allQuest); + alert("Randomly selected number:" +picked); + Q1=prompt(quest[picked*4],"Απάντηση"); + if (Q1==quest[picked*4+1]) + { + alert("Σωστά!") + doit(l); + + COR_answered.concat(quest.splice(picked*4,4)); + } + else + { + alert("Η απάντηση δεν ήταν σωστή. Χάνεις τη σειρά σου για αυτό το γύρο!") + //document.getElementById("playbtn").disabled = "disabled"; + WRO_answered.concat(quest.splice(picked*4,4)); + } + //remove question and answers from available questions - (thus not allowing to have a Repeated question) ---XOXOXO + allQuest--; + } \ No newline at end of file diff --git a/export/html/snakes/js/subModal.js b/export/html/snakes/js/subModal.js new file mode 100644 index 0000000..28de858 --- /dev/null +++ b/export/html/snakes/js/subModal.js @@ -0,0 +1,295 @@ +var gPopupMask = null; +var gPopupContainer = null; +var gPopFrame = null; +var gReturnFunc; +var gPopupIsShown = false; +var gDefaultPage = "/loading.html"; +var gHideSelects = false; +var gReturnVal = null; + +var gTabIndexes = new Array(); +// Pre-defined list of tags we want to disable/enable tabbing into +var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME"); + +// If using Mozilla or Firefox, use Tab-key trap. +if (!document.all) { + document.onkeypress = keyDownHandler; +} + +/** + * Initializes popup code on load. + */ +function initPopUp() { + // Add the HTML to the body + theBody = document.getElementsByTagName('BODY')[0]; + popmask = document.createElement('div'); + popmask.id = 'popupMask'; + popcont = document.createElement('div'); + popcont.id = 'popupContainer'; + popcont.innerHTML = '' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '' + + '
      ' + + '
      ' + + '' + + '
      '; + theBody.appendChild(popmask); + theBody.appendChild(popcont); + + gPopupMask = document.getElementById("popupMask"); + gPopupContainer = document.getElementById("popupContainer"); + gPopFrame = document.getElementById("popupFrame"); + + // check to see if this is IE version 6 or lower. hide select boxes if so + // maybe they'll fix this in version 7? + var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); + if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) { + gHideSelects = true; + } + + // Add onclick handlers to 'a' elements of class submodal or submodal-width-height + var elms = document.getElementsByTagName('a'); + for (i = 0; i < elms.length; i++) { + if (elms[i].className.indexOf("submodal") == 0) { + // var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};'; + // elms[i].onclick = eval(onclick); + elms[i].onclick = function(){ + // default width and height + var width = 400; + var height = 200; + // Parse out optional width and height from className + params = this.className.split('-'); + if (params.length == 3) { + width = parseInt(params[1]); + height = parseInt(params[2]); + } + showPopWin(this.href,width,height,null); return false; + } + } + } +} +addEvent(window, "load", initPopUp); + + /** + * @argument width - int in pixels + * @argument height - int in pixels + * @argument url - url to display + * @argument returnFunc - function to call when returning true from the window. + * @argument showCloseBox - show the close box - default true + */ +function showPopWin(url, width, height, returnFunc, showCloseBox) { + // show or hide the window close widget + if (showCloseBox == null || showCloseBox == true) { + document.getElementById("popCloseBox").style.display = "block"; + } else { + document.getElementById("popCloseBox").style.display = "none"; + } + gPopupIsShown = true; + disableTabIndexes(); + gPopupMask.style.display = "block"; + gPopupContainer.style.display = "block"; + // calculate where to place the window on screen + centerPopWin(width, height); + + var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); + + + gPopupContainer.style.width = width + "px"; + gPopupContainer.style.height = (height+titleBarHeight) + "px"; + + setMaskSize(); + + // need to set the width of the iframe to the title bar width because of the dropshadow + // some oddness was occuring and causing the frame to poke outside the border in IE6 + gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px"; + gPopFrame.style.height = (height) + "px"; + + // set the url + gPopFrame.src = url; + + gReturnFunc = returnFunc; + // for IE + if (gHideSelects == true) { + hideSelectBoxes(); + } + + window.setTimeout("setPopTitle();", 600); +} + +// +var gi = 0; +function centerPopWin(width, height) { + if (gPopupIsShown == true) { + if (width == null || isNaN(width)) { + width = gPopupContainer.offsetWidth; + } + if (height == null) { + height = gPopupContainer.offsetHeight; + } + + //var theBody = document.documentElement; + var theBody = document.getElementsByTagName("BODY")[0]; + //theBody.style.overflow = "hidden"; + var scTop = parseInt(getScrollTop(),10); + var scLeft = parseInt(theBody.scrollLeft,10); + + setMaskSize(); + + //window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++; + + var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); + + var fullHeight = getViewportHeight(); + var fullWidth = getViewportWidth(); + + gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px"; + gPopupContainer.style.left = (scLeft + ((fullWidth - width) / 2)) + "px"; + //alert(fullWidth + " " + width + " " + gPopupContainer.style.left); + } +} +addEvent(window, "resize", centerPopWin); +addEvent(window, "scroll", centerPopWin); +window.onscroll = centerPopWin; + + +/** + * Sets the size of the popup mask. + * + */ +function setMaskSize() { + var theBody = document.getElementsByTagName("BODY")[0]; + + var fullHeight = getViewportHeight(); + var fullWidth = getViewportWidth(); + + // Determine what's bigger, scrollHeight or fullHeight / width + if (fullHeight > theBody.scrollHeight) { + popHeight = fullHeight; + } else { + popHeight = theBody.scrollHeight; + } + + if (fullWidth > theBody.scrollWidth) { + popWidth = fullWidth; + } else { + popWidth = theBody.scrollWidth; + } + + gPopupMask.style.height = popHeight + "px"; + gPopupMask.style.width = popWidth + "px"; +} + +/** + * @argument callReturnFunc - bool - determines if we call the return function specified + * @argument returnVal - anything - return value + */ +function hidePopWin(callReturnFunc) { + gPopupIsShown = false; + var theBody = document.getElementsByTagName("BODY")[0]; + theBody.style.overflow = ""; + restoreTabIndexes(); + if (gPopupMask == null) { + return; + } + gPopupMask.style.display = "none"; + gPopupContainer.style.display = "none"; + if (callReturnFunc == true && gReturnFunc != null) { + // Set the return code to run in a timeout. + // Was having issues using with an Ajax.Request(); + gReturnVal = window.frames["popupFrame"].returnVal; + window.setTimeout('gReturnFunc(gReturnVal);', 1); + } + gPopFrame.src = gDefaultPage; + // display all select boxes + if (gHideSelects == true) { + displaySelectBoxes(); + } +} + +/** + * Sets the popup title based on the title of the html document it contains. + * Uses a timeout to keep checking until the title is valid. + */ +function setPopTitle() { + return; + if (window.frames["popupFrame"].document.title == null) { + window.setTimeout("setPopTitle();", 10); + } else { + document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title; + } +} + +// Tab key trap. iff popup is shown and key was [TAB], suppress it. +// @argument e - event - keyboard event that caused this function to be called. +function keyDownHandler(e) { + if (gPopupIsShown && e.keyCode == 9) return false; +} + +// For IE. Go through predefined tags and disable tabbing into them. +function disableTabIndexes() { + if (document.all) { + var i = 0; + for (var j = 0; j < gTabbableTags.length; j++) { + var tagElements = document.getElementsByTagName(gTabbableTags[j]); + for (var k = 0 ; k < tagElements.length; k++) { + gTabIndexes[i] = tagElements[k].tabIndex; + tagElements[k].tabIndex="-1"; + i++; + } + } + } +} + +function returnRefresh() +{ + //alert("I am active!"); + window.location.reload(); +} + +// For IE. Restore tab-indexes. +function restoreTabIndexes() { + if (document.all) { + var i = 0; + for (var j = 0; j < gTabbableTags.length; j++) { + var tagElements = document.getElementsByTagName(gTabbableTags[j]); + for (var k = 0 ; k < tagElements.length; k++) { + tagElements[k].tabIndex = gTabIndexes[i]; + tagElements[k].tabEnabled = true; + i++; + } + } + } +} + + +/** + * Hides all drop down form select boxes on the screen so they do not appear above the mask layer. + * IE has a problem with wanted select form tags to always be the topmost z-index or layer + * + * Thanks for the code Scott! + */ +function hideSelectBoxes() { + var x = document.getElementsByTagName("SELECT"); + + for (i=0;x && i < x.length; i++) { + x[i].style.visibility = "hidden"; + } +} + +/** + * Makes all drop down form select boxes on the screen visible so they do not + * reappear after the dialog is closed. + * + * IE has a problem with wanting select form tags to always be the + * topmost z-index or layer. + */ +function displaySelectBoxes() { + var x = document.getElementsByTagName("SELECT"); + + for (i=0;x && i < x.length; i++){ + x[i].style.visibility = "visible"; + } +} \ No newline at end of file diff --git a/export/html/snakes/maskBG.png b/export/html/snakes/maskBG.png new file mode 100644 index 0000000..b89babc Binary files /dev/null and b/export/html/snakes/maskBG.png differ diff --git a/export/html/snakes/modalContent.html b/export/html/snakes/modalContent.html new file mode 100644 index 0000000..f0498a5 --- /dev/null +++ b/export/html/snakes/modalContent.html @@ -0,0 +1,14 @@ + + + + + + + + + + +

      !

      .

      % , .

      ;

      + + + diff --git a/export/javame/hangman/simple/KeyCanvas.class b/export/javame/hangman/simple/KeyCanvas.class new file mode 100755 index 0000000..7f1cc9c Binary files /dev/null and b/export/javame/hangman/simple/KeyCanvas.class differ diff --git a/export/javame/hangman/simple/KeyCanvas.java b/export/javame/hangman/simple/KeyCanvas.java new file mode 100755 index 0000000..f616b16 --- /dev/null +++ b/export/javame/hangman/simple/KeyCanvas.java @@ -0,0 +1,537 @@ +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import javax.microedition.lcdui.Image; +import javax.microedition.lcdui.Canvas; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.Font; +import javax.microedition.lcdui.Graphics; +import java.util.Hashtable; +import java.util.Random; + +class KeyCanvas extends Canvas { + //private Font mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); + + private String mMessage = ""; + + private String m_letters; + private String m_lastletter; + private String m_answer; + private String m_question; + private String m_allletters; + private String m_guess; + private String m_wrong; + private int m_wrongletters; + private String m_encoding=""; + private int m_state=0; + //0=start 1=play 2=next word 3=lose 4=win + private String m_init_letters; + private String m_init_allletters; + private int m_count_games=0; + private int m_count_wins=0; + private String m_filewords; + public Hashtable m_hashLocales; + private int m_keysize = 0; + private int [] m_key; + + public KeyCanvas() throws IOException { + m_state = 0; + + m_key = new int[ m_keysize+1]; + m_key[ 0] = 0; + + SelectFileWords(); + //LoadEncoding(); + LoadLocales(); + + addCommand(new Command( getlocale( "exit"), Command.EXIT, 0)); + } + + private String decrypt( String s){ + String ret=""; + + if( m_keysize <=0 ){ + return s; + } + + int len=s.length(); + for(int i=0; i < len; i+=m_keysize){ + for(int j=0; j < m_keysize; j++){ + int pos=i + m_key[ j]; + if( pos < len){ + ret = ret + s.charAt( pos); + } + } + } + + return ret; + } + + private String getlocale( String key){ + return (String)m_hashLocales.get( key); + } + + private void SelectFileWords() throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangman/hangman.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + + String line = null; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + m_filewords = "hangman/" + line.substring( 0, pos); + } + break; + } + reader.close(); + } + + private String readLine(InputStreamReader reader) throws IOException { + // Test whether the end of file has been reached. If so, return null. + int readChar = reader.read(); + if (readChar <= -1) { + return null; + } + StringBuffer string = new StringBuffer(); + // Read until end of file or new line + while (readChar > -1 && readChar != '\n') { + + // Append the read character to the string. Some operating systems + // such as Microsoft Windows prepend newline character ('\n') with + // carriage return ('\r'). This is part of the newline character and + // therefore an exception that should not be appended to the string. + if (readChar != '\r') { + string.append( (char )readChar); + } + + // Read the next character + readChar = reader.read(); + } + return string.toString(); + } + + private void LoadLocales() throws IOException{ + m_hashLocales = new Hashtable(); + + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangman/language.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + String key, data; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + key = line.substring( 0, pos); + data = line.substring( pos+1); + m_hashLocales.put(key, data); + } + } + reader.close(); + } + + protected boolean SetCurrentWord( String line) throws IOException{ + + int pos=line.indexOf( '='); + if( pos == -1){ + return false; + } + m_answer = line.substring( 0, pos); + m_question = line.substring( pos+1); + + return true; + } + + protected int SelectWord( String fname) throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( fname); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + int count=0; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + // Append the read line to the main form with a linefeed ('\n') + count = count + 1; + } + reader.close(); + + //select randomly one word + Random r = new Random(); + int curline = r.nextInt(); + curline = curline % count; + if( curline < 0) + curline = curline + count; + + InputStreamReader reader2 = new InputStreamReader( + getClass().getResourceAsStream(fname), "UTF-8"); + int i = 0; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader2)) != null) { + if( i == curline){ + line = decrypt( line); + SetCurrentWord( line); + return 1; + } + i = i + 1; + } + reader.close(); + + return 0; + } + + + public void paint(Graphics g) { + switch( m_state){ + case 0: + try { + paint_state_start(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 1: + try { + paint_state_play( g); + } catch (StringIndexOutOfBoundsException ex) { + ex.printStackTrace(); + } + break; + case 2: + try { + paint_state_nextword(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 3: + paint_state_lose( g); + break; + case 4: + try { + paint_state_win(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + } + } + +private void paint_state_start(Graphics g) throws IOException{ + + m_init_letters = getlocale( "keyboardletters"); + m_init_allletters = m_init_letters; + + String sRemove = "1234567890:#"; + for(int i=0; i < sRemove.length(); i++){ + for(;;){ + int pos = m_init_allletters.indexOf( sRemove.charAt(i)); + if( pos < 0) + break; + m_init_allletters = m_init_allletters.substring( 0, pos) + m_init_allletters.substring( pos+1); + } + } + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_nextword(Graphics g) throws IOException{ + m_letters = m_init_letters; + m_allletters = m_init_allletters; + + SelectWord( m_filewords); + + m_lastletter = ""; + int len = m_answer.length(); + m_guess = ""; + m_wrong = ""; + for(int i=0; i < len; i++){ + m_guess = m_guess + "-"; + } + m_wrongletters = 0; + + m_state = 1; //play + paint_state_play( g); +} + +private void paint_state_win(Graphics g) throws IOException{ + m_count_games++; + m_count_wins++; + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_lose(Graphics g){ + m_count_games++; + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=10; + + int iHeight=g.getFont().getHeight(); + + String s = m_answer; + + if( m_wrong.length() > 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " [" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + "]"; + + y = drawtextmultiline( g, s, 0, y); + + y = drawtextmultiline( g, m_question, 0, y+iHeight); + + m_state = 2; +} + +private void paint_state_play(Graphics g){ + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=0; + Font font = g.getFont(); + + int iHeight=g.getFont().getHeight(); + + String s = m_guess; + if( m_wrong.compareTo( "") != 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " (" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + ")"; + + y = drawtextmultiline( g, s, 0, y); + + int x = getWidth() - 3 * font.charWidth( '-'); + y = drawtextmultiline( g, mMessage, x, y) + iHeight; + + y = drawtextmultiline( g, m_question, 0, y) + iHeight; + + Image im = null; + try { + String filename = "/hangman/hangman_" + String.valueOf(m_wrongletters) + ".jpg"; + im = Image.createImage( filename); + } catch (IOException ex) { + ex.printStackTrace(); + } + + int xMul = (100 * getWidth()) / im.getWidth(); + int yMul = (100 * (getHeight() - y)) / im.getHeight(); + + if( yMul < xMul){ + xMul = yMul; + } + int cx = (xMul * im.getWidth()) / 100; + int cy = (yMul * im.getHeight()) / 100; + Image resize = resizeImage( im, cx, cy); + + g.drawImage(resize, 0, y, Graphics.LEFT | Graphics.TOP); + } + + protected int drawtextmultiline(Graphics g, String text, int x, int y){ + Font font = g.getFont(); + int fontHeight = font.getHeight(); + //change string to char data + char[] data = new char[text.length()]; + text.getChars(0, text.length(), data, 0); + int width = getWidth(); + int lineWidth = 0; + int charWidth = 0; + int xStart = x; + char ch; + for(int ccnt=0; ccnt < data.length; ccnt++) + { + ch = data[ccnt]; + //measure the char to draw + charWidth = font.charWidth(ch); + lineWidth = lineWidth + charWidth; + //see if a new line is needed + if (lineWidth > width) + { + y = y + fontHeight; + lineWidth = 0; + x = xStart; + } + //draw the char + g.drawChar(ch, x, y, + Graphics.TOP|Graphics.LEFT); + x = x + charWidth; + } + + return y; + } + + protected void keyPressed(int keyCode) { + char number; + + if( m_state == 2){ + repaint(); + return; + } + + if( (keyCode >= 49) && (keyCode <= 57)){ + String numbers = "123456789"; + number = numbers.charAt(keyCode - 49); + + int pos = m_letters.indexOf( number + ":"); + String letters = ""; + + String letters2 = m_letters.substring( pos+2); + + if( pos >= 0){ + pos = letters2.indexOf( '#'); + if( pos >= 0){ + letters = letters2.substring( 0, pos); + //Compute the letters that correspond to the key pressed + + if( m_lastletter.compareTo( "") != 0){ + pos = letters.indexOf( m_lastletter); + + if( pos >= 0){ + pos = pos + 1; + if( pos >= letters.length()){ + pos = 0; + } + }else{ + //different key + pos = 0; + } + }else{ + pos = 0; + } + if( (pos < letters.length()) && (pos >= 0)){ + m_lastletter = letters.substring( pos, pos+1); + mMessage = m_lastletter; + repaint(); + } + return; + } + } + + repaint(); + return; + } + + int gameAction = getGameAction(keyCode); + switch (gameAction) { + case FIRE: + OnFire(); + break; + + default: + mMessage = String.valueOf( keyCode); + break; + } + } + + protected void OnFire() { + int pos = m_guess.indexOf( m_lastletter); + if( pos >= 0){ + //Already used + return; + } + + char ch = m_lastletter.charAt( 0); + pos = m_answer.indexOf( ch); + if( pos >= 0){ + //correct letter + //Maybe there are many letters + for(pos=0; pos < m_guess.length();pos++){ + if( m_answer.charAt( pos) == ch){ + m_guess = m_guess.substring( 0, pos) + m_lastletter + m_guess.substring( pos+1); + } + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + } + + remove_lastletter_from_keyboard(); + + if( m_guess.indexOf( '-') < 0){ + m_state = 4; //state=win; + } + + repaint(); + return; + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos < 0){ + return; + } + + //wrong letter + m_wrongletters = m_wrongletters + 1; + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + m_wrong = m_wrong + m_lastletter; + } + + remove_lastletter_from_keyboard(); + + if( m_wrongletters >= 6){ + m_state = 3; //state=lose + } + repaint(); + } + + private void remove_lastletter_from_keyboard(){ + int pos = m_letters.indexOf( m_lastletter); + + if( pos >= 0){ + m_letters = m_letters.substring( 0, pos) + m_letters.substring( pos+1); + } + } + + private Image resizeImage(Image src, int cx, int cy) { + int srcWidth = src.getWidth(); + int srcHeight = src.getHeight(); + Image tmp = Image.createImage(cx, srcHeight); + Graphics g = tmp.getGraphics(); + int ratio = (srcWidth << 16) / cx; + int pos = ratio/2; + + //Horizontal Resize + + for (int x = 0; x < cx; x++) { + g.setClip(x, 0, 1, srcHeight); + g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + + Image resizedImage = Image.createImage(cx, cy); + g = resizedImage.getGraphics(); + ratio = (srcHeight << 16) / cy; + pos = ratio/2; + + //Vertical resize + + for (int y = 0; y < cy; y++) { + g.setClip(0, y, cx, 1); + g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + return resizedImage; + + }//resize image +} \ No newline at end of file diff --git a/export/javame/hangman/simple/hangman-1.class b/export/javame/hangman/simple/hangman-1.class new file mode 100755 index 0000000..4526be0 Binary files /dev/null and b/export/javame/hangman/simple/hangman-1.class differ diff --git a/export/javame/hangman/simple/hangman.class b/export/javame/hangman/simple/hangman.class new file mode 100755 index 0000000..7446186 Binary files /dev/null and b/export/javame/hangman/simple/hangman.class differ diff --git a/export/javame/hangman/simple/hangman.java b/export/javame/hangman/simple/hangman.java new file mode 100755 index 0000000..c7922ae --- /dev/null +++ b/export/javame/hangman/simple/hangman.java @@ -0,0 +1,566 @@ +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import javax.microedition.lcdui.Image; +import javax.microedition.lcdui.Canvas; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.lcdui.Font; +import javax.microedition.lcdui.Graphics; +import javax.microedition.midlet.MIDlet; +import java.util.Hashtable; +import java.util.Random; + +public class hangman extends MIDlet { + public void startApp() { + Displayable d = null; + try { + d = new KeyCanvas(); + } catch (IOException ex) { + ex.printStackTrace(); + } + + d.setCommandListener(new CommandListener() { + public void commandAction(Command c, Displayable s) { + notifyDestroyed(); + } + }); + + Display.getDisplay(this).setCurrent(d); + } + + public void pauseApp() { + } + + public void destroyApp(boolean unconditional) { + } +} + +class KeyCanvas extends Canvas { + //private Font mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); + + private String mMessage = ""; + + private String m_letters; + private String m_lastletter; + private String m_answer; + private String m_question; + private String m_allletters; + private String m_guess; + private String m_wrong; + private int m_wrongletters; + private String m_encoding=""; + private int m_state=0; + //0=start 1=play 2=next word 3=lose 4=win + private String m_init_letters; + private String m_init_allletters; + private int m_count_games=0; + private int m_count_wins=0; + private String m_filewords; + public Hashtable m_hashLocales; + private int m_keysize = 0; + private int [] m_key; + + public KeyCanvas() throws IOException { + m_state = 0; + + m_key = new int[ m_keysize+1]; + m_key[ 0] = 0; + + SelectFileWords(); + //LoadEncoding(); + LoadLocales(); + + addCommand(new Command( getlocale( "exit"), Command.EXIT, 0)); + } + + private String decrypt( String s){ + String ret=""; + + if( m_keysize <=0 ){ + return s; + } + + int len=s.length(); + for(int i=0; i < len; i+=m_keysize){ + for(int j=0; j < m_keysize; j++){ + int pos=i + m_key[ j]; + if( pos < len){ + ret = ret + s.charAt( pos); + } + } + } + + return ret; + } + + private String getlocale( String key){ + return (String)m_hashLocales.get( key); + } + + private void SelectFileWords() throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangman/hangman.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + + String line = null; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + m_filewords = "hangman/" + line.substring( 0, pos); + } + break; + } + reader.close(); + } + + private String readLine(InputStreamReader reader) throws IOException { + // Test whether the end of file has been reached. If so, return null. + int readChar = reader.read(); + if (readChar <= -1) { + return null; + } + StringBuffer string = new StringBuffer(); + // Read until end of file or new line + while (readChar > -1 && readChar != '\n') { + + // Append the read character to the string. Some operating systems + // such as Microsoft Windows prepend newline character ('\n') with + // carriage return ('\r'). This is part of the newline character and + // therefore an exception that should not be appended to the string. + if (readChar != '\r') { + string.append( (char )readChar); + } + + // Read the next character + readChar = reader.read(); + } + return string.toString(); + } + + private void LoadLocales() throws IOException{ + m_hashLocales = new Hashtable(); + + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangman/language.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + String key, data; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + key = line.substring( 0, pos); + data = line.substring( pos+1); + m_hashLocales.put(key, data); + } + } + reader.close(); + } + + protected boolean SetCurrentWord( String line) throws IOException{ + + int pos=line.indexOf( '='); + if( pos == -1){ + return false; + } + m_answer = line.substring( 0, pos); + m_question = line.substring( pos+1); + + return true; + } + + protected int SelectWord( String fname) throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( fname); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + int count=0; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + // Append the read line to the main form with a linefeed ('\n') + count = count + 1; + } + reader.close(); + + //select randomly one word + Random r = new Random(); + int curline = r.nextInt(); + curline = curline % count; + if( curline < 0) + curline = curline + count; + + InputStreamReader reader2 = new InputStreamReader( + getClass().getResourceAsStream(fname), "UTF-8"); + int i = 0; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader2)) != null) { + if( i == curline){ + line = decrypt( line); + SetCurrentWord( line); + return 1; + } + i = i + 1; + } + reader.close(); + + return 0; + } + + + public void paint(Graphics g) { + switch( m_state){ + case 0: + try { + paint_state_start(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 1: + try { + paint_state_play( g); + } catch (StringIndexOutOfBoundsException ex) { + ex.printStackTrace(); + } + break; + case 2: + try { + paint_state_nextword(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 3: + paint_state_lose( g); + break; + case 4: + try { + paint_state_win(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + } + } + +private void paint_state_start(Graphics g) throws IOException{ + + m_init_letters = getlocale( "keyboardletters"); + m_init_allletters = m_init_letters; + + String sRemove = "1234567890:#"; + for(int i=0; i < sRemove.length(); i++){ + for(;;){ + int pos = m_init_allletters.indexOf( sRemove.charAt(i)); + if( pos < 0) + break; + m_init_allletters = m_init_allletters.substring( 0, pos) + m_init_allletters.substring( pos+1); + } + } + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_nextword(Graphics g) throws IOException{ + m_letters = m_init_letters; + m_allletters = m_init_allletters; + + SelectWord( m_filewords); + + m_lastletter = ""; + int len = m_answer.length(); + m_guess = ""; + m_wrong = ""; + for(int i=0; i < len; i++){ + m_guess = m_guess + "-"; + } + m_wrongletters = 0; + + m_state = 1; //play + paint_state_play( g); +} + +private void paint_state_win(Graphics g) throws IOException{ + m_count_games++; + m_count_wins++; + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_lose(Graphics g){ + m_count_games++; + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=10; + + int iHeight=g.getFont().getHeight(); + + String s = m_answer; + + if( m_wrong.length() > 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " [" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + "]"; + + y = drawtextmultiline( g, s, 0, y); + + y = drawtextmultiline( g, m_question, 0, y+iHeight); + + m_state = 2; +} + +private void paint_state_play(Graphics g){ + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=0; + Font font = g.getFont(); + + int iHeight=g.getFont().getHeight(); + + String s = m_guess; + if( m_wrong.compareTo( "") != 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " (" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + ")"; + + y = drawtextmultiline( g, s, 0, y); + + int x = getWidth() - 3 * font.charWidth( '-'); + y = drawtextmultiline( g, mMessage, x, y) + iHeight; + + y = drawtextmultiline( g, m_question, 0, y) + iHeight; + + Image im = null; + try { + String filename = "/hangman/hangman_" + String.valueOf(m_wrongletters) + ".jpg"; + im = Image.createImage( filename); + } catch (IOException ex) { + ex.printStackTrace(); + } + + int xMul = (100 * getWidth()) / im.getWidth(); + int yMul = (100 * (getHeight() - y)) / im.getHeight(); + + if( yMul < xMul){ + xMul = yMul; + } + int cx = (xMul * im.getWidth()) / 100; + int cy = (yMul * im.getHeight()) / 100; + Image resize = resizeImage( im, cx, cy); + + g.drawImage(resize, 0, y, Graphics.LEFT | Graphics.TOP); + } + + protected int drawtextmultiline(Graphics g, String text, int x, int y){ + Font font = g.getFont(); + int fontHeight = font.getHeight(); + //change string to char data + char[] data = new char[text.length()]; + text.getChars(0, text.length(), data, 0); + int width = getWidth(); + int lineWidth = 0; + int charWidth = 0; + int xStart = x; + char ch; + for(int ccnt=0; ccnt < data.length; ccnt++) + { + ch = data[ccnt]; + //measure the char to draw + charWidth = font.charWidth(ch); + lineWidth = lineWidth + charWidth; + //see if a new line is needed + if (lineWidth > width) + { + y = y + fontHeight; + lineWidth = 0; + x = xStart; + } + //draw the char + g.drawChar(ch, x, y, + Graphics.TOP|Graphics.LEFT); + x = x + charWidth; + } + + return y; + } + + protected void keyPressed(int keyCode) { + char number; + + if( m_state == 2){ + repaint(); + return; + } + + if( (keyCode >= 49) && (keyCode <= 57)){ + String numbers = "123456789"; + number = numbers.charAt(keyCode - 49); + + int pos = m_letters.indexOf( number + ":"); + String letters = ""; + + String letters2 = m_letters.substring( pos+2); + + if( pos >= 0){ + pos = letters2.indexOf( '#'); + if( pos >= 0){ + letters = letters2.substring( 0, pos); + //Compute the letters that correspond to the key pressed + + if( m_lastletter.compareTo( "") != 0){ + pos = letters.indexOf( m_lastletter); + + if( pos >= 0){ + pos = pos + 1; + if( pos >= letters.length()){ + pos = 0; + } + }else{ + //different key + pos = 0; + } + }else{ + pos = 0; + } + if( (pos < letters.length()) && (pos >= 0)){ + m_lastletter = letters.substring( pos, pos+1); + mMessage = m_lastletter; + repaint(); + } + return; + } + } + + repaint(); + return; + } + + int gameAction = getGameAction(keyCode); + switch (gameAction) { + case FIRE: + OnFire(); + break; + + default: + mMessage = String.valueOf( keyCode); + break; + } + } + + protected void OnFire() { + int pos = m_guess.indexOf( m_lastletter); + if( pos >= 0){ + //Already used + return; + } + + char ch = m_lastletter.charAt( 0); + pos = m_answer.indexOf( ch); + if( pos >= 0){ + //correct letter + //Maybe there are many letters + for(pos=0; pos < m_guess.length();pos++){ + if( m_answer.charAt( pos) == ch){ + m_guess = m_guess.substring( 0, pos) + m_lastletter + m_guess.substring( pos+1); + } + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + } + + remove_lastletter_from_keyboard(); + + if( m_guess.indexOf( '-') < 0){ + m_state = 4; //state=win; + } + + repaint(); + return; + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos < 0){ + return; + } + + //wrong letter + m_wrongletters = m_wrongletters + 1; + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + m_wrong = m_wrong + m_lastletter; + } + + remove_lastletter_from_keyboard(); + + if( m_wrongletters >= 6){ + m_state = 3; //state=lose + } + repaint(); + } + + private void remove_lastletter_from_keyboard(){ + int pos = m_letters.indexOf( m_lastletter); + + if( pos >= 0){ + m_letters = m_letters.substring( 0, pos) + m_letters.substring( pos+1); + } + } + + private Image resizeImage(Image src, int cx, int cy) { + int srcWidth = src.getWidth(); + int srcHeight = src.getHeight(); + Image tmp = Image.createImage(cx, srcHeight); + Graphics g = tmp.getGraphics(); + int ratio = (srcWidth << 16) / cx; + int pos = ratio/2; + + //Horizontal Resize + + for (int x = 0; x < cx; x++) { + g.setClip(x, 0, 1, srcHeight); + g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + + Image resizedImage = Image.createImage(cx, cy); + g = resizedImage.getGraphics(); + ratio = (srcHeight << 16) / cy; + pos = ratio/2; + + //Vertical resize + + for (int y = 0; y < cy; y++) { + g.setClip(0, y, cx, 1); + g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + return resizedImage; + + }//resize image +} diff --git a/export/javame/hangman/simple/lang/el_utf8/language.txt b/export/javame/hangman/simple/lang/el_utf8/language.txt new file mode 100644 index 0000000..dc2fc15 --- /dev/null +++ b/export/javame/hangman/simple/lang/el_utf8/language.txt @@ -0,0 +1,3 @@ +encoding=el_utf8 +exit=Έξοδος +keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# diff --git a/export/javame/hangman/simple/lang/en_utf8/language.txt b/export/javame/hangman/simple/lang/en_utf8/language.txt new file mode 100644 index 0000000..b91ae1c --- /dev/null +++ b/export/javame/hangman/simple/lang/en_utf8/language.txt @@ -0,0 +1,4 @@ +encoding=en_utf8 +exit=Exit +keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# + diff --git a/export/javame/hangman/simple/lang/es_utf8/language.txt b/export/javame/hangman/simple/lang/es_utf8/language.txt new file mode 100644 index 0000000..64ad1d1 --- /dev/null +++ b/export/javame/hangman/simple/lang/es_utf8/language.txt @@ -0,0 +1,4 @@ +encoding=es_utf8 +exit=Salir +keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# + diff --git a/export/javame/hangmanp/simple/hangmanp-1.class b/export/javame/hangmanp/simple/hangmanp-1.class new file mode 100644 index 0000000..15484b5 Binary files /dev/null and b/export/javame/hangmanp/simple/hangmanp-1.class differ diff --git a/export/javame/hangmanp/simple/hangmanp.class b/export/javame/hangmanp/simple/hangmanp.class new file mode 100644 index 0000000..b0f8eac Binary files /dev/null and b/export/javame/hangmanp/simple/hangmanp.class differ diff --git a/export/javame/hangmanp/simple/hangmanp.java b/export/javame/hangmanp/simple/hangmanp.java new file mode 100644 index 0000000..c1c7293 --- /dev/null +++ b/export/javame/hangmanp/simple/hangmanp.java @@ -0,0 +1,33 @@ +import java.io.IOException; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.CommandListener; +import javax.microedition.lcdui.Display; +import javax.microedition.lcdui.Displayable; +import javax.microedition.midlet.MIDlet; + +public class hangmanp extends MIDlet { + public void startApp() { + Displayable d = null; + try { + d = new keycanvasp(); + } catch (IOException ex) { + ex.printStackTrace(); + } + + d.setCommandListener(new CommandListener() { + public void commandAction(Command c, Displayable s) { + notifyDestroyed(); + } + }); + + Display.getDisplay(this).setCurrent(d); + } + + public void pauseApp() { + } + + public void destroyApp(boolean unconditional) { + } +} + + diff --git a/export/javame/hangmanp/simple/keycanvasp.class b/export/javame/hangmanp/simple/keycanvasp.class new file mode 100644 index 0000000..cfdc0ca Binary files /dev/null and b/export/javame/hangmanp/simple/keycanvasp.class differ diff --git a/export/javame/hangmanp/simple/keycanvasp.java b/export/javame/hangmanp/simple/keycanvasp.java new file mode 100644 index 0000000..06009b7 --- /dev/null +++ b/export/javame/hangmanp/simple/keycanvasp.java @@ -0,0 +1,570 @@ +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import javax.microedition.lcdui.Image; +import javax.microedition.lcdui.Canvas; +import javax.microedition.lcdui.Command; +import javax.microedition.lcdui.Font; +import javax.microedition.lcdui.Graphics; +import java.util.Hashtable; +import java.util.Random; + +class keycanvasp extends Canvas { + //private Font mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_MEDIUM); + + private String mMessage = ""; + + private String m_letters; + private String m_lastletter; + + private String m_dirphoto; + //read from photo.txt + private String m_file; + private String m_answer; + private String m_info; + + //private String m_question; + private String m_allletters; + private String m_guess; + private String m_wrong; + private int m_wrongletters; + private int m_state=0; + //0=start 1=play 2=next word 3=lose 4=win + private String m_init_letters; + private String m_init_allletters; + private int m_count_games=0; + private int m_count_wins=0; + public Hashtable m_hashLocales; + private int m_keysize = 0; + private int [] m_key; + + public keycanvasp() throws IOException { + m_state = 0; + + m_key = new int[ m_keysize+1]; + m_key[ 0] = 0; + + SelectFileWords(); + LoadLocales(); + + addCommand(new Command( getlocale( "exit"), Command.EXIT, 0)); + } + + private String decrypt( String s){ + String ret=""; + + if( m_keysize <=0 ){ + return s; + } + + int len=s.length(); + for(int i=0; i < len; i+=m_keysize){ + for(int j=0; j < m_keysize; j++){ + int pos=i + m_key[ j]; + if( pos < len){ + ret = ret + s.charAt( pos); + } + } + } + + return ret; + } + + private String getlocale( String key){ + return (String)m_hashLocales.get( key); + } + + private void SelectFileWords() throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangmanp/hangmanp.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + + String line = null; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + m_dirphoto = "/hangmanp/" + line.substring( 0, pos); + } + break; + } + reader.close(); + } + + private String readLine(InputStreamReader reader) throws IOException { + // Test whether the end of file has been reached. If so, return null. + int readChar = reader.read(); + if (readChar <= -1) { + return null; + } + StringBuffer string = new StringBuffer(); + // Read until end of file or new line + while (readChar > -1 && readChar != '\n') { + + // Append the read character to the string. Some operating systems + // such as Microsoft Windows prepend newline character ('\n') with + // carriage return ('\r'). This is part of the newline character and + // therefore an exception that should not be appended to the string. + if (readChar != '\r') { + string.append( (char )readChar); + } + + // Read the next character + readChar = reader.read(); + } + return string.toString(); + } + + private void LoadLocales() throws IOException{ + m_hashLocales = new Hashtable(); + + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( "hangmanp/language.txt"); + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + String key, data; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + int pos = line.indexOf( "="); + if( pos >= 0){ + key = line.substring( 0, pos); + data = line.substring( pos+1); + m_hashLocales.put(key, data); + } + } + reader.close(); + } + + protected boolean SetCurrentWord( String line) throws IOException{ + + int pos=line.indexOf( '='); + if( pos == -1){ + return false; + } + m_file = line.substring( 0, pos); + m_answer = line.substring( pos+1); + + pos=m_answer.indexOf( ','); + if( pos == -1){ + m_info = ""; + }else + { + m_info = line.substring( pos+1); + m_answer = line.substring( 0, pos); + } + + return true; + } + + protected int SelectWord( String fname) throws IOException{ + Class c = this.getClass(); + InputStream is = c.getResourceAsStream( fname); + + if( is == null) + is = c.getResourceAsStream( fname); + + if( is == null) + { + fname = "/hangmanp/01/photo.txt"; + is = c.getResourceAsStream( fname); + } + + InputStreamReader reader = new InputStreamReader( is, "UTF-8"); + String line = null; + int count=0; + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader)) != null) { + // Append the read line to the main form with a linefeed ('\n') + count = count + 1; + } + reader.close(); + + //select randomly one word + Random r = new Random(); + int curline = r.nextInt(); + curline = curline % count; + if( curline < 0) + curline = curline + count; + + is = c.getResourceAsStream( fname); + InputStreamReader reader2 = new InputStreamReader( is, "UTF-8"); + int i = 0; + + // Read a single line from the file. null represents the EOF. + while ((line = readLine(reader2)) != null) { + if( i == curline){ + line = decrypt( line); + SetCurrentWord( line); + return 1; + } + i = i + 1; + } + reader.close(); + + return 0; + } + + + public void paint(Graphics g) { + switch( m_state){ + case 0: + try { + paint_state_start(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 1: + try { + paint_state_play( g); + } catch (StringIndexOutOfBoundsException ex) { + ex.printStackTrace(); + } + break; + case 2: + try { + paint_state_nextword(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + case 3: + paint_state_lose( g); + break; + case 4: + try { + paint_state_win(g); + } catch (IOException ex) { + ex.printStackTrace(); + } + break; + } + } + +private void paint_state_start(Graphics g) throws IOException{ + + m_init_letters = getlocale( "keyboardletters"); + m_init_allletters = m_init_letters; + + String sRemove = "1234567890:#"; + for(int i=0; i < sRemove.length(); i++){ + for(;;){ + int pos = m_init_allletters.indexOf( sRemove.charAt(i)); + if( pos < 0) + break; + m_init_allletters = m_init_allletters.substring( 0, pos) + m_init_allletters.substring( pos+1); + } + } + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_nextword(Graphics g) throws IOException{ + m_letters = m_init_letters; + m_allletters = m_init_allletters; + + SelectWord( m_dirphoto + "/photo.txt"); + + m_lastletter = ""; + int len = m_answer.length(); + m_guess = ""; + m_wrong = ""; + for(int i=0; i < len; i++){ + m_guess = m_guess + "-"; + } + m_wrongletters = 0; + + m_state = 1; //play + paint_state_play( g); +} + +private void paint_state_win(Graphics g) throws IOException{ + m_count_games++; + m_count_wins++; + + m_state = 2; + paint_state_nextword( g); +} + +private void paint_state_lose(Graphics g){ + m_count_games++; + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=10; + + int iHeight=g.getFont().getHeight(); + + String s = m_answer; + + if( m_wrong.length() > 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " [" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + "]"; + + y = drawtextmultiline( g, s, 0, y); + + y = drawtextmultiline( g, m_info, 0, y+iHeight); + + m_state = 2; +} + +private void paint_state_play(Graphics g){ + + //clear the screen + g.setColor(255,255,255); + g.fillRect(0, 0, getWidth(), getHeight()); + //set color to black + g.setColor(0,0,0); + //get the font height + + int y=0; + Font font = g.getFont(); + + int iHeight=g.getFont().getHeight(); + + String s = m_guess; + if( m_wrong.compareTo( "") != 0){ + s = s + " (" + m_wrong + ")"; + } + + s = s + " (" + String.valueOf( m_count_wins) + "/" + String.valueOf( m_count_games) + ")"; + + y = drawtextmultiline( g, s, 0, y); + + int x = getWidth() - 3 * font.charWidth( '-'); + y = drawtextmultiline( g, mMessage, x, y) + iHeight; + + y = drawtextmultiline( g, m_info, 0, y) + iHeight; + + Image im = null; + try { + String filename = m_dirphoto + "/" + m_file; + im = Image.createImage( filename); + } catch (IOException ex) { + ex.printStackTrace(); + } + + if( im == null) + { + try { + String filename = "/hangmanp/01/"; + filename = filename + m_file; + im = Image.createImage(filename); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + int xMul = (100 * getWidth()) / im.getWidth(); + int yMul = (100 * (getHeight() - y)) / im.getHeight(); + + if( yMul < xMul){ + xMul = yMul; + } + int cx = (xMul * im.getWidth()) / 100; + int cy = (yMul * im.getHeight()) / 100; + Image resize = resizeImage( im, cx, cy); + + g.drawImage(resize, 0, y, Graphics.LEFT | Graphics.TOP); + } + + protected int drawtextmultiline(Graphics g, String text, int x, int y){ + Font font = g.getFont(); + int fontHeight = font.getHeight(); + //change string to char data + char[] data = new char[text.length()]; + text.getChars(0, text.length(), data, 0); + int width = getWidth(); + int lineWidth = 0; + int charWidth = 0; + int xStart = x; + char ch; + for(int ccnt=0; ccnt < data.length; ccnt++) + { + ch = data[ccnt]; + //measure the char to draw + charWidth = font.charWidth(ch); + lineWidth = lineWidth + charWidth; + //see if a new line is needed + if (lineWidth > width) + { + y = y + fontHeight; + lineWidth = 0; + x = xStart; + } + //draw the char + g.drawChar(ch, x, y, + Graphics.TOP|Graphics.LEFT); + x = x + charWidth; + } + + return y; + } + + protected void keyPressed(int keyCode) { + char number; + + if( m_state == 2){ + repaint(); + return; + } + + if( (keyCode >= 49) && (keyCode <= 57)){ + String numbers = "123456789"; + number = numbers.charAt(keyCode - 49); + + int pos = m_letters.indexOf( number + ":"); + String letters = ""; + + String letters2 = m_letters.substring( pos+2); + + if( pos >= 0){ + pos = letters2.indexOf( '#'); + if( pos >= 0){ + letters = letters2.substring( 0, pos); + //Compute the letters that correspond to the key pressed + + if( m_lastletter.compareTo( "") != 0){ + pos = letters.indexOf( m_lastletter); + + if( pos >= 0){ + pos = pos + 1; + if( pos >= letters.length()){ + pos = 0; + } + }else{ + //different key + pos = 0; + } + }else{ + pos = 0; + } + if( (pos < letters.length()) && (pos >= 0)){ + m_lastletter = letters.substring( pos, pos+1); + mMessage = m_lastletter; + repaint(); + } + return; + } + } + + repaint(); + return; + } + + int gameAction = getGameAction(keyCode); + switch (gameAction) { + case FIRE: + OnFire(); + break; + + default: + mMessage = String.valueOf( keyCode); + break; + } + } + + protected void OnFire() { + int pos = m_guess.indexOf( m_lastletter); + if( pos >= 0){ + //Already used + return; + } + + char ch = m_lastletter.charAt( 0); + pos = m_answer.indexOf( ch); + if( pos >= 0){ + //correct letter + //Maybe there are many letters + for(pos=0; pos < m_guess.length();pos++){ + if( m_answer.charAt( pos) == ch){ + m_guess = m_guess.substring( 0, pos) + m_lastletter + m_guess.substring( pos+1); + } + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + } + + remove_lastletter_from_keyboard(); + + if( m_guess.indexOf( '-') < 0){ + m_state = 4; //state=win; + } + + repaint(); + return; + } + + pos = m_allletters.indexOf( m_lastletter); + if( pos < 0){ + return; + } + + //wrong letter + m_wrongletters = m_wrongletters + 1; + + pos = m_allletters.indexOf( m_lastletter); + if( pos >= 0){ + m_allletters = m_allletters.substring( 0, pos) + "." + m_allletters.substring( pos+1); + m_wrong = m_wrong + m_lastletter; + } + + remove_lastletter_from_keyboard(); + + if( m_wrongletters >= 6){ + m_state = 3; //state=lose + } + repaint(); + } + + private void remove_lastletter_from_keyboard(){ + int pos = m_letters.indexOf( m_lastletter); + + if( pos >= 0){ + m_letters = m_letters.substring( 0, pos) + m_letters.substring( pos+1); + } + } + + private Image resizeImage(Image src, int cx, int cy) { + int srcWidth = src.getWidth(); + int srcHeight = src.getHeight(); + Image tmp = Image.createImage(cx, srcHeight); + Graphics g = tmp.getGraphics(); + int ratio = (srcWidth << 16) / cx; + int pos = ratio/2; + + //Horizontal Resize + + for (int x = 0; x < cx; x++) { + g.setClip(x, 0, 1, srcHeight); + g.drawImage(src, x - (pos >> 16), 0, Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + + Image resizedImage = Image.createImage(cx, cy); + g = resizedImage.getGraphics(); + ratio = (srcHeight << 16) / cy; + pos = ratio/2; + + //Vertical resize + + for (int y = 0; y < cy; y++) { + g.setClip(0, y, cx, 1); + g.drawImage(tmp, 0, y - (pos >> 16), Graphics.LEFT | Graphics.TOP); + pos += ratio; + } + return resizedImage; + + }//resize image +} \ No newline at end of file diff --git a/export/javame/hangmanp/simple/lang/el_utf8/language.txt b/export/javame/hangmanp/simple/lang/el_utf8/language.txt new file mode 100644 index 0000000..dc2fc15 --- /dev/null +++ b/export/javame/hangmanp/simple/lang/el_utf8/language.txt @@ -0,0 +1,3 @@ +encoding=el_utf8 +exit=Έξοδος +keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# diff --git a/export/javame/hangmanp/simple/lang/en_utf8/language.txt b/export/javame/hangmanp/simple/lang/en_utf8/language.txt new file mode 100644 index 0000000..b91ae1c --- /dev/null +++ b/export/javame/hangmanp/simple/lang/en_utf8/language.txt @@ -0,0 +1,4 @@ +encoding=en_utf8 +exit=Exit +keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# + diff --git a/export/javame/hangmanp/simple/lang/es_utf8/language.txt b/export/javame/hangmanp/simple/lang/es_utf8/language.txt new file mode 100644 index 0000000..64ad1d1 --- /dev/null +++ b/export/javame/hangmanp/simple/lang/es_utf8/language.txt @@ -0,0 +1,4 @@ +encoding=es_utf8 +exit=Salir +keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# + diff --git a/exporthtml.php b/exporthtml.php new file mode 100644 index 0000000..e0ac7dd --- /dev/null +++ b/exporthtml.php @@ -0,0 +1,418 @@ +gamekind){ + case 'cross'; + game_OnExportHTML_cross( $game, $context, $html, $destdir); + break; + case 'hangman': + game_OnExportHTML_hangman( $game, $context, $html, $destdir); + break; + case 'snakes': + game_OnExportHTML_snakes( $game, $html, $destdir, $context); + break; + case 'millionaire': + game_OnExportHTML_millionaire( $game, $context, $html, $destdir); + break; + } + + remove_dir( $destdir); + } + + function game_OnExportHTML_cross( $game, $context, $html, $destdir){ + + global $CFG, $DB; + + if( $html->filename == ''){ + $html->filename = 'cross'; + } + + $filename = $html->filename . '.htm'; + + require( "cross/play.php"); + $attempt = game_getattempt( $game, $crossrec, true); + if( $crossrec == false){ + game_cross_new( $game, $attempt->id, $crossm); + $attempt = game_getattempt( $game, $crossrec); + } + + $ret = game_export_printheader( $html->title); + echo "$ret
      "; + + ob_start(); + + game_cross_play( 0, $game, $attempt, $crossrec, '', true, false, false, false, $html->checkbutton, true, $html->printbutton, false, $context); + + $output_string = ob_get_contents(); + ob_end_clean(); + + $course = $DB->get_record( 'course', array( 'id' => $game->course)); + + $filename = $html->filename . '.htm'; + + file_put_contents( $destdir.'/'.$filename, $ret . "\r\n" . $output_string); + + $filename = game_OnExportHTML_cross_repair_questions( $game, $context, $filename, $destdir); + + game_send_stored_file( $filename); + } + + function game_OnExportHTML_cross_repair_questions( $game, $context, $filename, $destdir) + { + global $CFG, $DB; + + $file_handle = fopen( $destdir.'/'.$filename, "rb"); + + $found = false; + $files = array(); + $contextcourse = false; + $linesbefore = array(); + $linesafter = array(); + while (!feof($file_handle) ) { + $line = fgets( $file_handle); + + if( $found) + { + if( strpos( $line, 'new Array')) + { + $linesafter[] = $line; + break; + } + $array .= $line; + continue; + } + + if( strpos( $line, 'Clue = new Array') === false) + { + $linesbefore[] = $line; + continue; + } + + $array = $line; + $found = true; + } + while (!feof($file_handle) ) { + $linesafter[] = fgets( $file_handle); + } + + fclose($file_handle); + + $search = $CFG->wwwroot.'/pluginfile.php'; + $pos = 0; + $search = '"'.$CFG->wwwroot.'/pluginfile.php/'.$context->id.'/mod_game/'; + $len = strlen( $search); + $start = 0; + $filescopied = false; + for(;;) + { + $pos1 = strpos( $array, $search, $start); + if( $pos1 == false) + break; + + $pos2 = strpos( $array, '\"', $pos1+$len); + if( $pos2 == false) + break; + + //Have to copy the files + + if( $contextcourse === false) + { + mkdir( $destdir.'/images'); + if (!$contextcourse = get_context_instance(CONTEXT_COURSE, $game->course)) { + print_error('nocontext'); + } + $fs = get_file_storage(); + } + + $inputs = explode( '/', substr( $array, $pos1+$len, $pos2-$pos1-$len)); + + $filearea = $inputs[ 0]; + $id = $inputs[ 1]; + $fileimage = urldecode( $inputs[ 2]); + $component = 'question'; + + $params = array( 'component' => $component, 'filearea' => $filearea, + 'itemid' => $id, 'filename' => $fileimage, 'contextid' => $context, 'contextid' => $contextcourse->id); + $rec = $DB->get_record( 'files', $params); + if( $rec == false) + { + print_r( $params); + break; + } + + if (!$file = $fs->get_file_by_hash($rec->pathnamehash) or $file->is_directory()) + continue; + + $posext = strrpos( $fileimage, '.'); + $filenoext = substr( $fileimage, $posext); + $ext = substr( $fileimage, $posext+1); + for($i=0;;$i++) + { + $newfile = $filenoext.$i; + $newfile = md5( $newfile).'.'.$ext; + if( !array_search( $newfile, $files)) + break; + } + $file->copy_content_to( $destdir.'/images/'.$newfile); + $filescopied = true; + + $array = substr( $array, 0, $pos1+1).'images/'.$newfile.substr( $array, $pos2); + } + + if( $filescopied == false) + return $destdir.'/'.$filename; + + $linesbefore[] = $array; + foreach( $linesafter as $line) + $linesbefore [] = $line; + file_put_contents( $destdir.'/'.$filename, $linesbefore); + + $pos = strrpos( $filename, '.'); + if( $pos === false) + $filezip = $filename.'.zip'; + else + $filezip = substr( $filename, 0, $pos).'.zip'; + + $filezip = game_create_zip( $destdir, $game->course, $filezip); + + return $filezip; + } + + function game_export_printheader( $title, $showbody=true) + { + $ret = ''."\n"; + $ret .= ''."\n"; + $ret .= "\n"; + $ret .= ''."\n"; + $ret .= ''."\n"; + $ret .= "$title\n"; + $ret .= "\n"; + if( $showbody) + $ret .= ""; + + return $ret; + } + + function game_OnExportHTML_hangman( $game, $context, $html, $destdir){ + + global $CFG, $DB; + + if( $html->filename == ''){ + $html->filename = 'hangman'; + } + + if( $game->param10 <= 0) + $game->param10 = 6; + + $filename = $html->filename . '.htm'; + + $ret = game_export_printheader( $html->title, false); + $ret .= "\r\r"; + + $export_attachment = ( $html->type == 'hangmanp'); + + $map = game_exmportjavame_getanswers( $game, $context, $export_attachment, $destdir, $files); + if( $map == false){ + print_error( get_string('no_words', 'game')); + } + + ob_start(); + + //Here is the code of hangman + require_once( "exporthtml_hangman.php"); + + $output_string = ob_get_contents(); + ob_end_clean(); + + $courseid = $game->course; + $course = $DB->get_record( 'course', array( 'id' => $courseid)); + + $filename = $html->filename . '.htm'; + file_put_contents( $destdir.'/'.$filename, $ret . "\r\n" . $output_string); + + if( $html->type != 'hangmanp') + { + //Not copy the standard pictures when we use the "Hangman with pictures" + $src = $CFG->dirroot.'/mod/game/pix/hangman/1'; + $handle = opendir( $src); + while (false!==($item = readdir($handle))) { + if($item != '.' && $item != '..') { + if(!is_dir($src.'/'.$item)) { + $itemdest = $item; + + if( strpos( $item, '.') === false) + continue; + + copy( $src.'/'.$item, $destdir.'/'.$itemdest); + } + } + } + } + + $filezip = game_create_zip( $destdir, $courseid, $html->filename.'.zip'); + game_send_stored_file( $filezip); + } + + function game_OnExportHTML_millionaire( $game, $context, $html, $destdir){ + + global $CFG, $DB; + + if( $html->filename == ''){ + $html->filename = 'millionaire'; + } + + $filename = $html->filename . '.htm'; + + $ret = game_export_printheader( $html->title, false); + $ret .= "\r\r"; + + //Here is the code of millionaire + require( "exporthtml_millionaire.php"); + + $questions = game_millionaire_html_getquestions( $game, $context, $maxanswers, $maxquestions, $retfeedback, $destdir, $files); + ob_start(); + + game_millionaire_html_print( $game, $questions, $maxanswers); + + //End of millionaire code + $output_string = ob_get_contents(); + ob_end_clean(); + + $courseid = $game->course; + $course = $DB->get_record( 'course', array( 'id' => $courseid)); + + $filename = $html->filename . '.htm'; + + file_put_contents( $destdir.'/'.$filename, $ret . "\r\n" . $output_string); + + //Copy the standard pictures of Millionaire + $src = $CFG->dirroot.'/mod/game/millionaire/1'; + $handle = opendir( $src); + while (false!==($item = readdir($handle))) { + if($item != '.' && $item != '..') { + if(!is_dir($src.'/'.$item)) { + $itemdest = $item; + + if( strpos( $item, '.') === false) + continue; + + copy( $src.'/'.$item, $destdir.'/'.$itemdest); + } + } + } + + $filezip = game_create_zip( $destdir, $courseid, $html->filename.'.zip'); + game_send_stored_file($filezip); + } + + function game_OnExportHTML_snakes( $game, $html, $destdir, $context){ + require_once( "exporthtml_millionaire.php"); + + global $CFG, $DB; + + if( $html->filename == ''){ + $html->filename = 'snakes'; + } + + $filename = $html->filename . '.htm'; + + $ret = ''; + + $board = game_snakes_get_board( $game); + + if( ($game->sourcemodule == 'quiz') or ($game->sourcemodule == 'question')) + $questionsM = game_millionaire_html_getquestions( $game, $context, $maxquestions, $countofquestionsM, $retfeedback, $files); + else + { + $questionsM = array(); + $countofquestionsM = 0; + $retfeedback = ''; + } + $questionsS = game_exmportjavame_getanswers( $game, $context, false, $destdir, $files); + + ob_start(); + + //Here is the code of hangman + require( "exporthtml_snakes.php"); + + $output_string = ob_get_contents(); + ob_end_clean(); + + $courseid = $game->course; + $course = $DB->get_record( 'course', array( 'id' => $courseid)); + + $filename = $html->filename . '.htm'; + + file_put_contents( $destdir.'/'.$filename, $ret . "\r\n" . $output_string); + + $src = $CFG->dirroot.'/mod/game/export/html/snakes'; + game_copyfiles( $src, $destdir); + + mkdir( $destdir .'/css'); + $src = $CFG->dirroot.'/mod/game/export/html/snakes/css'; + game_copyfiles( $src, $destdir.'/css'); + + mkdir( $destdir .'/js'); + $src = $CFG->dirroot.'/mod/game/export/html/snakes/js'; + game_copyfiles( $src, $destdir.'/js'); + + mkdir( $destdir .'/images'); + $destfile = $destdir.'/images/'.$board->fileboard; + if( $game->param3 != 0) + { + //Is a standard board + copy( $board->imagesrc, $destfile); + }else + { + $cmg = get_coursemodule_from_instance('game', $game->id, $game->course); + $modcontext = get_context_instance(CONTEXT_MODULE, $cmg->id); + $fs = get_file_storage(); + $files = $fs->get_area_files($modcontext->id, 'mod_game', 'snakes_board', $game->id); + foreach ($files as $f) { + if( $f->is_directory()) + continue; + break; + } + $f->copy_content_to( $destfile); + } + + $a = array( 'player1.png', 'dice1.png', 'dice2.png', 'dice3.png', 'dice4.png', 'dice5.png', 'dice6.png', 'numbers.png'); + foreach( $a as $file) + copy( $CFG->dirroot.'/mod/game/snakes/1/'.$file, $destdir.'/images/'.$file); + + $filezip = game_create_zip( $destdir, $courseid, $html->filename.'.zip'); + game_send_stored_file($filezip); + } + + function game_copyfiles( $src, $destdir) + { + $handle = opendir( $src); + while (($item = readdir($handle)) !== false) + { + if( $item == '.' or $item == '..') + continue; + + if( strpos( $item, '.') === false) + continue; + + if(is_dir($src.'/'.$item)) + continue; + + copy( $src.'/'.$item, $destdir.'/'.$item); + } + closedir($handle); + } diff --git a/exporthtml_hangman.php b/exporthtml_hangman.php new file mode 100644 index 0000000..c028215 --- /dev/null +++ b/exporthtml_hangman.php @@ -0,0 +1,360 @@ + + + + +
      + +
      +
      +
      +
      +
      + + + diff --git a/exporthtml_millionaire.php b/exporthtml_millionaire.php new file mode 100644 index 0000000..7968c91 --- /dev/null +++ b/exporthtml_millionaire.php @@ -0,0 +1,526 @@ +sourcemodule != 'quiz') and ($game->sourcemodule != 'question')){ + print_error( get_string('millionaire_sourcemodule_must_quiz_question', 'game', get_string( 'modulename', 'quiz')).' '.get_string( 'modulename', $game->sourcemodule)); + } + + if( $game->sourcemodule == 'quiz'){ + if( $game->quizid == 0){ + print_error( get_string( 'must_select_quiz', 'game')); + } + $select = "qtype='multichoice' AND quiz='$game->quizid' ". + " AND qqi.question=q.id"; + $table = "{question} q,{quiz_question_instances} qqi"; + }else + { + if( $game->questioncategoryid == 0){ + print_error( get_string( 'must_select_questioncategory', 'game')); + } + + //include subcategories + $select = 'category='.$game->questioncategoryid; + if( $game->subcategories){ + $cats = question_categorylist( $game->questioncategoryid); + if( strpos( $cats, ',') > 0){ + $select = 'category in ('.$cats.')'; + } + } + $select .= " AND qtype='multichoice'"; + + $table = "{question} q"; + } + $select .= " AND q.hidden=0"; + $sql = "SELECT q.id as id, q.questiontext FROM $table WHERE $select"; + $recs = $DB->get_records_sql( $sql); + $ret = ''; + $retfeedback = ''; + foreach( $recs as $rec){ + $recs2 = $DB->get_records( 'question_answers', array( 'question' => $rec->id), 'fraction DESC', 'id,answer,feedback'); + + //Must parse the questiontext and get the name of files. + $line = $rec->questiontext; + $line = game_export_split_files( $game->course, $context, 'questiontext', $rec->id, $rec->questiontext, $destdir, $files); + $linefeedback = ''; + foreach( $recs2 as $rec2) + { + $line .= '#'.str_replace( array( '"', '#'), array( "'", ' '), game_export_split_files( $game->course, $context, 'answer', $rec2->id, $rec2->answer, $destdir, $files)); + $linefeedback .= '#'.str_replace( array( '"', '#'), array( "'", ' '), $rec2->feedback); + } + if( $ret != '') + $ret .= ",\r"; + $ret .= '"'.base64_encode( $line).'"'; + + if( $retfeedback != '') + $retfeedback .= ",\r"; + $retfeedback .= '"'.base64_encode( $linefeedback).'"'; + + if( count( $recs2) > $maxanswers) + $maxanswers = count( $recs2); + $countofquestions++; + } + + return $ret; +} + +function game_millionaire_html_print( $game, $questions, $maxquestions) +{ + $color1 = 'black'; + $color2 = 'DarkOrange'; + $colorback="white"; + $stylequestion = "background:$colorback;color:$color1"; + $stylequestionselected = "background:$colorback;color:$color2"; + +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\n"; + echo "\n"; + echo "\n"; + if( $i == 1) + { + echo "\n"; + } + echo "\n"; +} +?> + + + +
      >              >        
      +  +  +  +  + style='background:#408080'>      15      150000
      14 800000
      13 400000
      aa
      12 200000
      11 10000
      10 5000
      9 4000
      8 2000
      7 1500
      6 1000
      5 500
      4 400
      3 300
      2 200
      1 100
           
      "; + echo ""; + echo "  
           
      + + + + + + + + + +<?php echo $html->title;?> + + + + + + + + + + + + + + + + + + + diff --git a/exportjavame.php b/exportjavame.php new file mode 100644 index 0000000..894bf8c --- /dev/null +++ b/exportjavame.php @@ -0,0 +1,391 @@ +course; + $course = $DB->get_record( 'course', array( 'id' => $courseid)); + + $destdir = game_export_createtempdir(); + + if( $javame->type == 'hangmanp'){ + $destmobiledir = 'hangmanp'; + }else{ + $destmobiledir = 'hangman'; + } + $src = $CFG->dirroot.'/mod/game/export/javame/'.$destmobiledir.'/simple'; + + if( $javame->filename == ''){ + $javame->filename = 'moodle'.$destmobiledir; + } + + $handle = opendir( $src); + while (false!==($item = readdir($handle))) { + if($item != '.' && $item != '..') { + if(!is_dir($src.'/'.$item)) { + $itemdest = $item; + + if( substr( $item, -5) == '.java'){ + continue; //don't copy the java source code files + } + + if( substr( $itemdest, -8) == '-1.class'){ + $itemdest = substr( $itemdest, 0, -8).'$1.class'; + } + + copy( $src.'/'.$item, $destdir.'/'.$itemdest); + } + } + } + + mkdir( $destdir.'/META-INF'); + + game_exportjavame_exportdata( $src, $destmobiledir, $destdir, $game, $javame->maxpicturewidth, $javame->maxpictureheight); + + game_create_manifest_mf( $destdir.'/META-INF', $javame, $destmobiledir); + + $filejar = game_create_jar( $destdir, $course, $javame); + if( $filejar == ''){ + $filezip = game_create_zip( $destdir, $course->id, $javame->filename.'.zip'); + }else{ + $filezip = ''; + } + + if( $destdir != ''){ + remove_dir( $destdir); + } + + if( $filezip != ''){ + echo "unzip the $filezip in a directory and when you are in this directory use the command
      jar cvfm {$javame->filename}.jar META-INF/MANIFEST.MF
      to produce the jar files

      "; + } + + $file = ($filejar != '' ? $filejar : $filezip); + game_send_stored_file( $file); + } + + function game_exportjavame_exportdata( $src, $destmobiledir, $destdir, $game, $maxwidth, $maxheight){ + global $CFG; + + mkdir( $destdir.'/'.$destmobiledir); + + $handle = opendir( $src); + while (false!==($item = readdir($handle))) { + if($item != '.' && $item != '..') { + if(!is_dir($src.'/'.$item)) { + if( substr( $item, -4) == '.jpg'){ + copy( $src.'/'.$item, $destdir."/$destmobiledir/".$item); + } + } + } + } + + $lang = $game->language; + if( $lang == '') + $lang = current_language(); + copy( $src. '/lang/'.$lang.'/language.txt', $destdir."/$destmobiledir/language.txt"); + + $export_attachment = ( $destmobiledir == 'hangmanp'); + + $map = game_exmportjavame_getanswers( $game, $export_attachment, false, $destdir, $files); + if( $map == false){ + print_error( 'No Questions'); + } + + if( $destmobiledir == 'hangmanp'){ + game_exportjavame_exportdata_hangmanp( $src, $destmobiledir, $destdir, $game, $map, $maxwidth, $maxheight); + return; + } + + $fp = fopen( $destdir."/$destmobiledir/hangman.txt","w"); + fputs( $fp, "1.txt=$destmobiledir\r\n"); + fclose( $fp); + + $fp = fopen( $destdir."/$destmobiledir/1.txt","w"); + foreach( $map as $line){ + $s = game_upper( $line->answer) . '=' . $line->question; + fputs( $fp, "$s\r\n"); + } + fclose( $fp); + } + + function game_exportjavame_exportdata_hangmanp( $src, $destmobiledir, $destdir, $game, $map, $maxwidth, $maxheight) + { + global $CFG; + + $fp = fopen( $destdir."/$destmobiledir/$destmobiledir.txt","w"); + fputs( $fp, "01=01\r\n"); + fclose( $fp); + + $destdirphoto = $destdir.'/'.$destmobiledir.'/01'; + mkdir( $destdirphoto); + + $fp = fopen( $destdirphoto.'/photo.txt',"w"); + foreach( $map as $line){ + + $file = $line->attachment; + $pos = strrpos( $file, '.'); + if( $pos != false){ + $file = $line->id.substr( $file, $pos); + $src = $CFG->dataroot.'/'.$game->course.'/moddata/'.$line->attachment; + game_export_javame_smartcopyimage( $src, $destdirphoto.'/'.$file, $maxwidth, $maxheight); + + $s = $file . '=' . game_upper( $line->answer); + fputs( $fp, "$s\r\n"); + } + } + fclose( $fp); + } + + function game_exmportjavame_getanswers( $game, $context, $export_attachment, $dest, &$files){ + $map = array(); + $files = array(); + + switch( $game->sourcemodule){ + case 'question': + return game_exmportjavame_getanswers_question( $game, $context, $dest, $files); + case 'glossary': + return game_exmportjavame_getanswers_glossary( $game, $context, $export_attachment, $dest, $files); + case 'quiz': + return game_exmportjavame_getanswers_quiz( $game, $context, $dest, $files); + } + + return false; + } + + function game_exmportjavame_getanswers_question( $game, $context, $destdir, &$files){ + $select = 'hidden = 0 AND category='.$game->questioncategoryid; + + $select .= game_showanswers_appendselect( $game); + + return game_exmportjavame_getanswers_question_select( $game, $context, 'question', $select, '*', $game->course, $destdir, $files); + } + + function game_exmportjavame_getanswers_quiz( $game, $context, $destdir, $files) + { + global $CFG; + + $select = "quiz='$game->quizid' ". + " AND qqi.question=q.id". + " AND q.hidden=0". + game_showanswers_appendselect( $game); + $table = "{question} q,{quiz_question_instances} qqi"; + + return game_exmportjavame_getanswers_question_select( $game, $context, $table, $select, "q.*", $game->course, $destdir, $files); + } + + function game_exmportjavame_getanswers_question_select( $game, $context, $table, $select, $fields, $courseid, $destdir, &$files) + { + global $CFG, $DB; + if( ($questions = $DB->get_records_select( $table, $select, null, '', $fields)) === false){ + return; + } + + + $line = 0; + $map = array(); + foreach( $questions as $question){ + unset( $ret); + $ret->qtype = $question->qtype; + $ret->question = $question->questiontext; + $ret->question = str_replace( array( '"', '#'), array( "'", ' '), + game_export_split_files( $game->course, $context, 'questiontext', $question->id, $ret->question, $destdir, $files)); + + switch( $question->qtype){ + case 'shortanswer': + $rec = $DB->get_record( 'question_answers', array( 'question' => $question->id), 'id,answer,feedback'); + $ret->answer = $rec->answer; + $ret->feedback = $rec->feedback; + $map[] = $ret; + break; + default: + break; + } + } + + return $map; + } + + function game_exmportjavame_getanswers_glossary( $game, $context, $export_attachment, $destdir, &$files) + { + global $CFG, $DB; + + $table = '{glossary_entries} ge'; + $select = "glossaryid={$game->glossaryid}"; + if( $game->glossarycategoryid){ + $select .= " AND gec.entryid = ge.id ". + " AND gec.categoryid = {$game->glossarycategoryid}"; + $table .= ",{glossary_entries_categories} gec"; + } + + if( $export_attachment){ + $select .= " AND attachment <> ''"; + } + + $fields = 'ge.id,definition,concept'; + if( $export_attachment){ + $fields .= ',attachment'; + } + $sql = "SELECT $fields FROM $table WHERE $select ORDER BY definition"; + if( ($questions = $DB->get_records_sql( $sql)) === false){ + return false; + } + + $fs = get_file_storage(); + $map = array(); + $cmglossary = false; + + foreach( $questions as $question){ + $ret = new stdClass(); + $ret->id = $question->id; + $ret->qtype = 'shortanswer'; + $ret->question = strip_tags( $question->definition); + $ret->answer = $question->concept; + $ret->feedback = ''; + $ret->attachment = ''; + + //Copies the appropriate files from the file storage to destdir + if( $export_attachment){ + if( $question->attachment != ''){ + if( $cmglossary === false) + { + $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); + $contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); + } + + $ret->attachment = "glossary/{$game->glossaryid}/$question->id/$question->attachment"; + $myfiles = $fs->get_area_files( $contextglossary->id, 'mod_glossary', 'attachment', $ret->id); + $i=0; + foreach ($myfiles as $f) { + if( $f->is_directory()) + continue; + $filename = $f->get_filename(); + $url = "{$CFG->wwwroot}/pluginfile.php/{$f->get_contextid()}/mod_glossary/attachment}"; + $fileurl = $url.$f->get_filepath().$f->get_itemid().'/'.$filename; + $pos = strrpos( $filename, '.'); + $ext = substr( $filename, $pos); + $destfile = $ret->id; + if( $i > 0) + $destfile .= '_'.$i; + $destfile = $destdir.'/'.$destfile.$ext; + $f->copy_content_to( $destfile); + $ret->attachment = $destfile; + $i++; + $files[] = $destfile; + } + } + } + + $map[] = $ret; + } + + return $map; + } + + function game_create_manifest_mf( $dir, $javame, $destmobiledir){ + + $fp = fopen( $dir.'/MANIFEST.MF',"w"); + fputs( $fp, "Manifest-Version: 1.0\r\n"); + fputs( $fp, "Ant-Version: Apache Ant 1.7.0\r\n"); + fputs( $fp, "Created-By: {$javame->createdby}\r\n"); + fputs( $fp, "MIDlet-1: MoodleHangman,,$destmobiledir\r\n"); + fputs( $fp, "MIDlet-Vendor: {$javame->vendor}\r\n"); + fputs( $fp, "MIDlet-Name: {$javame->vendor}\r\n"); + fputs( $fp, "MIDlet-Description: {$javame->description}\r\n"); + fputs( $fp, "MIDlet-Version: {$javame->version}\r\n"); + fputs( $fp, "MicroEdition-Configuration: CLDC-1.0\r\n"); + fputs( $fp, "MicroEdition-Profile: MIDP-1.0\r\n"); + + fclose( $fp); + } + + function game_create_jar( $srcdir, $course, $javame){ + global $CFG; + + $dir = $CFG->dataroot . '/' . $course->id; + $filejar = $dir . "/export/{$javame->filename}.jar"; + if (!file_exists( $dir)){ + mkdir( $dir); + } + + if (!file_exists( $dir.'/export')){ + mkdir( $dir.'/export'); + } + + if (file_exists( $filejar)){ + unlink( $filejar); + } + + $cmd = "cd $srcdir;jar cvfm $filejar META-INF/MANIFEST.MF *"; + exec( $cmd); + + return (file_exists( $filejar) ? "{$javame->filename}.jar" : ''); + } + + +function game_showanswers_appendselect( $form) +{ + switch( $form->gamekind){ + case 'hangman': + case 'cross': + case 'crypto': + return " AND qtype='shortanswer'"; + case 'millionaire': + return " AND qtype = 'multichoice'"; + case 'sudoku': + case 'bookquiz': + case 'snakes': + return " AND qtype in ('shortanswer', 'truefalse', 'multichoice')"; + } + + return ''; +} + +function game_export_javame_smartcopyimage( $filename, $dest, $maxwidth) +{ + if( $maxwidth == 0){ + copy( $filename, $dest); + return; + } + + $size = getimagesize( $filename); + if( $size == false){ + copy( $filename, $dest); + return; + } + + $mul = $maxwidth / $size[ 0]; + if( $mul > 1){ + copy( $filename, $dest); + return; + } + + $mime = $size[ 'mime']; + switch( $mime){ + case 'image/png': + $src_image = imageCreateFromPNG( $filename); + break; + case 'image/jpeg': + $src_image = imagecreatefromjpeg( $filename); + break; + case 'image/gif': + $src_image = imageCreateFromGIF( $filename); + break; + default: + die('Aknown mime type $mime'); + return false; + } + + $dst_w = $size[ 0] * $mul; + $dst_h = $size[ 1] * $mul; + $dst_image = imagecreatetruecolor( $dst_w, $dst_h); + imagecopyresampled( $dst_image, $src_image, 0, 0, 0, 0, $dst_w, $dst_h, $size[ 0], $size[ 1]); + + imagejpeg( $dst_image, $dest); +} diff --git a/hangman/play.php b/hangman/play.php new file mode 100644 index 0000000..d1dfca8 --- /dev/null +++ b/hangman/play.php @@ -0,0 +1,487 @@ +finishedword != 0)){ + //finish with one word and continue to another + if( !$DB->set_field( 'game_hangman', 'finishedword', 0, array( 'id' => $hangman->id))){ + error( "game_hangman_continue: Can't update game_hangman"); + } + }else + { + return game_hangman_play( $id, $game, $attempt, $hangman, false, false, $context); + } + } + + $updatehangman = (($attempt != false) and ($hangman != false)); + + //new game + srand ((double)microtime()*1000003); + + //I try 10 times to find a new question + $found = false; + $min_num = 0; + $unchanged = 0; + for($i=1; $i <= 10; $i++) + { + $rec = game_question_shortanswer( $game, $game->param7, false); + if( $rec === false){ + continue; + } + + $answer = game_upper( $rec->answertext, $game->language); + if( $game->language == '') + { + $game->language = game_detectlanguage( $answer); + $answer = game_upper( $rec->answertext, $game->language); + } + + $answer2 = $answer; + if( $game->param7){ + //Have to delete space + $answer2 = str_replace( ' ', '', $answer2); + } + if( $game->param8){ + //Have to delete - + $answer2 = str_replace( '-', '', $answer2); + } + + $allletters = game_getallletters( $answer2, $game->language); + + if( $allletters == ''){ + continue; + } + + if( $game->param7){ + $allletters .= '_'; + } + if( $game->param8){ + $allletters .= '-'; + } + + if( $game->param7 == false){ + //I don't allow spaces + if( strpos( $answer, " ")){ + continue; + } + } + + $copy = false; + $select2 = 'gameid=? AND userid=? AND questionid=? AND glossaryentryid=?'; + if( ($rec2 = $DB->get_record_select( 'game_repetitions', $select2, array( $game->id, $USER->id, $rec->questionid, $rec->glossaryentryid), 'id,repetitions r')) != false){ + if( ($rec2->r < $min_num) or ($min_num == 0)){ + $min_num = $rec2->r; + $copy = true; + } + }else + { + $min_num = 0; + $copy = true; + } + + if( $copy){ + $found = true; + + $min = new stdClass(); + $min->questionid = $rec->questionid; + $min->glossaryentryid = $rec->glossaryentryid; + $min->attachment = $rec->attachment; + $min->questiontext = $rec->questiontext; + $min->answerid = $rec->answerid; + $min->answer = $answer; + $min->language = $game->language; + $min->allletters = $allletters; + if( $min_num == 0) + break; //We found an unused word + }else + $unchanged++; + + if( $unchanged > 2) + { + if( $found) + break; + } + } + + if( $found == false){ + print_error( get_string( 'no_words', 'game')); + } + + //Found one word for hangman + if( $attempt == false){ + $attempt = game_addattempt( $game); + } + if( !$DB->set_field( 'game_attempts', 'language', $min->language, array( 'id' => $attempt->id))){ + print_error( "game_hangman_continue: Can't set language"); + } + + $query = new stdClass(); + $query->attemptid = $attempt->id; + $query->gameid = $game->id; + $query->userid = $USER->id; + $query->sourcemodule = $game->sourcemodule; + $query->questionid = $min->questionid; + $query->glossaryentryid = $min->glossaryentryid; + $query->attachment = $min->attachment; + $query->questiontext = addslashes( $min->questiontext); + $query->score = 0; + $query->timelastattempt = time(); + $query->answertext = $min->answer; + $query->answerid = $min->answerid; + if( !($query->id = $DB->insert_record( 'game_queries', $query))){ + print_object( $query); + print_error( "game_hangman_continue: Can't insert to table game_queries"); + } + + $newrec = new stdClass(); + $newrec->id = $attempt->id; + $newrec->queryid = $query->id; + if( $updatehangman == false){ + $newrec->maxtries = $game->param4; + if( $newrec->maxtries == 0){ + $newrec->maxtries = 1; + } + $newrec->finishedword = 0; + $newrec->corrects = 0; + } + + $newrec->allletters = $min->allletters; + + $letters = ''; + if( $game->param1){ + $letters .= textlib::substr( $min->answer, 0, 1); + } + if( $game->param2){ + $letters .= textlib::substr( $min->answer, -1, 1); + } + $newrec->letters = $letters; + + if( $updatehangman == false){ + if( !game_insert_record( 'game_hangman', $newrec)){ + print_error( 'game_hangman_continue: error inserting in game_hangman'); + } + }else + { + if( !$DB->update_record( 'game_hangman', $newrec)){ + print_error( 'game_hangman_continue: error updating in game_hangman'); + } + $newrec = $DB->get_record( 'game_hangman', array( 'id' => $newrec->id)); + } + + game_update_repetitions( $game->id, $USER->id, $query->questionid, $query->glossaryentryid); + + game_hangman_play( $id, $game, $attempt, $newrec, false, false, $context); +} + +function game_hangman_onfinishgame( $game, $attempt, $hangman) +{ + global $DB; + + $score = $hangman->corrects / $hangman->maxtries; + + game_updateattempts( $game, $attempt, $score, true); + + if( !$DB->set_field( 'game_hangman', 'finishedword', 0, array( 'id' => $hangman->id))){ + print_error( "game_hangman_onfinishgame: Can't update game_hangman"); + } +} + +function game_hangman_play( $id, $game, $attempt, $hangman, $onlyshow, $showsolution, $context) +{ + global $CFG, $DB, $OUTPUT; + + $query = $DB->get_record( 'game_queries', array( 'id' => $hangman->queryid)); + + if( $attempt->language != '') + $wordrtl = game_right_to_left( $attempt->language); + else + $wordrtl = right_to_left(); + $reverseprint = ($wordrtl != right_to_left()); + + if( $game->toptext != ''){ + echo $game->toptext.'
      '; + } + + $max=$game->param10; // maximum number of wrong + if( $max <= 0) + $max = 6; + hangman_showpage( $done, $correct, $wrong, $max, $word_line, $word_line2, $links, $game, $attempt, $hangman, $query, $onlyshow, $showsolution, $context); + + if (!$done) + { + if ($wrong > $max){ + $wrong = $max; + } + if( $game->param3 == 0){ + $game->param3 = 1; + } + echo "\r\n
      pix_url('hangman/'.$game->param3.'/hangman_'.$wrong, 'mod_game')."\""; + $message = sprintf( get_string( 'hangman_wrongnum', 'game'), $wrong, $max); + echo ' ALIGN="MIDDLE" BORDER="0" HEIGHT="100" alt="'.$message.'"/>'; + + if ($wrong >= $max){ + + //This word is incorrect. If reach the max number of word I have to finish else continue with next word + hangman_onincorrect( $id, $word_line, $query->answertext, $game, $attempt, $hangman, $onlyshow, $showsolution); + }else + { + $i = $max-$wrong; + if( $i > 1) + echo ' '.get_string( 'hangman_restletters_many', 'game', $i); + else + echo ' '.get_string( 'hangman_restletters_one', 'game'); + + if( $reverseprint){ + echo ''; + } + + echo "
      \n$word_line\r\n"; + if( $word_line2 != ''){ + echo "
      \n$word_line2\r\n"; + } + + if( $reverseprint){ + echo "
      "; + } + + if( $hangman->finishedword == false){ + echo "


      ".get_string( 'hangman_letters', 'game').$links."\r\n"; + } + } + }else + { + //This word is correct. If reach the max number of word I have to finish else continue with next word + hangman_oncorrect( $id, $word_line, $game, $attempt, $hangman, $query); + } + + echo "

      ".get_string( 'grade', 'game').' : '.round( $query->percent * 100).' %'; + if( $hangman->maxtries > 1){ + echo '

      '.get_string( 'hangman_gradeinstance', 'game').' : '.round( $hangman->corrects / $hangman->maxtries * 100).' %'; + } + + if( $game->bottomtext != ''){ + echo '

      '.$game->bottomtext; + } +} + +function hangman_showpage(&$done, &$correct, &$wrong, $max, &$word_line, &$word_line2, &$links, $game, &$attempt, &$hangman, &$query, $onlyshow, $showsolution, $context) +{ + global $USER, $CFG, $DB; + + $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or + + $word = $query->answertext; + + $newletter = optional_param('newletter', "", PARAM_TEXT); + if( $newletter == '_'){ + $newletter = ' '; + } + + $letters = $hangman->letters; + if( $newletter != NULL) + { + if( textlib::strpos( $letters,$newletter) === false){ + $letters .= $newletter; + } + } + + $links=""; + + $alpha = $hangman->allletters; + $wrong = 0; + + if( $query->questionid) + { + $query->questiontext = game_filterquestion(str_replace( '\"', '"', $query->questiontext), $query->questionid, $context->id, $game->course); + }else + { + $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); + $contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); + $query->questiontext = game_filterglossary(str_replace( '\"', '"', $query->questiontext), $query->glossaryentryid, $contextglossary->id, $game->course); + } + + if( $game->param5){ + $s = trim( game_filtertext( $query->questiontext, $game->course)); + if( $s != '.' and $s <> ''){ + echo "
      ".$s.''; + } + if( $query->attachment != ''){ + $file = "{$CFG->wwwroot}/file.php/$game->course/moddata/$query->attachment"; + echo ""; + } + echo "

      "; + } + + $word_line = $word_line2 = ""; + + $len = textlib::strlen( $word); + + $done = 1; + $answer = ''; + $correct = 0; + for ($x=0; $x < $len; $x++) + { + $char = textlib::substr( $word, $x, 1); + + if( $showsolution){ + $word_line2 .= ( $char == " " ? '  ' : $char); + $done = 0; + } + + if ( textlib::strpos($letters, $char) === false){ + $word_line.="_ \r\n"; + $done = 0; + $answer .= '_'; + }else + { + $word_line .= ( $char == " " ? '  ' : $char); + $answer .= $char; + $correct++; + } + } + + $len_alpha = textlib::strlen($alpha); + $fontsize = 5; + + for ($c=0; $c < $len_alpha; $c++) + { + $char = textlib::substr( $alpha, $c, 1); + + if ( textlib::strpos($letters, $char) === false) + { + //User doesn't select this character + $params = 'id='.$id.'&newletter='.urlencode( $char); + if( $onlyshow or $showsolution){ + $links .= $char; + }else + { + $links .= "$char\r\n"; + } + continue; + } + + if ( textlib::strpos($word, $char) === false) + { + $links .= "\r\n$char "; + $wrong++; + }else + { + $links .= "\r\n$char "; + } + } + $finishedword = ($done or $wrong >= $max); + $finished = false; + + $updrec = new stdClass(); + $updrec->id = $hangman->id; + $updrec->letters = $letters; + if( $finishedword){ + if( $hangman->finishedword == 0){ + //only one time per word increace the variable try + $hangman->try = $hangman->try + 1; + if( $hangman->try > $hangman->maxtries){ + $finished = true; + } + if( $done){ + $hangman->corrects = $hangman->corrects + 1; + $updrec->corrects = $hangman->corrects; + } + } + + $updrec->try = $hangman->try; + $updrec->finishedword = 1; + + } + + $query->percent = ($correct -$wrong/$max) / textlib::strlen( $word); + if( $query->percent < 0){ + $query->percent = 0; + } + + if( $onlyshow or $showsolution){ + return; + } + + if( !$DB->update_record( 'game_hangman', $updrec)){ + print_error( "hangman_showpage: Can't update game_hangman id=$updrec->id"); + } + + if( $done){ + $score = 1; + }else if( $wrong >= $max){ + $score = 0; + }else + { + $score = -1; + } + + game_updateattempts( $game, $attempt, $score, $finished); + game_update_queries( $game, $attempt, $query, $score, $answer); +} + +//This word is correct. If reach the max number of words I have to finish else continue with next word +function hangman_oncorrect( $id, $word_line, $game, $attempt, $hangman, $query) +{ + global $DB; + + echo "

      \n$word_line\r\n"; + + echo '


      '.get_string( 'win', 'game').'

      '; + if( $query->answerid){ + $feedback = $DB->get_field( 'question_answers', 'feedback', array( 'id' => $query->answerid)); + if( $feedback != ''){ + echo "$feedback
      "; + } + } + + game_hangman_show_nextword( $id, $game, $attempt, $hangman); +} + +function hangman_onincorrect( $id, $word_line, $word, $game, $attempt, $hangman, $onlyshow, $showsolution) +{ + echo "\r\n

      \n$word_line\r\n"; + + if( $onlyshow or $showsolution) + return; + + echo '


      '.get_string( 'hangman_loose', 'game').'

      '; + + if( $game->param6){ + //show the correct answer + if( textlib::strpos($word, ' ') != false) + echo '
      '.get_string( 'hangman_correct_phrase', 'game'); + else + echo '
      '.get_string( 'hangman_correct_word', 'game'); + + echo ''.$word."

      \r\n"; + } + + game_hangman_show_nextword( $id, $game, $attempt, $hangman, true); +} + +function game_hangman_show_nextword( $id, $game, $attempt, $hangman) +{ + global $CFG, $DB; + + echo '
      '; + if( ($hangman->try < $hangman->maxtries) or ($hangman->maxtries == 0)){ + //continue to next word + $params = "id=$id&action2=nextword\">".get_string( 'nextword', 'game').'        '; + echo "wwwroot}/mod/game/attempt.php?$params"; + }else + { + game_hangman_onfinishgame( $game, $attempt, $hangman); + echo "wwwroot}/mod/game/attempt.php?id=$id\">".get_string( 'nextgame', 'game').'         '; + } + + if (! $cm = $DB->get_record('course_modules', array( 'id' => $id))) { + print_error( "Course Module ID was incorrect id=$id"); + } + + echo "wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').' '; +} diff --git a/header.php b/header.php new file mode 100644 index 0000000..76eaf3e --- /dev/null +++ b/header.php @@ -0,0 +1,79 @@ +libdir.'/gradelib.php'); + require_once($CFG->dirroot.'/mod/game/locallib.php'); + require_once($CFG->libdir . '/completionlib.php'); + + $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or + $q = optional_param('q', 0, PARAM_INT); // game ID + + if ($id) { + if (! $cm = get_coursemodule_from_id('game', $id)) { + print_error('invalidcoursemodule'); + } + if (! $course = $DB->get_record('course', array('id' => $cm->course))) { + print_error('coursemisconf'); + } + if (! $game = $DB->get_record('game', array('id' => $cm->instance))) { + print_error('invalidcoursemodule'); + } + } else { + if (! $game = $DB->get_record('game', array('id' => $q))) { + print_error('invalidgameid q='.$q, 'game'); + } + if (! $course = $DB->get_record('course', array('id' => $game->course))) { + print_error('invalidcourseid'); + } + if (! $cm = get_coursemodule_from_instance('game', $game->id, $course->id)) { + print_error('invalidcoursemodule'); + } + } + +/// Check login and get context. + require_login($course->id, false, $cm); + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + require_capability('mod/game:view', $context); + +/// Cache some other capabilites we use several times. + $canattempt = has_capability('mod/game:attempt', $context); + $canreviewmine = has_capability('mod/game:reviewmyattempts', $context); + +/// Create an object to manage all the other (non-roles) access rules. + $timenow = time(); + //$accessmanager = new game_access_manager(game::create($game->id, $USER->id), $timenow); + +/// If no questions have been set up yet redirect to edit.php + //if (!$game->questions && has_capability('mod/game:manage', $context)) { + // redirect($CFG->wwwroot . '/mod/game/edit.php?cmid=' . $cm->id); + //} + +/// Log this request. + add_to_log($course->id, 'game', 'view', "view.php?id=$cm->id", $game->id, $cm->id); + +/// Initialize $PAGE, compute blocks + $PAGE->set_url('/mod/game/view.php', array('id' => $cm->id)); + + $edit = optional_param('edit', -1, PARAM_BOOL); + if ($edit != -1 && $PAGE->user_allowed_editing()) { + $USER->editing = $edit; + } + + $PAGE->requires->yui2_lib('event'); + + // Note: MDL-19010 there will be further changes to printing header and blocks. + // The code will be much nicer than this eventually. + $title = $course->shortname . ': ' . format_string($game->name); + + if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) { + $buttons = '
      '. + ''. + ''. + '
      '; + $PAGE->set_button($buttons); + } + + $PAGE->set_title($title); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); diff --git a/hiddenpicture/numbers.png b/hiddenpicture/numbers.png new file mode 100644 index 0000000..5ab28f6 Binary files /dev/null and b/hiddenpicture/numbers.png differ diff --git a/hiddenpicture/picture.php b/hiddenpicture/picture.php new file mode 100644 index 0000000..efe0bc9 --- /dev/null +++ b/hiddenpicture/picture.php @@ -0,0 +1,107 @@ +get_file_by_hash( $filehash); + $image = $file->get_imageinfo(); + + if( $image === false){ + die("Aknown filehash $filehash"); + return false; + } + $img_handle = imagecreatefromstring($file->get_content()); + + $mime = $image[ 'mimetype']; + + $img_numbers = imageCreateFromPNG( $filenamenumbers); + $size_numbers = getimagesize ($filenamenumbers); + + Header ("Content-type: $mime"); + + $color = ImageColorAllocate ($img_handle, 100, 100, 100); + + $width = $image[ 'width']; + $height = $image[ 'height']; + $pos = 0; + + $font = 1; + + for($y = 0; $y < $rows; $y++){ + for( $x=0; $x < $cols; $x++){ + $pos++; + if( !array_key_exists( $pos, $found)){ + $x1 = $x * $width / $cols; + $y1 = $y * $height / $rows; + imagefilledrectangle( $img_handle, $x1, $y1, $x1 + $width / $cols, $y1 + $height / $rows, $color); + + if( array_key_exists( $pos, $cells)){ + shownumber( $img_handle, $img_numbers, $pos, $x1 , $y1, $width / $cols, $height / $rows, $size_numbers); + } + } + } + } + + switch( $mime){ + case 'image/png': + ImagePng ($img_handle); + break; + case 'image/jpeg': + ImageJpeg ($img_handle); + break; + case 'image/gif': + ImageGif ($img_handle); + break; + default: + die('Aknown mime type $mime'); + return false; + } + + ImageDestroy ($img_handle); +} + +function shownumber( $img_handle, $img_numbers, $number, $x1 , $y1, $width, $height, $size_numbers){ + if( $number < 10){ + $width_number = $size_numbers[ 0] / 10; + $dstX = $x1 + $width / 3; + $dstY = $y1 + $height / 3; + $srcX = $number * $size_numbers[ 0] / 10; + $srcW = $size_numbers[ 0]/10; + $srcH = $size_numbers[ 1]; + $dstW = $width / 10; + $dstH = $dstW * $srcH / $srcW; + imagecopyresized( $img_handle, $img_numbers, $dstX, $dstY, $srcX, 0, $dstW, $dstH, $srcW, $srcH); + }else + { + $number1 = floor( $number / 10); + $number2 = $number % 10; + shownumber( $img_handle, $img_numbers, $number1, $x1-$width/20, $y1, $width, $height, $size_numbers); + shownumber( $img_handle, $img_numbers, $number2, $x1+$width/20, $y1, $width, $height, $size_numbers); + } +} diff --git a/hiddenpicture/play.php b/hiddenpicture/play.php new file mode 100644 index 0000000..68994d7 --- /dev/null +++ b/hiddenpicture/play.php @@ -0,0 +1,482 @@ +param1; + $rows = $game->param2; + if( $cols == 0){ + print_error( get_string( 'hiddenpicture_nocols', 'game')); + } + if( $rows == 0){ + print_error( get_string( 'hiddenpicture_norows', 'game')); + } + + //new attempt + $n = $game->param1 * $game->param2; + $recs = game_questions_selectrandom( $game, CONST_GAME_TRIES_REPETITION*$n); + $selected_recs = game_select_from_repetitions( $game, $recs, $n); + + $newrec = game_hiddenpicture_selectglossaryentry( $game, $attempt); + + if( $recs === false){ + print_error( get_string( 'no_questions', 'game')); + } + + $positions = array(); + $pos=1; + for($col=0; $col < $cols; $col++){ + for( $row=0; $row < $rows; $row++){ + $positions[] = $pos++; + } + } + $i = 0; + $field = ($game->sourcemodule == 'glossary' ? 'glossaryentryid' : 'questionid'); + foreach( $recs as $rec) + { + if( $game->sourcemodule == 'glossary') + $key = $rec->glossaryentryid; + else + $key = $rec->questionid; + + if( !array_key_exists( $key, $selected_recs)) + continue; + + $query = new stdClass(); + $query->attemptid = $newrec->id; + $query->gamekind = $game->gamekind; + $query->gameid = $game->id; + $query->userid = $USER->id; + + $pos = array_rand( $positions); + $query->col = $positions[ $pos]; + unset( $positions[ $pos]); + + $query->sourcemodule = $game->sourcemodule; + $query->questionid = $rec->questionid; + $query->glossaryentryid = $rec->glossaryentryid; + $query->score = 0; + if( ($query->id = $DB->insert_record( 'game_queries', $query)) == 0){ + print_error( 'error inserting in game_queries'); + } + game_update_repetitions($game->id, $USER->id, $query->questionid, $query->glossaryentryid); + } + + //The score is zero + game_updateattempts( $game, $attempt, 0, 0); + + game_hiddenpicture_play( $id, $game, $attempt, $newrec, false, $context); +} + +//Create the game_hiddenpicture record +function game_hiddenpicture_selectglossaryentry( $game, $attempt){ + global $CFG, $DB, $USER; + + srand( (double)microtime()*1000000); + + if( $game->glossaryid2 == 0){ + print_error( get_string( 'must_select_glossary', 'game')); + } + $select = "ge.glossaryid={$game->glossaryid2}"; + $table = '{glossary_entries} ge'; + if( $game->glossarycategoryid2){ + $table .= ",{glossary_entries_categories} gec"; + $select .= " AND gec.entryid = ge.id AND gec.categoryid = {$game->glossarycategoryid2}"; + } + if( $game->param7 == 0){ + //Allow spaces + $select .= " AND concept NOT LIKE '% %'"; + } + + $sql = "SELECT ge.id,attachment FROM $table WHERE $select"; + if( ($recs=$DB->get_records_sql( $sql)) == false){ + $a->name = "'".$DB->get_field('glossary', 'name', array( 'id' => $game->glossaryid2))."'"; + print_error( get_string( 'hiddenpicture_nomainquestion', 'game', $a)); + return false; + } + $ids = array(); + $keys = array(); + $fs = get_file_storage(); + $cmg = get_coursemodule_from_instance('glossary', $game->glossaryid2, $game->course); + $context = get_context_instance(CONTEXT_MODULE, $cmg->id); + foreach( $recs as $rec){ + $files = $fs->get_area_files($context->id, 'mod_glossary', 'attachment', $rec->id, "timemodified", false); + if( $files) + { + foreach( $files as $key => $file) + { + $s = strtoupper( $file->get_filename()); + $s = substr( $s, -4); + if( $s == '.GIF' or $s == '.JPG' or $s == '.PNG'){ + $ids[] = $rec->id; + $keys[] = $file->get_pathnamehash(); + } + } + } + } + if( count( $ids) == 0){ + $a->name = "'".$DB->get_field( 'glossary', 'name', array( 'id' => $game->glossaryid2))."'"; + print_error( get_string( 'hiddenpicture_nomainquestion', 'game', $a)); + return false; + } + + //Have to select randomly one glossaryentry + $poss = array(); + for($i=0;$i $game->id, 'userid' => $USER->id, 'questionid' => 0, 'glossaryentryid' => $tempid); + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec2->r < $min_num) or ($min_num == 0)){ + $min_num = $rec2->r; + $glossaryentryid = $tempid; + $attachement = $keys[ $pos]; + } + } + else{ + $glossaryentryid = $tempid; + $attachement = $keys[ $pos]; + break; + } + } + + $sql = 'SELECT id, concept as answertext, definition as questiontext, id as glossaryentryid, 0 as questionid, glossaryid, attachment'. + ' FROM {glossary_entries} WHERE id = '.$glossaryentryid; + if( ($rec = $DB->get_record_sql( $sql)) == false) + return false; + + $query = new stdClass(); + $query->attemptid = $attempt->id; + $query->gamekind = $game->gamekind; + $query->gameid = $game->id; + $query->userid = $USER->id; + + $query->col = 0; + $query->sourcemodule = 'glossary'; + $query->questionid = 0; + $query->glossaryentryid = $rec->glossaryentryid; + $query->attachment = $attachement; + $query->questiontext = $rec->questiontext; + $query->answertext = $rec->answertext; + $query->score = 0; + if( ($query->id = $DB->insert_record( 'game_queries', $query)) == 0){ + print_error( 'Error inserting in game_queries'); + } + $newrec = new stdClass(); + $newrec->id = $attempt->id; + $newrec->correct = 0; + if( !game_insert_record( 'game_hiddenpicture', $newrec)){ + print_error( 'Error inserting in game_hiddenpicture'); + } + + game_update_repetitions($game->id, $USER->id, $query->questionid, $query->glossaryentryid); + + return $newrec; +} + +function game_hiddenpicture_play( $id, $game, $attempt, $hiddenpicture, $showsolution, $context) +{ + if( $game->toptext != ''){ + echo $game->toptext.'
      '; + } + + //Show picture + $offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); + unset( $offsetquestions[ 0]); + + game_hiddenpicture_showhiddenpicture( $id, $game, $attempt, $hiddenpicture, $showsolution, $offsetquestions, $correctquestions, $id, $attempt, $showsolution); + + //Show questions + $onlyshow = false; + $showsolution = false; + + switch( $game->sourcemodule) + { + case 'quiz': + case 'question': + game_sudoku_showquestions_quiz( $id, $game, $attempt, $hiddenpicture, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution, $context); + break; + case 'glossary': + game_sudoku_showquestions_glossary( $id, $game, $attempt, $hiddenpicture, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution); + break; + } + + if( $game->bottomtext != ''){ + echo '

      '.$game->bottomtext; + } +} + +function game_hidden_picture_computescore( $game, $hiddenpicture){ + $correct = $hiddenpicture->correct; + if( $hiddenpicture->found){ + $correct++; + } + $remaining = $game->param1 * $game->param2 - $hiddenpicture->correct; + $div2 = $correct + $hiddenpicture->wrong + $remaining; + if( $hiddenpicture->found){ + $percent = ($correct + $remaining) / $div2; + }else{ + $percent = $correct / $div2; + } + + return $percent; +} + +function game_hiddenpicture_showhiddenpicture( $id, $game, $attempt, $hiddenpicture, $showsolution, $offsetquestions, $correctquestions){ + global $DB; + + $foundcells=''; + foreach( $correctquestions as $key => $val){ + $foundcells .= ','.$key; + } + $cells=''; + foreach( $offsetquestions as $key => $val){ + if( $key != 0){ + $cells .= ','.$key; + } + } + + $query = $DB->get_record_select( 'game_queries', "attemptid=$hiddenpicture->id AND col=0", null, 'id,glossaryentryid,attachment,questiontext'); + + //Grade + echo "
      ".get_string( 'grade', 'game').' : '.round( $attempt->score * 100).' %'; + + game_hiddenpicture_showquestion_glossary( $id, $query); + + $cells = substr( $cells, 1); + $foundcells = substr( $foundcells, 1); + game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, true); +} + +function game_hiddenpicture_showquestion_glossary( $id, $query) +{ + global $CFG, $DB; + + $entry = $DB->get_record( 'glossary_entries', array( 'id' => $query->glossaryentryid)); + + /// Start the form + echo '
      '; + echo "
      wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + echo "
      \n"; + + // Add a hidden field with the queryid + echo '\n"; + echo ''; + echo '\n"; + + // Add a hidden field with glossaryentryid + echo '\n"; + + echo game_filtertext( $entry->definition, 0).'
      '; + + echo get_string( 'answer').': '; + echo "
      "; + + echo "

      \n"; +} + +function game_hiddenpicture_check_questions( $id, $game, &$attempt, &$hiddenpicture, $finishattempt) +{ + global $QTYPES, $DB; + + $responses = data_submitted(); + + $offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); + + $questionlist = game_sudoku_getquestionlist( $offsetquestions); + + $questions = game_sudoku_getquestions( $questionlist); + + $actions = question_extract_responses($questions, $responses, QUESTION_EVENTSUBMIT); + + $correct = $wrong = 0; + foreach($questions as $question) { + if( !array_key_exists( $question->id, $actions)){ + //no answered + continue; + } + unset( $state); + unset( $cmoptions); + $question->maxgrade = 100; + $state->responses = $actions[ $question->id]->responses; + $state->event = QUESTION_EVENTGRADE; + + $cmoptions = array(); + $QTYPES[$question->qtype]->grade_responses( $question, $state, $cmoptions); + + unset( $query); + + $select = "attemptid=$attempt->id"; + $select .= " AND questionid=$question->id"; + if( ($query->id = $DB->get_field_select( 'game_queries', 'id', $select)) == 0){ + print_error("problem game_hiddenpicture_check_questions (select=$select)"); + } + + $answertext = $state->responses[ '']; + if( $answertext != ''){ + $grade = $state->raw_grade; + if( $grade < 50){ + //wrong answer + game_update_queries( $game, $attempt, $query, $grade/100, $answertext); + $wrong++; + }else{ + //correct answer + game_update_queries( $game, $attempt, $query, 1, $answertext); + $correct++; + } + } + } + + $hiddenpicture->correct += $correct; + $hiddenpicture->wrong += $wrong; + + if( !$DB->update_record( 'game_hiddenpicture', $hiddenpicture)){ + print_error( 'game_hiddenpicture_check_questions: error updating in game_hiddenpicture'); + } + + $attempt->score = game_hidden_picture_computescore( $game, $hiddenpicture); + if( !$DB->update_record( 'game_attempts', $attempt)){ + print_error( 'game_hiddenpicture_check_questions: error updating in game_attempt'); + } + + game_sudoku_check_last( $id, $game, $attempt, $hiddenpicture, $finishattempt); + + return true; +} + +function game_hiddenpicture_check_mainquestion( $id, $game, &$attempt, &$hiddenpicture, $finishattempt) +{ + global $QTYPES, $CFG, $DB; + + $responses = data_submitted(); + + $glossaryentryid = $responses->glossaryentryid; + $queryid = $responses->queryid; + + // Load the glossary entry + if (!($entry = $DB->get_record( 'glossary_entries', array( 'id' => $glossaryentryid)))) { + print_error( get_string( 'noglossaryentriesfound', 'game')); + } + $answer = $responses->answer; + $correct = false; + if( $answer != ''){ + if( game_upper( $entry->concept) == game_upper( $answer)){ + $correct = true; + } + } + + // Load the query + if (!($query = $DB->get_record( 'game_queries', array( 'id' => $queryid)))) { + print_error( "The query $queryid not found"); + } + + game_update_queries( $game, $attempt, $query, $correct, $answer); + + if( $correct){ + $hiddenpicture->found = 1; + }else{ + $hiddenpicture->wrong++; + } + if( !$DB->update_record( 'game_hiddenpicture', $hiddenpicture)){ + print_error( 'game_hiddenpicture_check_mainquestion: error updating in game_hiddenpicture'); + } + + $score = game_hidden_picture_computescore( $game, $hiddenpicture); + game_updateattempts( $game, $attempt, $score, $correct); + + if( $correct == false){ + game_hiddenpicture_play( $id, $game, $attempt, $hiddenpicture, false, $context); + return true; + } + + //Finish the game + $query = $DB->get_record_select( 'game_queries', "attemptid=$hiddenpicture->id AND col=0", null, 'id,glossaryentryid,attachment,questiontext'); + game_showpicture( $id, $game, $attempt, $query, '', '', false); + echo '


      '.get_string( 'win', 'game').'

      '; + global $CFG; + + echo '
      '; + + echo "wwwroot/mod/game/attempt.php?id=$id\">"; + echo get_string( 'nextgame', 'game').'        '; + + if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { + print_error( "Course Module ID was incorrect id=$id"); + } + + echo "wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').' '; + + return false; +} + +function game_showpicture( $id, $game, $attempt, $query, $cells, $foundcells, $usemap) +{ + global $CFG; + + $filenamenumbers = str_replace( "\\", '/', $CFG->dirroot)."/mod/game/hiddenpicture/numbers.png"; + if( $usemap){ + $cols = $game->param1; + $rows = $game->param2; + }else{ + $cols = $rows = 0; + } + $params = "id=$id&id2=$attempt->id&f=$foundcells&cols=$cols&rows=$rows&cells=$cells&p={$query->attachment}&n=$filenamenumbers"; + $imagesrc = "hiddenpicture/picture.php?$params"; + + $fs = get_file_storage(); + $file = get_file_storage()->get_file_by_hash( $query->attachment); + $image = $file->get_imageinfo(); + if( $game->param4 > 10){ + $width = $game->param4; + $height = $image[ 'height'] * $width / $image[ 'width']; + }else if( $game->param5 > 10){ + $height = $game->param5; + $width = $image[ 'width'] * $height / $image[ 'height']; + }else + { + $width = $image[ 'width']; + $height = $image[ 'height']; + } + + echo "\r\n"; + + if( $usemap){ + echo "\r\n"; + $pos=0; + for($row=0; $row < $rows; $row++){ + for( $col=0; $col < $cols; $col++){ + $pos++; + $x1 = $col * $width / $cols; + $y1 = $row * $height / $rows; + $x2 = $x1 + $width / $cols; + $y2 = $y1 + $height / $rows; + $q = "a$pos"; + echo "\"$pos\"\r\n"; + } + } + echo ""; + } +} diff --git a/images/soundplay.gif b/images/soundplay.gif new file mode 100644 index 0000000..4f156b0 Binary files /dev/null and b/images/soundplay.gif differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..c77964e --- /dev/null +++ b/index.php @@ -0,0 +1,96 @@ +get_record( 'course', array( 'id' => $id))) { + print_error( 'Course ID is incorrect'); + } + + require_login($course->id); + + add_to_log($course->id, 'game', 'view all', "index.php?id=$course->id", ""); + + +/// Get all required strings game + + $strgames = get_string( 'modulenameplural', 'game'); + $strgame = get_string('modulename', 'game'); + + +/// Print the header +$PAGE->set_url('/mod/game/index.php', array('id'=>$id)); +$coursecontext = get_context_instance(CONTEXT_COURSE, $id); +$PAGE->set_pagelayout('incourse'); + +add_to_log($course->id, "game", "view all", "index.php?id=$course->id", ""); + +// Print the header. +$strgames = get_string("modulenameplural", "game"); +$streditquestions = ''; +$editqcontexts = new question_edit_contexts($coursecontext); +$PAGE->navbar->add($strgames); +$PAGE->set_title($strgames); +$PAGE->set_heading($course->fullname); +echo $OUTPUT->header(); + +/// Get all the appropriate data + + if (! $games = get_all_instances_in_course("game", $course)) { + notice("There are no games", "../../course/view.php?id=$course->id"); + die; + } + +/// Print the list of instances (your module will probably extend this) + + $timenow = time(); + $strname = get_string("name"); + $strweek = get_string("week"); + $strtopic = get_string("topic"); + + if ($course->format == "weeks") { + $table->head = array ($strweek, $strname); + $table->align = array ("center", "left"); + } else if ($course->format == "topics") { + $table->head = array ($strtopic, $strname); + $table->align = array ("center", "left", "left", "left"); + } else { + $table->head = array ($strname); + $table->align = array ("left", "left", "left"); + } + + foreach ($games as $game) { + if (!$game->visible) { + //Show dimmed if the mod is hidden + $link = "coursemodule\">$game->name"; + } else { + //Show normal if the mod is visible + $link = "coursemodule\">$game->name"; + } + + if ($course->format == "weeks" or $course->format == "topics") { + $table->data[] = array ($game->section, $link); + } else { + $table->data[] = array ($link); + } + } + + echo "
      "; + + print_table($table); + +/// Finish the page + + echo $OUTPUT->footer($course); + +?> diff --git a/lang/ca/game.php b/lang/ca/game.php new file mode 100644 index 0000000..66c515a --- /dev/null +++ b/lang/ca/game.php @@ -0,0 +1,305 @@ +¡Benvingut!

      Fes clic en una paraula per començar.

      '; +$string[ 'letter'] = 'lletra'; +$string[ 'letters'] = 'lletres'; +$string[ 'nextgame'] = 'Següent joc'; +$string[ 'no_words'] = 'Cap paraula trobada'; +$string[ 'print'] = 'Imprimir'; + +//cryptex/play.php +$string[ 'finish'] = 'Fi del joc'; + +//db/access.php +$string[ 'game:attempt'] = 'Juga el joc'; +$string[ 'game:deleteattempts'] = 'Esborrar intents'; +$string[ 'game:manage'] = 'Administrar'; +$string[ 'game:reviewmyattempts'] = 'Revisar els meus intents'; +$string[ 'game:view'] = 'Veure'; +$string[ 'game:viewreports'] = 'Veure informes'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'La frase correcta era: '; +$string[ 'hangman_correct_word'] = 'La paraula correcta era: '; +$string[ 'hangman_gradeinstance'] = 'Nivell en el joc complet'; +$string[ 'hangman_letters'] = 'Lletres: '; +$string[ 'hangman_restletters_many'] = 'Vd. té $a intents'; +$string[ 'hangman_restletters_one'] = 'Vd. té ÚNICAMENT 1 intent'; +$string[ 'hangman_wrongnum'] = 'Dolentes: %%d de %%d'; +$string[ 'nextword'] = 'Següent paraula'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Qualificació de la pregunta principal'; +$string[ 'hiddenpicture_nocols'] = 'Cal especificar el nombre de fileres horitzontals'; +$string[ 'hiddenpicture_nomainquestion'] = 'No hi ha entrades en el glossari $a->name amb una imatge annexada'; +$string[ 'hiddenpicture_norows'] = 'Cal especificar el nombre de columnes verticals'; +$string[ 'must_select_glossary'] = 'Vd ha de seleccionar un glossari'; +$string[ 'noglossaryentriesfound'] = 'No hi ha entrades de glossari'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Cal seleccionar una categoria de preguntes'; +$string[ 'millionaire_must_select_quiz'] = 'Cal seleccionar un qüestionari'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Mostrar tots els intents'; +$string[ 'allstudents'] = 'Mostrar tots $a'; +$string[ 'attemptsonly'] = 'Mostrar únicament estudiants amb intents'; +$string[ 'deleteattemptcheck'] = 'Està absolutament segur de voler esborrar completament aquests intents?'; +$string[ 'displayoptions'] = 'Mostrar opcions'; +$string[ 'downloadods'] = 'Descarregar en format ODS'; +$string[ 'feedback'] = 'Retroalimentació'; +$string[ 'noattemptsonly'] = 'Mostrar $a únicament sense intents'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring ha fet $a->attemptnum intents'; +$string[ 'pagesize'] = 'Preguntes per pàgina:'; +$string[ 'reportoverview'] = 'Llistat'; +$string[ 'selectall'] = 'Seleccionar tots'; +$string[ 'selectnone'] = 'Desmarcar tots'; +$string[ 'showdetailedmarks'] = 'Mostrar detalls de marca'; +$string[ 'startedon'] = 'Començà en'; +$string[ 'timecompleted'] = 'Completat'; +$string[ 'unfinished'] = 'obert'; +$string[ 'withselected'] = 'Amb seleccionats'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Nombre de sudokus que seran creats'; +$string[ 'sudoku_create_start'] = 'Començar creant sudokus'; +$string[ 'sudoku_creating'] = 'Creant $a sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fi del joc de sudoku'; +$string[ 'sudoku_guessnumber'] = 'Endevini el nombre correcte'; +$string[ 'sudoku_noentriesfound'] = 'Cap paraula trobada al glossari'; + +//export.php +$string[ 'export'] = 'Exporta a mòbil'; +$string[ 'html_hascheckbutton'] = 'Botó de prova:'; +$string[ 'html_hasprintbutton'] = 'Botó impresió:'; +$string[ 'html_title'] = 'Títol d\'html:'; +$string[ 'javame_createdby'] = 'Creat per:'; +$string[ 'javame_description'] = 'Descripció:'; +$string[ 'javame_filename'] = 'Nom de l\'arxiu:'; +$string[ 'javame_icon'] = 'Icona:'; +$string[ 'javame_maxpictureheight'] = 'Alçada màxima de la imatge:'; +$string[ 'javame_maxpicturewidth'] = 'Amplada màxima de la imatge:'; +$string[ 'javame_name'] = 'Nom:'; +$string[ 'javame_type'] = 'Tipus:'; +$string[ 'javame_vendor'] = 'Venedor:'; +$string[ 'javame_version'] = 'Versió'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Fí del joc'; +$string[ 'html_hangman_new'] = 'Nou'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Ajut del públic'; +$string[ 'millionaire_info_people'] = 'La gent diu'; +$string[ 'millionaire_info_telephone'] = 'Jo penso que la resposta correcta és'; +$string[ 'millionaire_info_wrong_answer'] = 'La seva resposta és incorrecta
      La resposta correcta és:'; +$string[ 'millionaire_quit'] = 'Sortir'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Pel millonari la font és $a o preguntes i no'; +$string[ 'millionaire_telephone'] = 'Trucada telefònica'; +$string[ 'must_select_questioncategory'] = 'Cal seleccionar una categoria de preguntes'; +$string[ 'must_select_quiz'] = 'Cal seleccionar un qüestionari'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Punts'; + +//index.php +$string[ 'modulename'] = 'Joc'; +$string[ 'modulenameplural'] = 'Jocs'; +$string[ 'pluginname'] = 'Joc'; + +//lib.php +$string[ 'attempt'] = 'Intent $a'; +$string[ 'bookquiz_questions'] = 'Associa categories de preguntes amb capítuls del llibre'; +$string[ 'export_to_html'] = 'Exportar a HTML'; +$string[ 'export_to_javame'] = 'Exportar a Javame'; +$string[ 'game_bookquiz'] = 'Llibre amb preguntes'; +$string[ 'game_cross'] = 'Mots encreuats'; +$string[ 'game_cryptex'] = 'Sopa de Lletres'; +$string[ 'game_hangman'] = 'Penjat'; +$string[ 'game_hiddenpicture'] = 'Imatge amagada'; +$string[ 'game_millionaire'] = 'Millionari'; +$string[ 'game_snakes'] = 'Serps i Escales'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'No s\'ha fet cap intent en aquest qüestionari'; +$string[ 'percent'] = 'Percentatge'; +$string[ 'results'] = 'Resultats'; +$string[ 'showanswers'] = 'Mostrar respostes'; +$string[ 'showattempts'] = 'Mostrar els intents'; + +//locallib.php +$string[ 'attemptfirst'] = 'Primer intent'; +$string[ 'attemptlast'] = 'Darrer intent'; +$string[ 'gradeaverage'] = 'Nota promig'; +$string[ 'gradehighest'] = 'Nota més alta'; + +//mod_form.php +$string[ 'bottomtext'] = 'Text al final'; +$string[ 'cross_layout'] = 'Disseny'; +$string[ 'cross_layout0'] = 'Frases a la part inferior dels mots encreuats'; +$string[ 'cross_layout1'] = 'Frases a la part dreta dels mots encreuats'; +$string[ 'cross_maxcols'] = 'Nombre màxim de columnes dels mots encreuats'; +$string[ 'cross_maxwords'] = 'Màxim nombre de paraules dels mots encreuats'; +$string[ 'cross_options'] = 'Opcions dels Mots encreuats'; +$string[ 'cryptex_maxcols'] = 'Máxim nombre de columnes/fileres en la Sopa de Lletres'; +$string[ 'cryptex_maxtries'] = 'Nombre màxim d\'intents'; +$string[ 'cryptex_maxwords'] = 'Màxim nombre de paraules en Sopa de Lletres'; +$string[ 'cryptex_options'] = 'Opcions del Criptograma'; +$string[ 'grademethod'] = 'Mètode de qüalificació'; +$string[ 'hangman_allowspaces'] = 'Permetre espais en les paraules'; +$string[ 'hangman_allowsub'] = 'Permetre símbols en las paraules'; +$string[ 'hangman_imageset'] = 'Seleccioni les imatges pel penjat'; +$string[ 'hangman_language'] = 'Idioma de les paraules'; +$string[ 'hangman_maxtries'] = 'Nombre de paraules per joc'; +$string[ 'hangman_options'] = 'Opcions del Penjat'; +$string[ 'hangman_showcorrectanswer'] = 'Mostrar la resposta correcta després del final'; +$string[ 'hangman_showfirst'] = 'Mostrar la primera lletra del penjat'; +$string[ 'hangman_showlast'] = 'Mostrar la darrera lletra del penjat'; +$string[ 'hangman_showquestion'] = '¿ Mostrar les preguntes ?'; +$string[ 'hiddenpicture_across'] = 'Caselles horizontals'; +$string[ 'hiddenpicture_down'] = 'Caselles verticals'; +$string[ 'hiddenpicture_height'] = 'Establir l\'alçada de la imatge en'; +$string[ 'hiddenpicture_options'] = '\'Imatge Amagada\' opcions'; +$string[ 'hiddenpicture_pictureglossary'] = 'El glossari per la qüestió principal'; +$string[ 'hiddenpicture_width'] = 'Establir l\'amplada de la imatge en'; +$string[ 'millionaire_background'] = 'Color de fons'; +$string[ 'millionaire_options'] = 'Opcions del Millionari'; +$string[ 'millionaire_shuffle'] = 'Barrejar preguntes'; +$string[ 'snakes_background'] = 'Fons'; +$string[ 'snakes_cols'] = 'Columnes'; +$string[ 'snakes_footerx'] = 'Espai inferior esquerre'; +$string[ 'snakes_footery'] = 'Espai inferior dret'; +$string[ 'snakes_headerx'] = 'Espai superior esquerre'; +$string[ 'snakes_headery'] = 'Espai superior dret'; +$string[ 'snakes_options'] = '\'Serps i Escales\' opcions'; +$string[ 'snakes_rows'] = 'Fileres'; +$string[ 'sourcemodule'] = 'Font de preguntes'; +$string[ 'sourcemodule_book'] = 'Seleccioni un llibre'; +$string[ 'sourcemodule_glossary'] = 'Seleccioni un glossari'; +$string[ 'sourcemodule_glossarycategory'] = 'Seleccioni una categoria del glossario.'; +$string[ 'sourcemodule_include_subcategories'] = 'Incloure subcategories'; +$string[ 'sourcemodule_question'] = 'Preguntes'; +$string[ 'sourcemodule_questioncategory'] = 'Seleccioni una categoria de preguntas'; +$string[ 'sourcemodule_quiz'] = 'Seleccioni un qüestionari'; +$string[ 'sudoku_maxquestions'] = 'Máxim nombre de preguntes'; +$string[ 'sudoku_options'] = 'Opcions del Sudoku'; +$string[ 'toptext'] = 'Text de la part superior'; +$string[ 'userdefined'] = 'Definit per l\'usuari'; + +//preview.php +$string[ 'only_teachers'] = 'Només el professor pot veure aquesta pàgina'; +$string[ 'preview'] = 'Visualitzar'; + +//review.php +$string[ 'attempts'] = 'Intents'; +$string[ 'completedon'] = 'Completat en'; +$string[ 'outof'] = '$a->grade de un màxim de $a->maxgrade'; +$string[ 'review'] = 'Revisar'; +$string[ 'reviewofattempt'] = 'Revisar intents $a'; +$string[ 'startagain'] = 'Començar de nou'; +$string[ 'timetaken'] = 'Temps utilitzat'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Esborrar estadístiques'; +$string[ 'computerepetitions'] = 'Recalcular estadístiques'; +$string[ 'feedbacks'] = 'Missatges de resposta correcta'; +$string[ 'repetitions'] = 'Repeticions'; + +//showattempts.php +$string[ 'lastip'] = 'IP de l\'estudiant'; +$string[ 'showsolution'] = 'solució'; +$string[ 'timefinish'] = 'Fi del joc'; +$string[ 'timelastattempt'] = 'Darrer intent'; +$string[ 'timestart'] = 'Començament'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Intentar jugar ara'; +$string[ 'continueattemptgame'] = 'Continueu un intent previ de joc'; +$string[ 'reattemptgame'] = 'Joc de reintent'; +$string[ 'yourfinalgradeis'] = 'La seva nota fina en aquest joc és $a.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/play.php $string[ 'win'] = 'Congratulations !!!'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/de/game.php b/lang/de/game.php new file mode 100644 index 0000000..5ead87c --- /dev/null +++ b/lang/de/game.php @@ -0,0 +1,304 @@ +Willkommen zum Kreuzworträtsel!

      Klicken Sie links auf eine Wortlücke um zu beginnen.

      '; +$string[ 'letter'] = 'Buchstabe'; +$string[ 'letters'] = 'Buchstaben'; +$string[ 'nextgame'] = 'Neues Spiel'; +$string[ 'no_words'] = 'Keine Wörter gefunden!'; +$string[ 'print'] = 'Drucken'; +$string[ 'win'] = 'Glückwunsch, Sie haben gewonnen !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Spiel beenden'; + +//db/access.php +$string[ 'game:attempt'] = 'Spiel starten'; +$string[ 'game:deleteattempts'] = 'Versuche löschen'; +$string[ 'game:grade'] = 'Spiele manuell bewerten'; +$string[ 'game:manage'] = 'Verwalten'; +$string[ 'game:manageoverrides'] = 'Manage game overrides'; +$string[ 'game:preview'] = 'Vorschau der Spiele'; +$string[ 'game:reviewmyattempts'] = 'Meine Versuche wiederholen'; +$string[ 'game:view'] = 'ansehen'; +$string[ 'game:viewreports'] = 'Berichte ansehen'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Der richtige Satz war: '; +$string[ 'hangman_correct_word'] = 'Das richtige Wort war: '; +$string[ 'hangman_gradeinstance'] = 'Bewertung des gesamten Spiels'; +$string[ 'hangman_letters'] = 'Buchstaben: '; +$string[ 'hangman_restletters_many'] = 'Sie haben {$a} Versuche'; +$string[ 'hangman_restletters_one'] = 'Sie haben ONLY 1 Versuche'; +$string[ 'hangman_wrongnum'] = 'Falsch: %d von %d'; +$string[ 'nextword'] = 'nächstes Wort'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Meine Antwort bewerten'; +$string[ 'hiddenpicture_nocols'] = 'Die Anzahl der horizontalen Spalten muss angegeben werden'; +$string[ 'hiddenpicture_nomainquestion'] = 'Es gibt keine Wörterbucheinträge im Wörterbuch {$a->name} mit angefügtem Bild'; +$string[ 'hiddenpicture_norows'] = 'Die Anzahl der vertikalen Spalten muss angegeben werden.'; +$string[ 'must_select_glossary'] = 'Wähle ein Glossar'; +$string[ 'no_questions'] = 'Es sind keine Fragen vorhanden'; +$string[ 'noglossaryentriesfound'] = 'Keine Wörterbucheinträge gefunden'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Sie müssen eine Kategorie wählen'; +$string[ 'millionaire_must_select_quiz'] = 'Sie müssen ein Quiz wählen'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Zeige alle Versuche'; +$string[ 'allstudents'] = 'Alle anzeigen $a'; +$string[ 'attemptduration'] = 'Benötigte Zeit'; +$string[ 'attemptsonly'] = 'Nur Teilnehmer mit Versuchen zeigen'; +$string[ 'deleteattemptcheck'] = 'Sind Sie sicher, dass Sie diese(n) Versuch(e) löschen wollen?'; +$string[ 'displayoptions'] = 'Anzeige-Optionen'; +$string[ 'downloadods'] = 'Download im ODS-Format'; +$string[ 'feedback'] = 'Rückmeldung'; +$string[ 'noattemptsonly'] = 'Nur $a ohne Versuche anzeigen'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring absolvierte(n) $a->attemptnum Versuch(e)'; +$string[ 'pagesize'] = 'Fragen pro Seite:'; +$string[ 'reportoverview'] = 'Überblick'; +$string[ 'selectall'] = 'Alle auswählen'; +$string[ 'selectnone'] = 'Alle abwählen'; +$string[ 'showdetailedmarks'] = 'Bewertungsdetails anzeigen'; +$string[ 'startedon'] = 'Gestartet am'; +$string[ 'timecompleted'] = 'Abgeschlossen'; +$string[ 'unfinished'] = 'offen'; +$string[ 'withselected'] = 'ausgewählte'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Würfle, {$a} Augen.'; +$string[ 'snakes_player'] = 'Spieler, Position: $a.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Anzahl der Sudokus, die erstellt werden'; +$string[ 'sudoku_create_start'] = 'Beginne mit dem Erstellen'; +$string[ 'sudoku_creating'] = 'Erstelle {$a} Sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Ende des Sudoku Spiels'; +$string[ 'sudoku_guessnumber'] = 'Die richtige Nummer erraten'; +$string[ 'sudoku_noentriesfound'] = 'Keine Wörter im Wörterbuch gefunden!'; + +//export.php +$string[ 'export'] = 'Export'; +$string[ 'html_hascheckbutton'] = 'Prüftaste:'; +$string[ 'html_hasprintbutton'] = 'Drucktaste:'; +$string[ 'html_title'] = 'Titel der html-Datei (Browser-Titelzeile):'; +$string[ 'javame_createdby'] = 'Erstellt von:'; +$string[ 'javame_description'] = 'Beschreibung:'; +$string[ 'javame_filename'] = 'Dateiname:'; +$string[ 'javame_icon'] = 'Icon:'; +$string[ 'javame_maxpictureheight'] = 'Größte Bildhöhe:'; +$string[ 'javame_maxpicturewidth'] = 'Größte Bildbreite:'; +$string[ 'javame_name'] = 'Name:'; +$string[ 'javame_type'] = 'Typ:'; +$string[ 'javame_vendor'] = 'Anbieter:'; +$string[ 'javame_version'] = 'Version:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Sie haben verloren!'; +$string[ 'html_hangman_new'] = 'Neu'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Publikums-Joker'; +$string[ 'millionaire_info_people'] = 'Ergebnis'; +$string[ 'millionaire_info_telephone'] = 'Ich glaube, die richtige Antwort ist'; +$string[ 'millionaire_info_wrong_answer'] = 'Ihre Antwort ist falsch!
      Die richtige Antwort ist:'; +$string[ 'millionaire_quit'] = 'Spiel beenden'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Für Wer wird Millionär: die Quelle der Fragen muss {$a} oder Fragen sein, und nicht'; +$string[ 'millionaire_telephone'] = 'Telefon-Joker'; +$string[ 'must_select_questioncategory'] = 'Sie müssen eine Fragenkategorie wählen!'; +$string[ 'must_select_quiz'] = 'Sie müssen einen Test auswählen'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Wähle'; +$string[ 'html_snakes_correct'] = 'Richtig!'; +$string[ 'html_snakes_no_selection'] = 'Bitte wählen Sie etwas aus!'; +$string[ 'html_snakes_wrong'] = 'Ihre Antwort ist falsch. Sie bleiben auf dem gleichen Feld.'; +$string[ 'score'] = 'Bewertung'; + +//index.php +$string[ 'helpbookquiz'] = 'Nach korrekter Beantwortung der Frage kann das nächste Kapitel geöffnet werden.'; +$string[ 'helpcross'] = 'Dieses Spiel verwendet Wörter aus Glossaren oder Kurzantwort-Fragen aus Tests zur Generierung eines Kreuzworträtsels. Sie können die maximalen Zeilen und Spalten einstellen. Die Teilnehmenden können zum Überprüfen ihrer Antworten auf "Kreuzworträtsel kontrollieren" klicken. Die Rätsel werden dynamisch generiert und sehen dadurch bei jedem Versuch anders aus.'; +$string[ 'helpcryptex'] = 'Bei diesem Spiel werden wie bei einen Kreuzworträtsel die Umschreibungen der gesuchten Wörter angegeben. Die Wörter sind aber bereits in einem Gitter versteckt waagrecht oder senkrecht angeordnet. Bei jedem neuen Versuch werden die Wörter wieder anders angeordnet.'; +$string[ 'helphangman'] = 'Dieses Spiel verwendet Wörter aus Glossaren oder Kurzantwort-Fragen aus Tests als Begriffe für Galgenmännchen. Sie können die Anzahl der Wörter des Spiels einstellen, ob der erste oder letzte Buchstabe angezeigt werden soll und, ob die Frage oder Antwort am Ende angezeigt werden soll.'; +$string[ 'helphiddenpicture'] = 'Mit jeder richtigen Antwort wird ein Stück eines verdeckten Bildes enthüllt. Mit jeder Zahl auf dem Bild ist eine Frage verknüpft. Nach richtiger Beantwortung der Frage wird der entsprechende Bereich des Bildes sichtbar.'; +$string[ 'helpmillionaire'] = 'In dieser Simulation des bekannten "Wer wird Millionär?" Spiels können solange neue Fragen beantwortet werden bis die Antwort falsch ist. Mit jeder richtigen Antwort steigt der virtuell erspielte Betrag. Genau wie im Original stehen drei Joker zur Verfügung. Als Quelle dienen Multiple Choice Fragen mit vier möglichen Antworten, von denen eine korrekt ist.'; +$string[ 'helpsnakes'] = 'Durch richtiges Beantworten der Fragen im Leiterspiel kann um die durch den Würfel angezeigte Zahl vorgerückt werden. Endet der Zug auf dem Anfangsfeld einer Leiter, wird auf deren Endfeld vorgerückt. Endet er auf einer Schlange, wird auf deren Endfeld zurück gerückt, das näher am Start liegt.'; +$string[ 'helpsudoku'] = 'Dieses Spiel generiert ein Sudoku-Rätsel, das nicht genügend Ziffern enthält, um es lösen zu können. Mit jeder richtig beantworteten Frage wird eine Ziffer ergänzt, um das Sudoku einfacher lösen zu können.'; +$string[ 'modulename'] = 'Spiel'; +$string[ 'modulenameplural'] = 'Spiele'; +$string[ 'pluginadministration'] = 'Spielaktivitätsverwaltung'; +$string[ 'pluginname'] = 'Spiel'; + +//lib.php +$string[ 'attempt'] = 'Versuch'; +$string[ 'bookquiz_questions'] = 'Verknüpfe Fragenkategorie zu Buchkapitel'; +$string[ 'export_to_html'] = 'Export nach HTML'; +$string[ 'export_to_javame'] = 'Export nach Javame'; +$string[ 'game_bookquiz'] = 'Buch mit Fragen'; +$string[ 'game_cross'] = 'Kreuzworträtsel'; +$string[ 'game_cryptex'] = 'Suchrätsel'; +$string[ 'game_hangman'] = 'Galgenmännchen'; +$string[ 'game_hiddenpicture'] = 'Verstecktes Bild'; +$string[ 'game_millionaire'] = 'Wer wird Millionär'; +$string[ 'game_snakes'] = 'Schlangen und Leitern'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Für dieses Spiel wurden keine Versuche gemacht'; +$string[ 'percent'] = 'Prozent'; +$string[ 'reset_game_all'] = 'Versuche aller Spiele löschen'; +$string[ 'reset_game_deleted_course'] = 'Versuche gelöschter Kurse löschen'; +$string[ 'results'] = 'Ergebnisse'; +$string[ 'showanswers'] = 'Antworten zeigen'; +$string[ 'showattempts'] = 'Versuche anzeigen'; + +//locallib.php +$string[ 'attemptfirst'] = 'Erster Versuch'; +$string[ 'attemptlast'] = 'Letzter Versuch'; +$string[ 'convertfrom'] = '-'; +$string[ 'convertto'] = '-'; +$string[ 'gradeaverage'] = 'Durchschnittsbewertung'; +$string[ 'gradehighest'] = 'Höchste Bewertung'; + +//mod_form.php +$string[ 'bookquiz_layout'] = 'Layout'; +$string[ 'bookquiz_layout0'] = 'Fragen oben anzeigen'; +$string[ 'bookquiz_layout1'] = 'Fragen unten anzeigen'; +$string[ 'bookquiz_options'] = 'Buch Optionen'; +$string[ 'bottomtext'] = 'Text am Ende der Seite'; +$string[ 'cross_layout'] = 'Layout'; +$string[ 'cross_layout0'] = 'Sätze auf der Unterseite des Kreuzes'; +$string[ 'cross_layout1'] = 'Sätze rechts des Kreuzes'; +$string[ 'cross_maxcols'] = 'Höchstzahl an Zeilen des Kreuzworträtsels'; +$string[ 'cross_maxwords'] = 'Höchstzahl von Wörtern des Kreuzworträtsels'; +$string[ 'cross_options'] = 'Kreuzworträtsel-Optionen'; +$string[ 'cryptex_maxcols'] = 'Maximale Spalten/Zeilen des Rätsels'; +$string[ 'cryptex_maxtries'] = 'Maximale Versuche'; +$string[ 'cryptex_maxwords'] = 'Maximale Anzahl an Wörtern des Rätsels'; +$string[ 'cryptex_options'] = 'Rätsel-Optionen'; +$string[ 'gameclose'] = 'Spiel schließen'; +$string[ 'gameopen'] = 'Spiel öffnen'; +$string[ 'grademethod'] = 'Bewertungsmethode'; +$string[ 'hangman_allowspaces'] = 'Wortzwischenräume erlauben'; +$string[ 'hangman_allowsub'] = 'Symbol in Wörtern erlauben'; +$string[ 'hangman_imageset'] = 'Das Bild des Spiels wählen'; +$string[ 'hangman_language'] = 'Wortsprache'; +$string[ 'hangman_maximum_number_of_errors'] = 'Maximale Anzahl von Versuchen (Bilder mit Namensschema hangman_0.jpg, hangman_1.jpg, ...)'; +$string[ 'hangman_maxtries'] = 'Wörterzahl pro Spiel'; +$string[ 'hangman_options'] = 'Galgenmännchen-Optionen'; +$string[ 'hangman_showcorrectanswer'] = 'Die richtige Anwort erscheint am Ende des Spiels'; +$string[ 'hangman_showfirst'] = 'Ersten Buchstaben des Wortes zeigen'; +$string[ 'hangman_showlast'] = 'Letzten Buchstaben des Wortes zeigen'; +$string[ 'hangman_showquestion'] = 'Fragen zeigen?'; +$string[ 'hiddenpicture_across'] = 'Horizontale Zellen'; +$string[ 'hiddenpicture_down'] = 'Vertikale Zellen'; +$string[ 'hiddenpicture_height'] = 'Höhe des Bildes'; +$string[ 'hiddenpicture_options'] = '\'Verstecktes Bild\' Optionen'; +$string[ 'hiddenpicture_pictureglossary'] = 'Wörterbuch für Hauptfrage und Bild'; +$string[ 'hiddenpicture_width'] = 'Breite des Bildes'; +$string[ 'millionaire_background'] = 'Hintergrundfarbe'; +$string[ 'millionaire_options'] = 'Millionär-Optionen'; +$string[ 'millionaire_shuffle'] = 'Zufallsfragen'; +$string[ 'snakes_background'] = 'Hintergrund'; +$string[ 'snakes_cols'] = 'Spalten'; +$string[ 'snakes_data'] = 'Positionen für Schlangen und Leitern'; +$string[ 'snakes_file'] = 'Datei für Hintergrund'; +$string[ 'snakes_footerx'] = 'Raum unten links'; +$string[ 'snakes_footery'] = 'Raum unten rechts'; +$string[ 'snakes_headerx'] = 'Raum nach links oben'; +$string[ 'snakes_headery'] = 'Raum nach links unten'; +$string[ 'snakes_layout0'] = 'Frage über dem Bild'; +$string[ 'snakes_layout1'] = 'Frage unter dem Bild'; +$string[ 'snakes_options'] = '\'Schlangen und Leitern\' Optionen'; +$string[ 'snakes_rows'] = 'Reihen'; +$string[ 'sourcemodule'] = 'Fragen-Quelle'; +$string[ 'sourcemodule_book'] = 'Ein Buch wählen'; +$string[ 'sourcemodule_glossary'] = 'Wörtebuch wählen'; +$string[ 'sourcemodule_glossarycategory'] = 'Wörtebuch-Kategorie wählen!'; +$string[ 'sourcemodule_include_subcategories'] = 'Unterkategorien einschließen'; +$string[ 'sourcemodule_question'] = 'Fragen'; +$string[ 'sourcemodule_questioncategory'] = 'Fragenkategorie wählen'; +$string[ 'sourcemodule_quiz'] = 'Quiz wählen'; +$string[ 'sudoku_maxquestions'] = 'Maximale Anzahl von Fragen erreicht'; +$string[ 'sudoku_options'] = 'Sudoku-Optionen'; +$string[ 'toptext'] = 'Text oben'; +$string[ 'userdefined'] = 'benutzerdefiniert'; + +//preview.php +$string[ 'only_teachers'] = 'Nur Lehrende können diese Seite sehen'; +$string[ 'preview'] = 'Vorschau'; + +//review.php +$string[ 'attempts'] = 'Versuche'; +$string[ 'completedon'] = 'Beendet am'; +$string[ 'outof'] = '{$a->grade} von maximal {$a->maxgrade}'; +$string[ 'review'] = 'Überprüfung'; +$string[ 'reviewofattempt'] = 'Überprüfung eines Versuchs {$a}'; +$string[ 'showall'] = 'Zeige alle'; +$string[ 'startagain'] = 'Neu starten'; +$string[ 'timetaken'] = 'Zeitaufwand'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Statistiken löschen'; +$string[ 'computerepetitions'] = 'Statistiken neu berechnen'; +$string[ 'feedbacks'] = 'Meldungen bei korrekter Antwort'; +$string[ 'repetitions'] = 'Wiederholungen'; + +//showattempts.php +$string[ 'lastip'] = 'Benutzer IP'; +$string[ 'showsolution'] = 'Lösung'; +$string[ 'timefinish'] = 'Spiel beendet'; +$string[ 'timelastattempt'] = 'Letzter Versuch'; +$string[ 'timestart'] = 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Jetzt Spiel starten'; +$string[ 'comment'] = 'Kommentar'; +$string[ 'continueattemptgame'] = 'Einen früheren Versuch des Spiels fortführen'; +$string[ 'gameclosed'] = 'Das Spiel ist beendet {$a}'; +$string[ 'gamecloseson'] = 'Das Spiel endet um {$a}'; +$string[ 'gamenotavailable'] = 'Das Spiel ist erst verfügbar ab {$a}'; +$string[ 'gameopenedon'] = 'Das Spiel begann um {$a}'; +$string[ 'reattemptgame'] = 'Spiel nochmals probieren'; +$string[ 'yourfinalgradeis'] = 'Ihre Endbewertung für dieses Spiel ist {$a}.'; diff --git a/lang/el/game.php b/lang/el/game.php new file mode 100644 index 0000000..69bad7a --- /dev/null +++ b/lang/el/game.php @@ -0,0 +1,307 @@ + Καλωσήρθατε!

      Κάντε κλικ σε μία λέξη για να ξεκινήσετε.

      '; +$string[ 'letter'] = 'γράμμα'; +$string[ 'letters'] = 'γράμματα'; +$string[ 'nextgame'] = 'Νέο παιχνίδι'; +$string[ 'no_words'] = 'Δεν βρέθηκε καμία λέξη'; +$string[ 'print'] = 'Εκτύπωση'; +$string[ 'win'] = 'Συγχαρητήρια !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Τέλος παιχνιδιού'; + +//db/access.php +$string[ 'game:attempt'] = 'Παίξιμο παιχνιδιών'; +$string[ 'game:deleteattempts'] = 'Διαγραφή προσπαθειών του παιχνιδιού'; +$string[ 'game:grade'] = 'Χειροκίνηση βαθμολόγηση των παιχνιδιών'; +$string[ 'game:manage'] = 'Διαχείριση των παιχνιδιών'; +$string[ 'game:preview'] = 'Προεπισκόπηση των παιχνιδιών'; +$string[ 'game:reviewmyattempts'] = 'Ανασκόπηση των δικών σου προσπαθειών'; +$string[ 'game:view'] = 'Εμφάνιση πληροφοριών του παιχνιδιού'; +$string[ 'game:viewreports'] = 'Εμφάνιση των αναφορών του παιχνιδιού'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Η σωστή φράση ήταν: '; +$string[ 'hangman_correct_word'] = 'Η σωστή λέξη ήταν: '; +$string[ 'hangman_gradeinstance'] = 'Βαθμολογία σε όλο το παιχνίδι'; +$string[ 'hangman_letters'] = 'Γράμματα : '; +$string[ 'hangman_restletters_many'] = 'Έχετε {$a} προσπάθειες ακόμη'; +$string[ 'hangman_restletters_one'] = 'Έχετε ακόμη ΜΟΝΟ 1 προσπάθεια'; +$string[ 'hangman_wrongnum'] = 'Λανθασμένα: %%d out of %%d'; +$string[ 'nextword'] = 'Επόμενη λέξη'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = "Βαθμολόγησε την κυρίως ερώτηση"; +$string[ 'hiddenpicture_nocols'] = 'Πρέπει να ορίσετε τον αριθμό των κελιών οριζόντια'; +$string[ 'hiddenpicture_nomainquestion'] = 'Δεν υπάρχει καμία εγγραφή στο λεξικό {$a->name} που να περιλαμβάνει και εικόνα'; +$string[ 'hiddenpicture_norows'] = 'Πρέπει να ορίσετε τον αριθμό των κελιών κατακόρυφα'; +$string[ 'must_select_glossary'] = 'Πρέπει να επιλέξετε οπωσδήποτε ένα λεξιλόγιο'; +$string[ 'no_questions'] = 'Δεν βρέθηκαν ερωτήσεις'; +$string[ 'noglossaryentriesfound'] = 'Δεν βρέθηκαν λέξεις στο λεξικό'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Πρέπει οπωσδήποτε να διαλέξετε μία κατηγορία ερωτήσεων'; +$string[ 'millionaire_must_select_quiz'] = 'Πρέπει οπωσδήποτε να διαλέξετε ένα Κουίζ'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Δείξε όλες τις προσπάθειες'; +$string[ 'allstudents'] = 'Δείξε όλα {$a}'; +$string[ 'attemptduration'] = 'Διάρκεια παιχνιδιού'; +$string[ 'attemptsonly'] = 'Δείξε μόνο τους μαθητές που έχουν προσπαθήσει'; +$string[ 'deleteattemptcheck'] = 'Είστε απόλυτα σίγουροι ότι θέλετε να σβήσετε αυτές τις προσπάθειες;'; +$string[ 'displayoptions'] = 'Εμφάνιση παραμέτρων'; +$string[ 'downloadods'] = 'Αποθήκευση σε μορφή ODS'; +$string[ 'feedback'] = 'Απάντηση'; +$string[ 'noattemptsonly'] = 'Εμφάνιση {$a} που δεν έχουν καθόλου προσπάθειες'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring έκαναν $a->attemptnum προσπάθειες'; +$string[ 'pagesize'] = 'Ερωτήσεις ανά σελίδα:'; +$string[ 'reportoverview'] = 'Σύνοψη'; +$string[ 'selectall'] = 'Επιλογή όλων'; +$string[ 'selectnone'] = 'Αποεπιλογή όλων'; +$string[ 'showdetailedmarks'] = 'Λεπτομέρειες ερωτήσεων'; +$string[ 'startedon'] = 'Ξεκίνησε στις'; +$string[ 'timecompleted'] = 'Συμπληρωμένο'; +$string[ 'unfinished'] = 'Ατελείωτο'; +$string[ 'withselected'] = 'Με τα επιλεγμένα'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Το ζάρι έφερε {$a}.'; +$string[ 'snakes_player'] = 'Η τρέχουσα θέση του παίχτη είναι: {$a}.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Αριθμός από sudoku που θα δημιουργηθούν'; +$string[ 'sudoku_create_start'] = 'Έναρξη δημιουργίας sudoku'; +$string[ 'sudoku_creating'] = 'Δημιουργήθηκε {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Τέλος παιχνιδιού'; +$string[ 'sudoku_guessnumber'] = 'Μαντέψτε το νούμερο'; +$string[ 'sudoku_noentriesfound'] = 'Δεν βρέθηκαν λέξεις στο λεξικό'; + +//export.php +$string[ 'export'] = 'Εξαγωγή'; +$string[ 'html_hascheckbutton'] = 'Να έχει κουμπί ελέγχου σωστής απάντησης:'; +$string[ 'html_hasprintbutton'] = 'Να έχει κουμπί εκτύπωσης:'; +$string[ 'html_title'] = 'Τίτλος της ιστοσελίδας:'; +$string[ 'javame_createdby'] = 'Δημιουργήθηκε από:'; +$string[ 'javame_description'] = 'Περιγραφή:'; +$string[ 'javame_filename'] = 'Όνομα αρχείου:'; +$string[ 'javame_icon'] = 'Εικονίδιο:'; +$string[ 'javame_maxpictureheight'] = 'Μέγιστο ύψος εικόνας:'; +$string[ 'javame_maxpicturewidth'] = 'Μέγιστο πλάτος εικόνας:'; +$string[ 'javame_name'] = 'Όνομα:'; +$string[ 'javame_type'] = 'Τύπος:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'Έκδοση:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Τέλος παιχνιδιού'; +$string[ 'html_hangman_new'] = 'Νέα'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Βοήθεια του κοινού'; +$string[ 'millionaire_info_people'] = 'Το κοινό λέει'; +$string[ 'millionaire_info_telephone'] = 'Νομίζω ότι σωστή απάντηση είναι η'; +$string[ 'millionaire_info_wrong_answer'] = 'Η απάντησή σας είναι λάθος
      Η σωστή απάντηση είναι η :'; +$string[ 'millionaire_quit'] = 'Έξοδος'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Για τον εκατομμυριούχο η πηγή των ερωτήσεων έπρεπε να είναι {$a} ή Ερωτήσεις και όχι'; +$string[ 'millionaire_telephone'] = 'Βοήθεια του τηλεφώνου'; +$string[ 'must_select_questioncategory'] = 'Πρέπει να επιλέξετε οπωσδήποτε μία κατηγορία ερωτήσεων'; +$string[ 'must_select_quiz'] = 'Πρέπει να επιλέξετε ένα κουίζ'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Έλεγχος'; +$string[ 'html_snakes_correct'] = 'Πολύ σωστά!'; +$string[ 'html_snakes_no_selection'] = 'Δεν επιλέξατε κάτι!'; +$string[ 'html_snakes_wrong'] = "Η απάντησή σου ήταν λάθος. Παραμένεις στη θέση σου."; +$string[ 'score'] = 'Βαθμολογία'; + +//index.php +$string[ 'helpbookquiz'] = 'Όταν ο μαθητής απαντά σωστά μια ερώτηση πάει στο επόμενο κεφάλαιο του βιβλίου.'; +$string[ 'helpcross'] = 'Αυτό το παιχνίδι δέχεται λέξεις από το λεξικό ή τη βάση ερωτήσεων του Moodle και δημιουργεί ένα τυχαίο σταυρόλεξο. Ο καθηγητής μπορεί να ορίσει το μέγιστο αριθμό γραμμών/στηλών ή λέξεων. Κάθε σταυρόλεξο είναι δυναμικό και έτσι ο κάθε μαθητής βλέπει διαφορετικό σταυρόλεξο.'; +$string[ 'helpcryptex'] = 'Αυτό το παιχνίδι μοιάζει με το σταυρόλεξο αλλά οι απαντήσεις είναι κρυμμένες μέσα στο κρυπτόλεξο οριζόντια ή κατακόρυφα.'; +$string[ 'helphangman'] = 'Αυτό το παιχνίδι χρησιμοποιεί λέξεις από το λεξικό ή τη βάση ερωτήσεων του Moodle και δημιουργεί το γνωστό παιχνίδι Κρεμάλα. Ο καθηγητής μπορεί να καθορίσει τον αριθμό των λέξεων που θα περιέχει κάθε παιχνίδι, αν θα δείχνει το πρώτο ή το τελευταίο γράμμα ή αν θα εμφανίζει την απάντηση στο τέλος.'; +$string[ 'helphiddenpicture'] = 'Το παιχνίδι αυτό μετά από κάθε επιτυχημένη απάντηση σε μια ερώτηση αποκαλύπτει ένα μικρό κομμάτι της εικόνας βοηθώντας έτσι το μαθητή να απαντήσει στην κυρίως ερώτηση.'; +$string[ 'helpmillionaire'] = 'Σε αυτό το παιχνίδι εμφανίζεται μια ερώτηση πολλαπλής επιλογής και αν ο μαθητής την απαντήσει σωστά προχωρά στο επόμενο επίπεδο.'; +$string[ 'helpsnakes'] = 'Αυτό το παιχνίδι εμφανίζει στο μαθητή ένα ζάρι και μια ερώτηση. Αν ο μαθητής απαντήσει σωστά στην ερώτηση προχωράει στην πίστα τόσες θέσεις όσες λέει το ζάρι.'; +$string[ 'helpsudoku'] = 'Αυτό το παιχνίδι εμφανίζει ένα άλυτο sudoku. Σε κάποια τετράγωνα υπάρχουν ερωτήσεις. Αν ο μαθητής απαντήσει σωστά μια τέτοια ερώτηση του αποκαλύπτει το νούμερο που υπάρχει σε αυτό το τετράγωνο.'; +$string[ 'modulename'] = 'Παιχνίδι'; +$string[ 'modulenameplural'] = 'Παιχνίδια'; +$string[ 'pluginadministration'] = 'Διαχείριση παιχνιδιού'; +$string[ 'pluginname'] = 'Παιχνίδι'; + +//lib.php +$string[ 'attempt'] = 'Προσπάθεια'; +$string[ 'bookquiz_questions'] = 'Αντιστοίχιση κατηγοριών ερωτήσεων με κεφάλαια'; +$string[ 'export_to_html'] = 'Εξαγωγή σε HTML'; +$string[ 'export_to_javame'] = 'Εξαγωγή σε JavaMe για κινητά τηλέφωνα'; +$string[ 'game_bookquiz'] = 'Βιβλίο με ερωτήσεις'; +$string[ 'game_cross'] = 'Σταυρόλεξο'; +$string[ 'game_cryptex'] = 'Κρυπτόλεξο'; +$string[ 'game_hangman'] = 'Κρεμάλα'; +$string[ 'game_hiddenpicture'] = "Η κρυμμένη εικόνα"; +$string[ 'game_millionaire'] = 'Εκατομμυριούχος'; +$string[ 'game_snakes'] = 'Φιδάκι'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Πληροφορίες'; +$string[ 'noattempts'] = 'Καμιά προσπάθεια δεν έγινε γι\' αυτό το παιχνίδι'; +$string[ 'percent'] = 'Ποσοστό'; +$string[ 'reset_game_all'] = 'Διαγραφή προσπαθειών από όλα τα παιχνίδια'; +$string[ 'reset_game_deleted_course'] = 'Διαγραφή προσπαθειών από όλα τα διαγραμμένα μαθήματα'; +$string[ 'results'] = 'Αποτελέσματα'; +$string[ 'showanswers'] = 'Εμφάνιση απαντήσεων'; +$string[ 'showattempts'] = 'Εμφάνιση προσπαθειών'; + +//locallib.php +$string[ 'attemptfirst'] = 'Πρώτη προσπάθεια'; +$string[ 'attemptlast'] = 'Τελευταία προσπάθεια'; +$string[ 'convertfrom'] = 'ἈΆἈἈἊΈἘἚΕΕΉΊΪἸἹΌΎΫύΏῶῶ'; +$string[ 'convertto'] = 'ΑΑΑΑΑΕΕΕΕΕΗΙΙΙΙΟΥΥΥΩΩΩ'; +$string[ 'gradeaverage'] = 'Μέσος βαθμός'; +$string[ 'gradehighest'] = 'Ο υψηλότερος βαθμός'; + +//mod_form.php +$string[ 'bookquiz_layout'] = 'Μορφή εμφάνισης'; +$string[ 'bookquiz_layout0'] = 'Εμφάνιση των ερωτήσεων στο πάνω μέρος του βιβλίου'; +$string[ 'bookquiz_layout1'] = 'Εμφάνιση των ερωτήσεων στο κάτω μέρος του βιβλίου'; +$string[ 'bookquiz_options'] = 'Παράμετροι του παιχνιδίου "Βιβλίο με ερωτήσεις"'; +$string[ 'bottomtext'] = 'Κείμενο στο κάτω μέρος της σελίδας'; +$string[ 'cross_layout'] = 'Τρόπος εμφάνισης'; +$string[ 'cross_layout0'] = 'Οι ορισμοί κάτω από το σταυρόλεξο'; +$string[ 'cross_layout1'] = 'Οι ορισμοί στα δεξιά του σταυρολέξου'; +$string[ 'cross_maxcols'] = 'Μέγιστος αριθμός γραμμών/στηλών στο σταυρόλεξο'; +$string[ 'cross_maxwords'] = 'Μέγιστος αριθμός λέξεων στο σταυρόλεξο'; +$string[ 'cross_options'] = 'Παράμετροι Σταυρολέξου'; +$string[ 'cryptex_maxcols'] = 'Μέγιστος αριθμός γραμμών/στηλών στο κρυπτόλεξο'; +$string[ 'cryptex_maxtries'] = 'Μέγιστος αριθμός προσπαθειών'; +$string[ 'cryptex_maxwords'] = 'Μέγιστος αριθμός λέξεων στο κρυπτόλεξο'; +$string[ 'cryptex_options'] = 'Παράμετροι Κρυπτόλεξου'; +$string[ 'gameclose'] = 'Κλείσιμο του παιχνιδιού'; +$string[ 'gameopen'] = 'Άνοιγμα του παιχνιδιού'; +$string[ 'grademethod'] = 'Μέθοδος βαθμολόγησης'; +$string[ 'hangman_allowspaces'] = 'Να επιτρέπονται τα κενά στις λέξεις'; +$string[ 'hangman_allowsub'] = 'Nα επιτρέπεται το σύμβολο - στις λέξεις'; +$string[ 'hangman_imageset'] = 'Διαλέξτε συλλογή φωτογραφιών'; +$string[ 'hangman_language'] = 'Γλώσσα στην οποία είναι οι λέξεις'; +$string[ 'hangman_maximum_number_of_errors'] = 'Μέγιστος αριθμός λάθος γραμμάτων (πρέπει να υπάρχουν τα αντίστοιχα αρχεία με όνομα hangman_0.jpg, hangman_1.jpg, ...)'; +$string[ 'hangman_maxtries'] = 'Αριθμός λέξεων ανά παιχνίδι'; +$string[ 'hangman_options'] = 'Παράμετροι Κρεμάλας'; +$string[ 'hangman_showcorrectanswer'] = 'Να εμφανίζει τη σωστή απάντηση μετά το τέλος του παιχνιδιού ;'; +$string[ 'hangman_showfirst'] = 'Να εμφανίζει το πρώτο γράμμα της λέξης'; +$string[ 'hangman_showlast'] = 'Να εμφανίζει το τελευταίο γράμμα της λέξης'; +$string[ 'hangman_showquestion'] = 'Να εμφανίζει τις ερωτήσεις ;'; +$string[ 'hiddenpicture_across'] = "Αριθμός κελιών οριζόντια"; +$string[ 'hiddenpicture_down'] = "Αριθμός κελιών κατακόρυφα"; +$string[ 'hiddenpicture_height'] = 'Ορισμός ύψους εικόνας'; +$string[ 'hiddenpicture_options'] = 'Παράμετροι Κρυμμένης Εικόνας'; +$string[ 'hiddenpicture_pictureglossary'] = 'Το λεξικό για την κυρίως ερώτηση'; +$string[ 'hiddenpicture_width'] = 'Ορισμός πλάτους εικόνας'; +$string[ 'millionaire_background'] = 'Χρώμα φόντου'; +$string[ 'millionaire_options'] = 'Παράμετροι Εκατομμυριούχου'; +$string[ 'millionaire_shuffle'] = 'Ανακάτεμα ερωτήσεων'; +$string[ 'snakes_background'] = 'Πίστα'; +$string[ 'snakes_cols'] = 'Στήλες'; +$string[ 'snakes_data'] = 'Πίστα'; +$string[ 'snakes_file'] = 'Αρχείο πίστας'; +$string[ 'snakes_footerx'] = 'Αριστερό περιθώριο (pixels)'; +$string[ 'snakes_footery'] = 'Κάτω περιθώριο (pixels)'; +$string[ 'snakes_headerx'] = 'Δεξί περιθώριο (pixels)'; +$string[ 'snakes_headery'] = 'Πάνω περιθώριο (pixels)'; +$string[ 'snakes_layout0'] = 'Εμφάνιση των ερωτήσεων στο πάνω μέρος της πίστας'; +$string[ 'snakes_layout1'] = 'Εμφάνιση των ερωτήσεων στο κάτω μέρος της πίστας'; +$string[ 'snakes_options'] = 'Παράμετροι για το Φιδάκι'; +$string[ 'snakes_rows'] = 'Γραμμές'; +$string[ 'sourcemodule'] = 'Πηγή ερωτήσεων'; +$string[ 'sourcemodule_book'] = 'Διαλέξτε βιβλίο'; +$string[ 'sourcemodule_glossary'] = 'Διαλέξτε λεξικό'; +$string[ 'sourcemodule_glossarycategory'] = 'Διαλέξτε κατηγορία λεξικού'; +$string[ 'sourcemodule_include_subcategories'] = 'Να συμπεριλαμβάνονται οι υποκατηγορίες'; +$string[ 'sourcemodule_question'] = 'Ερωτήσεις'; +$string[ 'sourcemodule_questioncategory'] = 'Διαλέξτε κατηγορία ερωτήσεων'; +$string[ 'sourcemodule_quiz'] = 'Διαλέξτε κουιζ'; +$string[ 'sudoku_maxquestions'] = 'Μέγιστος αριθμός ερωτήσεων'; +$string[ 'sudoku_options'] = 'Παράμετροι Sudoku'; +$string[ 'toptext'] = 'Κείμενο στο πάνω μέρος της σελίδας'; +$string[ 'userdefined'] = "Πίστα ορισμένη από το χρήστη"; + +//preview.php +$string[ 'only_teachers'] = 'Μόνο teacher μπορούν να δουν αυτή τη σελίδα'; +$string[ 'preview'] = 'Προεπισκόπηση'; + +//review.php +$string[ 'attempts'] = 'Προσπάθειες'; +$string[ 'completedon'] = 'Ολοκληρώθηκε στις'; +$string[ 'outof'] = '{$a->grade} από μέγιστο {$a->maxgrade}'; +$string[ 'review'] = 'Επανεξέταση'; +$string[ 'reviewofattempt'] = 'Επανεξέταση της προσπάθειας {$a}'; +$string[ 'showall'] = 'Εμφάνιση όλων'; +$string[ 'startagain'] = 'Προσπάθεια ξανά'; +$string[ 'timetaken'] = 'Χρόνος που χρειάστηκε'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Μηδενισμός στατιστικών'; +$string[ 'computerepetitions'] = 'Επαναϋπολογισμός στατιστικών'; +$string[ 'feedbacks'] = 'Μήνυμα σωστής απάντησης'; +$string[ 'repetitions'] = 'Επαναλήψεις'; + +//showattempts.php +$string[ 'lastip'] = 'IP σπουδαστή'; +$string[ 'showsolution'] = 'Λύση'; +$string[ 'timefinish'] = 'Τέλος παιχνιδιού'; +$string[ 'timelastattempt'] = 'Τελευταία προσπάθεια'; +$string[ 'timestart'] = 'Έναρξη'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Προσπάθεια παιχνιδιού τώρα'; +$string[ 'comment'] = 'Σχόλια'; +$string[ 'continueattemptgame'] = 'Συνέχιση του παιχνιδιού'; +$string[ 'gameclosed'] = 'Το παιχνίδι έκλεισε στις {$a}'; +$string[ 'gamecloseson'] = 'Το παιχνίδι θα κλείσει στις {$a}'; +$string[ 'gamenotavailable'] = 'Το παιχνίδι δε θα είναι διαθέσιμο μέχρι: {$a}'; +$string[ 'gameopenedon'] = 'Το παιχνίδι άνοιξε στις {$a}'; +$string[ 'reattemptgame'] = 'Προσπάθεια παιχνιδιού ξανά'; +$string[ 'yourfinalgradeis'] = 'Ο τελικός σου βαθμός γι\' αυτό το παιχνίδι είναι {$a}'; + +//Untranslated +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; diff --git a/lang/en/game.php b/lang/en/game.php new file mode 100644 index 0000000..0389c74 --- /dev/null +++ b/lang/en/game.php @@ -0,0 +1,304 @@ +Welcome!

      Click on a word to begin.

      '; +$string[ 'letter'] = 'letter'; +$string[ 'letters'] = 'letters'; +$string[ 'nextgame'] = 'New game'; +$string[ 'no_words'] = 'There are no words'; +$string[ 'print'] = 'Print'; +$string[ 'win'] = 'Congratulations !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'End of game'; + +//db/access.php +$string[ 'game:attempt'] = 'Play game'; +$string[ 'game:deleteattempts'] = 'Delete attempts'; +$string[ 'game:grade'] = 'Grade games manually'; +$string[ 'game:manage'] = 'Manage'; +$string[ 'game:manageoverrides'] = 'Manage game overrides'; +$string[ 'game:preview'] = 'Preview Games'; +$string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +$string[ 'game:view'] = 'view'; +$string[ 'game:viewreports'] = 'viewreports'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'The correct phrase was: '; +$string[ 'hangman_correct_word'] = 'The correct word was: '; +$string[ 'hangman_gradeinstance'] = 'Grade in whole game'; +$string[ 'hangman_letters'] = 'Letters: '; +$string[ 'hangman_restletters_many'] = 'You have {$a} tries'; +$string[ 'hangman_restletters_one'] = 'You have ONLY 1 try'; +$string[ 'hangman_wrongnum'] = 'Wrong: %d out of %d'; +$string[ 'nextword'] = 'Next word'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Grade main answer'; +$string[ 'hiddenpicture_nocols'] = 'Have to specify the number of cols horizontaly'; +$string[ 'hiddenpicture_nomainquestion'] = 'There are no glossary entries on glossary {$a->name} with an attached picture'; +$string[ 'hiddenpicture_norows'] = 'Have to specify the number of cols verticaly'; +$string[ 'must_select_glossary'] = 'You must select a glossary'; +$string[ 'no_questions'] = "There are no questions"; +$string[ 'noglossaryentriesfound'] = 'No glossary entries found'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'You must select one question category'; +$string[ 'millionaire_must_select_quiz'] = 'You must select one quiz'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Show all tries'; +$string[ 'allstudents'] = 'Show all $a'; +$string[ 'attemptduration'] = 'Attempt duration'; +$string[ 'attemptsonly'] = 'Show only students with attempts'; +$string[ 'deleteattemptcheck'] = 'Are you absolutely sure you want to completely delete these attempts?'; +$string[ 'displayoptions'] = 'Display options'; +$string[ 'downloadods'] = 'Download in ODS format'; +$string[ 'feedback'] = 'Feedback'; +$string[ 'noattemptsonly'] = 'Show $a with no attempts only'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring have made $a->attemptnum attempts'; +$string[ 'pagesize'] = 'Questions per page:'; +$string[ 'reportoverview'] = 'Overview'; +$string[ 'selectall'] = 'Select all'; +$string[ 'selectnone'] = 'Deselect all'; +$string[ 'showdetailedmarks'] = 'Show mark details'; +$string[ 'startedon'] = 'Started on'; +$string[ 'timecompleted'] = 'Completed'; +$string[ 'unfinished'] = 'open'; +$string[ 'withselected'] = 'With selected'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Dice, $a spots.'; +$string[ 'snakes_player'] = 'Player, position: $a.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Number of sudokus that will be created'; +$string[ 'sudoku_create_start'] = 'Start creating sudokus'; +$string[ 'sudoku_creating'] = 'Creating {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'End of game'; +$string[ 'sudoku_guessnumber'] = 'Guess the correct number'; +$string[ 'sudoku_noentriesfound'] = 'No words found in glossary'; + +//export.php +$string[ 'export'] = 'Export'; +$string[ 'html_hascheckbutton'] = 'Has check button:'; +$string[ 'html_hasprintbutton'] = 'Has print button:'; +$string[ 'html_title'] = 'Title of html:'; +$string[ 'javame_createdby'] = 'Created by:'; +$string[ 'javame_description'] = 'Description:'; +$string[ 'javame_filename'] = 'Filename:'; +$string[ 'javame_icon'] = 'Icon:'; +$string[ 'javame_maxpictureheight'] = 'Max picture height:'; +$string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +$string[ 'javame_name'] = 'Name:'; +$string[ 'javame_type'] = 'Type:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'Version:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Game over'; +$string[ 'html_hangman_new'] = 'New'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Help of people'; +$string[ 'millionaire_info_people'] = 'People say'; +$string[ 'millionaire_info_telephone'] = 'I think that the correct answer is '; +$string[ 'millionaire_info_wrong_answer'] = 'Your answer is wrong
      The right answer is:'; +$string[ 'millionaire_quit'] = 'Quit'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'For the millionaire the source must be {$a} or questions and not'; +$string[ 'millionaire_telephone'] = 'Help of telephone'; +$string[ 'must_select_questioncategory'] = 'You must select a question category'; +$string[ 'must_select_quiz'] = 'You must select a quiz'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Check'; +$string[ 'html_snakes_correct'] = 'Correct!'; +$string[ 'html_snakes_no_selection'] = 'Have to select something!'; +$string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +$string[ 'score'] = 'Score'; + +//index.php +$string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +$string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +$string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +$string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +$string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +$string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +$string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +$string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +$string[ 'modulename'] = 'Game'; +$string[ 'modulenameplural'] = 'Games'; +$string[ 'pluginadministration'] = 'Game administration'; +$string[ 'pluginname'] = 'Game'; + +//lib.php +$string[ 'attempt'] = 'Attempt'; +$string[ 'bookquiz_questions'] = 'Associate question categories to chapter of book'; +$string[ 'export_to_html'] = 'Export to HTML'; +$string[ 'export_to_javame'] = 'Export to Javame'; +$string[ 'game_bookquiz'] = 'Book with questions'; +$string[ 'game_cross'] = 'Crossword'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Hangman'; +$string[ 'game_hiddenpicture'] = 'Hidden Picture'; +$string[ 'game_millionaire'] = 'Millionaire'; +$string[ 'game_snakes'] = 'Snakes and Ladders'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'No attempts have been made on this game'; +$string[ 'percent'] = 'Percent'; +$string[ 'reset_game_all'] = 'Delete tries from all games'; +$string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +$string[ 'results'] = 'Results'; +$string[ 'showanswers'] = 'Show answers'; +$string[ 'showattempts'] = 'Show attempts'; + +//locallib.php +$string[ 'attemptfirst'] = 'First attempt'; +$string[ 'attemptlast'] = 'Last attempt'; +$string[ 'convertfrom'] = '-'; +$string[ 'convertto'] = '-'; +$string[ 'gradeaverage'] = 'Average grade'; +$string[ 'gradehighest'] = 'Highest grade'; + +//mod_form.php +$string[ 'bookquiz_layout'] = 'Layout'; +$string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +$string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +$string[ 'bookquiz_options'] = 'Bookquiz options'; +$string[ 'bottomtext'] = 'Text at the bottom of page'; +$string[ 'cross_layout'] = 'Layout'; +$string[ 'cross_layout0'] = 'Phrases on the bottom of cross'; +$string[ 'cross_layout1'] = 'Phrases on the right of cross'; +$string[ 'cross_maxcols'] = 'Maximum number of cols of crossword'; +$string[ 'cross_maxwords'] = 'Maximum number of words of crossword'; +$string[ 'cross_options'] = 'Crossword options'; +$string[ 'cryptex_maxcols'] = 'Maximum number of cols/rows in cryptex'; +$string[ 'cryptex_maxtries'] = 'Max tries'; +$string[ 'cryptex_maxwords'] = 'Maximum number of words in cryptex'; +$string[ 'cryptex_options'] = 'Cryptex ofptions'; +$string[ 'gameclose'] = 'Close the game'; +$string[ 'gameopen'] = 'Open the game'; +$string[ 'grademethod'] = 'Grading method'; +$string[ 'hangman_allowspaces'] = 'Allow spaces in words'; +$string[ 'hangman_allowsub'] = 'Allow the symbol - in words'; +$string[ 'hangman_imageset'] = 'Select the images of hangman'; +$string[ 'hangman_language'] = 'Language of words'; +$string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +$string[ 'hangman_maxtries'] = 'Number of words per game'; +$string[ 'hangman_options'] = 'Hangman options'; +$string[ 'hangman_showcorrectanswer'] = 'Show the correct answer after the end'; +$string[ 'hangman_showfirst'] = 'Show first letter of hangman'; +$string[ 'hangman_showlast'] = 'Show last letter of hangman'; +$string[ 'hangman_showquestion'] = 'Show the questions ?'; +$string[ 'hiddenpicture_across'] = 'Cells horizontal'; +$string[ 'hiddenpicture_down'] = 'Cells down'; +$string[ 'hiddenpicture_height'] = 'Set height of picture to'; +$string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +$string[ 'hiddenpicture_pictureglossary'] = 'The glossary for main question and picture'; +$string[ 'hiddenpicture_width'] = 'Set width of picture to'; +$string[ 'millionaire_background'] = 'Background color'; +$string[ 'millionaire_options'] = 'Millionaire\' options'; +$string[ 'millionaire_shuffle'] = 'Randomize questions'; +$string[ 'snakes_background'] = 'Background'; +$string[ 'snakes_cols'] = 'Cols'; +$string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +$string[ 'snakes_file'] = 'File for background'; +$string[ 'snakes_footerx'] = 'Space at bootom left'; +$string[ 'snakes_footery'] = 'Space at bottom right'; +$string[ 'snakes_headerx'] = 'Space at up left'; +$string[ 'snakes_headery'] = 'Space at up right'; +$string[ 'snakes_layout0'] = 'Question at the top of the image'; +$string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +$string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +$string[ 'snakes_rows'] = 'Rows'; +$string[ 'sourcemodule'] = 'Source of questions'; +$string[ 'sourcemodule_book'] = 'Select a book'; +$string[ 'sourcemodule_glossary'] = 'Select glossary'; +$string[ 'sourcemodule_glossarycategory'] = 'Select category of glossary'; +$string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +$string[ 'sourcemodule_question'] = 'Questions'; +$string[ 'sourcemodule_questioncategory'] = 'Select question category'; +$string[ 'sourcemodule_quiz'] = 'Select quiz'; +$string[ 'sudoku_maxquestions'] = 'Maximum number of questions'; +$string[ 'sudoku_options'] = 'Sudoku options'; +$string[ 'toptext'] = 'Text at the top of page'; +$string[ 'userdefined'] = 'User defined'; + +//preview.php +$string[ 'only_teachers'] = 'Only teacher can see this page'; +$string[ 'preview'] = 'Preview'; + +//review.php +$string[ 'attempts'] = 'Attempts'; +$string[ 'completedon'] = 'Completed on'; +$string[ 'outof'] = '{$a->grade} out of a maximum of {$a->maxgrade}'; +$string[ 'review'] = 'Review'; +$string[ 'reviewofattempt'] = 'Review of Attempt {$a}'; +$string[ 'showall'] = 'Show all'; +$string[ 'startagain'] = 'Start again'; +$string[ 'timetaken'] = 'Time taken'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Clear statistics'; +$string[ 'computerepetitions'] = 'Compute statistics again'; +$string[ 'feedbacks'] = 'Messages correct answer'; +$string[ 'repetitions'] = 'Repetitions'; + +//showattempts.php +$string[ 'lastip'] = 'IP student'; +$string[ 'showsolution'] = 'solution'; +$string[ 'timefinish'] = 'End of game'; +$string[ 'timelastattempt'] = 'Last attempt'; +$string[ 'timestart'] = 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Attempt game now'; +$string[ 'comment'] = 'Comment'; +$string[ 'continueattemptgame'] = 'Continue a previous attempt of game'; +$string[ 'gameclosed'] = 'This game closed on {$a}'; +$string[ 'gamecloseson'] = 'This game will close at {$a}'; +$string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +$string[ 'gameopenedon'] = 'This game opened at {$a}'; +$string[ 'reattemptgame'] = 'Reattempt game'; +$string[ 'yourfinalgradeis'] = 'Your final grade for this game is {$a}.'; diff --git a/lang/es/game.php b/lang/es/game.php new file mode 100644 index 0000000..1aba832 --- /dev/null +++ b/lang/es/game.php @@ -0,0 +1,305 @@ +¡Bienvenido!

      Haga clic en una palabra para comenzar.

      '; +$string[ 'letter'] = 'letra'; +$string[ 'letters'] = 'letras'; +$string[ 'nextgame'] = 'Siguiente juego'; +$string[ 'no_words'] = 'Ninguna palabra encontrada'; +$string[ 'print'] = 'Imprimir'; +$string[ 'win'] = '¡¡¡ Felicitaciones !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Fin del juego'; + +//db/access.php +$string[ 'game:attempt'] = 'Juega el juego'; +$string[ 'game:deleteattempts'] = 'Borrar intentos'; +$string[ 'game:manage'] = 'Administrar'; +$string[ 'game:reviewmyattempts'] = 'Revisar mis intentos'; +$string[ 'game:view'] = 'Ver'; +$string[ 'game:viewreports'] = 'Ver reportes'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'La frase correcta fué: '; +$string[ 'hangman_correct_word'] = 'La palabra correcta fué: '; +$string[ 'hangman_gradeinstance'] = 'Nivel en el juego completo'; +$string[ 'hangman_letters'] = 'Letras: '; +$string[ 'hangman_restletters_many'] = 'Ud. tiene {$a} intentos'; +$string[ 'hangman_restletters_one'] = 'Ud. tienen ÚNICAMENTE 1 intento'; +$string[ 'hangman_wrongnum'] = 'Malas: %%d de %%d'; +$string[ 'nextword'] = 'Siguiente palabra'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Calificación de la pregunta principal'; +$string[ 'hiddenpicture_nocols'] = 'Tiene que especificar el número de filas horizontales'; +$string[ 'hiddenpicture_nomainquestion'] = 'No hay entradas en el glosario glosario {$a->name} con una imagen adjunta'; +$string[ 'hiddenpicture_norows'] = 'Tiene que especificar el número de columnas verticales'; +$string[ 'must_select_glossary'] = 'Ud debe seleccionar un glosario'; +$string[ 'noglossaryentriesfound'] = 'No se han encontrado entradas de glosario'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Usted debe seleccionar una categoría de preguntas'; +$string[ 'millionaire_must_select_quiz'] = 'Usted debe seleccionar un cuestionario'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Mostrar todos los intentos'; +$string[ 'allstudents'] = 'Mostrar todos $a'; +$string[ 'attemptsonly'] = 'Mostrar únicamente estudiantes con intentos'; +$string[ 'deleteattemptcheck'] = 'Esta absolútamente seguro de querer borrar completamente estos intentos?'; +$string[ 'displayoptions'] = 'Mostrar opciones'; +$string[ 'downloadods'] = 'Descargar en formato ODS'; +$string[ 'feedback'] = 'Retroalimentación'; +$string[ 'noattemptsonly'] = 'Mostrar $a unicamente sin intentos'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring ha hecho $a->attemptnum intentos'; +$string[ 'pagesize'] = 'Preguntas por página:'; +$string[ 'reportoverview'] = 'Listado'; +$string[ 'selectall'] = 'Seleccione todos'; +$string[ 'selectnone'] = 'Des-marcar todos'; +$string[ 'showdetailedmarks'] = 'Mostrar detalles de marca'; +$string[ 'startedon'] = 'Comenzó en'; +$string[ 'timecompleted'] = 'Completado'; +$string[ 'unfinished'] = 'abierto'; +$string[ 'withselected'] = 'Con seleccionados'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Número de sudokus que serán creados'; +$string[ 'sudoku_create_start'] = 'Comenzar creando sudokus'; +$string[ 'sudoku_creating'] = 'Creando {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fin del juego de sudoku'; +$string[ 'sudoku_guessnumber'] = 'Adivine el número correcto'; +$string[ 'sudoku_noentriesfound'] = 'Ninguna palabra encontrada en el glosario'; + +//export.php +$string[ 'export'] = 'Exporta a móvil'; +$string[ 'html_hascheckbutton'] = 'Botón de prueba:'; +$string[ 'html_hasprintbutton'] = 'Botón de impresión:'; +$string[ 'html_title'] = 'Título de html:'; +$string[ 'javame_createdby'] = 'Creado por:'; +$string[ 'javame_description'] = 'Descripción:'; +$string[ 'javame_filename'] = 'Nombe del archivo:'; +$string[ 'javame_icon'] = 'Icono:'; +$string[ 'javame_maxpictureheight'] = 'Altura máxima de la imagen:'; +$string[ 'javame_maxpicturewidth'] = 'Anchura máxima de la imagen:'; +$string[ 'javame_name'] = 'Nombre:'; +$string[ 'javame_type'] = 'Tipo:'; +$string[ 'javame_vendor'] = 'Vendedor:'; +$string[ 'javame_version'] = 'Versión'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Fin del juego'; +$string[ 'html_hangman_new'] = 'Nuevo'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Ayuda del público'; +$string[ 'millionaire_info_people'] = 'La gente dice'; +$string[ 'millionaire_info_telephone'] = 'Yo pienso que la respuesta correcta es'; +$string[ 'millionaire_info_wrong_answer'] = 'Su respuesta es incorrecta
      La respuesta correcta es:'; +$string[ 'millionaire_quit'] = 'Salir'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Para millonario la fuente debe ser {$a} o preguntas y no'; +$string[ 'millionaire_telephone'] = 'Llamada telefónica'; +$string[ 'must_select_questioncategory'] = 'Ud debe seleccionar una categoría de preguntas'; +$string[ 'must_select_quiz'] = 'Ud debe seleccionar un cuestionario'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Puntaje'; + +//index.php +$string[ 'modulename'] = 'Juego'; +$string[ 'modulenameplural'] = 'Juegos'; +$string[ 'pluginname'] = 'Juego'; + +//lib.php +$string[ 'attempt'] = 'Intento'; +$string[ 'bookquiz_questions'] = 'Asocie categorías de preguntas con capítulos del libro'; +$string[ 'export_to_html'] = 'Exportar a HTML'; +$string[ 'export_to_javame'] = 'Exportar a Javame'; +$string[ 'game_bookquiz'] = 'Libro con preguntas'; +$string[ 'game_cross'] = 'Crucigrama'; +$string[ 'game_cryptex'] = 'Sopa de Letras'; +$string[ 'game_hangman'] = 'Ahorcado'; +$string[ 'game_hiddenpicture'] = 'Imagen oculta'; +$string[ 'game_millionaire'] = 'Millonario'; +$string[ 'game_snakes'] = 'Serpientes y Escaleras'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Ningún intento ha sido hecho en este cuestionario'; +$string[ 'percent'] = 'Porcentaje'; +$string[ 'results'] = 'Resultados'; +$string[ 'showanswers'] = 'Mostrar respuestas'; +$string[ 'showattempts'] = 'Mostrar los intentos'; + +//locallib.php +$string[ 'attemptfirst'] = 'Primer intento'; +$string[ 'attemptlast'] = 'Último intento'; +$string[ 'gradeaverage'] = 'Nota promedio'; +$string[ 'gradehighest'] = 'Nota más alta'; + +//mod_form.php +$string[ 'bottomtext'] = 'Texto al final'; +$string[ 'cross_layout'] = 'Diseño'; +$string[ 'cross_layout0'] = 'Frases en la parte inferior del crucigrama'; +$string[ 'cross_layout1'] = 'Frases en la parte derecha del crucigrama'; +$string[ 'cross_maxcols'] = 'Número máximo de columnas del crucigrama'; +$string[ 'cross_maxwords'] = 'Máximo número de palabras del crucigrama'; +$string[ 'cross_options'] = 'Opciones del Crucigrama'; +$string[ 'cryptex_maxcols'] = 'Máximo número de columnas/filas en Sopa de Letras'; +$string[ 'cryptex_maxtries'] = 'Número máximo de intentos'; +$string[ 'cryptex_maxwords'] = 'Máximo número de palabras en Sopa de Letras'; +$string[ 'cryptex_options'] = 'Opciones del Criptograma'; +$string[ 'grademethod'] = 'Método de calificación'; +$string[ 'hangman_allowspaces'] = 'Permitir espacios en las palabras'; +$string[ 'hangman_allowsub'] = 'Permitir símbolos en las palabras'; +$string[ 'hangman_imageset'] = 'Seleccione las imágenes para el ahorcado'; +$string[ 'hangman_language'] = 'Idioma de las palabras'; +$string[ 'hangman_maxtries'] = 'Número de palabras por juego'; +$string[ 'hangman_options'] = 'Opciones del Ahorcado'; +$string[ 'hangman_showcorrectanswer'] = 'Mostrar la respuesta correcta después del final'; +$string[ 'hangman_showfirst'] = 'Mostrar la primera letra de ahorcado'; +$string[ 'hangman_showlast'] = 'Mostrar la última letra del ahorcado'; +$string[ 'hangman_showquestion'] = '¿ Mostrar las preguntas ?'; +$string[ 'hiddenpicture_across'] = 'Celdas horizontales'; +$string[ 'hiddenpicture_down'] = 'Celdas verticales'; +$string[ 'hiddenpicture_height'] = 'Establecer la altura de la imagen en'; +$string[ 'hiddenpicture_options'] = '\'Imagen Oculta\' opciones'; +$string[ 'hiddenpicture_pictureglossary'] = 'El glosario para la cuestión principal'; +$string[ 'hiddenpicture_width'] = 'Establecer el ancho de la imagen en'; +$string[ 'millionaire_background'] = 'Color de fondo'; +$string[ 'millionaire_options'] = 'Opciones del Millonario'; +$string[ 'millionaire_shuffle'] = 'Mezclar preguntas'; +$string[ 'snakes_background'] = 'Fondo'; +$string[ 'snakes_cols'] = 'Columnas'; +$string[ 'snakes_footerx'] = 'Espacio inferior izquierdo'; +$string[ 'snakes_footery'] = 'Espacio inferior derecho'; +$string[ 'snakes_headerx'] = 'Espacio superior izquierdo'; +$string[ 'snakes_headery'] = 'Espacio superior derecho'; +$string[ 'snakes_options'] = '\'Serpientes y Escaleras\' opciones'; +$string[ 'snakes_rows'] = 'Filas'; +$string[ 'sourcemodule'] = 'Fuente de preguntas'; +$string[ 'sourcemodule_book'] = 'Seleccione un libro'; +$string[ 'sourcemodule_glossary'] = 'Seleccione un glosario'; +$string[ 'sourcemodule_glossarycategory'] = 'Seleccione una categoría del glosario.'; +$string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +$string[ 'sourcemodule_question'] = 'Preguntas'; +$string[ 'sourcemodule_questioncategory'] = 'Seleccione una categoría de preguntas'; +$string[ 'sourcemodule_quiz'] = 'Seleccione un cuestionario'; +$string[ 'sudoku_maxquestions'] = 'Máximo número de preguntas'; +$string[ 'sudoku_options'] = 'Opciones del Sudoku'; +$string[ 'toptext'] = 'Texto de la parte superior'; +$string[ 'userdefined'] = 'Definido por el usuario'; + +//preview.php +$string[ 'only_teachers'] = 'Sólo el profesor puede ver esta página'; +$string[ 'preview'] = 'Visualizar'; + +//review.php +$string[ 'attempts'] = 'Intentos'; +$string[ 'completedon'] = 'Completado en'; +$string[ 'outof'] = '{$a->grade} out of a maximum of {$a->maxgrade}'; +$string[ 'review'] = 'Revisar'; +$string[ 'reviewofattempt'] = 'Revisar intentos {$a}'; +$string[ 'startagain'] = 'Comenzar de nuevo'; +$string[ 'timetaken'] = 'Tiempo utilizado'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Borrar estadísticas'; +$string[ 'computerepetitions'] = 'Recalcular estadísticas'; +$string[ 'feedbacks'] = 'Mensajes de respuesta correcta'; +$string[ 'repetitions'] = 'Repeticiones'; + +//showattempts.php +$string[ 'lastip'] = 'IP del estudiante'; +$string[ 'showsolution'] = 'solución'; +$string[ 'timefinish'] = 'Fin del juego'; +$string[ 'timelastattempt'] = 'Último intento'; +$string[ 'timestart'] = 'Comienzo'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Intente jugar ahora'; +$string[ 'continueattemptgame'] = 'Continue un intento previo de juego'; +$string[ 'reattemptgame'] = 'Juego de reintento'; +$string[ 'yourfinalgradeis'] = 'Su nota final en este juego es {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/eu/game.php b/lang/eu/game.php new file mode 100644 index 0000000..a47393a --- /dev/null +++ b/lang/eu/game.php @@ -0,0 +1,304 @@ +Ongi etorri!

      Hasteko hitz batean klik egin.

      '; +$string[ 'letter'] = 'letra'; +$string[ 'letters'] = 'letrak'; +$string[ 'nextgame'] = 'Hurrengo jolasa'; +$string[ 'no_words'] = 'Ez da hitzik aurkitu'; +$string[ 'print'] = 'Imprimatu'; +$string[ 'win'] = 'Zorionak!!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Jolasa bukatu da'; + +//db/access.php +$string[ 'game:attempt'] = 'Jolastu'; +$string[ 'game:deleteattempts'] = 'Saiakerak ezabatu'; +$string[ 'game:grade'] = 'Jolasak eskuz baloratu'; +$string[ 'game:manage'] = 'Kudeatu'; +$string[ 'game:preview'] = 'Jolasak aurreikusi'; +$string[ 'game:reviewmyattempts'] = 'nire saiakerak berriro ikusi'; +$string[ 'game:view'] = 'ikusi'; +$string[ 'game:viewreports'] = 'txostenak ikusi'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Hauxe da esaldi zuzena: '; +$string[ 'hangman_correct_word'] = 'Hauxe da hitz zuzena: '; +$string[ 'hangman_gradeinstance'] = 'Maila jolas osoan'; +$string[ 'hangman_letters'] = 'Letrak: '; +$string[ 'hangman_restletters_many'] = '{$a} saiakera dituzu'; +$string[ 'hangman_restletters_one'] = 'Saiakera bakarra daukazu'; +$string[ 'hangman_wrongnum'] = 'Desegokiak: %%d %%d(e)tik'; +$string[ 'nextword'] = 'Hurrengo hitza'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Galdera nagusiaren erantzuna ebaluatu'; +$string[ 'hiddenpicture_nocols'] = 'Lerro horizontalen kopurua zehaztu behar duzu'; +$string[ 'hiddenpicture_nomainquestion'] = '{$a->name} glosategian ez dago irudia duen hitzik'; +$string[ 'hiddenpicture_norows'] = 'Zutabeen kopurua zehaztu behar duzu'; +$string[ 'must_select_glossary'] = 'Glosategia aukeratu behar duzu'; +$string[ 'no_questions'] = "Ez dago galderarik"; +$string[ 'noglossaryentriesfound'] = 'Ez da glosategi-sarrerarik aurkitu'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Galdera-kategoria aukeratu behar duzu'; +$string[ 'millionaire_must_select_quiz'] = 'Galdetegi bat aukeratu beharko'; + +//report/overview/report.php +$string[ 'allattempts'] = 'saiakera guztiak erakutsi'; +$string[ 'allstudents'] = '$a guztiak erakutsi'; +$string[ 'attemptsonly'] = 'Saiatu diren ikasleak soilik erakutsi'; +$string[ 'deleteattemptcheck'] = 'Saiakera hauek guztiak ezabatu nahi dituzula ziur al zaude?'; +$string[ 'displayoptions'] = 'Aukerak erakutsi'; +$string[ 'downloadods'] = 'ODS formatuan behera kargatu'; +$string[ 'feedback'] = 'Feedback'; +$string[ 'noattemptsonly'] = '$a saiakerarik gabekoak soilik erakutsi'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring $a->attemptnum saiakeren egilea da'; +$string[ 'pagesize'] = 'Galderak orriko:'; +$string[ 'reportoverview'] = 'zerrenda'; +$string[ 'selectall'] = 'Denak aukeratu'; +$string[ 'selectnone'] = 'Ezein ez aukeratu'; +$string[ 'showdetailedmarks'] = 'Marka-zehaztapenak erakutsi'; +$string[ 'startedon'] = 'Noiz hasia'; +$string[ 'timecompleted'] = 'Osaturik'; +$string[ 'unfinished'] = 'irekia'; +$string[ 'withselected'] = 'Aukeratutakoekin'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Dadoak, $a puntuak.'; +$string[ 'snakes_player'] = 'Jokalaria, kokapena: $a.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Sortuko den sudoku-kopurua'; +$string[ 'sudoku_create_start'] = 'Sudokuak sortzen hasi'; +$string[ 'sudoku_creating'] = '{$a} sudokua sortzen'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Sudokua bukatu da'; +$string[ 'sudoku_guessnumber'] = 'Zenbaki zuzena asmatu'; +$string[ 'sudoku_noentriesfound'] = 'Glosategian ez da hitzik aurkitu'; + +//export.php +$string[ 'export'] = 'Esportatu'; +$string[ 'html_hascheckbutton'] = 'Saiakera-botoia:'; +$string[ 'html_hasprintbutton'] = 'Imprimatzeko botoia:'; +$string[ 'html_title'] = 'Html izenburua:'; +$string[ 'javame_createdby'] = 'Egilea:'; +$string[ 'javame_description'] = 'Deskribapena:'; +$string[ 'javame_filename'] = 'Fitxategia:'; +$string[ 'javame_icon'] = 'Ikurra:'; +$string[ 'javame_maxpictureheight'] = 'Irudiaren gehienezko altuera:'; +$string[ 'javame_maxpicturewidth'] = 'Irudiaren gehienezko zabalera:'; +$string[ 'javame_name'] = 'Izena:'; +$string[ 'javame_type'] = 'Mota:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'Bertsioa:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Jolasa bukatu da'; +$string[ 'html_hangman_new'] = 'Berria'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Publikoaren laguntza'; +$string[ 'millionaire_info_people'] = 'Jendeak zera dio: '; +$string[ 'millionaire_info_telephone'] = 'Nire ustez, erantzun zuzena hau da: '; +$string[ 'millionaire_info_wrong_answer'] = 'Erantzun zuzena ezkerraldean markatuta dago.
      Zure erantzun hau desegokia da:'; +$string[ 'millionaire_quit'] = 'Irten'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Aberatsa jolaserako iturria {$a} edo galderak izango dira eta ez'; +$string[ 'millionaire_telephone'] = 'Telefono-deia'; +$string[ 'must_select_questioncategory'] = 'Galdera-kategoria bat aukeratu behar duzu'; +$string[ 'must_select_quiz'] = 'Galdetegi bat aukeratu behar duzu'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Konprobatu'; +$string[ 'html_snakes_correct'] = 'Ongi!'; +$string[ 'html_snakes_no_selection'] = 'Zerbait aukeratu behar duzu!'; +$string[ 'html_snakes_wrong'] = "Zure erantzuna ez da zuzena. Leku berean geratu behar duzu."; +$string[ 'score'] = 'Puntuazioak'; + +//index.php +$string[ 'modulename'] = 'Jolasa'; +$string[ 'modulenameplural'] = 'Jolasak'; +$string[ 'pluginname'] = 'Jolasa'; + +//lib.php +$string[ 'attempt'] = 'saiakera'; +$string[ 'bookquiz_questions'] = 'Galdera-kategoriak liburuaren azpikapituluekin lotu'; +$string[ 'export_to_html'] = 'HTMLera esportatu'; +$string[ 'export_to_javame'] = 'Javame-ra esportatu'; +$string[ 'game_bookquiz'] = 'Galdera-,liburua'; +$string[ 'game_cross'] = 'Gurutzegrama'; +$string[ 'game_cryptex'] = 'Hitz Zopa'; +$string[ 'game_hangman'] = 'Urkatua'; +$string[ 'game_hiddenpicture'] = 'Irudi izkutua'; +$string[ 'game_millionaire'] = 'Aberatsa'; +$string[ 'game_snakes'] = 'Sugeak eta eskailerak'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Galdetegi honetan ez da saiakerarik egin'; +$string[ 'percent'] = 'Portzentaia'; +$string[ 'results'] = 'Emaitza'; +$string[ 'showanswers'] = 'Erantzunak erakutsi'; +$string[ 'showattempts'] = 'Saiakerak erakutsi'; + +//locallib.php +$string[ 'attemptfirst'] = 'Lehen saiakera'; +$string[ 'attemptlast'] = 'Azken saiakera'; +$string[ 'gradeaverage'] = 'Batezbesteko emaitza'; +$string[ 'gradehighest'] = 'Emaitza altuena'; + +//mod_form.php +$string[ 'bottomtext'] = 'Bukaerako testua'; +$string[ 'cross_layout'] = 'Kokapena'; +$string[ 'cross_layout0'] = 'Definizioak behealdean'; +$string[ 'cross_layout1'] = 'Definizioak eskuin aldean'; +$string[ 'cross_maxcols'] = 'Gurutzegramaren gehienezko zutabe-kopurua'; +$string[ 'cross_maxwords'] = 'Gurutzegramaren gehienezko hitz-kopurua'; +$string[ 'cross_options'] = 'Gurutzegramaren aukerak'; +$string[ 'cryptex_maxcols'] = 'Zutabe/lerroen gehienezko kopurua Hitz Zopan'; +$string[ 'cryptex_maxtries'] = 'Saiakeren gehinezko kopurua'; +$string[ 'cryptex_maxwords'] = 'Gehienezko hitz-kopurua Hitz Zopan'; +$string[ 'cryptex_options'] = 'Hitz Zoparen aukerak'; +$string[ 'grademethod'] = 'Kalifikazio-metodoa'; +$string[ 'hangman_allowspaces'] = 'Hitzen arteko hutsuneak onartu'; +$string[ 'hangman_allowsub'] = 'Baimendu sinboloak - hitzetan'; +$string[ 'hangman_imageset'] = 'Urkatuarentzako irudiak aukeratu'; +$string[ 'hangman_language'] = 'Hitzen hizkuntza'; +$string[ 'hangman_maxtries'] = 'Hitz-kopurua jolaseko'; +$string[ 'hangman_options'] = 'Urkatuaren aukerak'; +$string[ 'hangman_showcorrectanswer'] = 'Bukatutakoan hitza erakutsi'; +$string[ 'hangman_showfirst'] = 'Urkatuaren lehenengo letra erakutsi'; +$string[ 'hangman_showlast'] = 'Urkatuaren azken letra erakutsi'; +$string[ 'hangman_showquestion'] = 'Galderak erakutsi?'; +$string[ 'hiddenpicture_across'] = 'Laukitxo horizontalen kopurua'; +$string[ 'hiddenpicture_down'] = 'Laukitxo bertikalen kopurua'; +$string[ 'hiddenpicture_height'] = 'Irudiaren altuera neurri honetara egokitu: '; +$string[ 'hiddenpicture_options'] = '\'Irudi Izkutuaren\' aukerak'; +$string[ 'hiddenpicture_pictureglossary'] = 'Galdera nagusiaren glosategia'; +$string[ 'hiddenpicture_width'] = 'Irudiaren zabalera neurri honetara egokitu: '; +$string[ 'millionaire_background'] = 'Hondoko kolorea'; +$string[ 'millionaire_options'] = 'Aberatsaren aukerak'; +$string[ 'millionaire_shuffle'] = 'Galderak nahastu'; +$string[ 'snakes_background'] = 'Hondoa'; +$string[ 'snakes_cols'] = 'Zutabeak'; +$string[ 'snakes_data'] = 'Taula'; +$string[ 'snakes_file'] = 'Hondorako fitxategia'; +$string[ 'snakes_footerx'] = 'Beheko ezker aldeko espazioa'; +$string[ 'snakes_footery'] = 'Beheko eskuin aldeko espazioa'; +$string[ 'snakes_headerx'] = 'Goiko ezker aldeko espazioa'; +$string[ 'snakes_headery'] = 'Goiko eskuin aldeko espazioa'; +$string[ 'snakes_options'] = '\'Sugeak eta Eskailerak\' aukerak'; +$string[ 'snakes_rows'] = 'Lerroak'; +$string[ 'sourcemodule'] = 'Galdera-iturria'; +$string[ 'sourcemodule_book'] = 'Liburu bat aukeratu'; +$string[ 'sourcemodule_glossary'] = 'Glosategia aukeratu'; +$string[ 'sourcemodule_glossarycategory'] = 'Glosategiaren kategoria bat aukeratu.'; +$string[ 'sourcemodule_include_subcategories'] = 'Azpikategoriak sartu'; +$string[ 'sourcemodule_question'] = 'Galderak'; +$string[ 'sourcemodule_questioncategory'] = 'Galdera-kategoria bat aukeratu'; +$string[ 'sourcemodule_quiz'] = 'Galdetegia aukeratu'; +$string[ 'sudoku_maxquestions'] = 'Gehienezko galdera-kopurua'; +$string[ 'sudoku_options'] = 'Sudokuren aukerak'; +$string[ 'toptext'] = 'Goialdeko testua'; +$string[ 'userdefined'] = 'Erabiltzaileak definitua'; + +//preview.php +$string[ 'only_teachers'] = 'Horri hau irakasleak bakarrik ikus dezake'; +$string[ 'preview'] = 'Aurreikusi'; + +//review.php +$string[ 'attempts'] = 'Saiakerak'; +$string[ 'completedon'] = 'Osatua'; +$string[ 'outof'] = '{$a->grade} emaitza {$a->maxgrade} gehienezko puntuaziotik'; +$string[ 'review'] = 'Berriro aztertu'; +$string[ 'reviewofattempt'] = '{$a} saiakerak berrikusi'; +$string[ 'showall'] = 'Dena erakutsi'; +$string[ 'startagain'] = 'Berriz hasi'; +$string[ 'timetaken'] = 'Erabilitako denbora'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Estatistikak garbitu'; +$string[ 'computerepetitions'] = 'Estatistikak berriro kalkulatu'; +$string[ 'feedbacks'] = 'Erantzun zuzeneko mezuak'; +$string[ 'repetitions'] = 'Errepikapenak'; + +//showattempts.php +$string[ 'lastip'] = 'Ikaslearen IPa'; +$string[ 'showsolution'] = 'soluzioa'; +$string[ 'timefinish'] = 'Jolasa bukatu da'; +$string[ 'timelastattempt'] = 'Azken saiakera'; +$string[ 'timestart'] = 'Hasiera'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Orain jolasten saiatu'; +$string[ 'continueattemptgame'] = 'Aurreko jolas-saiakerarekin jarraitu'; +$string[ 'reattemptgame'] = 'Saiakera berriko jolasa'; +$string[ 'yourfinalgradeis'] = 'Jolas honetarako zure azken nota hauxe da: {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/fr/game.php b/lang/fr/game.php new file mode 100644 index 0000000..e700de9 --- /dev/null +++ b/lang/fr/game.php @@ -0,0 +1,304 @@ +Bienvenue !

      Cliquez sur un mot pour commencer.

      '; +$string[ 'letter'] = 'lettre'; +$string[ 'letters'] = 'lettres'; +$string[ 'nextgame'] = 'Nouveau jeu'; +$string[ 'no_words'] = 'Pas de mots'; +$string[ 'win'] = 'Bravo !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Fin du jeu'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'La phrase correcte était : '; +$string[ 'hangman_correct_word'] = 'Le mot correct était : '; +$string[ 'hangman_gradeinstance'] = 'Note pour tout l\'ensemble'; +$string[ 'hangman_letters'] = 'Lettres : '; +$string[ 'hangman_restletters_many'] = 'Vous avez effectué {$a} tentatives'; +$string[ 'hangman_restletters_one'] = 'Vous n\'avez SEULEMENT QU\'UNE tentative'; +$string[ 'hangman_wrongnum'] = 'Non : %%d en dehors de %%d'; +$string[ 'nextword'] = 'Mot suivant'; + +//hiddenpicture/play.php +$string[ 'must_select_glossary'] = 'Vous devez choisir un glossaire'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Vous devez choisir une catégorie de questions'; +$string[ 'millionaire_must_select_quiz'] = 'Vous devez choisir un test'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Toutes les tentatives'; +$string[ 'allstudents'] = 'Tous les étudiants $a'; +$string[ 'attemptsonly'] = 'Ne montrer que les étudiants qui ont tenté'; +$string[ 'deleteattemptcheck'] = 'Etes-vous sûr(e) de vouloir complètement effacer ces tentatives ?'; +$string[ 'displayoptions'] = 'Montrer les options'; +$string[ 'downloadods'] = 'Télécharger au format ODS'; +$string[ 'feedback'] = 'Rapports'; +$string[ 'noattemptsonly'] = 'Montrer $a sans tentatives'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring ont effectué $a->attemptnum tentative(s)'; +$string[ 'pagesize'] = 'Questions par page :'; +$string[ 'reportoverview'] = 'Vue d\'ensemble'; +$string[ 'selectall'] = 'Choisir tout'; +$string[ 'selectnone'] = 'Déselectionner tout'; +$string[ 'showdetailedmarks'] = 'Montrer les marques de détail'; +$string[ 'startedon'] = 'Démarré le'; +$string[ 'timecompleted'] = 'Terminé'; +$string[ 'unfinished'] = 'ouvert'; +$string[ 'withselected'] = 'Avec les éléments sélectionnés'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Nombre de sudokus a créer'; +$string[ 'sudoku_create_start'] = 'Création des sudokus...'; +$string[ 'sudoku_creating'] = 'Créer {$a} sudoku(s)'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fin du sudoku'; +$string[ 'sudoku_guessnumber'] = 'Devniez le nombre suivant'; +$string[ 'sudoku_noentriesfound'] = 'Aucun mot dans le glossaire'; + +//export.php + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Jeu terminé'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Les gens disent'; +$string[ 'millionaire_info_telephone'] = 'I think that the correct answer is '; +$string[ 'millionaire_info_wrong_answer'] = 'Vous avez donné une mauvaise réponse
      La réponse correcte est :'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Pour le jeu du millionaire, la source doit être {$a} ou questions et non '; +$string[ 'must_select_questioncategory'] = 'Vous devez choisir une catégorie de questions'; +$string[ 'must_select_quiz'] = 'Vous devez choisir un test'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Score'; + +//index.php +$string[ 'modulename'] = 'Jeu'; +$string[ 'modulenameplural'] = 'Jeux'; +$string[ 'pluginname'] = 'Jeu'; + +//lib.php +$string[ 'attempt'] = 'Tentative'; +$string[ 'bookquiz_questions'] = 'Associez une catégorie de questions à un sous-chapitre'; +$string[ 'game_bookquiz'] = 'Livre de questions'; +$string[ 'game_cross'] = 'Mot-croisé'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Pendu'; +$string[ 'game_millionaire'] = 'Millionaire'; +$string[ 'game_snakes'] = 'Serpent et échelles'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Aucune tentative sur ce test'; +$string[ 'results'] = 'Resultats'; +$string[ 'showanswers'] = 'Montrer les réponses'; + +//locallib.php +$string[ 'attemptfirst'] = 'Première tentative'; +$string[ 'attemptlast'] = 'Dernière tentative'; +$string[ 'gradeaverage'] = 'Note moyenne'; +$string[ 'gradehighest'] = 'Note maximale'; + +//mod_form.php +$string[ 'bottomtext'] = 'Texte au bas'; +$string[ 'cross_maxcols'] = 'Nombre maximum de colonnes du mot-croisé'; +$string[ 'cross_maxwords'] = 'Nombre de mots maximum du mot-croisé'; +$string[ 'cryptex_maxcols'] = 'Nombre maximum de col./lignes du cryptex'; +$string[ 'cryptex_maxwords'] = 'Nombre maximum de mots du cryptex'; +$string[ 'grademethod'] = 'Méthode de notation'; +$string[ 'hangman_imageset'] = 'Choisissez les images du pendu'; +$string[ 'hangman_maxtries'] = 'Nombre de mots par jeu'; +$string[ 'hangman_showcorrectanswer'] = 'Montrer la réponse correcte après la fin du jeu'; +$string[ 'hangman_showfirst'] = 'Montrer la première lettre du pendu'; +$string[ 'hangman_showlast'] = 'Montrer la dernière lettre du pendu'; +$string[ 'hangman_showquestion'] = 'Montrer les questions ?'; +$string[ 'snakes_background'] = 'Arrière-plan'; +$string[ 'sourcemodule'] = 'Source des questions'; +$string[ 'sourcemodule_book'] = 'Choisissez un livre'; +$string[ 'sourcemodule_glossary'] = 'Choisissez un glossaire'; +$string[ 'sourcemodule_glossarycategory'] = 'Choisissez une catégorie ou un glossaire'; +$string[ 'sourcemodule_question'] = 'Questions'; +$string[ 'sourcemodule_questioncategory'] = 'Choisissez une catégorie de questions'; +$string[ 'sourcemodule_quiz'] = 'Choisissez un test'; +$string[ 'sudoku_maxquestions'] = 'Nombre maximum de questions'; + +//preview.php +$string[ 'only_teachers'] = 'Seuls les enseignants peuvent voir cette page'; +$string[ 'preview'] = 'Prévisualisation'; + +//review.php +$string[ 'attempts'] = 'Tentatives'; +$string[ 'completedon'] = 'Terminé le'; +$string[ 'outof'] = '{$a->grade} hors de la plage maximum de {$a->maxgrade}'; +$string[ 'review'] = 'Revue'; +$string[ 'reviewofattempt'] = 'Revue de la tentative {$a}'; +$string[ 'startagain'] = 'Démarrer à nouveau'; +$string[ 'timetaken'] = 'Temps consomé'; + +//showanswers.php +$string[ 'feedbacks'] = 'Messages pour réponses correctes'; + +//showattempts.php +$string[ 'lastip'] = 'IP de l\'étudiant'; +$string[ 'showsolution'] = 'solution'; +$string[ 'timefinish'] = 'Fin du jeu'; +$string[ 'timelastattempt'] = 'Dernière tentative'; +$string[ 'timestart'] = 'Démarrer'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Jouer maintenant'; +$string[ 'continueattemptgame'] = 'Continuer une tentative précédente du jeu'; +$string[ 'reattemptgame'] = 'Tenter à nouveau'; +$string[ 'yourfinalgradeis'] = 'Votre note finale pour ce jeu est {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/play.php $string[ 'print'] = 'Print'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'hiddenpicture_mainsubmit'] = 'Grade main answer'; +//hiddenpicture/play.php $string[ 'hiddenpicture_nocols'] = 'Have to specify the number of cols horizontaly'; +//hiddenpicture/play.php $string[ 'hiddenpicture_nomainquestion'] = 'There are no glossary entries on glossary {$a->name} with an attached picture'; +//hiddenpicture/play.php $string[ 'hiddenpicture_norows'] = 'Have to specify the number of cols verticaly'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//export.php $string[ 'export'] = 'Export'; +//export.php $string[ 'html_hascheckbutton'] = 'Has check button:'; +//export.php $string[ 'html_hasprintbutton'] = 'Has print button:'; +//export.php $string[ 'html_title'] = 'Title of html:'; +//export.php $string[ 'javame_createdby'] = 'Created by:'; +//export.php $string[ 'javame_description'] = 'Description:'; +//export.php $string[ 'javame_filename'] = 'Filename:'; +//export.php $string[ 'javame_icon'] = 'Icon:'; +//export.php $string[ 'javame_maxpictureheight'] = 'Max picture height:'; +//export.php $string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +//export.php $string[ 'javame_name'] = 'Name:'; +//export.php $string[ 'javame_type'] = 'Type:'; +//export.php $string[ 'javame_vendor'] = 'Vendor:'; +//export.php $string[ 'javame_version'] = 'Version:'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'export_to_html'] = 'Export to HTML'; +//lib.php $string[ 'export_to_javame'] = 'Export to Javame'; +//lib.php $string[ 'game_hiddenpicture'] = 'Hidden Picture'; +//lib.php $string[ 'percent'] = 'Percent'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_layout'] = 'Layout'; +//mod_form.php $string[ 'cross_layout0'] = 'Phrases on the bottom of cross'; +//mod_form.php $string[ 'cross_layout1'] = 'Phrases on the right of cross'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_maxtries'] = 'Max tries'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_allowspaces'] = 'Allow spaces in words'; +//mod_form.php $string[ 'hangman_allowsub'] = 'Allow the symbol - in words'; +//mod_form.php $string[ 'hangman_language'] = 'Language of words'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_across'] = 'Cells horizontal'; +//mod_form.php $string[ 'hiddenpicture_down'] = 'Cells down'; +//mod_form.php $string[ 'hiddenpicture_height'] = 'Set height of picture to'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'hiddenpicture_pictureglossary'] = 'The glossary for main question and picture'; +//mod_form.php $string[ 'hiddenpicture_width'] = 'Set width of picture to'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'millionaire_shuffle'] = 'Randomize questions'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/he/game.php b/lang/he/game.php new file mode 100644 index 0000000..10d528b --- /dev/null +++ b/lang/he/game.php @@ -0,0 +1,304 @@ +ברוכים הבאים!

      לחצו על מילה להתחיל.

      '; +$string[ 'letter'] = 'אות'; +$string[ 'letters'] = 'אותיות'; +$string[ 'nextgame'] = 'משחק חדש'; +$string[ 'no_words'] = 'לא נמצאו מילים'; +$string[ 'print'] = 'Print'; +$string[ 'win'] = 'כל הכבוד !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'המשחק הסתיים'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'המשפט הנכון הוא: '; +$string[ 'hangman_correct_word'] = 'המילה הנכונה היא: '; +$string[ 'hangman_gradeinstance'] = 'הציון הכללי במשחק'; +$string[ 'hangman_letters'] = 'אותיות: '; +$string[ 'hangman_restletters_many'] = 'יש לכם {$a} נסיונות'; +$string[ 'hangman_restletters_one'] = 'יש לכם ניסיון אחד בלבד'; +$string[ 'hangman_wrongnum'] = 'טעויות: %%d מתוך %%d'; +$string[ 'nextword'] = 'מילה חדשה'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Grade main answer'; +$string[ 'hiddenpicture_nocols'] = 'Have to specify the number of cols horizontaly'; +$string[ 'hiddenpicture_nomainquestion'] = 'There are no glossary entries on glossary {$a->name} with an attached picture'; +$string[ 'hiddenpicture_norows'] = 'Have to specify the number of cols verticaly'; +$string[ 'must_select_glossary'] = 'יש לבחור אגרון'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'יש לבחור סיווג שאלות אחד '; +$string[ 'millionaire_must_select_quiz'] = 'יש לבחור מבחן אחד'; + +//report/overview/report.php +$string[ 'allattempts'] = 'הציגו את כל הניסיונות'; +$string[ 'allstudents'] = 'הציגו את כל $a'; +$string[ 'attemptsonly'] = 'הציגו רק תלמידים עם ניסיונות'; +$string[ 'deleteattemptcheck'] = 'האם אתם בטוחים שאתם מעוניינים למחוק את התשובות המסומנות?'; +$string[ 'displayoptions'] = 'תצוגת מאפיינים'; +$string[ 'downloadods'] = 'הורידו גליון אלקטרוני בתצורת ODF'; +$string[ 'feedback'] = 'משוב'; +$string[ 'noattemptsonly'] = 'הציגו $a שטרם ענו, בלבד'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring ביצעו $a->attemptnum נסיונות'; +$string[ 'pagesize'] = 'מספר השאלות בדף:'; +$string[ 'reportoverview'] = 'תצוגה כללית'; +$string[ 'selectall'] = 'בחירה כוללת'; +$string[ 'selectnone'] = 'ביטול סימון כולל'; +$string[ 'showdetailedmarks'] = 'הציגו פירוט עבור המסומנים'; +$string[ 'startedon'] = 'Started on'; +$string[ 'timecompleted'] = 'הושלם'; +$string[ 'unfinished'] = 'open'; +$string[ 'withselected'] = 'עם התשובות המסומנות'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'מספר לוחות סודוקו העומדים להיווצר'; +$string[ 'sudoku_create_start'] = 'התחלת יצירת לוחות סודוקו'; +$string[ 'sudoku_creating'] = 'מייצר {$a} לוחות סודוקו'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'End of sudoku game'; +$string[ 'sudoku_guessnumber'] = 'נחשו את המספר הנכון'; +$string[ 'sudoku_noentriesfound'] = 'לא נמצאו מילים באגרון'; + +//export.php +$string[ 'export'] = 'Export'; +$string[ 'html_hascheckbutton'] = 'Has check button:'; +$string[ 'html_hasprintbutton'] = 'Has print button:'; +$string[ 'html_title'] = 'Title of html:'; +$string[ 'javame_createdby'] = 'Created by:'; +$string[ 'javame_description'] = 'Description:'; +$string[ 'javame_filename'] = 'Filename:'; +$string[ 'javame_icon'] = 'Icon:'; +$string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +$string[ 'javame_name'] = 'Name:'; +$string[ 'javame_type'] = 'Type:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'Version:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'המשחק הסתיים'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'אנשים אומרים'; +$string[ 'millionaire_info_telephone'] = 'אני חושב/ת שהתשובה הנכונה היא '; +$string[ 'millionaire_info_wrong_answer'] = 'תשובתכם שגוייה
      התשובה הנכונה היא:'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'עבור משחק המיליונר מקור השאלות צריך להיות {$a} או שאלות ולא'; +$string[ 'must_select_questioncategory'] = 'יש לבחור סיווג לשאלות'; +$string[ 'must_select_quiz'] = 'You must select a quiz'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Score'; + +//index.php +$string[ 'modulename'] = 'משחק'; +$string[ 'modulenameplural'] = 'משחקים'; +$string[ 'pluginname'] = 'משחק'; + +//lib.php +$string[ 'attempt'] = 'ניסיון'; +$string[ 'bookquiz_questions'] = 'קישור סיווג שאלות לפרק בספר'; +$string[ 'game_bookquiz'] = 'ספר עם שאלות'; +$string[ 'game_cross'] = 'תשבץ'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'הצילו את האיש התלוי'; +$string[ 'game_hiddenpicture'] = 'Hidden Picture'; +$string[ 'game_millionaire'] = 'מי רוצה להיות מיליונר'; +$string[ 'game_snakes'] = 'סולמות ונחשים'; +$string[ 'game_sudoku'] = 'סודוקו'; +$string[ 'info'] = 'מידע'; +$string[ 'noattempts'] = 'No attempts have been made on this game'; +$string[ 'percent'] = 'Percent'; +$string[ 'results'] = 'תוצאות'; +$string[ 'showanswers'] = 'הצגת תשובות'; + +//locallib.php +$string[ 'attemptfirst'] = 'ניסיון ראשון'; +$string[ 'attemptlast'] = 'ניסיון אחרון'; +$string[ 'gradeaverage'] = 'ציון ממוצע'; +$string[ 'gradehighest'] = 'הציון הגובהה ביותר'; + +//mod_form.php +$string[ 'bottomtext'] = 'המלל בתחתית'; +$string[ 'cross_layout'] = 'מבנה תצורה'; +$string[ 'cross_layout0'] = 'המשפט יופיע תחת התשבץ'; +$string[ 'cross_layout1'] = 'המשפט יופיע מימין לתשבץ'; +$string[ 'cross_maxcols'] = 'מספר עמודות מירבי בתשבץ'; +$string[ 'cross_maxwords'] = 'מספר מילים מירבי בתשבץ'; +$string[ 'cryptex_maxcols'] = 'מספר העמודות/שורות במשחק cryptex'; +$string[ 'cryptex_maxwords'] = 'מספר המילים במשחק cryptex'; +$string[ 'grademethod'] = 'שיטת מתן ציונים'; +$string[ 'hangman_allowspaces'] = 'אפשרות לרווחים במילים'; +$string[ 'hangman_allowsub'] = 'אפשרות לתו - במילים'; +$string[ 'hangman_imageset'] = 'בחרו תמונה למשחק האיש התלוי'; +$string[ 'hangman_language'] = 'שפת המילים'; +$string[ 'hangman_maxtries'] = 'מספר מילים בכל משחק'; +$string[ 'hangman_showcorrectanswer'] = 'הצגת התשובה הנכונה בסוף כל משחק'; +$string[ 'hangman_showfirst'] = 'הצגת האות הראשונה במשחק האיש התלוי'; +$string[ 'hangman_showlast'] = 'הצגת האות האחרונה במשחק האיש התלוי'; +$string[ 'hangman_showquestion'] = 'להציג את השאלות ?'; +$string[ 'hiddenpicture_across'] = 'Cells horizontal'; +$string[ 'hiddenpicture_down'] = 'Cells down'; +$string[ 'hiddenpicture_height'] = 'קבעו גובה תמונה ל'; +$string[ 'hiddenpicture_pictureglossary'] = 'The glossary for main question and picture'; +$string[ 'hiddenpicture_width'] = 'קבעו רוחב תמונה ל'; +$string[ 'snakes_background'] = 'רקע'; +$string[ 'sourcemodule'] = 'מקור השאלות'; +$string[ 'sourcemodule_book'] = 'בחרו ספר'; +$string[ 'sourcemodule_glossary'] = 'בחרו אגרון'; +$string[ 'sourcemodule_glossarycategory'] = 'בחרו סיווג עבור אגרון'; +$string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +$string[ 'sourcemodule_question'] = 'שאלות'; +$string[ 'sourcemodule_questioncategory'] = 'בחרו סיווג לשאלות'; +$string[ 'sourcemodule_quiz'] = 'בחרו מבחן'; +$string[ 'sudoku_maxquestions'] = 'מספר שאלות מירבי'; + +//preview.php +$string[ 'only_teachers'] = 'רק מורה יכול לראות דף זה'; +$string[ 'preview'] = 'תצוגה מקדימה'; + +//review.php +$string[ 'attempts'] = 'Attempts'; +$string[ 'completedon'] = 'Completed on'; +$string[ 'outof'] = '{$a->grade} out of a maximum of {$a->maxgrade}'; +$string[ 'review'] = 'Review'; +$string[ 'reviewofattempt'] = 'Review of Attempt {$a}'; +$string[ 'startagain'] = 'Start again'; +$string[ 'timetaken'] = 'זמן המשחק'; + +//showanswers.php +$string[ 'feedbacks'] = 'ההודעה במצב של תשובה נכונה'; + +//showattempts.php +$string[ 'lastip'] = 'כתובת ה IP של התלמיד'; +$string[ 'showsolution'] = 'פתרון'; +$string[ 'timefinish'] = 'המשחק הסתיים'; +$string[ 'timelastattempt'] = 'ניסיון אחרון'; +$string[ 'timestart'] = 'התחלה'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'שחקו עכשיו'; +$string[ 'continueattemptgame'] = 'המשיכו ניסיון משחק קודם שלכם'; +$string[ 'reattemptgame'] = 'Reattempt game'; +$string[ 'yourfinalgradeis'] = 'הציון הסופי שלכם למשחק זה הוא {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//export.php $string[ 'javame_maxpictureheight'] = 'Max picture height:'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'export_to_html'] = 'Export to HTML'; +//lib.php $string[ 'export_to_javame'] = 'Export to Javame'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_maxtries'] = 'Max tries'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'millionaire_shuffle'] = 'Randomize questions'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/hr/game.php b/lang/hr/game.php new file mode 100644 index 0000000..ddb3cb8 --- /dev/null +++ b/lang/hr/game.php @@ -0,0 +1,306 @@ +Dobrodošli!

      Za početak igre odaberite riječ.

      '; +$string[ 'letter'] = 'slovo'; +$string[ 'letters'] = 'slova'; +$string[ 'nextgame'] = 'Nova igra'; +$string[ 'no_words'] = 'Riječi nisu pronađene'; +$string[ 'print'] = 'Ispiši'; +$string[ 'win'] = 'Čestitamo !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Kraj igre'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Tražena fraza je: '; +$string[ 'hangman_correct_word'] = 'Tražena riječ je: '; +$string[ 'hangman_gradeinstance'] = 'Ocjena u cijeloj igri'; +$string[ 'hangman_letters'] = 'Slova: '; +$string[ 'hangman_restletters_many'] = 'Imate još {$a} pokušaja'; +$string[ 'hangman_restletters_one'] = 'Imate još SAMO 1 pokušaj'; +$string[ 'hangman_wrongnum'] = 'Krivo: %%d od %%d'; +$string[ 'nextword'] = 'Sljedeća riječ'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Ocjeni glavni odgovor'; +$string[ 'hiddenpicture_nocols'] = 'Treba zadati broj stupaca vodoravno'; +$string[ 'hiddenpicture_nomainquestion'] = 'Nije pronađen ni jedan zapis u rječniku {$a->name} sa pridruženom slikom'; +$string[ 'hiddenpicture_norows'] = 'Treba zadati broj stupaca okomito'; +$string[ 'must_select_glossary'] = 'Morate odabrati rječnik'; +$string[ 'noglossaryentriesfound'] = 'U rječniku nije pronađen ni jedan pojam'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Morate odabrati kategoriju pitanja'; +$string[ 'millionaire_must_select_quiz'] = 'Morate odabrati tip igre'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Prikaži sve pokušaje'; +$string[ 'allstudents'] = 'Prikaži sve $a'; +$string[ 'attemptsonly'] = 'Prikaži samo studente sa pokušajima'; +$string[ 'deleteattemptcheck'] = 'Dali ste sigurni da želite nepovratno obrisati ove pokušaje?'; +$string[ 'displayoptions'] = 'Postavke prikaza'; +$string[ 'downloadods'] = 'Preuzmi u ODS formatu'; +$string[ 'feedback'] = 'Povratna informacija'; +$string[ 'noattemptsonly'] = 'Prikaži samo $a bez pokušaja'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring su imali $a->attemptnum pokušaja'; +$string[ 'pagesize'] = 'Pitanja po stranici:'; +$string[ 'reportoverview'] = 'Pregled'; +$string[ 'selectall'] = 'Označi sve'; +$string[ 'selectnone'] = 'Odznači sve'; +$string[ 'showdetailedmarks'] = 'Prikaži detalje ocjena'; +$string[ 'startedon'] = 'Započeto'; +$string[ 'timecompleted'] = 'Završeno'; +$string[ 'unfinished'] = 'nije završeno'; +$string[ 'withselected'] = 'Sa odabranim'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Broju sudoku zadataka koji će se napraviti'; +$string[ 'sudoku_create_start'] = 'Započni pravljenje sudou zadataka'; +$string[ 'sudoku_creating'] = 'Pravim {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Kraj igre'; +$string[ 'sudoku_guessnumber'] = 'Pogodite točan broj'; +$string[ 'sudoku_noentriesfound'] = 'U rječniku nije pronađena ni jedna riječ'; + +//export.php +$string[ 'export'] = 'Izvoz'; +$string[ 'html_hascheckbutton'] = 'Sadrži tipku za provjeru:'; +$string[ 'html_hasprintbutton'] = 'Sadrži tipku za ispis:'; +$string[ 'html_title'] = 'Naslov stranice:'; +$string[ 'javame_createdby'] = 'Autor:'; +$string[ 'javame_description'] = 'Opis:'; +$string[ 'javame_filename'] = 'Ime datoteke:'; +$string[ 'javame_icon'] = 'Ikona:'; +$string[ 'javame_maxpictureheight'] = 'Maksimalna visina slike:'; +$string[ 'javame_maxpicturewidth'] = 'Maksimalna širina slike:'; +$string[ 'javame_name'] = 'Ime:'; +$string[ 'javame_type'] = 'Tip:'; +$string[ 'javame_vendor'] = 'Prodavač:'; +$string[ 'javame_version'] = 'Verzija:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Kraj igre'; +$string[ 'html_hangman_new'] = 'Nova igra'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Pitaj publiku'; +$string[ 'millionaire_info_people'] = 'Publika kaže'; +$string[ 'millionaire_info_telephone'] = 'Mislim da je točan odgovor '; +$string[ 'millionaire_info_wrong_answer'] = 'Vaš odgovor je pogrešan
      Točan odgovor je:'; +$string[ 'millionaire_quit'] = 'Kraj'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Za Milijunaša izvor mora biti {$a} ili pitanja i ne'; +$string[ 'millionaire_telephone'] = 'Pomoć zovi'; +$string[ 'must_select_questioncategory'] = 'Morate odabrati kategoriju pitanja'; +$string[ 'must_select_quiz'] = 'Morate odabrati igru'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Rezultat'; + +//index.php +$string[ 'modulename'] = 'igru'; +$string[ 'modulenameplural'] = 'Igre'; +$string[ 'pluginname'] = 'igru'; + +//lib.php +$string[ 'attempt'] = 'Pokušaj'; +$string[ 'bookquiz_questions'] = 'Pridruži kategorije pitanja poglavlju knjige'; +$string[ 'export_to_html'] = 'Izvoz u HTML'; +$string[ 'export_to_javame'] = 'Izvoz u Javame'; +$string[ 'game_bookquiz'] = 'Knjiga sa pitanjima'; +$string[ 'game_cross'] = 'Križaljka'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Vješalo'; +$string[ 'game_hiddenpicture'] = 'Skrivena slika'; +$string[ 'game_millionaire'] = 'Milijunaš'; +$string[ 'game_snakes'] = 'Zmije i Ljestve'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Informacije'; +$string[ 'noattempts'] = 'Ovu igru nitko još nije pokušao igrati'; +$string[ 'percent'] = 'Postotak'; +$string[ 'results'] = 'Rezultati'; +$string[ 'showanswers'] = 'Prikaži odgovore'; +$string[ 'showattempts'] = 'Prikaži pokušaje'; + +//locallib.php +$string[ 'attemptfirst'] = 'Prvi pokušaj'; +$string[ 'attemptlast'] = 'Zadnji pokušaj'; +$string[ 'convertfrom'] = ''; //Special convertation to capital letters +$string[ 'convertto'] = ''; //It is needed for some languages +$string[ 'gradeaverage'] = 'Prosječna ocjena'; +$string[ 'gradehighest'] = 'Najveća ocjena'; + +//mod_form.php +$string[ 'bottomtext'] = 'Tekst na dnu'; +$string[ 'cross_layout'] = 'Raspored'; +$string[ 'cross_layout0'] = 'Fraze ispod križaljke'; +$string[ 'cross_layout1'] = 'Fraze desno od križaljke'; +$string[ 'cross_maxcols'] = 'Maksimaln broj stupaca u križaljci'; +$string[ 'cross_maxwords'] = 'Maksimalan broj riječi u križaljci'; +$string[ 'cross_options'] = 'Postavke križaljke'; +$string[ 'cryptex_maxcols'] = 'Maksimalan broj stupaca/redova cryptexa'; +$string[ 'cryptex_maxtries'] = 'Maksimalan broj pokušaja'; +$string[ 'cryptex_maxwords'] = 'Maksimalan broj riječi cryptexa'; +$string[ 'cryptex_options'] = 'Cryptex postavke'; +$string[ 'grademethod'] = 'Metoda ocjenjivanja'; +$string[ 'hangman_allowspaces'] = 'Dozvoli razmake u riječima'; +$string[ 'hangman_allowsub'] = 'Dozvoli znak - u riječima'; +$string[ 'hangman_imageset'] = 'Odaberite sliku vješala'; +$string[ 'hangman_language'] = 'Jezik riječi'; +$string[ 'hangman_maxtries'] = 'Broj riječi po igri'; +$string[ 'hangman_options'] = 'Postavke vješala'; +$string[ 'hangman_showcorrectanswer'] = 'Prikaži ispravan odgovor nakon završetka'; +$string[ 'hangman_showfirst'] = 'Prikaži prvo slovo vješala'; +$string[ 'hangman_showlast'] = 'Prikaži zadnje slovo vješala'; +$string[ 'hangman_showquestion'] = 'Prikaži pitanje?'; +$string[ 'hiddenpicture_across'] = 'Ćelije vodoravno'; +$string[ 'hiddenpicture_down'] = 'Ćelije okomito'; +$string[ 'hiddenpicture_height'] = 'Postavi visinu slike na'; +$string[ 'hiddenpicture_options'] = 'Postavke skrivene slike'; +$string[ 'hiddenpicture_pictureglossary'] = 'Rječnik za glavno pitanje i sliku'; +$string[ 'hiddenpicture_width'] = 'Postavi širinu slike na'; +$string[ 'millionaire_background'] = 'Boja pozadine'; +$string[ 'millionaire_options'] = 'Postavke Milijunaša'; +$string[ 'millionaire_shuffle'] = 'Izmješaj pitanja'; +$string[ 'snakes_background'] = 'Pozadina'; +$string[ 'snakes_options'] = 'Postavke \'Zmije i ljestve\''; +$string[ 'sourcemodule'] = 'Izvor pitanja'; +$string[ 'sourcemodule_book'] = 'Odaberite knjigu'; +$string[ 'sourcemodule_glossary'] = 'Odaberite rječnik'; +$string[ 'sourcemodule_glossarycategory'] = 'Odaberite kategoriju rječnika'; +$string[ 'sourcemodule_include_subcategories'] = 'Uključi podkategorije'; +$string[ 'sourcemodule_question'] = 'Pitanja'; +$string[ 'sourcemodule_questioncategory'] = 'Kategorija pitanja'; +$string[ 'sourcemodule_quiz'] = 'Odaberite igru'; +$string[ 'sudoku_maxquestions'] = 'Maksimalan broj pitanja'; +$string[ 'sudoku_options'] = 'Sudoku postavke'; +$string[ 'toptext'] = 'Tekst na vrhu'; + +//preview.php +$string[ 'only_teachers'] = 'Samo učitelj može vidjeti ovu stranicu'; +$string[ 'preview'] = 'Pregled'; + +//review.php +$string[ 'attempts'] = 'Pokušaji'; +$string[ 'completedon'] = 'Završeno'; +$string[ 'outof'] = '{$a->grade} od maksimalno {$a->maxgrade}'; +$string[ 'review'] = 'Pregled'; +$string[ 'reviewofattempt'] = 'Pregled pokušaja {$a}'; +$string[ 'startagain'] = 'Ponovo igraj'; +$string[ 'timetaken'] = 'Proteklo vrijeme'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Obriši statistiku'; +$string[ 'computerepetitions'] = 'Ponovo izračunaj statistiku'; +$string[ 'feedbacks'] = 'Poruke ispravnih odgovora'; +$string[ 'repetitions'] = 'Ponavljanja'; + +//showattempts.php +$string[ 'lastip'] = 'Adresa računala'; +$string[ 'showsolution'] = 'Rješenje'; +$string[ 'timefinish'] = 'Kraj igre'; +$string[ 'timelastattempt'] = 'Posljednji pokušaj'; +$string[ 'timestart'] = 'Početak'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Pokušaj ponovo'; +$string[ 'continueattemptgame'] = 'Nastavi sa prethodnim pokušajem ove igre'; +$string[ 'reattemptgame'] = 'Ponovni pokušaj igre'; +$string[ 'yourfinalgradeis'] = 'Vaša konačna ocjena za ovu igru je {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/it/game.php b/lang/it/game.php new file mode 100644 index 0000000..d3c0941 --- /dev/null +++ b/lang/it/game.php @@ -0,0 +1,305 @@ +Dobrodošli!

      Za početak igre odaberite riječ.

      '; +$string[ 'letter'] = 'slovo'; +$string[ 'letters'] = 'slova'; +$string[ 'nextgame'] = 'Nova igra'; +$string[ 'no_words'] = 'una o più parole non sono state trovate'; +$string[ 'print'] = 'Ispiši'; +$string[ 'win'] = 'congratulazioni!!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Kraj igre'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'la frase giusta era: '; +$string[ 'hangman_correct_word'] = 'la parola giusta era: '; +$string[ 'hangman_gradeinstance'] = 'Ocjena u cijeloj igri'; +$string[ 'hangman_letters'] = 'Slova: '; +$string[ 'hangman_restletters_many'] = 'Imate još {$a} pokušaja'; +$string[ 'hangman_restletters_one'] = 'Imate još SAMO 1 pokušaj'; +$string[ 'hangman_wrongnum'] = 'Krivo: %%d od %%d'; +$string[ 'nextword'] = 'Sljedeća riječ'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Ocjeni glavni odgovor'; +$string[ 'hiddenpicture_nocols'] = 'Treba zadati broj stupaca vodoravno'; +$string[ 'hiddenpicture_nomainquestion'] = 'Nije pronađen ni jedan zapis u rječniku {$a->name} sa pridruženom slikom'; +$string[ 'hiddenpicture_norows'] = 'Treba zadati broj stupaca okomito'; +$string[ 'must_select_glossary'] = 'Morate odabrati rječnik'; +$string[ 'noglossaryentriesfound'] = 'Non sono state trovate voci di glossario'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Morate odabrati kategoriju pitanja'; +$string[ 'millionaire_must_select_quiz'] = 'Morate odabrati tip igre'; + +//report/overview/report.php +$string[ 'allattempts'] = 'mostra tutti i tentativi'; +$string[ 'allstudents'] = 'mostra tutti $a'; +$string[ 'attemptsonly'] = 'indica solo gli studenti che hanno svolto tentativi'; +$string[ 'deleteattemptcheck'] = 'Sei sicbookquiz_emptyuro che tu vuoi eliminare completamente questi tentativi?'; +$string[ 'displayoptions'] = 'mostrare i fattori'; +$string[ 'downloadods'] = 'salvare in formato ODS'; +$string[ 'feedback'] = 'risposta'; +$string[ 'noattemptsonly'] = 'mostra solo $a che non presentano tentativi'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring Hanno fatto $a->attemptnum tentativi'; +$string[ 'pagesize'] = 'domande per pagina:'; +$string[ 'reportoverview'] = 'sommario'; +$string[ 'selectall'] = 'seleziona tutti'; +$string[ 'selectnone'] = 'deseleziona tutti'; +$string[ 'showdetailedmarks'] = 'mostra i dettagli delle valutazioni'; +$string[ 'startedon'] = 'Započeto'; +$string[ 'timecompleted'] = 'Završeno'; +$string[ 'unfinished'] = 'nije završeno'; +$string[ 'withselected'] = 'con i file selezionati'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Broju sudoku zadataka koji će se napraviti'; +$string[ 'sudoku_create_start'] = 'Započni pravljenje sudou zadataka'; +$string[ 'sudoku_creating'] = 'Pravim {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Kraj igre'; +$string[ 'sudoku_guessnumber'] = 'Pogodite točan broj'; +$string[ 'sudoku_noentriesfound'] = 'U rječniku nije pronađena ni jedna riječ'; + +//export.php +$string[ 'export'] = 'Izvoz'; +$string[ 'html_hascheckbutton'] = 'Sadrži tipku za provjeru:'; +$string[ 'html_hasprintbutton'] = 'Sadrži tipku za ispis:'; +$string[ 'html_title'] = 'Naslov stranice:'; +$string[ 'javame_createdby'] = 'Autor:'; +$string[ 'javame_description'] = 'Opis:'; +$string[ 'javame_filename'] = 'Ime datoteke:'; +$string[ 'javame_icon'] = 'Ikona:'; +$string[ 'javame_maxpictureheight'] = 'Maksimalna visina slike:'; +$string[ 'javame_maxpicturewidth'] = 'Maksimalna širina slike:'; +$string[ 'javame_name'] = 'Ime:'; +$string[ 'javame_type'] = 'Tip:'; +$string[ 'javame_vendor'] = 'Prodavač:'; +$string[ 'javame_version'] = 'Verzija:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Kraj igre'; +$string[ 'html_hangman_new'] = 'nuovo'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Pitaj publiku'; +$string[ 'millionaire_info_people'] = 'Publika kaže'; +$string[ 'millionaire_info_telephone'] = 'Mislim da je točan odgovor '; +$string[ 'millionaire_info_wrong_answer'] = 'Vaš odgovor je pogrešan
      Točan odgovor je:'; +$string[ 'millionaire_quit'] = 'Kraj'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Za Milijunaša izvor mora biti {$a} ili pitanja i ne'; +$string[ 'millionaire_telephone'] = 'Pomoć zovi'; +$string[ 'must_select_questioncategory'] = 'Morate odabrati kategoriju pitanja'; +$string[ 'must_select_quiz'] = 'Morate odabrati igru'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Rezultat'; + +//index.php +$string[ 'modulename'] = 'igru'; +$string[ 'modulenameplural'] = 'Igre'; +$string[ 'pluginname'] = 'igru'; + +//lib.php +$string[ 'attempt'] = 'Pokušaj'; +$string[ 'bookquiz_questions'] = 'Pridruži kategorije pitanja poglavlju knjige'; +$string[ 'export_to_html'] = 'Izvoz u HTML'; +$string[ 'export_to_javame'] = 'Izvoz u Javame'; +$string[ 'game_bookquiz'] = 'Knjiga sa pitanjima'; +$string[ 'game_cross'] = 'Križaljka'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Vješalo'; +$string[ 'game_hiddenpicture'] = 'Skrivena slika'; +$string[ 'game_millionaire'] = 'Milijunaš'; +$string[ 'game_snakes'] = 'Zmije i Ljestve'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Informacije'; +$string[ 'noattempts'] = 'Ovu igru nitko još nije pokušao igrati'; +$string[ 'percent'] = 'Postotak'; +$string[ 'results'] = 'Rezultati'; +$string[ 'showanswers'] = 'Prikaži odgovore'; +$string[ 'showattempts'] = 'mostra i tentativi'; + +//locallib.php +$string[ 'attemptfirst'] = 'Prvi pokušaj'; +$string[ 'attemptlast'] = 'Zadnji pokušaj'; +$string[ 'gradeaverage'] = 'Prosječna ocjena'; +$string[ 'gradehighest'] = 'Najveća ocjena'; + +//mod_form.php +$string[ 'bottomtext'] = 'Tekst na dnu'; +$string[ 'cross_layout'] = 'Raspored'; +$string[ 'cross_layout0'] = 'Fraze ispod križaljke'; +$string[ 'cross_layout1'] = 'Fraze desno od križaljke'; +$string[ 'cross_maxcols'] = 'Maksimaln broj stupaca u križaljci'; +$string[ 'cross_maxwords'] = 'Maksimalan broj riječi u križaljci'; +$string[ 'cross_options'] = 'opzioni di incrocio'; +$string[ 'cryptex_maxcols'] = 'Maksimalan broj stupaca/redova cryptexa'; +$string[ 'cryptex_maxtries'] = 'massimo numero di tentativi'; +$string[ 'cryptex_maxwords'] = 'Maksimalan broj riječi cryptexa'; +$string[ 'cryptex_options'] = 'opzioni nel criptoverba'; +$string[ 'grademethod'] = 'Metoda ocjenjivanja'; +$string[ 'hangman_allowspaces'] = 'Dozvoli razmake u riječima'; +$string[ 'hangman_allowsub'] = 'Dozvoli znak - u riječima'; +$string[ 'hangman_imageset'] = 'Odaberite sliku vješala'; +$string[ 'hangman_language'] = 'Jezik riječi'; +$string[ 'hangman_maxtries'] = 'Broj riječi po igri'; +$string[ 'hangman_options'] = 'opzioni del gioco dell\'impiccato'; +$string[ 'hangman_showcorrectanswer'] = 'Prikaži ispravan odgovor nakon završetka'; +$string[ 'hangman_showfirst'] = 'Prikaži prvo slovo vješala'; +$string[ 'hangman_showlast'] = 'Prikaži zadnje slovo vješala'; +$string[ 'hangman_showquestion'] = 'Prikaži pitanje?'; +$string[ 'hiddenpicture_across'] = 'Ćelije vodoravno'; +$string[ 'hiddenpicture_down'] = 'Ćelije okomito'; +$string[ 'hiddenpicture_height'] = 'Postavi visinu slike na'; +$string[ 'hiddenpicture_options'] = 'opzioni della figura nascosta'; +$string[ 'hiddenpicture_pictureglossary'] = 'Rječnik za glavno pitanje i sliku'; +$string[ 'hiddenpicture_width'] = 'Postavi širinu slike na'; +$string[ 'millionaire_background'] = 'Boja pozadine'; +$string[ 'millionaire_options'] = 'opzioni del gioco del milionario'; +$string[ 'millionaire_shuffle'] = 'Izmješaj pitanja'; +$string[ 'snakes_background'] = 'Pozadina'; +$string[ 'snakes_options'] = 'opzioni del gioco delle serpentine'; +$string[ 'sourcemodule'] = 'Izvor pitanja'; +$string[ 'sourcemodule_book'] = 'Odaberite knjigu'; +$string[ 'sourcemodule_glossary'] = 'Odaberite rječnik'; +$string[ 'sourcemodule_glossarycategory'] = 'Odaberite kategoriju rječnika'; +$string[ 'sourcemodule_include_subcategories'] = 'Uključi podkategorije'; +$string[ 'sourcemodule_question'] = 'Pitanja'; +$string[ 'sourcemodule_questioncategory'] = 'Kategorija pitanja'; +$string[ 'sourcemodule_quiz'] = 'Odaberite igru'; +$string[ 'sudoku_maxquestions'] = 'Maksimalan broj pitanja'; +$string[ 'sudoku_options'] = 'opzioni del gioco del Sudoku'; +$string[ 'toptext'] = 'testo in cima'; + +//preview.php +$string[ 'only_teachers'] = 'Samo učitelj može vidjeti ovu stranicu'; +$string[ 'preview'] = 'Pregled'; + +//review.php +$string[ 'attempts'] = 'Pokušaji'; +$string[ 'completedon'] = 'Završeno'; +$string[ 'outof'] = '{$a->grade} od maksimalno {$a->maxgrade}'; +$string[ 'review'] = 'Pregled'; +$string[ 'reviewofattempt'] = 'Pregled pokušaja {$a}'; +$string[ 'startagain'] = 'Ponovo igraj'; +$string[ 'timetaken'] = 'Proteklo vrijeme'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Clear statistics'; +$string[ 'computerepetitions'] = 'ricalcola le statistiche'; +$string[ 'feedbacks'] = 'Poruke ispravnih odgovora'; +$string[ 'repetitions'] = 'ripetizioni'; + +//showattempts.php +$string[ 'lastip'] = 'Adresa računala'; +$string[ 'showsolution'] = 'Rješenje'; +$string[ 'timefinish'] = 'Kraj igre'; +$string[ 'timelastattempt'] = 'Posljednji pokušaj'; +$string[ 'timestart'] = 'Početak'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Pokušaj ponovo'; +$string[ 'continueattemptgame'] = 'Nastavi sa prethodnim pokušajem ove igre'; +$string[ 'reattemptgame'] = 'Ponovni pokušaj igre'; +$string[ 'yourfinalgradeis'] = 'Vaša konačna ocjena za ovu igru je {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/lt/game.php b/lang/lt/game.php new file mode 100644 index 0000000..32d4e83 --- /dev/null +++ b/lang/lt/game.php @@ -0,0 +1,306 @@ +Sveiki!

      Norėdami pradėti, paspauskite bet kurį kryžiažodžio langelį. Atsiradusiame lauke įveskite savo atsakymą.

      '; // '

      Welcome!

      Click on a word to begin.

      '; +$string[ 'letter'] = 'raidė'; // 'letter'; +$string[ 'letters'] = 'raidės'; // 'letters'; +$string[ 'nextgame'] = 'Naujas žaidimas'; // 'New game'; +$string[ 'no_words'] = 'Nėra žodžių'; // 'There are no words'; +$string[ 'print'] = 'Spausdinti'; // 'Print'; +$string[ 'win'] = 'Sveikiname !!!'; // 'Congratulations !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Žaidimo pabaiga'; // 'End of game'; + +//db/access.php +$string[ 'game:attempt'] = 'Pradėti žaidimą'; // 'Play game'; +$string[ 'game:deleteattempts'] = 'Ištrinti bandymus'; // 'Delete attempts'; +$string[ 'game:grade'] = 'Rašyti žaidimų įvertinimus'; // 'Grade games manually'; +$string[ 'game:manage'] = 'Tvarkyti'; // 'Manage'; +$string[ 'game:manageoverrides'] = 'Tvarkyti žaidimo išimtis'; // 'Manage game overrides'; +$string[ 'game:preview'] = 'Peržiūrėti žaidimus'; // 'Preview Games'; +$string[ 'game:reviewmyattempts'] = 'Peržiūrėti bandymus'; // 'reviewmyattempts'; +$string[ 'game:view'] = 'žiūrėti'; // 'view'; +$string[ 'game:viewreports'] = 'Peržiūrėti ataskaitas'; // 'viewreports'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Teisinga frazė buvo: '; // 'The correct phrase was: '; +$string[ 'hangman_correct_word'] = 'Teisingas žodis buvo: '; // 'The correct word was: '; +$string[ 'hangman_gradeinstance'] = 'Viso žaidimo įvertinimas'; // 'Grade in whole game'; +$string[ 'hangman_letters'] = 'Raidės: '; // 'Letters: '; +$string[ 'hangman_restletters_many'] = 'Jums liko {$a} bandymai'; // 'You have {$a} tries'; +$string[ 'hangman_restletters_one'] = 'Jums liko TIK 1 - PASKUTINIS bandymas'; // 'You have ONLY 1 try'; +$string[ 'hangman_wrongnum'] = 'Neteisingai: %d iš %d'; // 'Wrong: %d out of %d'; +$string[ 'nextword'] = 'Sekantis žodis'; // 'Next word'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Vertinti pagrindinį atsakymą'; // 'Grade main answer'; +$string[ 'hiddenpicture_nocols'] = 'Reikia nurodyti stulpelių skaičių'; // 'Have to specify the number of cols horizontaly'; +$string[ 'hiddenpicture_nomainquestion'] = 'Žodyne {$a->name} nėra įrašo su pridėta nuotrauka'; // 'There are no glossary entries on glossary {$a->name} with an attached picture'; +$string[ 'hiddenpicture_norows'] = 'Reikia nurodyti eilučių skaičių'; // 'Have to specify the number of cols verticaly'; +$string[ 'must_select_glossary'] = 'Privalote parinkti žodyną'; // 'You must select a glossary'; +$string[ 'no_questions'] = "Nėra klausimų"; // "There are no questions"; +$string[ 'noglossaryentriesfound'] = 'Žodyne nerasta nei vieno įrašo'; // 'No glossary entries found'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Pasirinkite klausimo kategoriją'; // 'You must select one question category'; +$string[ 'millionaire_must_select_quiz'] = 'Pasirinkite klausimų sąrašą'; // 'You must select one quiz'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Rodyti visus bandymus'; // 'Show all tries'; +$string[ 'allstudents'] = 'Rodyti visus $a'; // 'Show all $a'; +$string[ 'attemptsonly'] = 'Rodyti tik bandžiusius spręsti studentus'; // 'Show only students with attempts'; +$string[ 'deleteattemptcheck'] = 'Ar jūs tikrai norite visiškai pašalinti šiuos bandymus?'; // 'Are you absolutely sure you want to completely delete these attempts?'; +$string[ 'displayoptions'] = 'Parodyti parinktis'; // 'Display options'; +$string[ 'downloadods'] = 'Atsiųsti ODS formatu'; // 'Download in ODS format'; +$string[ 'feedback'] = 'Atsiliepimai'; // 'Feedback'; +$string[ 'noattemptsonly'] = 'Rodyti tiktai $a nebandžiusius spręsti'; // 'Show $a with no attempts only'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring atliko $a->attemptnum bandymų'; // '$a->studentnum $a->studentstring have made $a->attemptnum attempts'; +$string[ 'pagesize'] = 'Klausimų viename puslapyje:'; // 'Questions per page:'; +$string[ 'reportoverview'] = 'Apžvalga'; // 'Overview'; +$string[ 'selectall'] = 'Pažymėti viską'; // 'Select all'; +$string[ 'selectnone'] = 'Panaikinti žymėjimą'; // 'Deselect all'; +$string[ 'showdetailedmarks'] = 'Rodyti vertininmą išsamiai'; // 'Show mark details'; +$string[ 'startedon'] = 'Pradėta'; // 'Started on'; +$string[ 'timecompleted'] = 'Pabaigta'; // 'Completed'; +$string[ 'unfinished'] = 'atverti'; // 'open'; +$string[ 'withselected'] = 'Su pažymėtais'; // 'With selected'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Žaidimo kauliukas, $a taškų.'; // 'Dice, $a spots.'; +$string[ 'snakes_player'] = 'Žaidėjo, vieta: $a.'; // 'Player, position: $a.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Sukuriamų sudoku žaidimų skaičius'; // 'Number of sudokus that will be created'; +$string[ 'sudoku_create_start'] = 'Pradėti kurti sudoku žaidimus'; // 'Start creating sudokus'; +$string[ 'sudoku_creating'] = 'Kuriamas {$a} sudoku'; // 'Creating {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Baigti žaidimą'; // 'End of game'; +$string[ 'sudoku_guessnumber'] = 'Spėti teisingą skaičių'; // 'Guess the correct number'; +$string[ 'sudoku_noentriesfound'] = 'Žodyne nerasta nei vieno įrašo'; // 'No words found in glossary'; + +//export.php +$string[ 'export'] = 'Eksportuoti'; // 'Export'; +$string[ 'html_hascheckbutton'] = 'Yra tikrinimo mygtukas:'; // 'Has check button:'; +$string[ 'html_hasprintbutton'] = 'Yra spausdinimo mygtukas:'; // 'Has print button:'; +$string[ 'html_title'] = 'html antraštė:'; // 'Title of html:'; +$string[ 'javame_createdby'] = 'Autorius:'; // 'Created by:'; +$string[ 'javame_description'] = 'Aprašymas:'; // 'Description:'; +$string[ 'javame_filename'] = 'Failo vardas:'; // 'Filename:'; +$string[ 'javame_icon'] = 'Piktograma:'; // 'Icon:'; +$string[ 'javame_maxpictureheight'] = 'Maksimalus nuotraukos aukštis:'; // 'Max picture height:'; +$string[ 'javame_maxpicturewidth'] = 'Maksimalus nuotraukos plotis:'; // 'Max picture width:'; +$string[ 'javame_name'] = 'Pavadinimas:'; // 'Name:'; +$string[ 'javame_type'] = 'Tipas:'; // 'Type:'; +$string[ 'javame_vendor'] = 'Pardavėjas:'; // 'Vendor:'; +$string[ 'javame_version'] = 'Versija:'; // 'Version:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Žaidimas baigtas'; // 'Game over'; +$string[ 'html_hangman_new'] = 'Naujas žaidimas'; // 'New'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Salės pagalba'; // 'Help of people'; +$string[ 'millionaire_info_people'] = 'Salė sako'; // 'People say'; +$string[ 'millionaire_info_telephone'] = 'Man atrodo teisingas atsakymas yra '; // 'I think that the correct answer is '; +$string[ 'millionaire_info_wrong_answer'] = 'Jūsų atsakymas neteisingas.
      Teisingas atsakymas yra:'; // 'Your answer is wrong
      The right answer is:'; +$string[ 'millionaire_quit'] = 'Baigti'; // 'Quit'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Milijonierio žaidimui duomenys turi būti {$a} arba klausimai, bet ne'; // 'For the millionaire the source must be {$a} or questions and not'; +$string[ 'millionaire_telephone'] = 'Pagalba telefonu'; // 'Help of telephone'; +$string[ 'must_select_questioncategory'] = 'Pasirinkite klausimo kategoriją'; // 'You must select a question category'; +$string[ 'must_select_quiz'] = 'Pasirinkite klausimų sąrašą'; // 'You must select a quiz'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Tikrinti'; // 'Check'; +$string[ 'html_snakes_correct'] = 'Teisingai!'; // 'Correct!'; +$string[ 'html_snakes_no_selection'] = 'Turite ką nors pažymėti!'; // 'Have to select something!'; +$string[ 'html_snakes_wrong'] = "Jūsų atsakymas neteisingas. Pasiliekate toje pačioje vietoje."; // "Your answer isn't correct. Stay on the same seat."; +$string[ 'score'] = 'Rezultatas'; // 'Score'; + +//index.php +$string[ 'modulename'] = 'Žaidimas'; // 'Game'; +$string[ 'modulenameplural'] = 'Žaidimai'; // 'Games'; +$string[ 'pluginadministration'] = 'Žaidimo valdymas'; // 'Game administration'; +$string[ 'pluginname'] = 'Žaidimai'; // 'Game'; + +//lib.php +$string[ 'attempt'] = 'Bandyti'; // 'Attempt'; +$string[ 'bookquiz_questions'] = 'Susieti klausimų grupes su knygos skyriumi'; // 'Associate question categories to chapter of book'; +$string[ 'export_to_html'] = 'Eksportuoti į HTML'; // 'Export to HTML'; +$string[ 'export_to_javame'] = 'Eksportuoti į Java'; // 'Export to Javame'; +$string[ 'game_bookquiz'] = 'Knyga su klausimais'; // 'Book with questions'; +$string[ 'game_cross'] = 'Kryžiažodis'; // 'Crossword'; +$string[ 'game_cryptex'] = 'Cryptex'; // 'Cryptex'; +$string[ 'game_hangman'] = 'Kartuvės'; // 'Hangman'; +$string[ 'game_hiddenpicture'] = 'Paslėpta nuotrauka'; // 'Hidden Picture'; +$string[ 'game_millionaire'] = 'Milijonierius'; // 'Millionaire'; +$string[ 'game_snakes'] = 'Gyvatės ir kopėčios'; // 'Snakes and Ladders'; +$string[ 'game_sudoku'] = 'Sudoku'; // 'Sudoku'; +$string[ 'info'] = 'Informacija'; // 'Info'; +$string[ 'noattempts'] = 'Nebuvo bandyta žaisti šio žaidimo'; // 'No attempts have been made on this game'; +$string[ 'percent'] = 'Procentai'; // 'Percent'; +$string[ 'reset_game_all'] = 'Šalinti bandymus iš visų žaidimų'; // 'Delete tries from all games'; +$string[ 'reset_game_deleted_course'] = 'Šalinti bandymus iš pašalintų žaidimų'; // 'Delete tries from deleted courses'; +$string[ 'results'] = 'Rezultatas'; // 'Results'; +$string[ 'showanswers'] = 'Rodyti atsakymus'; // 'Show answers'; +$string[ 'showattempts'] = 'Rodyti bandymus'; // 'Show attempts'; + +//locallib.php +$string[ 'attemptfirst'] = 'Pirmas bandymas'; // 'First attempt'; +$string[ 'attemptlast'] = 'Paskutinis bandymas'; // 'Last attempt'; +$string[ 'convertfrom'] = '-'; // '-'; +$string[ 'convertto'] = '-'; // '-'; +$string[ 'gradeaverage'] = 'Vidurkis'; // 'Average grade'; +$string[ 'gradehighest'] = 'Aukščiausias rezultatas'; // 'Highest grade'; + +//mod_form.php +$string[ 'bottomtext'] = 'Tekstas puslapio apačioje'; // 'Text at the bottom of page'; +$string[ 'cross_layout'] = 'Išdėstymas'; // 'Layout'; +$string[ 'cross_layout0'] = 'Frazės po kryžiažodžiu'; // 'Phrases on the bottom of cross'; +$string[ 'cross_layout1'] = 'Frazės kryžiažodžio dešinėje'; // 'Phrases on the right of cross'; +$string[ 'cross_maxcols'] = 'Maksimalus stulpelių skaičius kryžiažodyje'; // 'Maximum number of cols of crossword'; +$string[ 'cross_maxwords'] = 'Maksimalus žodžių skaičius kryžiažodyje'; // 'Maximum number of words of crossword'; +$string[ 'cross_options'] = 'Kryžiažodžio parametrai'; // 'Crossword options'; +$string[ 'cryptex_maxcols'] = 'Maksimalus stulpelių/eilučių skaičius cryptex žaidime'; // 'Maximum number of cols/rows in cryptex'; +$string[ 'cryptex_maxtries'] = 'Maksimalus bandymų skaičius'; // 'Max tries'; +$string[ 'cryptex_maxwords'] = 'Maksimalus žodžių skaičius cryptex žaidime'; // 'Maximum number of words in cryptex'; +$string[ 'cryptex_options'] = 'Cryptex žaidimo parametrai'; // 'Cryptex options'; +$string[ 'gameclose'] = 'Užbaigti žaidimą'; // 'Close the game'; +$string[ 'gameopen'] = 'Pradėti žaidimą'; // 'Open the game'; +$string[ 'grademethod'] = 'Vertinimo metodas'; // 'Grading method'; +$string[ 'hangman_allowspaces'] = 'Leisti naudoti tarpus žodžiuose'; // 'Allow spaces in words'; +$string[ 'hangman_allowsub'] = 'Leisti naudoti "-" (brūkšnelio ženklą) žodžiuose'; // 'Allow the symbol - in words'; +$string[ 'hangman_imageset'] = 'Parinkite Kartuvių žaidimo paveiksliuką'; // 'Select the images of hangman'; +$string[ 'hangman_language'] = 'Žodžių kalba'; // 'Language of words'; +$string[ 'hangman_maximum_number_of_errors'] = 'Maksimalus klaidų skaičius (turi būti paveiksliukai kiekvienai klaidai - hangman_0.jpg, hangman_1.jpg, ...)'; // 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +$string[ 'hangman_maxtries'] = 'Žodžių skaičius viename žaidime'; // 'Number of words per game'; +$string[ 'hangman_options'] = 'Kartuvių žaidimo parametrai'; // 'Hangman options'; +$string[ 'hangman_showcorrectanswer'] = 'Pabaigoje parodyti teisingą atsakymą'; // 'Show the correct answer after the end'; +$string[ 'hangman_showfirst'] = 'Rodyti pirmą žodžio raidę'; // 'Show first letter of hangman'; +$string[ 'hangman_showlast'] = 'Rodyti paskutinę žodžio raidę'; // 'Show last letter of hangman'; +$string[ 'hangman_showquestion'] = 'Rodyti klausimus?'; // 'Show the questions ?'; +$string[ 'hiddenpicture_across'] = 'Langeliai horizontaliai'; // 'Cells horizontal'; +$string[ 'hiddenpicture_down'] = 'Langeliai vertikaliai'; // 'Cells down'; +$string[ 'hiddenpicture_height'] = 'Nustatyti nuotraukos aukštį'; // 'Set height of picture to'; +$string[ 'hiddenpicture_options'] = '\'Paslėpta nuotrauka\' žaidimo parametrai'; // '\'Hidden Picture\' options'; +$string[ 'hiddenpicture_pictureglossary'] = 'Pagrindinio klausimo ir nuotraukos žodymas'; // 'The glossary for main question and picture'; +$string[ 'hiddenpicture_width'] = 'Nustatyti nuotraukos plotį'; // 'Set width of picture to'; +$string[ 'millionaire_background'] = 'Fono spalva'; // 'Background color'; +$string[ 'millionaire_options'] = 'Milijonieriaus žaidimo parametrai'; // 'Millionaire\' options'; +$string[ 'millionaire_shuffle'] = 'Klausimų parinkimas atsitiktine tvarka'; // 'Randomize questions'; +$string[ 'snakes_background'] = 'Fonas'; // 'Background'; +$string[ 'snakes_cols'] = 'Stulpeliai'; // 'Cols'; +$string[ 'snakes_data'] = 'Gyvačių ir kopėčių padėtis'; // 'Positions of Snakes and Ladders'; +$string[ 'snakes_file'] = 'Fono failas'; // 'File for background'; +$string[ 'snakes_footerx'] = 'Tarpas apačioje kairėje'; // 'Space at bootom left'; +$string[ 'snakes_footery'] = 'Tarpas apačioje dešinėje'; // 'Space at bottom right'; +$string[ 'snakes_headerx'] = 'Tarpas viršuje kairėje'; // 'Space at up left'; +$string[ 'snakes_headery'] = 'Tarpas viršuje dešinėje'; // 'Space at up right'; +$string[ 'snakes_options'] = '\'Gyvatės ir kopėčios\' žaidimo parametrai'; // '\'Snakes and Ladders\' options'; +$string[ 'snakes_rows'] = 'Eilutės'; // 'Rows'; +$string[ 'sourcemodule'] = 'Klausimų šaltinis'; // 'Source of questions'; +$string[ 'sourcemodule_book'] = 'Parinkite knygą'; // 'Select a book'; +$string[ 'sourcemodule_glossary'] = 'Parinkite žodyną'; // 'Select glossary'; +$string[ 'sourcemodule_glossarycategory'] = 'Parinkite žodyno grupę'; // 'Select category of glossary'; +$string[ 'sourcemodule_include_subcategories'] = 'Įtraukti pogrupį'; // 'Include subcategories'; +$string[ 'sourcemodule_question'] = 'Klausimai'; // 'Questions'; +$string[ 'sourcemodule_questioncategory'] = 'Parinkite klausimų grupę'; // 'Select question category'; +$string[ 'sourcemodule_quiz'] = 'Parinkite kontrolinių klausimų sąrašą'; // 'Select quiz'; +$string[ 'sudoku_maxquestions'] = 'Didžiausias klausimų skaičius'; // 'Maximum number of questions'; +$string[ 'sudoku_options'] = 'Sudoku parametrai'; // 'Sudoku options'; +$string[ 'toptext'] = 'Tekstas puslapio viršuje'; // 'Text at the top of page'; +$string[ 'userdefined'] = 'Naudotojo apibrėžtas'; // 'User defined'; + +//preview.php +$string[ 'only_teachers'] = 'Tik mokytojai gali matyti šį puslapį'; // 'Only teacher can see this page'; +$string[ 'preview'] = 'Peržiūrėti'; // 'Preview'; + +//review.php +$string[ 'attempts'] = 'Bandymai'; // 'Attempts'; +$string[ 'completedon'] = 'Išspręsta'; // 'Completed on'; +$string[ 'outof'] = '{$a->grade} balų iš {$a->maxgrade}'; // '{$a->grade} out of a maximum of {$a->maxgrade}'; +$string[ 'review'] = 'Peržiūrėti'; // 'Review'; +$string[ 'reviewofattempt'] = 'Peržiūrėti bandymą {$a}'; // 'Review of Attempt {$a}'; +$string[ 'showall'] = 'Parodyti visus'; // 'Show all'; +$string[ 'startagain'] = 'Pradėti iš naujo'; // 'Start again'; +$string[ 'timetaken'] = 'Užėmė laiko'; // 'Time taken'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Išvalyti statistiką'; // 'Clear statistics'; +$string[ 'computerepetitions'] = 'Skaičiuoti statistiką iš naujo'; // 'Compute statistics again'; +$string[ 'feedbacks'] = 'Teisingų atsakymų pranešimai'; // 'Messages correct answer'; +$string[ 'repetitions'] = 'Pasikartojimai'; // 'Repetitions'; + +//showattempts.php +$string[ 'lastip'] = 'Studento IP'; // 'IP student'; +$string[ 'showsolution'] = 'Sprendimas'; // 'solution'; +$string[ 'timefinish'] = 'Žaidimas pabaigtas'; // 'End of game'; +$string[ 'timelastattempt'] = 'Paskutinins bandymas'; // 'Last attempt'; +$string[ 'timestart'] = 'Pradėta'; // 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Pradėti dabar žaidimą'; // 'Attempt game now'; +$string[ 'continueattemptgame'] = 'Tęsti anksčiau pradėtą žaidimą'; // 'Continue a previous attempt of game'; +$string[ 'gameclosed'] = 'Žaidimas užbaigtas {$a}'; // 'This game closed on {$a}'; +$string[ 'gamecloseson'] = 'Žaidimas bus baigiamas {$a}'; // 'This game will close at {$a}'; +$string[ 'gamenotavailable'] = 'Žaidimas nebus pradedamas iki {$a}'; // 'The game will not be available until {$a}'; +$string[ 'gameopenedon'] = 'Žaidimas bus pradedamas {$a}'; // 'This game opened at {$a}'; +$string[ 'reattemptgame'] = 'Bandyti žaidimą dar kartą'; // 'Reattempt game'; +$string[ 'yourfinalgradeis'] = 'Galutinis Jūsų žaidimo įvertinimas yra {$a}.'; // 'Your final grade for this game is {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//view.php $string[ 'comment'] = 'Comment'; diff --git a/lang/nl/game.php b/lang/nl/game.php new file mode 100644 index 0000000..d49e621 --- /dev/null +++ b/lang/nl/game.php @@ -0,0 +1,305 @@ +Welkom!

      Klik op een woord om te beginnen.'; +$string[ 'letter'] = 'letter'; +$string[ 'letters'] = 'letters'; +$string[ 'nextgame'] = 'Nieuw spel'; +$string[ 'no_words'] = 'Geen woorden gevonden'; +$string[ 'print'] = 'Print'; +$string[ 'win'] = 'Gefeliciteerd!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Einde van het spel'; + +//db/access.php +$string[ 'game:attempt'] = 'Speel het spel'; +$string[ 'game:deleteattempts'] = 'Verwijder pogingen'; +$string[ 'game:grade'] = 'Geef manueel punten'; +$string[ 'game:manage'] = 'Beheer'; +$string[ 'game:preview'] = 'Bekijk Spellen'; +$string[ 'game:reviewmyattempts'] = 'Bekijk mijn pogingen'; +$string[ 'game:view'] = 'Bekijk'; +$string[ 'game:viewreports'] = 'Bekijk het rapport'; + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'De juiste oplossing was:'; +$string[ 'hangman_correct_word'] = 'Het juiste woord was:'; +$string[ 'hangman_gradeinstance'] = 'Cijfer in het hele spel'; +$string[ 'hangman_letters'] = 'Letters'; +$string[ 'hangman_restletters_many'] = 'Je hebt {$a} pogingen'; +$string[ 'hangman_restletters_one'] = 'Je hebt slechts ÉÉN poging'; +$string[ 'hangman_wrongnum'] = 'Fout: %%d van de %%d'; +$string[ 'nextword'] = 'Volgende woord'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Cijfer hoofdantwoord'; +$string[ 'hiddenpicture_nocols'] = 'Het aantal kolommen horizontaal dient ingesteld te worden'; +$string[ 'hiddenpicture_nomainquestion'] = 'Er zijn geen woordenlijst onderdelen in woordenlijst {$a->name} met een toegevoegde afbeelding.'; +$string[ 'hiddenpicture_norows'] = 'Het aantal rijen verticaal dient ingesteld te worden'; +$string[ 'must_select_glossary'] = 'Je moet een woordenlijst kiezen'; +$string[ 'no_questions'] = "Geen vragen gevonden"; +$string[ 'noglossaryentriesfound'] = 'Geen woorden gevonden'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Je moet een vragencategorie kiezen'; +$string[ 'millionaire_must_select_quiz'] = 'Je moet één quiz kiezen'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Alle pogingen'; +$string[ 'allstudents'] = 'Alle leerlingen'; +$string[ 'attemptsonly'] = 'Laat alleen leerlingen met pogingen zien'; +$string[ 'deleteattemptcheck'] = 'Weet je zeker dat je deze pogingen wilt verwijderen?'; +$string[ 'displayoptions'] = 'Weergaveopties'; +$string[ 'downloadods'] = 'Download in ODS formaat'; +$string[ 'feedback'] = 'Reactie'; +$string[ 'noattemptsonly'] = 'Laat $a zonder pogingen zien'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring heeft $a->attemptnum pogingen gedaan'; +$string[ 'pagesize'] = 'Aantal vragen per pagina'; +$string[ 'reportoverview'] = 'Overzicht'; +$string[ 'selectall'] = 'Selecteer allemaal'; +$string[ 'selectnone'] = 'Deselecteer allemaal'; +$string[ 'showdetailedmarks'] = 'Laat markeringsdetails zien'; +$string[ 'startedon'] = 'Gestart op'; +$string[ 'timecompleted'] = 'Voltooid'; +$string[ 'unfinished'] = 'open'; +$string[ 'withselected'] = 'Met geselecteerde'; + +//snakes/play.php +$string[ 'snakes_dice'] = 'Dobbelsteen, $a ogen.'; +$string[ 'snakes_player'] = 'Speler, plaats: $a.'; + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Aantal sudokus die gemaakt worden'; +$string[ 'sudoku_create_start'] = 'Start met het maken van sudokus'; +$string[ 'sudoku_creating'] = 'Creëren van {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Einde van het sudoku spel'; +$string[ 'sudoku_guessnumber'] = 'Gok het correcte aantal'; +$string[ 'sudoku_noentriesfound'] = 'Geen woorden gevonden in de woordenlijst'; + +//export.php +$string[ 'export'] = 'Exporteer'; +$string[ 'html_hascheckbutton'] = 'Heeft een check-knop:'; +$string[ 'html_hasprintbutton'] = 'Heeft een print-knop:'; +$string[ 'html_title'] = 'Html-titel:'; +$string[ 'javame_createdby'] = 'Gemaakt door:'; +$string[ 'javame_description'] = 'Beschrijving:'; +$string[ 'javame_filename'] = 'Naam van de file:'; +$string[ 'javame_icon'] = 'Icoon:'; +$string[ 'javame_maxpictureheight'] = 'Max afbeeldingshoogte:'; +$string[ 'javame_maxpicturewidth'] = 'Max afbeeldingsbreedte:'; +$string[ 'javame_name'] = 'Naam:'; +$string[ 'javame_type'] = 'Type:'; +$string[ 'javame_vendor'] = 'Verkoper:'; +$string[ 'javame_version'] = 'Versie:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Spel voorbij'; +$string[ 'html_hangman_new'] = 'Nieuw'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Aan het publiek vragen'; +$string[ 'millionaire_info_people'] = 'Mensen zeggen'; +$string[ 'millionaire_info_telephone'] = 'Ik denk dat het juiste antwoord is...'; +$string[ 'millionaire_info_wrong_answer'] = 'Helaas, je antwoord is fout.
      Het goede antwoord is:'; +$string[ 'millionaire_quit'] = 'Stop'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Voor de miljonair moet de bron {$a} zijn of de vragen en niet'; +$string[ 'millionaire_telephone'] = 'Een hulplijn bellen'; +$string[ 'must_select_questioncategory'] = 'Je moet een vragencategorie kiezen'; +$string[ 'must_select_quiz'] = 'Je moet een quiz/test kiezen'; + +//exporthtml_snakes.php +$string[ 'html_snakes_check'] = 'Check'; +$string[ 'html_snakes_correct'] = 'Juist!'; +$string[ 'html_snakes_no_selection'] = 'Je moet iets aanduiden!'; +$string[ 'html_snakes_wrong'] = "Je antwoord is niet juist, je mag niet verdergaan op het bord."; +$string[ 'score'] = 'Score'; + +//index.php +$string[ 'modulename'] = 'Spel'; +$string[ 'modulenameplural'] = 'Spellen'; +$string[ 'pluginname'] = 'Spel'; + +//lib.php +$string[ 'attempt'] = 'Poging'; +$string[ 'bookquiz_questions'] = 'Associeer vraagcategorieën aan het hoofdstuk van dit boek.'; +$string[ 'export_to_html'] = 'Exporteer naar HTML'; +$string[ 'export_to_javame'] = 'Exporteer naar Javame'; +$string[ 'game_bookquiz'] = 'Boek met vragen'; +$string[ 'game_cross'] = 'Kruiswoord'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Galgje'; +$string[ 'game_hiddenpicture'] = 'Verborgen foto'; +$string[ 'game_millionaire'] = 'Miljonair'; +$string[ 'game_snakes'] = 'Slangen en Ladders'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Er zijn in deze quiz/test geen pogingen gedaan'; +$string[ 'percent'] = 'Percentage'; +$string[ 'results'] = 'Resultaten'; +$string[ 'showanswers'] = 'Laat antwoorden zien'; +$string[ 'showattempts'] = 'Toon pogingen'; + +//locallib.php +$string[ 'attemptfirst'] = 'Eerste poging'; +$string[ 'attemptlast'] = 'Laatste poging'; +$string[ 'gradeaverage'] = 'Gemiddeld cijfer'; +$string[ 'gradehighest'] = 'Hoogste cijfer'; + +//mod_form.php +$string[ 'bottomtext'] = 'Tekst aan onderkant'; +$string[ 'cross_layout'] = 'Layout'; +$string[ 'cross_layout0'] = 'Zinnen aan de onderkant van het kruiswoord'; +$string[ 'cross_layout1'] = 'Zinnen aan de rechterkant van het kruiswoord'; +$string[ 'cross_maxcols'] = 'Maximum aantal kolommen in kruiswoord'; +$string[ 'cross_maxwords'] = 'Maximum aantal woorden in het kruiswoord'; +$string[ 'cross_options'] = 'Kruiswoordraadsel opties'; +$string[ 'cryptex_maxcols'] = 'Maximum aantal kolommen/rijen in de cryptex'; +$string[ 'cryptex_maxtries'] = 'Max pogingen'; +$string[ 'cryptex_maxwords'] = 'Maximum aantal woorden in de cryptex'; +$string[ 'cryptex_options'] = 'Woordzoeker opties'; +$string[ 'grademethod'] = 'Becijferingsmethode'; +$string[ 'hangman_allowspaces'] = 'Sta spaties in woorden toe'; +$string[ 'hangman_allowsub'] = 'Sta het -symbool toe in woorden'; +$string[ 'hangman_imageset'] = 'Kies de plaatjes voor galgje'; +$string[ 'hangman_language'] = 'Taal van de woorden'; +$string[ 'hangman_maxtries'] = 'Aantal woorden per spel'; +$string[ 'hangman_options'] = 'Galgje opties'; +$string[ 'hangman_showcorrectanswer'] = 'Laat de juiste antwoorden aan het einde zien'; +$string[ 'hangman_showfirst'] = 'Laat de eerste letter bij galgje zien'; +$string[ 'hangman_showlast'] = 'Laat de laatste letter bij galgje zien'; +$string[ 'hangman_showquestion'] = 'Laat de vragen zien?'; +$string[ 'hiddenpicture_across'] = 'Cellen horizontaal'; +$string[ 'hiddenpicture_down'] = 'Cellen naar beneden'; +$string[ 'hiddenpicture_height'] = 'Stel de hoogte in op'; +$string[ 'hiddenpicture_options'] = '\'Verborgen afbeelding\' opties'; +$string[ 'hiddenpicture_pictureglossary'] = 'De woordenlijst voor de hoofdvraag'; +$string[ 'hiddenpicture_width'] = 'Stel de breedte van de afbeelding in op'; +$string[ 'millionaire_background'] = 'Achtergrondkleur'; +$string[ 'millionaire_options'] = 'Miljonair\' opties'; +$string[ 'millionaire_shuffle'] = 'Haal de vragen door elkaar'; +$string[ 'snakes_background'] = 'Achtergrond'; +$string[ 'snakes_cols'] = 'Kolommen'; +$string[ 'snakes_data'] = 'Spelbord'; +$string[ 'snakes_file'] = 'Achtergrond'; +$string[ 'snakes_footerx'] = 'Ruimte linksonder'; +$string[ 'snakes_footery'] = 'Ruimte rechtsonder'; +$string[ 'snakes_headerx'] = 'Ruimte linksboven'; +$string[ 'snakes_headery'] = 'Ruimte rechtsboven'; +$string[ 'snakes_options'] = '\'Slangen en ladders\' opties'; +$string[ 'snakes_rows'] = 'Rijen'; +$string[ 'sourcemodule'] = 'Vragenbron'; +$string[ 'sourcemodule_book'] = 'Kies een boek'; +$string[ 'sourcemodule_glossary'] = 'Kies een woordenlijst'; +$string[ 'sourcemodule_glossarycategory'] = 'Selecteer een categorie van de woordenlijst'; +$string[ 'sourcemodule_include_subcategories'] = 'Subcategorieën meerekenen'; +$string[ 'sourcemodule_question'] = 'Vragen'; +$string[ 'sourcemodule_questioncategory'] = 'Selecteer vragencategorie'; +$string[ 'sourcemodule_quiz'] = 'Selecteer quiz/test'; +$string[ 'sudoku_maxquestions'] = 'Maximum aantal vragen'; +$string[ 'sudoku_options'] = 'Sudoku opties'; +$string[ 'toptext'] = 'Teskt bovenaan de pagina'; +$string[ 'userdefined'] = 'Bepaald door de gebruiker'; + +//preview.php +$string[ 'only_teachers'] = 'Alleen de leraar kan deze pagina zien'; +$string[ 'preview'] = 'Voorbeeld'; + +//review.php +$string[ 'attempts'] = 'Pogingen'; +$string[ 'completedon'] = 'Voltooid op'; +$string[ 'outof'] = '{$a->grade} uit een maximum van {$a->maxgrade}'; +$string[ 'review'] = 'Bekijk'; +$string[ 'reviewofattempt'] = 'Overzicht van Poging {$a}'; +$string[ 'showall'] = 'Toon alles'; +$string[ 'startagain'] = 'Start opnieuw'; +$string[ 'timetaken'] = 'Gebruikte tijd'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Ruim statistieken op'; +$string[ 'computerepetitions'] = 'Bereken statistieken opnieuw'; +$string[ 'feedbacks'] = 'Berichten bij juist antwoord'; +$string[ 'repetitions'] = 'Herhalingen'; + +//showattempts.php +$string[ 'lastip'] = 'IP leerling'; +$string[ 'showsolution'] = 'oplossing'; +$string[ 'timefinish'] = 'Einde van het spel'; +$string[ 'timelastattempt'] = 'Laatste poging'; +$string[ 'timestart'] = 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Probeer het spel nu'; +$string[ 'continueattemptgame'] = 'Ga verder met een vorige poging'; +$string[ 'reattemptgame'] = 'Probeer het spel opnieuw'; +$string[ 'yourfinalgradeis'] = 'Je uiteindelijke cijfer voor dit spel is {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/no/game.php b/lang/no/game.php new file mode 100644 index 0000000..69bbb8a --- /dev/null +++ b/lang/no/game.php @@ -0,0 +1,305 @@ +Velkommen!

      Klikk et ord for å begyne.

      '; +$string[ 'letter'] = 'bokstav'; +$string[ 'letters'] = 'bokstaver'; +$string[ 'nextgame'] = 'Nytt spill'; +$string[ 'no_words'] = 'Ingen ord funnet'; +$string[ 'win'] = 'Gratulerer!!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Spill slutt'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Korrekt setning var:'; +$string[ 'hangman_correct_word'] = 'Korrekt ord var:'; +$string[ 'hangman_gradeinstance'] = 'Karakter i hele spillet'; +$string[ 'hangman_letters'] = 'Bokstaver:'; +$string[ 'hangman_restletters_many'] = 'Du har {$a} forsøk'; +$string[ 'hangman_restletters_one'] = 'Du har BARE 1 forsøk'; +$string[ 'hangman_wrongnum'] = 'Feil: %%d av %%d'; +$string[ 'nextword'] = 'Neste ord'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Karakter hovedsvar'; +$string[ 'hiddenpicture_nocols'] = 'Du må angi antall kolonner horisontalt'; +$string[ 'hiddenpicture_nomainquestion'] = 'Det er ingen ordbokinnlegg i ordboken {$a->name} med vedlagt bilde'; +$string[ 'hiddenpicture_norows'] = 'Må angi antall kolonner vertikalt'; +$string[ 'must_select_glossary'] = 'Du må velge en ordbok'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Du må velge en spørsmålskategori'; +$string[ 'millionaire_must_select_quiz'] = 'Du må velge en prøve'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Alle forsøk'; +$string[ 'allstudents'] = 'Alle studenter'; +$string[ 'attemptsonly'] = 'Bare vis studenter som har forsøkt'; +$string[ 'deleteattemptcheck'] = 'Er du sikkker på at du vil slette disse forsøkene helt?'; +$string[ 'displayoptions'] = 'Vis valg'; +$string[ 'downloadods'] = 'Last ned i ODS format'; +$string[ 'feedback'] = 'Tilbakemelding'; +$string[ 'noattemptsonly'] = 'Vis $a uten noen forsøk'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring har gjort $a->attemptnum forsøk'; +$string[ 'pagesize'] = 'Spørsmål per side'; +$string[ 'reportoverview'] = 'Oversikt'; +$string[ 'selectall'] = 'Velg alle'; +$string[ 'selectnone'] = 'Ikke velg noen'; +$string[ 'showdetailedmarks'] = 'Vis markeringsdetaljer'; +$string[ 'startedon'] = 'Startet'; +$string[ 'timecompleted'] = 'Ferdig'; +$string[ 'unfinished'] = 'åpne'; +$string[ 'withselected'] = 'Med valgte'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Antall sudokus som vil lages'; +$string[ 'sudoku_create_start'] = 'Start med å lage sudokus'; +$string[ 'sudoku_creating'] = 'Lag {$a}sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Slutt på sudokuspill'; +$string[ 'sudoku_guessnumber'] = 'Gjett riktig tall'; +$string[ 'sudoku_noentriesfound'] = 'Ingen ord funnet i ordboken'; + +//export.php + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Spillet slutt'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Folk sier'; +$string[ 'millionaire_info_telephone'] = 'Jeg tror korrekt svar er'; +$string[ 'millionaire_info_wrong_answer'] = 'Svaret ditt er feil
      Riktig svar er:'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'I \"Vil du bli millionær\" må kilden være {$a} eller spørsmål og ikke'; +$string[ 'must_select_questioncategory'] = 'Du må velge en spørsmålskategori'; +$string[ 'must_select_quiz'] = 'Du må velge en prøve'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Score'; + +//index.php +$string[ 'modulename'] = 'Spill'; +$string[ 'modulenameplural'] = 'Spill'; +$string[ 'pluginname'] = 'Spill'; + +//lib.php +$string[ 'attempt'] = 'Forsøk'; +$string[ 'bookquiz_questions'] = 'Koble spørsmålskategorier til kapitler i bok'; +$string[ 'game_bookquiz'] = 'Bok med spørsmål'; +$string[ 'game_cross'] = 'Kryssord'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Hangman'; +$string[ 'game_hiddenpicture'] = 'Skjult bilde'; +$string[ 'game_millionaire'] = 'Millionær'; +$string[ 'game_snakes'] = 'Slange og stiger'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Ingen forsøk er gjort på denne prøven'; +$string[ 'results'] = 'Resulat'; +$string[ 'showanswers'] = 'Vis svar'; + +//locallib.php +$string[ 'attemptfirst'] = 'Første forsøk'; +$string[ 'attemptlast'] = 'Siste forsøk'; +$string[ 'gradeaverage'] = 'Gjennomsnittelig karakter'; +$string[ 'gradehighest'] = 'Høyeste karakter'; + +//mod_form.php +$string[ 'bottomtext'] = 'Bunntekst'; +$string[ 'cross_layout'] = 'Layout'; +$string[ 'cross_layout0'] = 'Fraser på bunnen på tvers'; +$string[ 'cross_layout1'] = 'Fraser til høyre på tvers'; +$string[ 'cross_maxcols'] = 'Maksimum antall kolonner i kryssordet'; +$string[ 'cross_maxwords'] = 'Maksimum antall ord i kryssordet'; +$string[ 'cryptex_maxcols'] = 'Max antall kol/rader i cryptex'; +$string[ 'cryptex_maxwords'] = 'Max antall ord i cryptex'; +$string[ 'grademethod'] = 'Karaktermetode'; +$string[ 'hangman_allowspaces'] = 'Tillatt mellomrom i ord'; +$string[ 'hangman_allowsub'] = 'Tillat symbolet i ord'; +$string[ 'hangman_imageset'] = 'Velg bilder for hangman'; +$string[ 'hangman_language'] = 'Språk for ordene'; +$string[ 'hangman_maxtries'] = 'Antall ord per spill'; +$string[ 'hangman_showcorrectanswer'] = 'Vis korrekt svar når du er ferdig'; +$string[ 'hangman_showfirst'] = 'Vis første bokstaven i hangman'; +$string[ 'hangman_showlast'] = 'Vis siste bokstaven i hangman'; +$string[ 'hangman_showquestion'] = 'Vis spørsmålet?'; +$string[ 'hiddenpicture_across'] = 'Ruter horisontalt'; +$string[ 'hiddenpicture_down'] = 'Ruter nedover'; +$string[ 'hiddenpicture_pictureglossary'] = 'Ordbok for hovedspørsmål'; +$string[ 'snakes_background'] = 'Bakgrunn'; +$string[ 'sourcemodule'] = 'Spørsmålskilde'; +$string[ 'sourcemodule_book'] = 'Velg en bok'; +$string[ 'sourcemodule_glossary'] = 'Velg ordbok'; +$string[ 'sourcemodule_glossarycategory'] = 'Velg ordbokskategori'; +$string[ 'sourcemodule_question'] = 'Spørsmål'; +$string[ 'sourcemodule_questioncategory'] = 'Velg spørsmålskategori'; +$string[ 'sourcemodule_quiz'] = 'Velg prøve'; +$string[ 'sudoku_maxquestions'] = 'Maks antall spørsmål'; + +//preview.php +$string[ 'only_teachers'] = 'Bare lærer kan se denne siden'; +$string[ 'preview'] = 'Forhåndsvisning'; + +//review.php +$string[ 'attempts'] = 'Forsøk'; +$string[ 'completedon'] = 'Ferdig på'; +$string[ 'outof'] = '{$a->grade} av makismalt {$a->maxgrade}'; +$string[ 'review'] = 'Rapport'; +$string[ 'reviewofattempt'] = 'Rapport fra forsøk {$a}'; +$string[ 'startagain'] = 'Start på nytt'; +$string[ 'timetaken'] = 'Tid brukt'; + +//showanswers.php +$string[ 'feedbacks'] = 'Tilbakemelding ved riktig svar'; + +//showattempts.php +$string[ 'lastip'] = 'IP student'; +$string[ 'showsolution'] = 'løsning'; +$string[ 'timefinish'] = 'Spill slutt'; +$string[ 'timelastattempt'] = 'Siste forsøk'; +$string[ 'timestart'] = 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Prøv å spille nå'; +$string[ 'continueattemptgame'] = 'Fortsette et tidligere forsøk av spillet'; +$string[ 'reattemptgame'] = 'Prøv spillet igjen'; +$string[ 'yourfinalgradeis'] = 'Din endelige karakter for spillet er {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/play.php $string[ 'print'] = 'Print'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//export.php $string[ 'export'] = 'Export'; +//export.php $string[ 'html_hascheckbutton'] = 'Has check button:'; +//export.php $string[ 'html_hasprintbutton'] = 'Has print button:'; +//export.php $string[ 'html_title'] = 'Title of html:'; +//export.php $string[ 'javame_createdby'] = 'Created by:'; +//export.php $string[ 'javame_description'] = 'Description:'; +//export.php $string[ 'javame_filename'] = 'Filename:'; +//export.php $string[ 'javame_icon'] = 'Icon:'; +//export.php $string[ 'javame_maxpictureheight'] = 'Max picture height:'; +//export.php $string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +//export.php $string[ 'javame_name'] = 'Name:'; +//export.php $string[ 'javame_type'] = 'Type:'; +//export.php $string[ 'javame_vendor'] = 'Vendor:'; +//export.php $string[ 'javame_version'] = 'Version:'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'export_to_html'] = 'Export to HTML'; +//lib.php $string[ 'export_to_javame'] = 'Export to Javame'; +//lib.php $string[ 'percent'] = 'Percent'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_maxtries'] = 'Max tries'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_height'] = 'Set height of picture to'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'hiddenpicture_width'] = 'Set width of picture to'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'millionaire_shuffle'] = 'Randomize questions'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/pl/game.php b/lang/pl/game.php new file mode 100644 index 0000000..eae8e8e --- /dev/null +++ b/lang/pl/game.php @@ -0,0 +1,304 @@ +Witaj!

      Kliknij na słowo aby rozpocząć.

      '; +$string[ 'letter'] = 'litera'; +$string[ 'letters'] = 'litery'; +$string[ 'nextgame'] = 'Nowa gra'; +$string[ 'no_words'] = 'Nie znaleziono wyrazów'; +$string[ 'win'] = 'Gratulacje !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Koniec gry'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Prawidłowa fraza to: '; +$string[ 'hangman_correct_word'] = 'Prawidłowe słowo to: '; +$string[ 'hangman_gradeinstance'] = 'Ocena za całą grę'; +$string[ 'hangman_letters'] = 'Litery: '; +$string[ 'hangman_restletters_many'] = 'Pozostało prób: {$a}'; +$string[ 'hangman_restletters_one'] = 'Pozostała TYLKO 1 próba'; +$string[ 'hangman_wrongnum'] = 'Źle: %%d z %%d'; +$string[ 'nextword'] = 'Następne słowo'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Oceń główną odpowiedź'; +$string[ 'hiddenpicture_nocols'] = 'Musisz określić maksymalną liczbę kolumn'; +$string[ 'hiddenpicture_nomainquestion'] = 'Brak wpisów z załączonym zdjęciem w słowniku {$a->name}'; +$string[ 'hiddenpicture_norows'] = 'Musisz określić maksymalną liczbę wierszy'; +$string[ 'must_select_glossary'] = 'Musisz wybrać słownik'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Musisz wybrać kategorię pytań'; +$string[ 'millionaire_must_select_quiz'] = 'Musisz wybrać jeden quiz'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Pokaż wszystkie próby'; +$string[ 'allstudents'] = 'Pokaż wszystkie $a'; +$string[ 'attemptsonly'] = 'Pokaż tylko studentów którzy dokonali prób'; +$string[ 'deleteattemptcheck'] = 'Czy na pewno chcesz usunąć te próby?'; +$string[ 'displayoptions'] = 'Wyświetl opcje'; +$string[ 'downloadods'] = 'Pobierz w formacie ODS'; +$string[ 'feedback'] = 'Informacja zwrotna'; +$string[ 'noattemptsonly'] = 'Pokaż $a bez prób'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring podjęło $a->attemptnum prób'; +$string[ 'pagesize'] = 'Pytań na stronę:'; +$string[ 'reportoverview'] = 'Przegląd'; +$string[ 'selectall'] = 'Wybierz wszystkie'; +$string[ 'selectnone'] = 'Odznacz wszytko'; +$string[ 'showdetailedmarks'] = 'Pokaż szczegóły oceny'; +$string[ 'startedon'] = 'Rozpoczęto'; +$string[ 'timecompleted'] = 'Ukończono'; +$string[ 'unfinished'] = 'otwarte'; +$string[ 'withselected'] = 'Z zaznaczonymi'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Liczba sudoku które zostaną stworzone'; +$string[ 'sudoku_create_start'] = 'Rozpocznij tworzenie sudoku'; +$string[ 'sudoku_creating'] = 'Tworzenie {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Sudoku zakończone'; +$string[ 'sudoku_guessnumber'] = 'Odgadnij prawidłową liczbę'; +$string[ 'sudoku_noentriesfound'] = 'Nie znaleziono słów w słowniku'; + +//export.php +$string[ 'export'] = 'Eksportuj'; +$string[ 'javame_createdby'] = 'Stworzony przez:'; +$string[ 'javame_description'] = 'Opis:'; +$string[ 'javame_filename'] = 'Nazwa pliku:'; +$string[ 'javame_icon'] = 'Ikona:'; +$string[ 'javame_name'] = 'Nazwa:'; +$string[ 'javame_vendor'] = 'Dostawca:'; +$string[ 'javame_version'] = 'Wersja:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Koniec gry'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Odpowiedź publiczności'; +$string[ 'millionaire_info_telephone'] = 'Wydaje mi się że prawidłowa odpowiedź to '; +$string[ 'millionaire_info_wrong_answer'] = 'Zła odpowiedź.
      Prawidłowo:'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'W milionerach źródłem mogą być {$a} lub pytania a nie'; +$string[ 'must_select_questioncategory'] = 'Musisz wybrać kategorię pytań'; +$string[ 'must_select_quiz'] = 'Musisz wybrać quiz'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Wynik'; + +//index.php +$string[ 'modulename'] = 'Gra'; +$string[ 'modulenameplural'] = 'Gry'; +$string[ 'pluginname'] = 'Gra'; + +//lib.php +$string[ 'attempt'] = 'Próba'; +$string[ 'bookquiz_questions'] = 'Przypisz kategorie pytań do rozdziałów książki'; +$string[ 'game_bookquiz'] = 'Książka z pytaniami'; +$string[ 'game_cross'] = 'Krzyżówka'; +$string[ 'game_cryptex'] = 'Cryptex'; +$string[ 'game_hangman'] = 'Wisielec'; +$string[ 'game_hiddenpicture'] = 'Ukryty obraz'; +$string[ 'game_millionaire'] = 'Milionerzy'; +$string[ 'game_snakes'] = 'Węże i Drabiny'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Informacje'; +$string[ 'noattempts'] = 'Nie dokonano prób'; +$string[ 'results'] = 'Wyniki'; +$string[ 'showanswers'] = 'Pokaż odpowiedzi'; + +//locallib.php +$string[ 'attemptfirst'] = 'Pierwsza próba'; +$string[ 'attemptlast'] = 'Ostatnia próba'; +$string[ 'gradeaverage'] = 'Średnia ocena'; +$string[ 'gradehighest'] = 'Najwyższa ocena'; + +//mod_form.php +$string[ 'bottomtext'] = 'Tekst na dole'; +$string[ 'cross_layout'] = 'Układ'; +$string[ 'cross_layout0'] = 'Wyrażenia pod krzyżówką'; +$string[ 'cross_layout1'] = 'Wyrażenia na prawo od krzyżówki'; +$string[ 'cross_maxcols'] = 'Maksymalna ilość kolumn krzyżówki'; +$string[ 'cross_maxwords'] = 'Maksymalna ilość słów'; +$string[ 'cryptex_maxcols'] = 'Maksymalna liczba kolumn/wierszy'; +$string[ 'cryptex_maxwords'] = 'Maksymalna liczba wyrazów'; +$string[ 'grademethod'] = 'Metoda oceniania'; +$string[ 'hangman_allowspaces'] = 'Zezwól na spacje w wyrazach'; +$string[ 'hangman_allowsub'] = 'Zezwól na symbol - w wyrazach'; +$string[ 'hangman_imageset'] = 'Wybierz obrazek wisielca'; +$string[ 'hangman_language'] = 'Język słów'; +$string[ 'hangman_maxtries'] = 'Ilość słów na grę'; +$string[ 'hangman_showcorrectanswer'] = 'Pokazuj na koniec prawidłową odpowiedź'; +$string[ 'hangman_showfirst'] = 'Pokazuj pierwszą literę'; +$string[ 'hangman_showlast'] = 'Pokazuj ostatnią literę'; +$string[ 'hangman_showquestion'] = 'Pokazywać pytania ?'; +$string[ 'hiddenpicture_across'] = 'Komórki poziomo'; +$string[ 'hiddenpicture_down'] = 'Komórki pionowo'; +$string[ 'hiddenpicture_height'] = 'Ustaw wysokość obrazka na'; +$string[ 'hiddenpicture_pictureglossary'] = 'Słownik dla głównego pytania i obrazu'; +$string[ 'hiddenpicture_width'] = 'Ustaw szerokość obrazka na'; +$string[ 'snakes_background'] = 'Tło'; +$string[ 'sourcemodule'] = 'Źródło pytań'; +$string[ 'sourcemodule_book'] = 'Wybierz książkę'; +$string[ 'sourcemodule_glossary'] = 'Wybierz słownik'; +$string[ 'sourcemodule_glossarycategory'] = 'Wybierz kategorię słownika'; +$string[ 'sourcemodule_include_subcategories'] = 'Dołącz podkategorie'; +$string[ 'sourcemodule_question'] = 'Pytania'; +$string[ 'sourcemodule_questioncategory'] = 'Wybierz kategorię pytań'; +$string[ 'sourcemodule_quiz'] = 'Wybierz quiz'; +$string[ 'sudoku_maxquestions'] = 'Maksymalna liczba pytań'; + +//preview.php +$string[ 'only_teachers'] = 'Tylko nauczyciel może oglądać tą stronę'; +$string[ 'preview'] = 'Podgląd'; + +//review.php +$string[ 'attempts'] = 'Próby'; +$string[ 'completedon'] = 'Ukończono'; +$string[ 'outof'] = '{$a->grade} z {$a->maxgrade}'; +$string[ 'review'] = 'Opis'; +$string[ 'reviewofattempt'] = 'Opis próby {$a}'; +$string[ 'startagain'] = 'Rozpocznij ponownie'; +$string[ 'timetaken'] = 'Zużyty czas'; + +//showanswers.php +$string[ 'feedbacks'] = 'Wiadomości po prawidłowej odpowiedzi'; + +//showattempts.php +$string[ 'lastip'] = 'IP studenta'; +$string[ 'showsolution'] = 'rozwiązanie'; +$string[ 'timefinish'] = 'Koniec gry'; +$string[ 'timelastattempt'] = 'Ostatnia próba'; +$string[ 'timestart'] = 'Start'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Rozpocznij grę'; +$string[ 'continueattemptgame'] = 'Kontynuuj poprzednią próbę'; +$string[ 'reattemptgame'] = 'Wznów grę'; +$string[ 'yourfinalgradeis'] = 'Ostateczną oceną za tą grę jest $a.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/cross_class.php $string[ 'lettersall'] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; +//cross/play.php $string[ 'print'] = 'Print'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//export.php $string[ 'html_hascheckbutton'] = 'Has check button:'; +//export.php $string[ 'html_hasprintbutton'] = 'Has print button:'; +//export.php $string[ 'html_title'] = 'Title of html:'; +//export.php $string[ 'javame_maxpictureheight'] = 'Max picture height:'; +//export.php $string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +//export.php $string[ 'javame_type'] = 'Type:'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'export_to_html'] = 'Export to HTML'; +//lib.php $string[ 'export_to_javame'] = 'Export to Javame'; +//lib.php $string[ 'percent'] = 'Percent'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_maxtries'] = 'Max tries'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'millionaire_shuffle'] = 'Randomize questions'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/pt_br/game.php b/lang/pt_br/game.php new file mode 100644 index 0000000..0a5086b --- /dev/null +++ b/lang/pt_br/game.php @@ -0,0 +1,305 @@ +Bem vindo!

      Clique em uma palavra para começar.

      '; +$string[ 'letter'] = 'letra'; +$string[ 'letters'] = 'letras'; +$string[ 'nextgame'] = 'Próximo jogo'; +$string[ 'print'] = 'Imprimir'; + +//cryptex/play.php +$string[ 'finish'] = 'Fim de jogo'; + +//db/access.php +$string[ 'game:attempt'] = 'Começar o jogo'; +$string[ 'game:deleteattempts'] = 'Apagar tentativas'; +$string[ 'game:manage'] = 'Administrar'; +$string[ 'game:reviewmyattempts'] = 'Rever minhas tentativas'; +$string[ 'game:view'] = 'Ver'; +$string[ 'game:viewreports'] = 'Ver relatórios'; + +//hangman/play.php +$string[ 'hangman_gradeinstance'] = 'Nível do jogo completo'; +$string[ 'hangman_letters'] = 'Letras: '; +$string[ 'hangman_restletters_many'] = 'Você tem {$a} tentativas'; +$string[ 'hangman_restletters_one'] = 'Você tem SOMENTE 1 tentativa'; +$string[ 'hangman_wrongnum'] = 'Erradas: %%d de %%d'; +$string[ 'nextword'] = 'Próxima palavra'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Nota da pergunta principal'; +$string[ 'hiddenpicture_nocols'] = 'Especifique o número de linhas horizontais'; +$string[ 'hiddenpicture_nomainquestion'] = 'Sem entradas no glossário {$a->name} com imagem anexa'; +$string[ 'hiddenpicture_norows'] = 'Especifique o número de colunas verticais'; +$string[ 'must_select_glossary'] = 'Um glossário deve ser selecionado'; +$string[ 'noglossaryentriesfound'] = 'Não foram encontradas entradas no glossário'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Uma categoria de perguntas deve ser selecionada'; +$string[ 'millionaire_must_select_quiz'] = 'Um questionário deve ser selecionado'; + +//report/overview/report.php +$string[ 'feedback'] = 'Retorno'; +$string[ 'startedon'] = 'Començou em'; +$string[ 'timecompleted'] = 'Completo'; +$string[ 'unfinished'] = 'aberto'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Número de sudokus que serão criados'; +$string[ 'sudoku_create_start'] = 'Comece a criar sudokus'; +$string[ 'sudoku_creating'] = 'Criando {$a} sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fim do jogo de sudoku'; +$string[ 'sudoku_guessnumber'] = 'Adivinhe o número correto'; +$string[ 'sudoku_noentriesfound'] = 'Não foram contradas palavras no glossário'; + +//export.php +$string[ 'export'] = 'Exportar'; +$string[ 'html_hascheckbutton'] = 'Botão de teste:'; +$string[ 'html_hasprintbutton'] = 'Botão de impressão:'; +$string[ 'html_title'] = 'Título de html:'; +$string[ 'javame_createdby'] = 'Criado por:'; +$string[ 'javame_description'] = 'Descrição:'; +$string[ 'javame_filename'] = 'Nome do arquivo:'; +$string[ 'javame_icon'] = 'Ícone:'; +$string[ 'javame_maxpictureheight'] = 'Altura máxima da imagem:'; +$string[ 'javame_maxpicturewidth'] = 'Largura máxima da imagem:'; +$string[ 'javame_name'] = 'Nome:'; +$string[ 'javame_type'] = 'Tipo:'; +$string[ 'javame_vendor'] = 'Vendedor:'; +$string[ 'javame_version'] = 'Versão'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Fim de jogo'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = 'Ajuda do público'; +$string[ 'millionaire_info_people'] = 'O púlico diz'; +$string[ 'millionaire_info_telephone'] = 'Creio que a resposta correta seja'; +$string[ 'millionaire_info_wrong_answer'] = 'Sua resposta está errada
      A resposta correta é:'; +$string[ 'millionaire_quit'] = 'Sair'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Para milhonário a fonte deve ser {$a} ou perguntas e não'; +$string[ 'millionaire_telephone'] = 'Ajuda pelo telefone'; +$string[ 'must_select_questioncategory'] = 'Uma categoria de perguntas deve ser selecionada'; +$string[ 'must_select_quiz'] = 'Um questionário deve ser selecionado'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Pontuação'; + +//index.php +$string[ 'modulename'] = 'Jogo'; +$string[ 'modulenameplural'] = 'Jogos'; +$string[ 'pluginname'] = 'Jogo'; + +//lib.php +$string[ 'attempt'] = 'Tentativa'; +$string[ 'bookquiz_questions'] = 'Relacione categorias de perguntas com capítulos do livro'; +$string[ 'export_to_html'] = 'Exportar como HTML'; +$string[ 'export_to_javame'] = 'Exportar como Javame'; +$string[ 'game_bookquiz'] = 'Livro de perguntas'; +$string[ 'game_cross'] = 'Palavras-cruzadas'; +$string[ 'game_cryptex'] = 'Sopa de Letras'; +$string[ 'game_hangman'] = 'Forca'; +$string[ 'game_hiddenpicture'] = 'Imagem oculta'; +$string[ 'game_millionaire'] = 'Milhonário'; +$string[ 'game_snakes'] = 'Serpentes'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Info'; +$string[ 'noattempts'] = 'Nenhuma tentativa foi feita com este questionário'; +$string[ 'percent'] = 'Porcentagem'; +$string[ 'results'] = 'Resultados'; +$string[ 'showanswers'] = 'Mostrar respostas'; +$string[ 'showattempts'] = 'Mostrar as tentativas'; + +//locallib.php +$string[ 'attemptfirst'] = 'Primeira tentativa'; +$string[ 'attemptlast'] = 'Última tentativa'; +$string[ 'gradeaverage'] = 'Nota média'; +$string[ 'gradehighest'] = 'Maior nota'; + +//mod_form.php +$string[ 'bottomtext'] = 'Texto no rodapé da página'; +$string[ 'cross_layout'] = 'Formato'; +$string[ 'cross_layout0'] = 'Frases na parte inferior do palavras-cruzadas'; +$string[ 'cross_layout1'] = 'Frases na parte direita do palavras-cruzadas'; +$string[ 'cross_maxcols'] = 'Número máximo de colunas do palavras-cruzadas'; +$string[ 'cross_maxwords'] = 'Máximo número de palavras do palavras-cruzadas'; +$string[ 'cross_options'] = 'Opções do Palavras-cruzadas'; +$string[ 'cryptex_maxcols'] = 'Máximo número de colunas/linhas do Criptograma'; +$string[ 'cryptex_maxtries'] = 'Número máximo de tantativas'; +$string[ 'cryptex_maxwords'] = 'Máximo número de palavras do Criptograma'; +$string[ 'cryptex_options'] = 'Opções do Criptograma'; +$string[ 'grademethod'] = 'Método de avaliação'; +$string[ 'hangman_allowspaces'] = 'Permitir espaços nas palavras'; +$string[ 'hangman_allowsub'] = 'Permitir símbolos nas palavras'; +$string[ 'hangman_imageset'] = 'Selecione as imágens para a Forca'; +$string[ 'hangman_language'] = 'Idioma das palavras'; +$string[ 'hangman_maxtries'] = 'Número de palavras por jogo'; +$string[ 'hangman_options'] = 'Opções da Forca'; +$string[ 'hangman_showcorrectanswer'] = 'Mostrar a resposta correta ao final'; +$string[ 'hangman_showfirst'] = 'Mostrar a primeira letra da Forca'; +$string[ 'hangman_showlast'] = 'Mostrar a última letra da Forca'; +$string[ 'hangman_showquestion'] = 'Mostrar as perguntas ?'; +$string[ 'hiddenpicture_across'] = 'Células horizontais'; +$string[ 'hiddenpicture_down'] = 'Células verticais'; +$string[ 'hiddenpicture_height'] = 'Definir a altura da imagem em'; +$string[ 'hiddenpicture_options'] = '\'Imagem Oculta\' opções'; +$string[ 'hiddenpicture_pictureglossary'] = 'O glossário para a pergunta principal'; +$string[ 'hiddenpicture_width'] = 'Definir a largura da imagem em'; +$string[ 'millionaire_background'] = 'Cor de fundo'; +$string[ 'millionaire_options'] = 'Opções o Milhonário'; +$string[ 'millionaire_shuffle'] = 'Mesclar perguntas'; +$string[ 'snakes_background'] = 'Fundo'; +$string[ 'snakes_cols'] = 'Colunas'; +$string[ 'snakes_footerx'] = 'Espaço inferior esquerdo'; +$string[ 'snakes_footery'] = 'Espaço inferior direito'; +$string[ 'snakes_headerx'] = 'Espaço superior esquerdo'; +$string[ 'snakes_headery'] = 'Espaço superior direito'; +$string[ 'snakes_options'] = '\'Serpentes\' opções'; +$string[ 'snakes_rows'] = 'Linhas'; +$string[ 'sourcemodule'] = 'Fonte de perguntas'; +$string[ 'sourcemodule_book'] = 'Selecione un livro'; +$string[ 'sourcemodule_glossary'] = 'Selecione um glossário'; +$string[ 'sourcemodule_glossarycategory'] = 'Selecione una categoria de glossário.'; +$string[ 'sourcemodule_include_subcategories'] = 'Inclua subcategorias'; +$string[ 'sourcemodule_question'] = 'Perguntas'; +$string[ 'sourcemodule_questioncategory'] = 'Selecione uma categoria de perguntas'; +$string[ 'sourcemodule_quiz'] = 'Selecione un questionário'; +$string[ 'sudoku_maxquestions'] = 'Máximo número de perguntas'; +$string[ 'sudoku_options'] = 'Opcções do Sudoku'; +$string[ 'toptext'] = 'Texto da parte superior'; +$string[ 'userdefined'] = 'Definido pelo usuário'; + +//preview.php +$string[ 'only_teachers'] = 'Somente o professor pode ver esta página'; +$string[ 'preview'] = 'Visualizar'; + +//review.php +$string[ 'attempts'] = 'Tentativas'; +$string[ 'completedon'] = 'Completado em'; +$string[ 'outof'] = '{$a->grade} de um máximo de {$a->maxgrade}'; +$string[ 'review'] = 'Revisar'; +$string[ 'reviewofattempt'] = 'Revisar tentativas {$a}'; +$string[ 'startagain'] = 'Começar de novo'; +$string[ 'timetaken'] = 'Timpo utilizado'; + +//showanswers.php +$string[ 'clearrepetitions'] = 'Limpar estatísticas'; +$string[ 'computerepetitions'] = 'Recalcular estatísticas'; +$string[ 'feedbacks'] = 'Mensagens de resposta correta'; +$string[ 'repetitions'] = 'Repetições'; + +//showattempts.php +$string[ 'lastip'] = 'IP do estudante'; +$string[ 'showsolution'] = 'solução'; +$string[ 'timefinish'] = 'Fim de jogo'; +$string[ 'timelastattempt'] = 'Última tentativa'; +$string[ 'timestart'] = 'Começo'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Tente jogar agora'; +$string[ 'continueattemptgame'] = 'Continue uma tentativa anterior do jogo'; +$string[ 'reattemptgame'] = 'Tentar novamente'; +$string[ 'yourfinalgradeis'] = 'Sua nota final neste jogo é {$a}.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/play.php $string[ 'no_words'] = 'There are no words'; +//cross/play.php $string[ 'win'] = 'Congratulations !!!'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//hangman/play.php $string[ 'hangman_correct_phrase'] = 'The correct phrase was: '; +//hangman/play.php $string[ 'hangman_correct_word'] = 'The correct word was: '; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'allattempts'] = 'Show all tries'; +//report/overview/report.php $string[ 'allstudents'] = 'Show all $a'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//report/overview/report.php $string[ 'attemptsonly'] = 'Show only students with attempts'; +//report/overview/report.php $string[ 'deleteattemptcheck'] = 'Are you absolutely sure you want to completely delete these attempts?'; +//report/overview/report.php $string[ 'displayoptions'] = 'Display options'; +//report/overview/report.php $string[ 'downloadods'] = 'Download in ODS format'; +//report/overview/report.php $string[ 'noattemptsonly'] = 'Show $a with no attempts only'; +//report/overview/report.php $string[ 'numattempts'] = '$a->studentnum $a->studentstring have made $a->attemptnum attempts'; +//report/overview/report.php $string[ 'pagesize'] = 'Questions per page:'; +//report/overview/report.php $string[ 'reportoverview'] = 'Overview'; +//report/overview/report.php $string[ 'selectall'] = 'Select all'; +//report/overview/report.php $string[ 'selectnone'] = 'Deselect all'; +//report/overview/report.php $string[ 'showdetailedmarks'] = 'Show mark details'; +//report/overview/report.php $string[ 'withselected'] = 'With selected'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/ru/game.php b/lang/ru/game.php new file mode 100644 index 0000000..f88eb1e --- /dev/null +++ b/lang/ru/game.php @@ -0,0 +1,305 @@ +Добро пожаловать!

      Сначала щелкните по любой из клеток, содержащих слово, затем введите в появившемся окне ответ.

      '; +$string[ 'letter'] = 'буква'; +$string[ 'letters'] = 'буквы'; +$string[ 'nextgame'] = 'Новая игра'; +$string[ 'no_words'] = 'Не найдены слова'; +$string[ 'win'] = 'Поздравляем !!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Конец игры'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Правильная фраза: '; +$string[ 'hangman_correct_word'] = 'Правильное слово: '; +$string[ 'hangman_gradeinstance'] = 'Оценить всю игру'; +$string[ 'hangman_letters'] = 'Буквы: '; +$string[ 'hangman_restletters_many'] = 'У Вас {$a} попыток'; +$string[ 'hangman_restletters_one'] = 'У Вас только 1 попытка'; +$string[ 'hangman_wrongnum'] = 'Неправильно: %%d из %%d'; +$string[ 'nextword'] = 'Следующее слово'; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = 'Оценить главный ответ'; +$string[ 'hiddenpicture_nocols'] = 'Необходимо указать количество колонок по горизонтали'; +$string[ 'hiddenpicture_norows'] = 'Необходимо указать количество срок по вертикали'; +$string[ 'must_select_glossary'] = 'Вы должны выбрать глоссарий'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Вы должны выбрать одну из категорий вопросов'; +$string[ 'millionaire_must_select_quiz'] = 'Вы должны выбрать тест'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Все попытки'; +$string[ 'allstudents'] = 'Все студенты $a'; +$string[ 'attemptsonly'] = 'Показать только студентов с попытками'; +$string[ 'deleteattemptcheck'] = 'Вы уверены, что хотите полностью удалить эти попытки?'; +$string[ 'displayoptions'] = 'Отобразить дополнительно'; +$string[ 'downloadods'] = 'Загрузить в формате ODS'; +$string[ 'feedback'] = 'Комментарий'; +$string[ 'noattemptsonly'] = 'Показать $a только, у которых нет попыток'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring сделали $a->attemptnum попыток'; +$string[ 'pagesize'] = 'Вопросов на страницу:'; +$string[ 'reportoverview'] = 'Обзор'; +$string[ 'selectall'] = 'Выбрать все'; +$string[ 'selectnone'] = 'Снять выделение со всех'; +$string[ 'showdetailedmarks'] = 'Показать детали оценок'; +$string[ 'startedon'] = 'Начато'; +$string[ 'timecompleted'] = 'Выполнено'; +$string[ 'unfinished'] = 'открыто'; +$string[ 'withselected'] = 'С выделенным'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Количество созданных \"Судоку\"'; +$string[ 'sudoku_create_start'] = 'Начало создания \"Судоку\"'; +$string[ 'sudoku_creating'] = 'Создание {$a} \"Судоку\"'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Окончание игры \"Судоку\"'; +$string[ 'sudoku_guessnumber'] = 'Введите правильное число'; +$string[ 'sudoku_noentriesfound'] = 'В глоссарии нет слов'; + +//export.php + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Игра окончена'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Люди говорят'; +$string[ 'millionaire_info_telephone'] = 'Я думаю, что правильный ответ '; +$string[ 'millionaire_info_wrong_answer'] = 'Ваш ответ неверный
      Правильный ответ:'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Для игры Миллионер источником вопросов должен быть {$a}, а не'; +$string[ 'must_select_questioncategory'] = 'Вы должны выбрать категорию вопросов'; +$string[ 'must_select_quiz'] = 'Вы должны выбрать тест'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Очки'; + +//index.php +$string[ 'modulename'] = 'Игра'; +$string[ 'modulenameplural'] = 'Игры'; +$string[ 'pluginname'] = 'Игра'; + +//lib.php +$string[ 'attempt'] = 'Попытка'; +$string[ 'bookquiz_questions'] = 'Связать категории вопросов с главой книги'; +$string[ 'game_bookquiz'] = 'Книга с вопросами'; +$string[ 'game_cross'] = 'Кроссворд'; +$string[ 'game_cryptex'] = 'Криптекст'; +$string[ 'game_hangman'] = 'Виселица'; +$string[ 'game_hiddenpicture'] = 'Спрятанная картинка'; +$string[ 'game_millionaire'] = 'Миллионер'; +$string[ 'game_snakes'] = 'Змеи и лестницы'; +$string[ 'game_sudoku'] = 'Судоку'; +$string[ 'info'] = 'Информация'; +$string[ 'noattempts'] = 'В этом тесте не сделано попыток'; +$string[ 'results'] = 'Результаты'; +$string[ 'showanswers'] = 'Показать ответы'; + +//locallib.php +$string[ 'attemptfirst'] = 'Первая попытка'; +$string[ 'attemptlast'] = 'Последняя попытка'; +$string[ 'gradeaverage'] = 'Оценивание по среднему баллу'; +$string[ 'gradehighest'] = 'Оценивание по высшему баллу'; + +//mod_form.php +$string[ 'bottomtext'] = 'Текст внизу экрана игры'; +$string[ 'cross_layout'] = 'Слой'; +$string[ 'cross_layout0'] = 'Расшифровка внизу кроссворда'; +$string[ 'cross_layout1'] = 'Расшифровка справа от кроссворда'; +$string[ 'cross_maxcols'] = 'Максимальное число колонок в кроссворде'; +$string[ 'cross_maxwords'] = 'Максимальное число слов в кроссворде'; +$string[ 'cryptex_maxcols'] = 'Макимальное число колонок/рядов в Криптексте'; +$string[ 'cryptex_maxwords'] = 'Макимальное число слов в Криптексте'; +$string[ 'grademethod'] = 'Метод оценивания'; +$string[ 'hangman_allowspaces'] = 'Разрешить в словах пробелы'; +$string[ 'hangman_allowsub'] = 'Разрешить дефис в словах'; +$string[ 'hangman_imageset'] = 'Выберите изображение виселицы'; +$string[ 'hangman_language'] = 'Язык слов'; +$string[ 'hangman_maxtries'] = 'Число попыток в игре'; +$string[ 'hangman_showcorrectanswer'] = 'Показать правильные ответы после окончания игры'; +$string[ 'hangman_showfirst'] = 'Показать первую букву'; +$string[ 'hangman_showlast'] = 'Показать последнюю букву'; +$string[ 'hangman_showquestion'] = 'Показать вопросы?'; +$string[ 'hiddenpicture_across'] = 'Клетки по горизонтали'; +$string[ 'hiddenpicture_down'] = 'Клетки по вертикали'; +$string[ 'hiddenpicture_pictureglossary'] = 'Глоссарий для главного вопроса'; +$string[ 'snakes_background'] = 'Фон'; +$string[ 'sourcemodule'] = 'Источник вопросов'; +$string[ 'sourcemodule_book'] = 'Выберите книгу'; +$string[ 'sourcemodule_glossary'] = 'Выберите глоссарий'; +$string[ 'sourcemodule_glossarycategory'] = 'Выберите категорию глоссария'; +$string[ 'sourcemodule_question'] = 'Вопросы'; +$string[ 'sourcemodule_questioncategory'] = 'Выберите категорию вопросов'; +$string[ 'sourcemodule_quiz'] = 'Выберите тест'; +$string[ 'sudoku_maxquestions'] = 'Максимальное число вопросов'; + +//preview.php +$string[ 'only_teachers'] = 'Только учителя могут просматривать эту страницу'; +$string[ 'preview'] = 'Предварительный просмотр'; + +//review.php +$string[ 'attempts'] = 'Попытки'; +$string[ 'completedon'] = 'Выполнено'; +$string[ 'outof'] = '{$a->grade} out of a maximum of {$a->maxgrade}'; +$string[ 'review'] = 'Повторный просмотр'; +$string[ 'reviewofattempt'] = 'Повторный промотр попыток {$a}'; +$string[ 'startagain'] = 'Начать снова'; +$string[ 'timetaken'] = 'Время выполнения'; + +//showanswers.php +$string[ 'feedbacks'] = 'Текст сообщения о правильном ответе'; + +//showattempts.php +$string[ 'lastip'] = 'IP студента'; +$string[ 'showsolution'] = 'решение'; +$string[ 'timefinish'] = 'Конец игры'; +$string[ 'timelastattempt'] = 'Последняя попытка'; +$string[ 'timestart'] = 'Начало'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Начать новую попытку игры'; +$string[ 'continueattemptgame'] = 'Продолжить предыдущую попытку этой игры'; +$string[ 'reattemptgame'] = 'Сделать попытку в этой игре'; +$string[ 'yourfinalgradeis'] = 'Ваша последняя оценка за эту игру: $a.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/play.php $string[ 'print'] = 'Print'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'hiddenpicture_nomainquestion'] = 'There are no glossary entries on glossary {$a->name} with an attached picture'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//export.php $string[ 'export'] = 'Export'; +//export.php $string[ 'html_hascheckbutton'] = 'Has check button:'; +//export.php $string[ 'html_hasprintbutton'] = 'Has print button:'; +//export.php $string[ 'html_title'] = 'Title of html:'; +//export.php $string[ 'javame_createdby'] = 'Created by:'; +//export.php $string[ 'javame_description'] = 'Description:'; +//export.php $string[ 'javame_filename'] = 'Filename:'; +//export.php $string[ 'javame_icon'] = 'Icon:'; +//export.php $string[ 'javame_maxpictureheight'] = 'Max picture height:'; +//export.php $string[ 'javame_maxpicturewidth'] = 'Max picture width:'; +//export.php $string[ 'javame_name'] = 'Name:'; +//export.php $string[ 'javame_type'] = 'Type:'; +//export.php $string[ 'javame_vendor'] = 'Vendor:'; +//export.php $string[ 'javame_version'] = 'Version:'; +//exporthtml_hangman.php $string[ 'html_hangman_new'] = 'New'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'export_to_html'] = 'Export to HTML'; +//lib.php $string[ 'export_to_javame'] = 'Export to Javame'; +//lib.php $string[ 'percent'] = 'Percent'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_maxtries'] = 'Max tries'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_height'] = 'Set height of picture to'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'hiddenpicture_width'] = 'Set width of picture to'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'millionaire_shuffle'] = 'Randomize questions'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sourcemodule_include_subcategories'] = 'Include subcategories'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/sq/game.php b/lang/sq/game.php new file mode 100644 index 0000000..4f3b8ce --- /dev/null +++ b/lang/sq/game.php @@ -0,0 +1,304 @@ +Mirësevini!

      Kliko në një fjalë për të filluar.

      '; +$string[ 'letter'] = 'shkronja'; +$string[ 'letters'] = 'shkronja'; +$string[ 'nextgame'] = 'Lojë e re '; +$string[ 'no_words'] = 'Nuk u gjend asnjë fjalë '; +$string[ 'print'] = 'Printim'; +$string[ 'win'] = 'Urime!!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Fund loje'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Fjalia e saktë ishte: '; +$string[ 'hangman_correct_word'] = 'Fjala e saktë ishte: '; +$string[ 'hangman_gradeinstance'] = 'Shuma e pikeve ne gjithe lojen'; +$string[ 'hangman_letters'] = 'Shkronja : '; +$string[ 'hangman_restletters_many'] = 'Keni $a përpjekje akoma'; +$string[ 'hangman_restletters_one'] = 'Keni akoma VETEM 1 përpjekje'; +$string[ 'hangman_wrongnum'] = 'Gabime: %%d out of %%d'; +$string[ 'nextword'] = 'Fjalë tjetër '; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = "Ver pikë në pyetjen kryesore"; +$string[ 'hiddenpicture_nocols'] = 'Duhet te përcaktoni numrin e qelizave horizontalisht'; +$string[ 'hiddenpicture_nomainquestion'] = 'Nuk ka asnjë regjistrim në fjalor $a->name që të përmbajë dhë figurë'; +$string[ 'hiddenpicture_norows'] = 'Duhet te përcaktoni numrin e qelizave vertikalisht'; +$string[ 'must_select_glossary'] = 'Duhet te zgjidhni me patjetër një fjalor'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Duhet me patjetër te zgjidhni një kategori pyetjesh'; +$string[ 'millionaire_must_select_quiz'] = 'Duhet me patjetër te zgjidhni një kuiz'; + +//report/overview/report.php +$string[ 'feedback'] = 'Përgjigje'; +$string[ 'startedon'] = 'Filloni në'; +$string[ 'timecompleted'] = 'Kompletuar'; +$string[ 'unfinished'] = 'Pafund'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Numuri i sudoku që do krijohet'; +$string[ 'sudoku_create_start'] = 'Fillimi i krijimit sudoku'; +$string[ 'sudoku_creating'] = 'U krijua $a sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fund loje'; +$string[ 'sudoku_guessnumber'] = 'Supozo numurin '; +$string[ 'sudoku_noentriesfound'] = 'Nuk u gjendën fjalë në fjalor'; + +//export.php +$string[ 'export'] = 'Εksport'; +$string[ 'html_hascheckbutton'] = 'Të ketë buton kontrollimi përgjigjjeve të sakta:'; +$string[ 'html_hasprintbutton'] = 'Të ketë buton printimi:'; +$string[ 'html_title'] = 'Titulli i faqes të internetit:'; +$string[ 'javame_createdby'] = 'U krijua nga:'; +$string[ 'javame_description'] = 'Përshkrim:'; +$string[ 'javame_filename'] = 'emri i zarfit:'; +$string[ 'javame_icon'] = 'ikona:'; +$string[ 'javame_maxpictureheight'] = 'Maksimumi i gjatësisë të ikonës:'; +$string[ 'javame_maxpicturewidth'] = 'Μaksimumi i gjërësisë të ikonës:'; +$string[ 'javame_name'] = 'Emri:'; +$string[ 'javame_type'] = 'Τip:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'versioni:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Fund loje'; +$string[ 'html_hangman_new'] = 'E re'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Fjala bosh thotë'; +$string[ 'millionaire_info_telephone'] = 'Mendoj se përgjigjja e saktë është '; +$string[ 'millionaire_info_wrong_answer'] = 'Përgjigjja juaj është gabim
      Pergjigjja e saktë është :'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Burimi i pyetjeve per milionerin duhet te ishte $a ose Pyetje dhe jo '; +$string[ 'must_select_questioncategory'] = 'Duhet te zgjedhësh me patjetër një kategori pyetjesh '; +$string[ 'must_select_quiz'] = 'Duhet te zgjidhni një kuiz'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Piket'; + +//index.php +$string[ 'modulename'] = 'Lojë'; +$string[ 'modulenameplural'] = 'Lojra'; +$string[ 'pluginname'] = 'Lojë'; + +//lib.php +$string[ 'attempt'] = 'Përpjekja $a'; +$string[ 'bookquiz_questions'] = 'Radhitja e katigorive te pyetjeve në vellime libri'; +$string[ 'export_to_html'] = 'Εksport në HTML'; +$string[ 'export_to_javame'] = 'Εksport në JavaMe për telefona celularë'; +$string[ 'game_bookquiz'] = 'Libër me pyetje'; +$string[ 'game_cross'] = 'Fjalëkryq'; +$string[ 'game_cryptex'] = 'Fjalefshehje'; +$string[ 'game_hangman'] = 'Xhelat'; +$string[ 'game_hiddenpicture'] = "Figura e fshehtë"; +$string[ 'game_millionaire'] = 'Milioner'; +$string[ 'game_snakes'] = 'Gjarpër'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Informacione'; +$string[ 'noattempts'] = 'Asnjë përpjekje nuk u bë për këtë lojë'; +$string[ 'percent'] = 'Përqindje'; +$string[ 'results'] = 'Përfundime'; +$string[ 'showanswers'] = 'Shfaqja e përgjigjjeve'; + +//locallib.php +$string[ 'attemptfirst'] = 'Përpjekja e parë'; +$string[ 'attemptlast'] = 'Përpjekja e fundit'; +$string[ 'gradeaverage'] = 'Numuri mesatar'; +$string[ 'gradehighest'] = 'Numuri më i madh'; + +//mod_form.php +$string[ 'bottomtext'] = 'Text në pjesën e poshtme të faqes'; +$string[ 'cross_layout'] = 'Mënyrë shfaqjeje'; +$string[ 'cross_layout0'] = 'Përcaktimet poshtë fjalëkryqit'; +$string[ 'cross_layout1'] = 'Përcaktimet nga e djathta e fjalëkryqit'; +$string[ 'cross_maxcols'] = 'Maximumi i rreshtave / shtyllave të fjalëkryqit'; +$string[ 'cross_maxwords'] = 'Maximumi i fjalëve të fjalëkryqit'; +$string[ 'cryptex_maxcols'] = 'Maximumi i rreshtave / shtyllave të fjalëkryqit'; +$string[ 'cryptex_maxtries'] = 'Maximumi i përpjekjeve'; +$string[ 'cryptex_maxwords'] = 'Maximumi i fjalëve të fjalëkryqit'; +$string[ 'grademethod'] = 'Μënyrë vleresimi'; +$string[ 'hangman_allowspaces'] = 'Të lejohen vendet bosh në fjalët'; +$string[ 'hangman_allowsub'] = 'Të lejohet simboli - në fjalet'; +$string[ 'hangman_imageset'] = 'Zgjidhni fotografi'; +$string[ 'hangman_language'] = 'Gjuha në të cilën janë fjalët'; +$string[ 'hangman_maxtries'] = 'Numuri i fjalëve për cdo lojë'; +$string[ 'hangman_showcorrectanswer'] = 'Të shfaqet përgjigjja e saktë pas fund loje ;'; +$string[ 'hangman_showfirst'] = 'Të shfaqet shkronja e parë e fjalës'; +$string[ 'hangman_showlast'] = 'Të shfaqet shkronja e fundit e fjalës'; +$string[ 'hangman_showquestion'] = 'Të shfaqen pyetjet;'; +$string[ 'hiddenpicture_across'] = "Numri i qelizave horizontale "; +$string[ 'hiddenpicture_down'] = "Numri i qelizave vertikal "; +$string[ 'hiddenpicture_height'] = 'Përcaktimi i lartesisë të ikonës'; +$string[ 'hiddenpicture_pictureglossary'] = 'Fjalori për pyetjen kryesore'; +$string[ 'hiddenpicture_width'] = 'Përcaktimi i gjërësisë të ikonës'; +$string[ 'millionaire_shuffle'] = 'Përzjerje pyetjesh'; +$string[ 'snakes_background'] = 'Pistë'; +$string[ 'sourcemodule'] = 'Burim pyetjesh'; +$string[ 'sourcemodule_book'] = 'Zgjidh libër '; +$string[ 'sourcemodule_glossary'] = 'Zgjidh fjalor'; +$string[ 'sourcemodule_glossarycategory'] = 'Zgjidh kategori fjalori'; +$string[ 'sourcemodule_include_subcategories'] = 'Te plotësohen nënkategoritë'; +$string[ 'sourcemodule_question'] = 'Pyetje'; +$string[ 'sourcemodule_questioncategory'] = 'Zgjidh kategori pyetjesh'; +$string[ 'sourcemodule_quiz'] = 'Zgjidh kuiz'; +$string[ 'sudoku_maxquestions'] = 'Μaximumi i pyetjeve'; + +//preview.php +$string[ 'only_teachers'] = 'Vetëm mesuesi mundet te shikojë këtë faqe'; +$string[ 'preview'] = 'Parashfaq'; + +//review.php +$string[ 'attempts'] = 'Përpjekje'; +$string[ 'completedon'] = 'U përfundua në'; +$string[ 'outof'] = '$a->grade nga maksimumi $a->maxgrade'; +$string[ 'review'] = 'Rikorigjim'; +$string[ 'reviewofattempt'] = 'Rikorigjim i mundimit $a'; +$string[ 'startagain'] = 'Përpjekje prap'; +$string[ 'timetaken'] = 'Koha e duhur'; + +//showanswers.php +$string[ 'feedbacks'] = 'Mesazh përgjigjjeje të saktë'; + +//showattempts.php +$string[ 'lastip'] = 'IP studenti'; +$string[ 'showsolution'] = 'Zgjedhje'; +$string[ 'timefinish'] = 'Fund loje '; +$string[ 'timelastattempt'] = 'Përpjekje e fundit'; +$string[ 'timestart'] = 'Fillimi '; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Përpjekje loje tani'; +$string[ 'continueattemptgame'] = 'Vazhdim i lojës'; +$string[ 'reattemptgame'] = 'Përpjekje loje përsëri'; +$string[ 'yourfinalgradeis'] = 'Pikët përfundimtare për këtë kuiz janë $a'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//cross/cross_class.php $string[ 'lettersall'] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'allattempts'] = 'Show all tries'; +//report/overview/report.php $string[ 'allstudents'] = 'Show all $a'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//report/overview/report.php $string[ 'attemptsonly'] = 'Show only students with attempts'; +//report/overview/report.php $string[ 'deleteattemptcheck'] = 'Are you absolutely sure you want to completely delete these attempts?'; +//report/overview/report.php $string[ 'displayoptions'] = 'Display options'; +//report/overview/report.php $string[ 'downloadods'] = 'Download in ODS format'; +//report/overview/report.php $string[ 'noattemptsonly'] = 'Show $a with no attempts only'; +//report/overview/report.php $string[ 'numattempts'] = '$a->studentnum $a->studentstring have made $a->attemptnum attempts'; +//report/overview/report.php $string[ 'pagesize'] = 'Questions per page:'; +//report/overview/report.php $string[ 'reportoverview'] = 'Overview'; +//report/overview/report.php $string[ 'selectall'] = 'Select all'; +//report/overview/report.php $string[ 'selectnone'] = 'Deselect all'; +//report/overview/report.php $string[ 'showdetailedmarks'] = 'Show mark details'; +//report/overview/report.php $string[ 'withselected'] = 'With selected'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/uk/game.php b/lang/uk/game.php new file mode 100644 index 0000000..d9d7e41 --- /dev/null +++ b/lang/uk/game.php @@ -0,0 +1,304 @@ +Mirësevini!

      Kliko në një fjalë për të filluar.

      '; +$string[ 'letter'] = 'shkronja'; +$string[ 'letters'] = 'shkronja'; +$string[ 'nextgame'] = 'Lojë e re '; +$string[ 'no_words'] = 'Не знайшлось жодного слова'; +$string[ 'print'] = 'Printim'; +$string[ 'win'] = 'Вітання!!!'; + +//cryptex/play.php +$string[ 'finish'] = 'Fund loje'; + +//db/access.php + +//hangman/play.php +$string[ 'hangman_correct_phrase'] = 'Вірна фраза була: '; +$string[ 'hangman_correct_word'] = 'Вірне слово було: '; +$string[ 'hangman_gradeinstance'] = 'Shuma e pikeve ne gjithe lojen'; +$string[ 'hangman_letters'] = 'Shkronja : '; +$string[ 'hangman_restletters_many'] = 'Keni $a përpjekje akoma'; +$string[ 'hangman_restletters_one'] = 'Keni akoma VETEM 1 përpjekje'; +$string[ 'hangman_wrongnum'] = 'Gabime: %%d out of %%d'; +$string[ 'nextword'] = 'Fjalë tjetër '; + +//hiddenpicture/play.php +$string[ 'hiddenpicture_mainsubmit'] = "Ver pikë në pyetjen kryesore"; +$string[ 'hiddenpicture_nocols'] = 'Duhet te përcaktoni numrin e qelizave horizontalisht'; +$string[ 'hiddenpicture_nomainquestion'] = 'Nuk ka asnjë regjistrim në fjalor $a->name që të përmbajë dhë figurë'; +$string[ 'hiddenpicture_norows'] = 'Duhet te përcaktoni numrin e qelizave vertikalisht'; +$string[ 'must_select_glossary'] = 'Duhet te zgjidhni me patjetër një fjalor'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = 'Duhet me patjetër te zgjidhni një kategori pyetjesh'; +$string[ 'millionaire_must_select_quiz'] = 'Duhet me patjetër te zgjidhni një kuiz'; + +//report/overview/report.php +$string[ 'allattempts'] = 'Показати всі зусилля'; +$string[ 'allstudents'] = 'Показати всі $a'; +$string[ 'attemptsonly'] = 'Показати тільки учнів які намагалися'; +$string[ 'deleteattemptcheck'] = 'Ви абсолютно впевнені,що хочете,повністю видалити ці спроби?'; +$string[ 'displayoptions'] = 'Відображити параметри'; +$string[ 'downloadods'] = 'Зберегти як ODS'; +$string[ 'feedback'] = 'Përgjigje'; +$string[ 'noattemptsonly'] = 'Відображити $a які не мають жодної спроби'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring зробили $a->attemptnum спроб'; +$string[ 'pagesize'] = 'Питання на сторінці:'; +$string[ 'reportoverview'] = 'Πерегляд'; +$string[ 'selectall'] = 'Виділити все'; +$string[ 'selectnone'] = ' Відмінити все'; +$string[ 'showdetailedmarks'] = 'Інформація питань'; +$string[ 'startedon'] = 'Filloni në'; +$string[ 'timecompleted'] = 'Kompletuar'; +$string[ 'unfinished'] = 'Pafund'; +$string[ 'withselected'] = 'З вибраним'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = 'Numuri i sudoku që do krijohet'; +$string[ 'sudoku_create_start'] = 'Fillimi i krijimit sudoku'; +$string[ 'sudoku_creating'] = 'U krijua $a sudoku'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = 'Fund loje'; +$string[ 'sudoku_guessnumber'] = 'Supozo numurin '; +$string[ 'sudoku_noentriesfound'] = 'Nuk u gjendën fjalë në fjalor'; + +//export.php +$string[ 'export'] = 'Εksport'; +$string[ 'html_hascheckbutton'] = 'Të ketë buton kontrollimi përgjigjjeve të sakta:'; +$string[ 'html_hasprintbutton'] = 'Të ketë buton printimi:'; +$string[ 'html_title'] = 'Titulli i faqes të internetit:'; +$string[ 'javame_createdby'] = 'U krijua nga:'; +$string[ 'javame_description'] = 'Përshkrim:'; +$string[ 'javame_filename'] = 'emri i zarfit:'; +$string[ 'javame_icon'] = 'ikona:'; +$string[ 'javame_maxpictureheight'] = 'Maksimumi i gjatësisë të ikonës:'; +$string[ 'javame_maxpicturewidth'] = 'Μaksimumi i gjërësisë të ikonës:'; +$string[ 'javame_name'] = 'Emri:'; +$string[ 'javame_type'] = 'Τip:'; +$string[ 'javame_vendor'] = 'Vendor:'; +$string[ 'javame_version'] = 'versioni:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = 'Fund loje'; +$string[ 'html_hangman_new'] = 'E re'; + +//exporthtml_millionaire.php +$string[ 'millionaire_info_people'] = 'Fjala bosh thotë'; +$string[ 'millionaire_info_telephone'] = 'Mendoj se përgjigjja e saktë është '; +$string[ 'millionaire_info_wrong_answer'] = 'Përgjigjja juaj është gabim
      Pergjigjja e saktë është :'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = 'Burimi i pyetjeve per milionerin duhet te ishte $a ose Pyetje dhe jo '; +$string[ 'must_select_questioncategory'] = 'Duhet te zgjedhësh me patjetër një kategori pyetjesh '; +$string[ 'must_select_quiz'] = 'Duhet te zgjidhni një kuiz'; + +//exporthtml_snakes.php +$string[ 'score'] = 'Piket'; + +//index.php +$string[ 'modulename'] = 'Lojë'; +$string[ 'modulenameplural'] = 'Lojra'; +$string[ 'pluginname'] = 'Lojë'; + +//lib.php +$string[ 'attempt'] = 'Përpjekja $a'; +$string[ 'bookquiz_questions'] = 'Radhitja e katigorive te pyetjeve në vellime libri'; +$string[ 'export_to_html'] = 'Εksport në HTML'; +$string[ 'export_to_javame'] = 'Εksport në JavaMe për telefona celularë'; +$string[ 'game_bookquiz'] = 'Libër me pyetje'; +$string[ 'game_cross'] = 'Fjalëkryq'; +$string[ 'game_cryptex'] = 'Fjalefshehje'; +$string[ 'game_hangman'] = 'Xhelat'; +$string[ 'game_hiddenpicture'] = "Figura e fshehtë"; +$string[ 'game_millionaire'] = 'Milioner'; +$string[ 'game_snakes'] = 'Gjarpër'; +$string[ 'game_sudoku'] = 'Sudoku'; +$string[ 'info'] = 'Informacione'; +$string[ 'noattempts'] = 'Asnjë përpjekje nuk u bë për këtë lojë'; +$string[ 'percent'] = 'Përqindje'; +$string[ 'results'] = 'Përfundime'; +$string[ 'showanswers'] = 'Shfaqja e përgjigjjeve'; + +//locallib.php +$string[ 'attemptfirst'] = 'Përpjekja e parë'; +$string[ 'attemptlast'] = 'Përpjekja e fundit'; +$string[ 'gradeaverage'] = 'Numuri mesatar'; +$string[ 'gradehighest'] = 'Numuri më i madh'; + +//mod_form.php +$string[ 'bottomtext'] = 'Text në pjesën e poshtme të faqes'; +$string[ 'cross_layout'] = 'Mënyrë shfaqjeje'; +$string[ 'cross_layout0'] = 'Përcaktimet poshtë fjalëkryqit'; +$string[ 'cross_layout1'] = 'Përcaktimet nga e djathta e fjalëkryqit'; +$string[ 'cross_maxcols'] = 'Maximumi i rreshtave / shtyllave të fjalëkryqit'; +$string[ 'cross_maxwords'] = 'Maximumi i fjalëve të fjalëkryqit'; +$string[ 'cryptex_maxcols'] = 'Maximumi i rreshtave / shtyllave të fjalëkryqit'; +$string[ 'cryptex_maxtries'] = 'Maximumi i përpjekjeve'; +$string[ 'cryptex_maxwords'] = 'Maximumi i fjalëve të fjalëkryqit'; +$string[ 'grademethod'] = 'Μënyrë vleresimi'; +$string[ 'hangman_allowspaces'] = 'Të lejohen vendet bosh në fjalët'; +$string[ 'hangman_allowsub'] = 'Të lejohet simboli - në fjalet'; +$string[ 'hangman_imageset'] = 'Zgjidhni fotografi'; +$string[ 'hangman_language'] = 'Gjuha në të cilën janë fjalët'; +$string[ 'hangman_maxtries'] = 'Numuri i fjalëve për cdo lojë'; +$string[ 'hangman_showcorrectanswer'] = 'Të shfaqet përgjigjja e saktë pas fund loje ;'; +$string[ 'hangman_showfirst'] = 'Të shfaqet shkronja e parë e fjalës'; +$string[ 'hangman_showlast'] = 'Të shfaqet shkronja e fundit e fjalës'; +$string[ 'hangman_showquestion'] = 'Të shfaqen pyetjet;'; +$string[ 'hiddenpicture_across'] = "Numri i qelizave horizontale "; +$string[ 'hiddenpicture_down'] = "Numri i qelizave vertikal "; +$string[ 'hiddenpicture_height'] = 'Përcaktimi i lartesisë të ikonës'; +$string[ 'hiddenpicture_pictureglossary'] = 'Fjalori për pyetjen kryesore'; +$string[ 'hiddenpicture_width'] = 'Përcaktimi i gjërësisë të ikonës'; +$string[ 'millionaire_shuffle'] = 'Përzjerje pyetjesh'; +$string[ 'snakes_background'] = 'Pistë'; +$string[ 'sourcemodule'] = 'Burim pyetjesh'; +$string[ 'sourcemodule_book'] = 'Zgjidh libër '; +$string[ 'sourcemodule_glossary'] = 'Zgjidh fjalor'; +$string[ 'sourcemodule_glossarycategory'] = 'Zgjidh kategori fjalori'; +$string[ 'sourcemodule_include_subcategories'] = 'Te plotësohen nënkategoritë'; +$string[ 'sourcemodule_question'] = 'Pyetje'; +$string[ 'sourcemodule_questioncategory'] = 'Zgjidh kategori pyetjesh'; +$string[ 'sourcemodule_quiz'] = 'Zgjidh kuiz'; +$string[ 'sudoku_maxquestions'] = 'Μaximumi i pyetjeve'; + +//preview.php +$string[ 'only_teachers'] = 'Vetëm mesuesi mundet te shikojë këtë faqe'; +$string[ 'preview'] = 'Parashfaq'; + +//review.php +$string[ 'attempts'] = 'Përpjekje'; +$string[ 'completedon'] = 'U përfundua në'; +$string[ 'outof'] = '$a->grade nga maksimumi $a->maxgrade'; +$string[ 'review'] = 'Rikorigjim'; +$string[ 'reviewofattempt'] = 'Rikorigjim i mundimit $a'; +$string[ 'startagain'] = 'Përpjekje prap'; +$string[ 'timetaken'] = 'Koha e duhur'; + +//showanswers.php +$string[ 'feedbacks'] = 'Mesazh përgjigjjeje të saktë'; + +//showattempts.php +$string[ 'lastip'] = 'IP studenti'; +$string[ 'showsolution'] = 'Zgjedhje'; +$string[ 'timefinish'] = 'Fund loje '; +$string[ 'timelastattempt'] = 'Përpjekje e fundit'; +$string[ 'timestart'] = 'Fillimi '; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = 'Përpjekje loje tani'; +$string[ 'continueattemptgame'] = 'Vazhdim i lojës'; +$string[ 'reattemptgame'] = 'Përpjekje loje përsëri'; +$string[ 'yourfinalgradeis'] = 'Pikët përfundimtare për këtë kuiz janë $a'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//hiddenpicture/play.php $string[ 'noglossaryentriesfound'] = 'No glossary entries found'; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_millionaire.php $string[ 'millionaire_helppeople'] = 'Help of people'; +//exporthtml_millionaire.php $string[ 'millionaire_quit'] = 'Quit'; +//exporthtml_millionaire.php $string[ 'millionaire_telephone'] = 'Help of telephone'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//lib.php $string[ 'showattempts'] = 'Show attempts'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'cross_options'] = 'Crossword options'; +//mod_form.php $string[ 'cryptex_options'] = 'Cryptex ofptions'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'hangman_options'] = 'Hangman options'; +//mod_form.php $string[ 'hiddenpicture_options'] = '\'Hidden Picture\' options'; +//mod_form.php $string[ 'millionaire_background'] = 'Background color'; +//mod_form.php $string[ 'millionaire_options'] = 'Millionaire\' options'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_options'] = '\'Snakes and Ladders\' options'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'sudoku_options'] = 'Sudoku options'; +//mod_form.php $string[ 'toptext'] = 'Text at the top of page'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; +//showanswers.php $string[ 'computerepetitions'] = 'Compute statistics again'; +//showanswers.php $string[ 'repetitions'] = 'Repetitions'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lang/zh_cn/game.php b/lang/zh_cn/game.php new file mode 100644 index 0000000..f6221f7 --- /dev/null +++ b/lang/zh_cn/game.php @@ -0,0 +1,304 @@ +名称附加照片'; +$string[ 'hiddenpicture_norows'] = '必须指定垂直列数'; +$string[ 'must_select_glossary'] = '你必须选定一个词汇'; +$string[ 'noglossaryentriesfound'] = '词汇表没找到'; + +//millionaire/play.php +$string[ 'millionaire_must_select_questioncategory'] = '你必须选定一个问题类别'; +$string[ 'millionaire_must_select_quiz'] = '你必须选择一个小测验'; + +//report/overview/report.php +$string[ 'allattempts'] = '显示所有可能的机会'; +$string[ 'allstudents'] = '显示所有的 $a'; +$string[ 'attemptsonly'] = '只显示进行尝试的学生'; +$string[ 'deleteattemptcheck'] = '你真的确定要完全删除这些尝试?'; +$string[ 'displayoptions'] = '显示选项'; +$string[ 'downloadods'] = '以ODS格式下载'; +$string[ 'feedback'] = '反馈'; +$string[ 'noattemptsonly'] = '显示 $a ,不需任何尝试'; +$string[ 'numattempts'] = '$a->studentnum $a->studentstring 已经形成 $a->attemptnum 尝试'; +$string[ 'pagesize'] = '每页出现的问题:'; +$string[ 'reportoverview'] = '浏览'; +$string[ 'selectall'] = '全选'; +$string[ 'selectnone'] = '全不选'; +$string[ 'showdetailedmarks'] = '显示标记'; +$string[ 'startedon'] = '开始'; +$string[ 'timecompleted'] = '完成'; +$string[ 'unfinished'] = '打开'; +$string[ 'withselected'] = '选定'; + +//snakes/play.php + +//sudoku/create.php +$string[ 'sudoku_create_count'] = '创建数独游戏数'; +$string[ 'sudoku_create_start'] = '开始创建数独游戏'; +$string[ 'sudoku_creating'] = '正在创建 $a 数独游戏'; + +//sudoku/play.php +$string[ 'sudoku_finishattemptbutton'] = '数独游戏结束'; +$string[ 'sudoku_guessnumber'] = '猜测正确的编号'; +$string[ 'sudoku_noentriesfound'] = '没找到任何字'; + +//export.php +$string[ 'export'] = '输出'; +$string[ 'html_hascheckbutton'] = '已检查按钮:'; +$string[ 'html_hasprintbutton'] = '已打印按钮:'; +$string[ 'html_title'] = 'HTML的标题:'; +$string[ 'javame_createdby'] = '创建于:'; +$string[ 'javame_description'] = '描述:'; +$string[ 'javame_filename'] = '文件名:'; +$string[ 'javame_icon'] = '图标:'; +$string[ 'javame_maxpictureheight'] = '图片的最大高度:'; +$string[ 'javame_maxpicturewidth'] = '图片的最大宽度:'; +$string[ 'javame_name'] = '名称:'; +$string[ 'javame_type'] = '类型:'; +$string[ 'javame_vendor'] = '销售商:'; +$string[ 'javame_version'] = '版本:'; + +//exporthtml_hangman.php +$string[ 'hangman_loose'] = '游戏结束'; +$string[ 'html_hangman_new'] = '新的'; + +//exporthtml_millionaire.php +$string[ 'millionaire_helppeople'] = '帮助'; +$string[ 'millionaire_info_people'] = '人们说'; +$string[ 'millionaire_info_telephone'] = '我认为正确答案是 '; +$string[ 'millionaire_info_wrong_answer'] = '你的回答错误,正确答案是:'; +$string[ 'millionaire_quit'] = '退出'; +$string[ 'millionaire_sourcemodule_must_quiz_question'] = '对于百万富翁来说资源一定是 $a 要么有问题要么没有'; +$string[ 'millionaire_telephone'] = '借助电话'; +$string[ 'must_select_questioncategory'] = '你必须选定一个问题类别'; +$string[ 'must_select_quiz'] = '你必须选择一个小测验'; + +//exporthtml_snakes.php +$string[ 'score'] = '得分'; + +//index.php +$string[ 'modulename'] = '游戏'; +$string[ 'modulenameplural'] = '游戏'; +$string[ 'pluginname'] = '游戏'; + +//lib.php +$string[ 'attempt'] = '尝试 $a'; +$string[ 'bookquiz_questions'] = '把一些问题分类同各章节联系起来'; +$string[ 'export_to_html'] = '导出HTML'; +$string[ 'export_to_javame'] = '导出Javame'; +$string[ 'game_bookquiz'] = '带有问题的书'; +$string[ 'game_cross'] = '填字游戏'; +$string[ 'game_cryptex'] = '藏密筒'; +$string[ 'game_hangman'] = '刽子手'; +$string[ 'game_hiddenpicture'] = '图片隐藏'; +$string[ 'game_millionaire'] = '百万富翁'; +$string[ 'game_snakes'] = '蛇和梯子'; +$string[ 'game_sudoku'] = '数独游戏'; +$string[ 'info'] = '信息'; +$string[ 'noattempts'] = '这个游戏没有进行任何尝试'; +$string[ 'percent'] = '百分率'; +$string[ 'results'] = '结果'; +$string[ 'showanswers'] = '答案显示'; +$string[ 'showattempts'] = '试玩显示'; + +//locallib.php +$string[ 'attemptfirst'] = '第一次机会'; +$string[ 'attemptlast'] = '最后一次机会'; +$string[ 'gradeaverage'] = '平均分'; +$string[ 'gradehighest'] = '最高分'; + +//mod_form.php +$string[ 'bottomtext'] = '底部文本'; +$string[ 'cross_layout'] = '布局'; +$string[ 'cross_layout0'] = '字谜底部的词组'; +$string[ 'cross_layout1'] = '字谜右侧的词组'; +$string[ 'cross_maxcols'] = '填字游戏的最大数'; +$string[ 'cross_maxwords'] = '游戏字的最大数'; +$string[ 'cross_options'] = '填字游戏选项'; +$string[ 'cryptex_maxcols'] = '藏密筒的最大行/列数'; +$string[ 'cryptex_maxtries'] = '最多机会'; +$string[ 'cryptex_maxwords'] = '藏密筒中最多词汇'; +$string[ 'cryptex_options'] = '藏密筒选项'; +$string[ 'grademethod'] = '评分方法'; +$string[ 'hangman_allowspaces'] = '允许文字间有间隔'; +$string[ 'hangman_allowsub'] = '允许文字里有符号'; +$string[ 'hangman_imageset'] = '选择刽子手的图像'; +$string[ 'hangman_language'] = '选择语言'; +$string[ 'hangman_maxtries'] = '每个游戏数'; +$string[ 'hangman_options'] = '刽子手选项'; +$string[ 'hangman_showcorrectanswer'] = '结束后正确答案显示'; +$string[ 'hangman_showfirst'] = '刽子手游戏的第一个字母显示'; +$string[ 'hangman_showlast'] = '刽子手游戏的最后一个字母显示'; +$string[ 'hangman_showquestion'] = '问题显示 ?'; +$string[ 'hiddenpicture_across'] = '水平单元'; +$string[ 'hiddenpicture_down'] = '纵向单元'; +$string[ 'hiddenpicture_height'] = '图片的高度设置'; +$string[ 'hiddenpicture_options'] = '\图片隐藏\' 选项'; +$string[ 'hiddenpicture_pictureglossary'] = '主要问题和图片词汇'; +$string[ 'hiddenpicture_width'] = '图像宽度设置'; +$string[ 'millionaire_background'] = '背景颜色'; +$string[ 'millionaire_options'] = '百万富翁选项'; +$string[ 'millionaire_shuffle'] = '随机问题'; +$string[ 'snakes_background'] = '背景'; +$string[ 'snakes_options'] = '\'蛇和梯子\' 选项'; +$string[ 'sourcemodule'] = '问题来源'; +$string[ 'sourcemodule_book'] = '挑选一本书'; +$string[ 'sourcemodule_glossary'] = '词汇选择'; +$string[ 'sourcemodule_glossarycategory'] = '词汇类别选择'; +$string[ 'sourcemodule_include_subcategories'] = '包括子目录'; +$string[ 'sourcemodule_question'] = '问题'; +$string[ 'sourcemodule_questioncategory'] = '问题类别选择'; +$string[ 'sourcemodule_quiz'] = '小测验选择'; +$string[ 'sudoku_maxquestions'] = '问题的最大数量'; +$string[ 'sudoku_options'] = '数独游戏选项'; +$string[ 'toptext'] = '顶部文本'; + +//preview.php +$string[ 'only_teachers'] = '只有老师可以查看此页'; +$string[ 'preview'] = '预览'; + +//review.php +$string[ 'attempts'] = '尝试'; +$string[ 'completedon'] = '完成'; +$string[ 'outof'] = '$a->$a 的最高分->最高分'; +$string[ 'review'] = '回顾'; +$string[ 'reviewofattempt'] = '回顾 $a'; +$string[ 'startagain'] = '重新开始'; +$string[ 'timetaken'] = '所需时间'; + +//showanswers.php +$string[ 'clearrepetitions'] = '清除数据'; +$string[ 'computerepetitions'] = '再次计算数据'; +$string[ 'feedbacks'] = '正确答案信息'; +$string[ 'repetitions'] = '重复'; + +//showattempts.php +$string[ 'lastip'] = 'IP学生'; +$string[ 'showsolution'] = '答案'; +$string[ 'timefinish'] = '游戏结束'; +$string[ 'timelastattempt'] = '最后一次机会'; +$string[ 'timestart'] = '开始'; + +//tabs.php + +//view.php +$string[ 'attemptgamenow'] = '现在试玩游戏'; +$string[ 'continueattemptgame'] = '继续前一个游戏'; +$string[ 'reattemptgame'] = '重新试玩游戏'; +$string[ 'yourfinalgradeis'] = '此轮游戏的最后得分是 $a.'; + +//Untranslated +//bookquiz/questions.php $string[ 'bookquiz_numquestions'] = 'Questions'; +//db/access.php $string[ 'game:attempt'] = 'Play game'; +//db/access.php $string[ 'game:deleteattempts'] = 'Delete attempts'; +//db/access.php $string[ 'game:grade'] = 'Grade games manually'; +//db/access.php $string[ 'game:manage'] = 'Manage'; +//db/access.php $string[ 'game:manageoverrides'] = 'Manage game overrides'; +//db/access.php $string[ 'game:preview'] = 'Preview Games'; +//db/access.php $string[ 'game:reviewmyattempts'] = 'reviewmyattempts'; +//db/access.php $string[ 'game:view'] = 'view'; +//db/access.php $string[ 'game:viewreports'] = 'viewreports'; +//hiddenpicture/play.php $string[ 'no_questions'] = "There are no questions"; +//report/overview/report.php $string[ 'attemptduration'] = 'Attempt duration'; +//snakes/play.php $string[ 'snakes_dice'] = 'Dice, $a spots.'; +//snakes/play.php $string[ 'snakes_player'] = 'Player, position: $a.'; +//exporthtml_snakes.php $string[ 'html_snakes_check'] = 'Check'; +//exporthtml_snakes.php $string[ 'html_snakes_correct'] = 'Correct!'; +//exporthtml_snakes.php $string[ 'html_snakes_no_selection'] = 'Have to select something!'; +//exporthtml_snakes.php $string[ 'html_snakes_wrong'] = "Your answer isn't correct. Stay on the same seat."; +//index.php $string[ 'helpbookquiz'] = 'When the student answers correct can go to the next chapter.'; +//index.php $string[ 'helpcross'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a random crossword puzzle. Teacher can set the maximum number of columns/rows or words that contains. Student can press the button “Check crossword” to check if the answers are correct. Every crossword is dynamic so it is different to every student.'; +//index.php $string[ 'helpcryptex'] = 'This game is like a crossword but the answers are hidden inside a random cryptex.'; +//index.php $string[ 'helphangman'] = 'This game takes words from either a Glossary or quiz short answer questions and generates a hangman puzzle. Teacher can set the number of words that each game contains, if shows the first or last letter, or if show the question or the answer at the end.'; +//index.php $string[ 'helphiddenpicture'] = 'The hidden picture game uncovers each piece of a picture for each question correctly answered by the student. Each number in the hidden picture game displays a question to the student such that when the student answers the question correctly, the number is uncovered to display a piece of the picture.'; +//index.php $string[ 'helpmillionaire'] = 'A question is displayed to the student which if answered correctly moves up to the next number in the game until the user has completed the questions. If a question is answered incorrectly, the game is over.'; +//index.php $string[ 'helpsnakes'] = 'A question is displayed to the student which if answered correctly, displays a number on the dice, then game piece moves up the number displayed on the dice.'; +//index.php $string[ 'helpsudoku'] = 'This game shows a sudoku puzzle to the students with not enough numbers to allow it to be solved. For each question the student correctly answers an additional number is slotted into the puzzle to make it easier to solve.'; +//index.php $string[ 'pluginadministration'] = 'Game administration'; +//lib.php $string[ 'reset_game_all'] = 'Delete tries from all games'; +//lib.php $string[ 'reset_game_deleted_course'] = 'Delete tries from deleted courses'; +//mod_form.php $string[ 'bookquiz_layout'] = 'Layout'; +//mod_form.php $string[ 'bookquiz_layout0'] = 'Question at the top of the book'; +//mod_form.php $string[ 'bookquiz_layout1'] = 'Question at the bottom of the book'; +//mod_form.php $string[ 'bookquiz_options'] = 'Bookquiz options'; +//mod_form.php $string[ 'gameclose'] = 'Close the game'; +//mod_form.php $string[ 'gameopen'] = 'Open the game'; +//mod_form.php $string[ 'hangman_maximum_number_of_errors'] = 'Maximum number or errors (have to be images named hangman_0.jpg, hangman_1.jpg, ...)'; +//mod_form.php $string[ 'snakes_cols'] = 'Cols'; +//mod_form.php $string[ 'snakes_data'] = 'Positions of Snakes and Ladders'; +//mod_form.php $string[ 'snakes_file'] = 'File for background'; +//mod_form.php $string[ 'snakes_footerx'] = 'Space at bootom left'; +//mod_form.php $string[ 'snakes_footery'] = 'Space at bottom right'; +//mod_form.php $string[ 'snakes_headerx'] = 'Space at up left'; +//mod_form.php $string[ 'snakes_headery'] = 'Space at up right'; +//mod_form.php $string[ 'snakes_layout0'] = 'Question at the top of the image'; +//mod_form.php $string[ 'snakes_layout1'] = 'Question at the bottom of the image'; +//mod_form.php $string[ 'snakes_rows'] = 'Rows'; +//mod_form.php $string[ 'userdefined'] = 'User defined'; +//review.php $string[ 'showall'] = 'Show all'; +//view.php $string[ 'comment'] = 'Comment'; +//view.php $string[ 'gameclosed'] = 'This game closed on {$a}'; +//view.php $string[ 'gamecloseson'] = 'This game will close at {$a}'; +//view.php $string[ 'gamenotavailable'] = 'The game will not be available until {$a}'; +//view.php $string[ 'gameopenedon'] = 'This game opened at {$a}'; diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..94262d0 --- /dev/null +++ b/lib.php @@ -0,0 +1,1101 @@ +review + * These constants help to extract the options + */ +/** + * The first 6 bits refer to the time immediately after the attempt + */ +define('GAME_REVIEW_IMMEDIATELY', 0x3f); +/** + * the next 6 bits refer to the time after the attempt but while the game is open + */ +define('GAME_REVIEW_OPEN', 0xfc0); +/** + * the final 6 bits refer to the time after the game closes + */ +define('GAME_REVIEW_CLOSED', 0x3f000); + +// within each group of 6 bits we determine what should be shown +define('GAME_REVIEW_RESPONSES', 1*0x1041); // Show responses +define('GAME_REVIEW_SCORES', 2*0x1041); // Show scores +define('GAME_REVIEW_FEEDBACK', 4*0x1041); // Show feedback +define('GAME_REVIEW_ANSWERS', 8*0x1041); // Show correct answers +// Some handling of worked solutions is already in the code but not yet fully supported +// and not switched on in the user interface. +define('GAME_REVIEW_SOLUTIONS', 16*0x1041); // Show solutions +define('GAME_REVIEW_GENERALFEEDBACK', 32*0x1041); // Show general feedback +/**#@-*/ + + +/** + * Given an object containing all the necessary data, + * (defined by the form in mod.html) this function + * will create a new instance and return the id number + * of the new instance. + * + * @param object $instance An object from the form in mod.html + * @return int The id of the newly inserted game record + **/ + +function game_add_instance($game) { + global $DB; + + $game->timemodified = time(); + game_before_add_or_update( $game); + + # May have to add extra stuff in here # + + $id = $DB->insert_record("game", $game); + + $game = $DB->get_record_select( 'game', "id=$id"); + + // Do the processing required after an add or an update. + game_grade_item_update( $game); + + return $id; +} + +/** + * Given an object containing all the necessary data, + * (defined by the form in mod.html) this function + * will update an existing instance with new data. + * + * @param object $instance An object from the form in mod.html + * @return boolean Success/Fail + **/ +function game_update_instance($game) { + global $DB; + + $game->timemodified = time(); + $game->id = $game->instance; + + if( !isset( $game->glossarycategoryid)){ + $game->glossarycategoryid = 0; + } + + if( !isset( $game->glossarycategoryid2)){ + $game->glossarycategoryid2 = 0; + } + + if( $game->grade == ''){ + $game->grade = 0; + } + + if( !isset( $game->param1)){ + $game->param1 = 0; + } + + if( $game->param1 == ''){ + $game->param1 = 0; + } + + if( !isset( $game->param2)){ + $game->param2 = 0; + } + + if( $game->param2 == ''){ + $game->param2 = 0; + } + + if( !isset( $game->questioncategoryid)){ + $game->questioncategoryid = 0; + } + + game_before_add_or_update( $game); + + if( !$DB->update_record("game", $game)){ + return false; + } + + // Do the processing required after an add or an update. + game_grade_item_update( $game); + + return true; +} + +function game_before_add_or_update(&$game) { + if( isset( $game->questioncategoryid)) + { + $pos = strpos( $game->questioncategoryid, ','); + if( $pos != false) + $game->questioncategoryid = substr( $game->questioncategoryid, 0, $pos); + } + + if( $game->gamekind == 'millionaire') + { + $pos = strpos( '-'.$game->param8, '#'); + if( $pos > 0) + { + $game->param8 = hexdec(substr( $game->param8, $pos)); + } + }else if( $game->gamekind == 'snakes') + { + $s = ''; + if( $game->param3 == 0) + { + //means user defined + $draftitemid = $game->param4; + if( isset( $game->id)) + { + $cmg = get_coursemodule_from_instance('game', $game->id, $game->course); + $modcontext = get_context_instance(CONTEXT_MODULE, $cmg->id); + $attachmentoptions=array('subdirs' => 0, 'maxbytes' => 9999999, 'maxfiles' => 1); + file_save_draft_area_files($draftitemid, $modcontext->id, 'mod_game', 'snakes_file', $game->id, array('subdirs' => 0, 'maxbytes' => 9999999, 'maxfiles' => 1)); + $game->param5 = 1; + } + + if( isset( $_POST[ 'snakes_cols'])) + { + $fields = array( 'snakes_data', 'snakes_cols', 'snakes_rows', 'snakes_headerx', 'snakes_headery', 'snakes_footerx', 'snakes_footery', 'snakes_width', 'snakes_height'); + foreach( $fields as $f) + $s .= '#'.$f.':'.$_POST[ $f]; + $s = substr( $s, 1); + } + } + $game->param9 = $s; + } +} + +/** + * Given an ID of an instance of this module, + * this function will permanently delete the instance + * and any data that depends on it. + * + * @param int $id Id of the module instance + * @return boolean Success/Failure + **/ +function game_delete_instance($gameid) { + global $DB; + + $result = true; + + # Delete any dependent records here # + + if( ($recs = $DB->get_records( 'game_attempts', array( 'gameid' => $gameid))) != false){ + $ids = ''; + $count = 0; + $aids = array(); + foreach( $recs as $rec){ + $ids .= ','.$rec->id; + if( ++$count > 10){ + $count = 0; + $aids[] = $ids; + $ids = ''; + } + } + if( $ids != ''){ + $aids[] = $ids; + } + + foreach( $aids as $ids){ + if( $result == false){ + break; + } + $tables = array( 'game_hangman', 'game_cross', 'game_cryptex', 'game_millionaire', 'game_bookquiz', 'game_sudoku', 'game_snakes'); + foreach( $tables as $t){ + $sql = "DELETE FROM {".$t."} WHERE id IN (".substr( $ids, 1).')'; + if (! $DB->execute( $sql)) { + $result = false; + break; + } + } + } + } + + $tables = array( 'game_attempts', 'game_grades', 'game_bookquiz_questions', 'game_queries', 'game_repetitions'); + foreach( $tables as $t){ + if( $result == false){ + break; + } + + if (! $DB->delete_records( $t, array( 'gameid' => $gameid))) { + $result = false; + } + } + + if( $result){ + $tables = array( 'game_export_javame', 'game_export_html', 'game'); + if (!$DB->delete_records( 'game', array( 'id' => $gameid))) { + $result = false; + } + } + + return $result; +} + +/** + * Return a small object with summary information about what a + * user has done with a given particular instance of this module + * Used for user activity reports. + * $return->time = the time they did it + * $return->info = a short text description + **/ +function game_user_outline($course, $user, $mod, $game) { + global $DB; + + if ($grade = $DB->get_record_select('game_grades', "userid=$user->id AND gameid = $game->id", null, 'id,score,timemodified')) { + + $result = new stdClass; + if ((float)$grade->score) { + $result->info = get_string('grade').': '.round($grade->score * $game->grade, $game->decimalpoints).' '. + get_string('percent', 'game').': '.round(100 * $grade->score, $game->decimalpoints).' %'; + } + $result->time = $grade->timemodified; + return $result; + } + return NULL; +} + +/** + * Print a detailed representation of what a user has done with + * a given particular instance of this module, for user activity reports. + **/ +function game_user_complete($course, $user, $mod, $game) { + global $DB; + + if ($attempts = $DB->get_records_select('game_attempts', "userid='$user->id' AND gameid='$game->id'", null, 'attempt ASC')) { + if ($game->grade && $grade = $DB->get_record('game_grades', array( 'userid' => $user->id, 'gameid' => $game->id))) { + echo get_string('grade').': '.game_format_score( $game, $grade->score).'/'.$game->grade.'
      '; + } + foreach ($attempts as $attempt) { + echo get_string('attempt', 'game').' '.$attempt->attempt.': '; + if ($attempt->timefinish == 0) { + print_string( 'unfinished'); + } else { + echo game_format_score( $game, $attempt->score).'/'.$game->grade; + } + echo ' - '.userdate($attempt->timelastattempt).'
      '; + } + } else { + print_string('noattempts', 'game'); + } + + return true; +} + +/** + * Given a course and a time, this module should find recent activity + * that has occurred in game activities and print it out. + * Return true if there was output, or false is there was none. + * + * @uses $CFG + * @return boolean + * @todo Finish documenting this function + **/ +function game_print_recent_activity($course, $isteacher, $timestart) { + global $CFG; + + return false; // True if anything was printed, otherwise false +} + +/** + * Function to be run periodically according to the moodle cron + * This function searches for things that need to be done, such + * as sending out mail, toggling flags etc ... + * + * @uses $CFG + * @return boolean + * @todo Finish documenting this function + **/ +function game_cron () { + global $CFG; + + return true; +} + +/** + * Must return an array of grades for a given instance of this module, + * indexed by user. It also returns a maximum allowed grade. + * + * Example: + * $return->grades = array of grades; + * $return->maxgrade = maximum allowed grade; + * + * return $return; + * + * @param int $gameid ID of an instance of this module + * @return mixed Null or object with an array of grades and with the maximum grade + **/ +function game_grades($gameid) { +/// Must return an array of grades, indexed by user, and a max grade. + + global $DB; + + $game = $DB->get_record( 'game', array( 'id' => intval($gameid))); + if (empty($game) || empty($game->grade)) { + return NULL; + } + + $return = new stdClass; + $return->grades = $DB->get_records_menu('game_grades', 'gameid', $game->id, '', "userid, score * {$game->grade}"); + $return->maxgrade = $game->grade; + + return $return; +} + +/** + * Return grade for given user or all users. + * + * @param int $gameid id of game + * @param int $userid optional user id, 0 means all users + * @return array array of grades, false if none + */ +function game_get_user_grades($game, $userid=0) { + global $DB; + + $user = $userid ? "AND u.id = $userid" : ""; + + $sql = 'SELECT u.id, u.id AS userid, '.$game->grade.' * g.score AS rawgrade, g.timemodified AS dategraded, MAX(a.timefinish) AS datesubmitted + FROM {user} u, {game_grades} g, {game_attempts} a + WHERE u.id = g.userid AND g.gameid = '.$game->id.' AND a.gameid = g.gameid AND u.id = a.userid'; + if( $userid != 0) + $sql .= ' AND u.id='.$userid; + $sql .= ' GROUP BY u.id, g.score, g.timemodified'; + + return $DB->get_records_sql( $sql); +} + +/** + * Must return an array of user records (all data) who are participants + * for a given instance of game. Must include every user involved + * in the instance, independient of his role (student, teacher, admin...) + * See other modules as example. + * + * @param int $gameid ID of an instance of this module + * @return mixed boolean/array of students + **/ +function game_get_participants($gameid) { + return false; //todo +} + +/** + * This function returns if a scale is being used by one game + * it it has support for grading and scales. Commented code should be + * modified if necessary. See forum, glossary or journal modules + * as reference. + * + * @param int $gameid ID of an instance of this module + * @return mixed + * @todo Finish documenting this function + **/ +function game_scale_used ($gameid,$scaleid) { + $return = false; + + //$rec = get_record("game","id","$gameid","scale","-$scaleid"); + // + //if (!empty($rec) && !empty($scaleid)) { + // $return = true; + //} + + return $return; +} + +/** + * Update grades in central gradebook + * + * @param object $game null means all games + * @param int $userid specific user only, 0 mean all + */ +function game_update_grades($game=null, $userid=0, $nullifnone=true) { + global $CFG; + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + if( file_exists( $CFG->libdir.'/gradelib.php')){ + require_once($CFG->libdir.'/gradelib.php'); + }else{ + return; + } + } + + if ($game != null) { + if ($grades = game_get_user_grades($game, $userid)) { + game_grade_item_update($game, $grades); + + } else if ($userid and $nullifnone) { + $grade = new object(); + $grade->userid = $userid; + $grade->rawgrade = NULL; + game_grade_item_update( $game, $grade); + + } else { + game_grade_item_update( $game); + } + + } else { + $sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid + FROM {game} a, {course_modules} cm, {modules} m + WHERE m.name='game' AND m.id=cm.module AND cm.instance=a.id"; + if ($rs = $DB->get_recordset_sql( $sql)) { + while ($game = $DB->rs_fetch_next_record( $rs)) { + if ($game->grade != 0) { + game_update_grades( $game, 0, false); + } else { + game_grade_item_update( $game); + } + } + $DB->rs_close( $rs); + } + } +} + +/** + * Create grade item for given game + * + * @param object $game object with extra cmidnumber + * @param mixed optional array/object of grade(s); 'reset' means reset grades in gradebook + * @return int 0 if ok, error code otherwise + */ +function game_grade_item_update($game, $grades=NULL) { + global $CFG; + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + if( file_exists( $CFG->libdir.'/gradelib.php')){ + require_once($CFG->libdir.'/gradelib.php'); + }else{ + return; + } + } + + if (array_key_exists('cmidnumber', $game)) { //it may not be always present + $params = array('itemname'=>$game->name, 'idnumber'=>$game->cmidnumber); + } else { + $params = array('itemname'=>$game->name); + } + + if ($game->grade > 0) { + $params['gradetype'] = GRADE_TYPE_VALUE; + $params['grademax'] = $game->grade; + $params['grademin'] = 0; + + } else { + $params['gradetype'] = GRADE_TYPE_NONE; + } + + + if ($grades === 'reset') { + $params['reset'] = true; + $grades = NULL; + } + + return grade_update('mod/game', $game->course, 'mod', 'game', $game->id, 0, $grades, $params); +} + + +/** + * Delete grade item for given game + * + * @param object $game object + * @return object game + */ +function game_grade_item_delete( $game) { + global $CFG; + + if( file_exists( $CFG->libdir.'/gradelib.php')){ + require_once($CFG->libdir.'/gradelib.php'); + }else{ + return; + } + + return grade_update('mod/game', $game->course, 'mod', 'game', $game->id, 0, NULL, array('deleted'=>1)); +} + +/** + * Returns all game graded users since a given time for specified game + */ +function game_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) { + global $DB, $COURSE, $USER; + + if ($COURSE->id == $courseid) { + $course = $COURSE; + } else { + $course = $DB->get_record('course', array( 'id' => $courseid)); + } + + $modinfo =& get_fast_modinfo($course); + + $cm = $modinfo->cms[$cmid]; + + if ($userid) { + $userselect = "AND u.id = $userid"; + } else { + $userselect = ""; + } + + if ($groupid) { + $groupselect = "AND gm.groupid = $groupid"; + $groupjoin = "JOIN {groups_members} gm ON gm.userid=u.id"; + } else { + $groupselect = ""; + $groupjoin = ""; + } + + if (!$attempts = $DB->get_records_sql("SELECT qa.*, q.grade, + u.firstname, u.lastname, u.email, u.picture + FROM {game_attempts} qa + JOIN {game} q ON q.id = qa.gameid + JOIN {user} u ON u.id = qa.userid + $groupjoin + WHERE qa.timefinish > $timestart AND q.id = $cm->instance + $userselect $groupselect + ORDER BY qa.timefinish ASC")) { + return; + } + + + $cm_context = get_context_instance(CONTEXT_MODULE, $cm->id); + $grader = has_capability('moodle/grade:viewall', $cm_context); + $accessallgroups = has_capability('moodle/site:accessallgroups', $cm_context); + $viewfullnames = has_capability('moodle/site:viewfullnames', $cm_context); + $grader = has_capability('mod/game:grade', $cm_context); + //$grader = isteacher( $courseid, $userid); + $groupmode = groups_get_activity_groupmode($cm, $course); + + if (is_null($modinfo->groups)) { + $modinfo->groups = groups_get_user_groups($course->id); // load all my groups and cache it in modinfo + } + + $aname = format_string($cm->name,true); + foreach ($attempts as $attempt) { + if ($attempt->userid != $USER->id) { + if (!$grader) { + // grade permission required + continue; + } + + if ($groupmode == SEPARATEGROUPS and !$accessallgroups) { + $usersgroups = groups_get_all_groups($course->id, $attempt->userid, $cm->groupingid); + if (!is_array($usersgroups)) { + continue; + } + $usersgroups = array_keys($usersgroups); + $interset = array_intersect($usersgroups, $modinfo->groups[$cm->id]); + if (empty($intersect)) { + continue; + } + } + } + + $tmpactivity = new object(); + + $tmpactivity->type = 'game'; + $tmpactivity->cmid = $cm->id; + $tmpactivity->name = $aname; + $tmpactivity->sectionnum= $cm->sectionnum; + $tmpactivity->timestamp = $attempt->timefinish; + + $tmpactivity->content->attemptid = $attempt->id; + $tmpactivity->content->sumgrades = $attempt->score * $attempt->grade; + $tmpactivity->content->maxgrade = $attempt->grade; + $tmpactivity->content->attempt = $attempt->attempt; + + $tmpactivity->user->userid = $attempt->userid; + $tmpactivity->user->fullname = fullname($attempt, $viewfullnames); + $tmpactivity->user->picture = $attempt->picture; + + $activities[$index++] = $tmpactivity; + } + + return; +} + +function game_print_recent_mod_activity($activity, $courseid, $detail, $modnames) { + global $CFG; + + echo ''; + + echo "
      "; + print_user_picture($activity->user->userid, $courseid, $activity->user->picture); + echo ""; + + if ($detail) { + $modname = $modnames[$activity->type]; + echo '
      '; + echo "modpixpath/{$activity->type}/icon.gif\" ". + "class=\"icon\" alt=\"$modname\" />"; + echo "wwwroot}/mod/game/view.php?id={$activity->cmid}\">{$activity->name}"; + echo '
      '; + } + + echo '
      '; + echo get_string("attempt", "game")." {$activity->content->attempt}: "; + $grades = "({$activity->content->sumgrades} / {$activity->content->maxgrade})"; + echo "wwwroot}/mod/game/review.php?attempt={$activity->content->attemptid}\">$grades"; + echo '
      '; + + echo ''; + + echo "
      "; + + return; +} + + +/** + * Removes all grades from gradebook + * @param int $courseid + * @param string optional type + */ +function game_reset_gradebook($courseid, $type='') { + global $DB; + + $sql = "SELECT q.*, cm.idnumber as cmidnumber, q.course as courseid + FROM {game} q, {course_modules} cm, {modules} m + WHERE m.name='game' AND m.id=cm.module AND cm.instance=q.id AND q.course=$courseid"; + + if ($games = $DB->get_records_sql( $sql)) { + foreach ($games as $game) { + game_grade_item_update( $game, 'reset'); + } + } +} + +/** + * @uses FEATURE_GRADE_HAS_GRADE + * @return bool True if quiz supports feature + */ +function game_supports($feature) { + switch($feature) { + + case FEATURE_GRADE_HAS_GRADE: return true; + + case FEATURE_GROUPS: return true; + case FEATURE_GROUPINGS: return true; + case FEATURE_GROUPMEMBERSONLY: return true; + case FEATURE_MOD_INTRO: return false; + case FEATURE_COMPLETION_TRACKS_VIEWS: return true; + case FEATURE_COMPLETION_HAS_RULES: return true; + case FEATURE_GRADE_HAS_GRADE: return true; + case FEATURE_GRADE_OUTCOMES: return true; + case FEATURE_RATE: return false; + case FEATURE_BACKUP_MOODLE2: return true; + + default: return null; + } +} + +/** + * @global object + * @global stdClass + * @return array all other caps used in module + */ +function game_get_extra_capabilities() { + global $DB, $CFG; + + require_once($CFG->libdir.'/questionlib.php'); + $caps = question_get_all_capabilities(); + $reportcaps = $DB->get_records_select_menu('capabilities', 'name LIKE ?', array('quizreport/%'), 'id,name'); + $caps = array_merge($caps, $reportcaps); + $caps[] = 'moodle/site:accessallgroups'; + return $caps; +} + +/** + * Return a textual summary of the number of attemtps that have been made at a particular game, + * returns '' if no attemtps have been made yet, unless $returnzero is passed as true. + * + * @global stdClass + * @global object + * @global object + * @param object $game the game object. Only $game->id is used at the moment. + * @param object $cm the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment. + * @param boolean $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'. + * @param int $currentgroup if there is a concept of current group where this method is being called + * (e.g. a report) pass it in here. Default 0 which means no current group. + * @return string a string like "Attempts: 123", "Attemtps 123 (45 from your groups)" or + * "Attemtps 123 (45 from this group)". + */ +function game_num_attempt_summary($game, $cm, $returnzero = false, $currentgroup = 0) { + global $CFG, $USER, $DB; + + $numattempts = $DB->count_records('game_attempts', array('gameid'=> $game->id, 'preview'=>0)); + if ($numattempts || $returnzero) { + if (groups_get_activity_groupmode($cm)) { + $a->total = $numattempts; + if ($currentgroup) { + $a->group = $DB->count_records_sql('SELECT count(1) FROM ' . + '{game_attempts} qa JOIN ' . + '{groups_members} gm ON qa.userid = gm.userid ' . + 'WHERE gameid = ? AND preview = 0 AND groupid = ?', array($game->id, $currentgroup)); + return get_string('attemptsnumthisgroup', 'quiz', $a); + } else if ($groups = groups_get_all_groups($cm->course, $USER->id, $cm->groupingid)) { + list($usql, $params) = $DB->get_in_or_equal(array_keys($groups)); + $a->group = $DB->count_records_sql('SELECT count(1) FROM ' . + '{game_attempts} qa JOIN ' . + '{groups_members} gm ON qa.userid = gm.userid ' . + 'WHERE gameid = ? AND preview = 0 AND ' . + "groupid $usql", array_merge(array($game->id), $params)); + return get_string('attemptsnumyourgroups', 'quiz', $a); + } + } + return get_string('attemptsnum', 'quiz', $numattempts); + } + return ''; +} + +function game_format_score($game, $score) { + return format_float($game->grade * $score / 100, $game->decimalpoints); +} + +function game_format_grade($game, $grade) { + return format_float($grade, $game->decimalpoints); +} + +/** + * @return the options for calculating the quiz grade from the individual attempt grades. + */ +function game_get_grading_options() { + return array ( + GAME_GRADEHIGHEST => get_string('gradehighest', 'quiz'), + GAME_GRADEAVERAGE => get_string('gradeaverage', 'quiz'), + GAME_ATTEMPTFIRST => get_string('attemptfirst', 'quiz'), + GAME_ATTEMPTLAST => get_string('attemptlast', 'quiz')); +} + +/** + * This fucntion extends the global navigaiton for the site. + * It is important to note that you should not rely on PAGE objects within this + * body of code as there is no guarantee that during an AJAX request they are + * available + * + * @param navigation_node $gamenode The game node within the global navigation + * @param stdClass $course The course object returned from the DB + * @param stdClass $module The module object returned from the DB + * @param stdClass $cm The course module isntance returned from the DB + */ +function game_extend_navigation($gamenode, $course, $module, $cm) { + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + + if (!has_capability('mod/game:viewreports', $context)) + return; + + if (has_capability('mod/game:view', $context)) { + $url = new moodle_url('/mod/game/view.php', array('id'=>$cm->id)); + $gamenode->add(get_string('info', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/info', '')); + } + + if (has_capability('mod/game:manage', $context)) { + $url = new moodle_url('/course/modedit.php', array('update' => $cm->id, 'return' => true, 'sesskey' => sesskey())); + $gamenode->add(get_string('edit', 'moodle', ''), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('t/edit', '')); + } + + /* if (has_capability('mod/game:viewreports', $context)) { + $url = new moodle_url('/mod/game/report.php', array('q'=>$cm->instance)); + $reportnode = $gamenode->add(get_string('results', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + } */ + + if (has_capability('mod/game:viewreports', $context)) { + $url = new moodle_url('/mod/game/showanswers.php', array('q'=>$cm->instance)); + $reportnode = $gamenode->add(get_string('showanswers', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + } + + if (has_capability('mod/game:viewreports', $context)) { + $url = new moodle_url('/mod/game/showattempts.php', array('q'=>$cm->instance)); + $reportnode = $gamenode->add(get_string('showattempts', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('f/explore', '')); + } + + + if (has_capability('mod/game:viewreports', $context)) + { + switch( $module->gamekind){ + case 'bookquiz': + $url = new moodle_url('/mod/game/bookquiz/questions.php', array('q'=>$cm->instance)); + $exportnode = $gamenode->add( get_string('bookquiz_questions', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + break; + case 'hangman': + $url = new moodle_url('', null); + $exportnode = $gamenode->add( get_string('export', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')); + + $url = new moodle_url('/mod/game/export.php', array( 'id' => $cm->id,'courseid'=>$course->id, 'target' => 'html')); + $exportnode->add( get_string('export_to_html', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + + $url = new moodle_url('/mod/game/export.php', array( 'id' => $cm->id,'courseid'=>$course->id, 'target' => 'javame')); + $exportnode->add( get_string('export_to_javame', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + break; + case 'snakes': + case 'cross': + case 'millionaire': + $url = new moodle_url('/mod/game/export.php', array( 'id' => $cm->id,'courseid'=>$course->id, 'target' => 'html')); + $gamenode->add(get_string('export_to_html', 'game'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/item', '')); + break; + } + } +} + +/** + * Returns an array of game type objects to construct + * menu list when adding new game + * + */ +function game_get_types(){ + global $DB; + + $types = array(); + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game_group_start"; + $type->typestr = '--'.get_string( 'modulenameplural', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=hangman"; + $type->typestr = get_string('game_hangman', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=cross"; + $type->typestr = get_string('game_cross', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=cryptex"; + $type->typestr = get_string('game_cryptex', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=millionaire"; + $type->typestr = get_string('game_millionaire', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=sudoku"; + $type->typestr = get_string('game_sudoku', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=snakes"; + $type->typestr = get_string('game_snakes', 'game'); + $types[] = $type; + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=hiddenpicture"; + $type->typestr = get_string('game_hiddenpicture', 'game'); + $types[] = $type; + + if($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')){ + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=bookquiz"; + $type->typestr = get_string('game_bookquiz', 'game'); + $types[] = $type; + } + + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game_group_end"; + $type->typestr = '--'; + $types[] = $type; + + return $types; + +} + +function mod_game_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) +{ + global $CFG, $DB; + + if ($context->contextlevel != CONTEXT_MODULE) { + return false; + } + + require_course_login($course, true, $cm); + + if( $filearea == 'questiontext') + { + $questionid = $args[ 0]; + $file = $args[ 1]; + + if (!$contextcourse = get_context_instance(CONTEXT_COURSE, $course->id)) { + print_error('nocontext'); + } + $a = array( 'component' => 'question', 'filearea' => 'questiontext', + 'itemid' => $questionid, 'filename' => $file, 'contextid' => $contextcourse->id); + $rec = $DB->get_record( 'files', $a); + + $fs = get_file_storage(); + if (!$file = $fs->get_file_by_hash($rec->pathnamehash) or $file->is_directory()) { + return false; + } + + // finally send the file + send_stored_file($file, 0, 0, true); // download MUST be forced - security! + }else if( $filearea == 'answer') + { + $answerid = $args[ 0]; + $file = $args[ 1]; + + if (!$contextcourse = get_context_instance(CONTEXT_COURSE, $course->id)) { + print_error('nocontext'); + } + $rec = $DB->get_record( 'files', array( 'component' => 'question', 'filearea' => 'answer', + 'itemid' => $answerid, 'filename' => $file, 'contextid' => $contextcourse->id)); + + $fs = get_file_storage(); + if (!$file = $fs->get_file_by_hash($rec->pathnamehash) or $file->is_directory()) { + return false; + } + + // finally send the file + send_stored_file($file, 0, 0, true); // download MUST be forced - security! + } + + $filearea = $args[ 0]; + $filename = $args[ 1]; + + $fs = get_file_storage(); + $relativepath = implode('/', $args); + $fullpath = "/$context->id/mod_game/$filearea/$cm->instance/$filename"; + if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { + return false; + } + + // finally send the file + send_stored_file($file, 0, 0, true); // download MUST be forced - security! +} + +/** + * Implementation of the function for printing the form elements that control + * whether the course reset functionality affects the Game. + * @param object $mform form passed by reference + */ +function game_reset_course_form_definition(&$mform) { + $mform->addElement('header', 'gameheader', get_string('modulenameplural', 'game')); + $mform->addElement('checkbox', 'reset_game_all', get_string('reset_game_all','game')); + + $mform->addElement('checkbox', 'reset_game_deleted_course', get_string('reset_game_deleted_course', 'game')); +} + +/** + * Course reset form defaults. + * @return array + */ +function game_reset_course_form_defaults($course) { + return array('reset_game_all'=>0, 'reset_game_deleted_course' => 0); +} + +/** + * Actual implementation of the reset course functionality, delete all the + * Game responses for course $data->courseid. + * + * @global object + * @param $data the data submitted from the reset course. + * @return array status array + */ +function game_reset_userdata($data) { + global $DB; + + $componentstr = get_string('modulenameplural', 'game'); + $status = array(); + $fs = get_file_storage(); + + for($i=1; $i <= 2; $i++){ + if( $i == 1){ + if (empty($data->reset_game_all)) + continue; + $allgamessql = 'SELECT g.id FROM {game} g WHERE g.course = '.$data->courseid; + $allattemptssql = 'SELECT ga.id FROM {game} g LEFT JOIN {game_attempts} ga ON g.id = ga.gameid WHERE g.course = '.$data->courseid; + $newstatus = array('component'=>$componentstr, 'item'=>get_string('reset_game_all', 'game'), 'error'=>false); + }else if( $i == 2) + { + if (empty($data->reset_game_deleted_course)) + continue; + $allgamessql = 'SELECT g.id FROM {game} g WHERE NOT EXISTS( SELECT * FROM {course} c WHERE c.id = g.course)'; + $allattemptssql = 'SELECT ga.id FROM {game_attempts} ga WHERE NOT EXISTS( SELECT * FROM {game} g WHERE ga.gameid = g.id)'; + $newstatus = array('component'=>$componentstr, 'item'=>get_string('reset_game_deleted_course', 'game'), 'error'=>false); + } + + $recs = $DB->get_recordset_sql($allgamessql); + if ($recs->valid()) { + foreach ($recs as $rec) { + if (!$cm = get_coursemodule_from_instance('game', $rec->id)) { + continue; + } + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + $fs->delete_area_files($context->id, 'mod_game', 'gnakes_file'); + $fs->delete_area_files($context->id, 'mod_game', 'gnakes_board'); + + //reset grades + $game = $DB->get_record_select( 'game', 'id='.$rec->id, null,'id,name,course '); + $grades = NULL; + $params = array('itemname'=>$game->name, 'idnumber'=>0); + $params['reset'] = true; + grade_update('mod/game', $game->course, 'mod', 'game', $game->id, 0, $grades, $params); + } + } + + $DB->delete_records_select('game_bookquiz', "id IN ($allgamessql)"); + $DB->delete_records_select('game_bookquiz_chapters', "attemptid IN ($allattemptssql)"); + $DB->delete_records_select('game_bookquiz_questions', "gameid IN ($allgamessql)"); + $DB->delete_records_select('game_cross', "id IN ($allgamessql)"); + $DB->delete_records_select('game_cryptex', "id IN ($allgamessql)"); + $DB->delete_records_select('game_export_html', "id IN ($allgamessql)"); + $DB->delete_records_select('game_export_javame', "id IN ($allgamessql)"); + $DB->delete_records_select('game_grades', "gameid IN ($allgamessql)"); + $DB->delete_records_select('game_hangman', "id IN ($allgamessql)"); + $DB->delete_records_select('game_hiddenpicture', "id IN ($allgamessql)"); + $DB->delete_records_select('game_millionaire', "id IN ($allgamessql)"); + $DB->delete_records_select('game_queries', "gameid IN ($allgamessql)"); + $DB->delete_records_select('game_repetitions', "gameid IN ($allgamessql)"); + $DB->delete_records_select('game_snakes', "id IN ($allgamessql)"); + $DB->delete_records_select('game_sudoku', "id IN ($allgamessql)"); + + if( $i == 2) + $DB->delete_records_select('game_attempts', "NOT EXISTS (SELECT * FROM {game} g WHERE {game_attempts}.gameid=g.id)"); + else + $DB->delete_records_select('game_attempts', "gameid IN ($allgamessql)"); + + $status[] = $newstatus; + } + + if (empty($data->reset_game_deleted_course)) + return $status; + + //Delete data from deleted games + $a = array( 'bookquiz', 'cross', 'cryptex', 'grades', 'bookquiz_questions', 'export_html', 'export_javame', 'hangman', + 'hiddenpicture', 'millionaire', 'snakes', 'sudoku'); + foreach( $a as $table) + $DB->delete_records_select( 'game_'.$table, "NOT EXISTS( SELECT * FROM {game} g WHERE {game_$table}.id=g.id)"); + + //gameid + $a = array( 'grades', 'queries', 'repetitions'); + foreach( $a as $table) + $DB->delete_records_select( 'game_'.$table, "NOT EXISTS( SELECT * FROM {game} g WHERE {game_$table}.gameid=g.id)"); + + //attempts + $a = array( 'bookquiz_chapters'); + foreach( $a as $table) + $DB->delete_records_select( 'game_'.$table, "NOT EXISTS( SELECT * FROM {game_attempts} ga WHERE {game_$table}.attemptid=ga.id)"); + + return $status; +} + diff --git a/locallib.php b/locallib.php new file mode 100644 index 0000000..fee0c40 --- /dev/null +++ b/locallib.php @@ -0,0 +1,1896 @@ +dirroot . '/mod/game/lib.php'); +require_once($CFG->dirroot . '/mod/quiz/locallib.php'); +/// CONSTANTS /////////////////////////////////////////////////////////////////// + +/**#@+ +* Options determining how the grades from individual attempts are combined to give +* the overall grade for a user +*/ + +define( "GAME_GRADEMETHOD_HIGHEST", "1"); +define( "GAME_GRADEMETHOD_AVERAGE", "2"); +define( "GAME_GRADEMETHOD_FIRST", "3"); +define( "GAME_GRADEMETHOD_LAST", "4"); + +$GAME_GRADE_METHOD = array ( GAME_GRADEMETHOD_HIGHEST => get_string("gradehighest", "game"), + GAME_GRADEMETHOD_AVERAGE => get_string("gradeaverage", "game"), + GAME_GRADEMETHOD_FIRST => get_string("attemptfirst", "game"), + GAME_GRADEMETHOD_LAST => get_string("attemptlast", "game")); + +define( "CONST_GAME_TRIES_REPETITION", "3"); + +/**#@-*/ + + +function game_upper( $str, $lang='') +{ + $str = textlib::strtoupper( $str); + + $strings = get_string_manager()->load_component_strings( 'game', ($lang == '' ? 'en' : $lang)); + if( !isset( $strings[ 'convertfrom'])) + return $str; + if( !isset( $strings[ 'convertto'])) + return $str; + + $from = $strings[ 'convertfrom']; + $to = $strings[ 'convertto']; + $len = textlib::strlen( $from); + for($i=0; $i < $len; $i++){ + $str = str_replace( textlib::substr( $from, $i, 1), textlib::substr( $to, $i, 1), $str); + } + + return $str; +} + + +function game_showselectcontrol( $name, $a, $input, $events=''){ + $ret = "\r\n"; + + return $ret; +} + +function game_showcheckbox( $name, $value) +{ + $a = array(); + $a[ 0] = get_string( 'no'); + $a[ 1] = get_string( 'yes'); + + return game_showselectcontrol( $name, $a, $value); + + $ret = 'sourcemodule) + { + case 'glossary': + return game_question_shortanswer_glossary( $game, $allowspaces, $use_repetitions); + case 'quiz': + return game_question_shortanswer_quiz( $game, $allowspaces, $use_repetitions); + case 'question': + return game_question_shortanswer_question( $game, $allowspaces, $use_repetitions); + } + + return false; +} + +//used by hangman +function game_question_shortanswer_glossary( $game, $allowspaces, $use_repetitions) +{ + global $DB; + + if( $game->glossaryid == 0){ + print_error( get_string( 'must_select_glossary', 'game')); + } + + $select = "glossaryid={$game->glossaryid}"; + $table = '{glossary_entries} ge'; + if( $game->glossarycategoryid){ + $table .= ',{glossary_entries_categories} gec'; + $select .= ' AND gec.entryid = ge.id '. + " AND gec.categoryid = {$game->glossarycategoryid}"; + } + if( $allowspaces == false){ + $select .= " AND concept NOT LIKE '% %' "; + } + + if( ($id = game_question_selectrandom( $game, $table, $select, 'ge.id', $use_repetitions)) == false) + return false; + + $sql = 'SELECT id, concept as answertext, definition as questiontext, id as glossaryentryid, 0 as questionid, glossaryid, attachment, 0 as answerid'. + " FROM {glossary_entries} ge WHERE id = $id"; + if( ($rec = $DB->get_record_sql( $sql)) == false) + return false; + + if( $rec->attachment != ''){ + $rec->attachment = "glossary/{$game->glossaryid}/$rec->id/$rec->attachment"; + } + + return $rec; +} + +//used by hangman +function game_question_shortanswer_quiz( $game, $allowspaces, $use_repetitions) +{ + global $DB; + + if( $game->quizid == 0){ + print_error( get_string( 'must_select_quiz', 'game')); + } + + $select = "qtype='shortanswer' AND quiz='$game->quizid' ". + " AND qqi.question=q.id"; + $table = "{question} q,{quiz_question_instances} qqi"; + $fields = "q.id"; + + if( ($id = game_question_selectrandom( $game, $table, $select, $fields, $use_repetitions)) == false) + return false; + + $select = "q.id=$id AND qa.question=$id". + " AND q.hidden=0 AND qtype='shortanswer'"; + $table = "{question} q,{question_answers} qa"; + $fields = "qa.id as answerid, q.id, q.questiontext as questiontext, ". + "qa.answer as answertext, q.id as questionid, ". + "0 as glossaryentryid, '' as attachment"; + + //Maybe there are more answers to one question. I use as correct the one with bigger fraction + $sql = "SELECT $fields FROM $table WHERE $select ORDER BY fraction DESC"; + if( ($recs=$DB->get_records_sql( $sql, null, 0, 1)) == false){ + return false; + } + foreach( $recs as $rec){ + return $rec; + } +} + +//used by hangman +function game_question_shortanswer_question( $game, $allowspaces, $use_repetitions) +{ + global $DB; + + if( $game->questioncategoryid == 0){ + print_error( get_string( 'must_select_questioncategory', 'game')); + } + + $select = 'category='.$game->questioncategoryid; + if( $game->subcategories){ + $cats = question_categorylist( $game->questioncategoryid); + if( count( $cats) > 0){ + $s = implode( ',', $cats); + $select = 'category in ('.$s.')'; + } + } + $select .= " AND qtype='shortanswer'"; + + $table = '{question} q'; + $fields = 'q.id'; + + if( ($id = game_question_selectrandom( $game, $table, $select, $fields, $use_repetitions)) == false) + return false; + + $select = "q.id=$id AND qa.question=$id". + " AND q.hidden=0 AND qtype='shortanswer'"; + $table = "{question} q,{question_answers} qa"; + $fields = "qa.id as answerid, q.id, q.questiontext as questiontext, ". + "qa.answer as answertext, q.id as questionid, ". + "0 as glossaryentryid, '' as attachment"; + + //Maybe there are more answers to one question. I use as correct the one with bigger fraction + $sql = "SELECT $fields FROM $table WHERE $select ORDER BY fraction DESC"; + if( ($recs = $DB->get_records_sql( $sql, null, 0, 1)) == false){ + return false; + } + foreach( $recs as $rec){ + return $rec; + } +} + +//used by millionaire, game_question_shortanswer_quiz, hidden picture +function game_question_selectrandom( $game, $table, $select, $id_fields='id', $use_repetitions=true) +{ + global $DB, $USER; + + $count = $DB->get_field_sql( "SELECT COUNT(*) FROM $table WHERE $select"); + + if( $count == 0) + return false; + + $min_num = 0; + $min_id = 0; + for($i=1; $i <= CONST_GAME_TRIES_REPETITION; $i++){ + $sel = mt_rand(0, $count-1); + + $sql = "SELECT $id_fields,$id_fields FROM ".$table." WHERE $select"; + if( ($recs = $DB->get_records_sql( $sql, null, $sel, 1)) == false){ + return false; + } + + $id = 0; + foreach( $recs as $rec){ + $id = $rec->id; + } + if( $min_id == 0){ + $min_id = $id; + } + + if( $use_repetitions == false){ + return $id; + } + + if( $count == 1){ + break; + } + + $questionid = $glossaryentryid = 0; + if( $game->sourcemodule == 'glossary') + $glossaryentryid = $id; + else + $questionid = $id; + + $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $questionid, 'glossaryentryid' => $glossaryentryid); + if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec->r < $min_num) or ($min_num == 0)){ + $min_num = $rec->r; + $min_id = $id; + } + }else + { + $min_id = $questionid; + break; + } + + } + + if( $game->sourcemodule == 'glossary') + game_update_repetitions( $game->id, $USER->id, 0, $min_id); + else + game_update_repetitions( $game->id, $USER->id, $min_id, 0); + + return $min_id; +} + +function game_update_repetitions( $gameid, $userid, $questionid, $glossaryentryid){ + global $DB; + + $a = array( 'gameid' => $gameid, 'userid' => $userid, 'questionid' => $questionid, 'glossaryentryid' => $glossaryentryid); + if( ($rec = $DB->get_record( 'game_repetitions', $a, 'id,repetitions r')) != false){ + $updrec = new stdClass(); + $updrec->id = $rec->id; + $updrec->repetitions = $rec->r + 1; + if( !$DB->update_record( 'game_repetitions', $updrec)){ + print_error("Update page: can't update game_repetitions id={$updrec->id}"); + } + }else + { + $newrec = new stdClass(); + $newrec->gameid = $gameid; + $newrec->userid = $userid; + $newrec->questionid = $questionid; + $newrec->glossaryentryid = $glossaryentryid; + $newrec->repetitions = 1; + + if( $newrec->questionid == ''){ + $newrec->questionid = 0; + } + if( $newrec->glossaryentryid == ''){ + $newrec->glossaryentryid = 0; + } + + if (!$DB->insert_record( 'game_repetitions', $newrec)){ + print_r( $newrec); + print_error("Insert page: new page game_repetitions not inserted"); + } + } +} + +//used by sudoku +function game_questions_selectrandom( $game, $count=1) +{ + global $DB; + + switch( $game->sourcemodule) + { + case 'quiz': + + if( $game->quizid == 0){ + print_error( get_string( 'must_select_quiz', 'game')); + } + + $table = '{question} q, {quiz_question_instances} qqi'; + $select = " qqi.quiz=$game->quizid". + " AND qqi.question=q.id ". + " AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')". + " AND q.hidden=0"; +//todo 'match' + $field = "q.id as id"; + + $table2 = 'question'; + $fields2 = 'id as questionid,0 as glossaryentryid,qtype'; + break; + case 'glossary': + if( $game->glossaryid == 0){ + print_error( get_string( 'must_select_glossary', 'game')); + } + $table = '{glossary_entries} ge'; + $select = "glossaryid='$game->glossaryid' "; + if( $game->glossarycategoryid){ + $table .= ',{glossary_entries_categories} gec'; + $select .= " AND gec.entryid = ge.id ". + " AND gec.categoryid = {$game->glossarycategoryid}"; + } + $field = 'ge.id'; + $table2 = 'glossary_entries'; + $fields2 = 'id as glossaryentryid, 0 as questionid'; + break; + case 'question': + if( $game->questioncategoryid == 0){ + print_error( get_string( 'must_select_questioncategory', 'game')); + } + $table = '{question} q'; + + //inlcude subcategories + $select = 'category='.$game->questioncategoryid; + if( $game->subcategories){ + $cats = question_categorylist( $game->questioncategoryid); + if( count( $cats)) + $select = 'category in ('.implode( ',', $cats).')'; + } + + $select .= " AND q.qtype in ('shortanswer', 'truefalse', 'multichoice') ". + "AND q.hidden=0"; +//todo 'match' + $field = "id"; + + $table2 = 'question'; + $fields2 = 'id as questionid,0 as glossaryentryid'; + break; + default: + print_error( 'No sourcemodule defined'); + break; + } + + $ids = game_questions_selectrandom_detail( $table, $select, $field, $count); + if( $ids === false){ + print_error( get_string( 'no_questions', 'game')); + } + + if( count( $ids) > 1){ + //randomize the array + shuffle( $ids); + } + + $ret = array(); + foreach( $ids as $id) + { + if( $recquestion = $DB->get_record( $table2, array( 'id' => $id), $fields2)){ + $new = new stdClass(); + $new->questionid = (int )$recquestion->questionid; + $new->glossaryentryid = (int )$recquestion->glossaryentryid; + $ret[] = $new; + } + } + + return $ret; +} + +//used by game_questions_selectrandom +function game_questions_selectrandom_detail( $table, $select, $id_field="id", $count=1) +{ + global $DB; + + $sql = "SELECT $id_field FROM $table WHERE $select"; + if( ($recs=$DB->get_records_sql( $sql)) == false) + return false; + + //the array contains the ids of all questions + $a = array(); + foreach( $recs as $rec){ + $a[ $rec->id] = $rec->id; + } + + if( $count >= count( $a)){ + return $a; + }else + { + $id = array_rand( $a, $count); + return ( $count == 1 ? array( $id) : $id); + } +} + +//Tries to detect the language of word +function game_detectlanguage( $word){ + global $CFG; + + $langs = get_string_manager()->get_list_of_translations(); + + //English has more priority + if( array_key_exists( 'en', $langs)) + { + unset( $langs[ 'en']); + $langs[ ''] = ''; + } + ksort( $langs); + $langs_installed = get_string_manager()->get_list_of_translations(); + + foreach( $langs as $lang => $name) + { + if( $lang == '') + $lang = 'en'; + + if( !array_key_exists( $lang, $langs_installed)) + continue; + + $strings = get_string_manager()->load_component_strings( 'game', $lang); + if( isset( $strings[ 'lettersall'])) + { + $letters = $strings[ 'lettersall']; + $word2 = game_upper( $word, $lang); + + if( hangman_existall( $word2, $letters)) + return $lang; + } + } + + return false; +} + +//The words maybe are in two languages e.g. greek or english +//so I try to find the correct one. +function game_getallletters( $word, $lang='') +{ + for(;;) + { + $strings = get_string_manager()->load_component_strings( 'game', ($lang == '' ? 'en' : $lang)); + if( isset( $strings[ 'lettersall'])) + { + $letters = $strings[ 'lettersall']; + $word2 = game_upper( $word, $lang); + if( hangman_existall( $word2, $letters)) + return $letters; + } + + if( $lang == '') + break; + else + $lang = ''; + } + + + return ''; +} + + +function hangman_existall( $str, $strfind) +{ + $n = textlib::strlen( $str); + for( $i=0; $i < $n; $i++) + { + $pos = textlib::strpos( $strfind, textlib::substr( $str, $i, 1)); + if( $pos === false) + return false; + } + + return true; +} + +//used by cross +function game_questions_shortanswer( $game) +{ + switch( $game->sourcemodule) + { + case 'glossary': + $recs = game_questions_shortanswer_glossary( $game); + break; + case 'quiz'; + $recs = game_questions_shortanswer_quiz( $game); + break; + case 'question'; + $recs = game_questions_shortanswer_question( $game); + break; + } + + return $recs; +} + +//used by cross +function game_questions_shortanswer_glossary( $game) +{ + global $DB; + + $select = "glossaryid={$game->glossaryid}"; + $table = '{glossary_entries} ge'; + if( $game->glossarycategoryid){ + $table .= ',{glossary_entries_categories} gec'; + $select .= ' AND gec.entryid = ge.id '. + ' AND gec.categoryid = '.$game->glossarycategoryid; + } + + $sql = 'SELECT ge.id, concept as answertext, definition as questiontext, ge.id as glossaryentryid, 0 as questionid, attachment '. + " FROM $table WHERE $select"; + + return $DB->get_records_sql( $sql); + +} +//used by cross +function game_questions_shortanswer_quiz( $game) +{ + global $DB; + + if( $game->quizid == 0){ + print_error( get_string( 'must_select_quiz', 'game')); + } + + $select = "qtype='shortanswer' AND quiz='$game->quizid' ". + " AND qqi.question=q.id". + " AND qa.question=q.id". + " AND q.hidden=0"; + $table = "{question} q,{quiz_question_instances} qqi,{question_answers} qa"; + $fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ". + "qa.answer as answertext, q.id as questionid,". + " 0 as glossaryentryid,'' as attachment"; + + return game_questions_shortanswer_question_fraction( $table, $fields, $select); +} + +//used by cross +function game_questions_shortanswer_question( $game) +{ + if( $game->questioncategoryid == 0){ + print_error( get_string( 'must_select_questioncategory', 'game')); + } + + //include subcategories + $select = 'q.category='.$game->questioncategoryid; + if( $game->subcategories){ + $cats = question_categorylist( $game->questioncategoryid); + if( strpos( $cats, ',') > 0){ + $select = 'q.category in ('.$cats.')'; + } + } + + $select .= " AND qtype='shortanswer' ". + " AND qa.question=q.id". + " AND q.hidden=0"; + $table = "{question} q,{question_answers} qa"; + $fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ". + "qa.answer as answertext, q.id as questionid"; + + return game_questions_shortanswer_question_fraction( $table, $fields, $select); +} + +function game_questions_shortanswer_question_fraction( $table, $fields, $select) +{ + global $DB; + + $sql = "SELECT $fields FROM ".$table." WHERE $select ORDER BY fraction DESC"; + + $recs = $DB->get_records_sql( $sql); + if( $recs == false){ + print_error( get_string( 'no_questions', 'game')); + } + + $recs2 = array(); + $map = array(); + foreach( $recs as $rec){ + if( array_key_exists( $rec->questionid, $map)){ + continue; + } + $rec2 = new stdClass(); + $rec2->id = $rec->id; + $rec2->questiontext = $rec->questiontext; + $rec2->answertext = $rec->answertext; + $rec2->questionid = $rec->questionid; + $rec2->glossaryentryid = 0; + $rec2->attachment = ''; + $recs2[] = $rec2; + + $map[ $rec->questionid] = $rec->questionid; + } + + return $recs2; +} + + + function game_setchar( &$s, $pos, $char) + { + $ret = ""; + + if( $pos > 0){ + $ret .= textlib::substr( $s, 0, $pos); + } + + $s = $ret . $char . textlib::substr( $s, $pos+1); + } + + + function game_insert_record( $table, $rec) + { + global $DB; + + if( $DB->get_record($table, array('id' => $rec->id), 'id,id') == false){ + $sql = 'INSERT INTO {'.$table.'}(id) VALUES('.$rec->id.')'; + if( !$DB->execute( $sql)){ + print_error( "Cannot insert an empty $table with id=$rec->id"); + return false; + } + } + if( isset( $rec->question)){ + $temp = $rec->question; + $rec->question = addslashes( $rec->question); + } + $ret = $DB->update_record( $table, $rec); + + if( isset( $rec->question)){ + $rec->question = $temp; + } + + return $ret; + } + + //if score is negative doesn't update the record + //score is between 0 and 1 + function game_updateattempts( $game, $attempt, $score, $finished) + { + global $DB, $USER; + + if( $attempt != false){ + $updrec = new stdClass(); + $updrec->id = $attempt->id; + $updrec->timelastattempt = time(); + $updrec->lastip = getremoteaddr(); + if( isset( $_SERVER[ 'REMOTE_HOST'])){ + $updrec->lastremotehost = $_SERVER[ 'REMOTE_HOST']; + } + else{ + $updrec->lastremotehost = gethostbyaddr( $updrec->lastip); + } + $updrec->lastremotehost = substr( $updrec->lastremotehost, 0, 50); + + if( $score >= 0){ + $updrec->score = $score; + } + + if( $finished){ + $updrec->timefinish = $updrec->timelastattempt; + } + + $updrec->attempts = $attempt->attempts + 1; + + if( !$DB->update_record( 'game_attempts', $updrec)){ + print_error( "game_updateattempts: Can't update game_attempts id=$updrec->id"); + } + + // update grade item and send all grades to gradebook + game_grade_item_update( $game); + game_update_grades( $game); + } + + //Update table game_grades + if( $finished){ + game_save_best_score( $game); + } + } + + function game_updateattempts_maxgrade( $game, $attempt, $grade, $finished) + { + global $DB; + + $recgrade = $DB->get_field( 'game_attempts', 'score', array( 'id' => $attempt->id)); + + if( $recgrade > $grade){ + $grade = -1; //don't touch the grade + } + + game_updateattempts( $game, $attempt, $grade, $finished); + } + + function game_update_queries( $game, $attempt, $query, $score, $studentanswer, $updatetries=false) + { + global $DB, $USER; + + if( $query->id != 0){ + $select = "id=$query->id"; + }else + { + $select = "attemptid = $attempt->id AND sourcemodule = '{$query->sourcemodule}'"; + switch( $query->sourcemodule) + { + case 'quiz': + $select .= " AND questionid='$query->questionid' "; + break; + case 'glossary': + $select .= " AND glossaryentryid='$query->glossaryentryid'"; + break; + } + } + + if( ($recq = $DB->get_record_select( 'game_queries', $select)) === false) + { + $recq = new stdClass(); + $recq->gamekind = $game->gamekind; + $recq->gameid = $attempt->gameid; + $recq->userid = $attempt->userid; + $recq->attemptid = $attempt->id; + $recq->sourcemodule = $query->sourcemodule; + $recq->questionid = $query->questionid; + $recq->glossaryentryid = $query->glossaryentryid; + if ($updatetries) + $recq->tries = 1; + + if (!($recq->id = $DB->insert_record( 'game_queries', $recq))){ + print_error( 'Insert page: new page game_queries not inserted'); + } + } + + $updrec = new stdClass(); + $updrec->id = $recq->id; + $updrec->timelastattempt = time(); + + if( $score >= 0){ + $updrec->score = $score; + } + + if( $studentanswer != ''){ + $updrec->studentanswer = $studentanswer; + } + + if ($updatetries) + $updrec->tries = $recq->tries + 1; + + if (!($DB->update_record( 'game_queries', $updrec))){ + print_error( "game_update_queries: not updated id=$updrec->id"); + } + } + + + function game_getattempt( $game, &$detail, $autoadd=false) + { + global $DB, $USER; + + $select = "gameid=$game->id AND userid=$USER->id and timefinish=0 "; + if( $USER->id == 1){ + $key = 'mod/game:instanceid'.$game->id; + if( array_key_exists( $key, $_SESSION)){ + $select .= ' AND id="'.$_SESSION[ $key].'"'; + }else{ + $select .= ' AND id=-1'; + } + } + + if( ($recs=$DB->get_records_select( 'game_attempts', $select))){ + foreach( $recs as $attempt){ + if( $USER->id == 1){ + $_SESSION[ $key] = $attempt->id; + } + + $detail = $DB->get_record( 'game_'.$game->gamekind, array( 'id' => $attempt->id)); + + return $attempt; + } + }; + + if( $autoadd) + { + game_addattempt( $game); + return game_getattempt( $game, $detail, false); + } + + return false; + } + +/** + * @param integer $gameid the game id. + * @param integer $userid the userid. + * @param string $status 'all', 'finished' or 'unfinished' to control + * @return an array of all the user's attempts at this game. Returns an empty array if there are none. + */ +function game_get_user_attempts( $gameid, $userid, $status = 'finished') { + global $DB; + + $status_condition = array( + 'all' => '', + 'finished' => ' AND timefinish > 0', + 'unfinished' => ' AND timefinish = 0' + ); + if ($attempts = $DB->get_records_select( 'game_attempts', + "gameid = ? AND userid = ? AND preview = 0" . $status_condition[$status], + array( $gameid, $userid), 'attempt ASC')) { + return $attempts; + } else { + return array(); + } +} + + +/** + * Returns an unfinished attempt (if there is one) for the given + * user on the given game. This function does not return preview attempts. + * + * @param integer $gameid the id of the game. + * @param integer $userid the id of the user. + * + * @return mixed the unfinished attempt if there is one, false if not. + */ +function game_get_user_attempt_unfinished( $gameid, $userid) { + $attempts = game_get_user_attempts( $gameid, $userid, 'unfinished'); + if ($attempts) { + return array_shift($attempts); + } else { + return false; + } +} + +/** + * Get the best current score for a particular user in a game. + * + * @param object $game the game object. + * @param integer $userid the id of the user. + * @return float the user's current grade for this game. + */ +function game_get_best_score($game, $userid) { + global $DB; + + $score = $DB->get_field( 'game_grades', 'score', array( 'gameid' => $game->id, 'userid' => $userid)); + + // Need to detect errors/no result, without catching 0 scores. + if (is_numeric($score)) { + return $score; + } else { + return NULL; + } +} + +function game_get_best_grade($game, $userid) { + $score = game_get_best_score( $game, $userid); + + if( is_numeric( $score)){ + return round( $score * $game->grade, $game->decimalpoints); + }else + { + return NULL; + } +} + + +function game_score_to_grade($score, $game) { + if ($score) { + return round($score*$game->grade, $game->decimalpoints); + } else { + return 0; + } +} + +/** + * Determine review options + * + * @param object $game the game instance. + * @param object $attempt the attempt in question. + * @param $context the roles and permissions context, + * normally the context for the game module instance. + * + * @return object an object with boolean fields responses, scores, feedback, + * correct_responses, solutions and general feedback + */ +function game_get_reviewoptions($game, $attempt, $context=null) { + + $options = new stdClass; + $options->readonly = true; + // Provide the links to the question review and comment script + $options->questionreviewlink = '/mod/game/reviewquestion.php'; + + if ($context /* && has_capability('mod/game:viewreports', $context) */ and !$attempt->preview) { + // The teacher should be shown everything except during preview when the teachers + // wants to see just what the students see + $options->responses = true; + $options->scores = true; + $options->feedback = true; + $options->correct_responses = true; + $options->solutions = false; + $options->generalfeedback = true; + $options->overallfeedback = true; + + // Show a link to the comment box only for closed attempts + if ($attempt->timefinish) { + $options->questioncommentlink = '/mod/game/comment.php'; + } + } else { + if (((time() - $attempt->timefinish) < 120) || $attempt->timefinish==0) { + $game_state_mask = GAME_REVIEW_IMMEDIATELY; + } else if (!$game->timeclose or time() < $game->timeclose) { + $game_state_mask = GAME_REVIEW_OPEN; + } else { + $game_state_mask = GAME_REVIEW_CLOSED; + } + $options->responses = ($game->review & $game_state_mask & GAME_REVIEW_RESPONSES) ? 1 : 0; + $options->scores = ($game->review & $game_state_mask & GAME_REVIEW_SCORES) ? 1 : 0; + $options->feedback = ($game->review & $game_state_mask & GAME_REVIEW_FEEDBACK) ? 1 : 0; + $options->correct_responses = ($game->review & $game_state_mask & GAME_REVIEW_ANSWERS) ? 1 : 0; + $options->solutions = ($game->review & $game_state_mask & GAME_REVIEW_SOLUTIONS) ? 1 : 0; + $options->generalfeedback = ($game->review & $game_state_mask & GAME_REVIEW_GENERALFEEDBACK) ? 1 : 0; + $options->overallfeedback = $attempt->timefinish && ($game->review & $game_state_mask & GAME_REVIEW_FEEDBACK); + } + + return $options; +} + + +function game_compute_attempt_layout( $game, &$attempt) +{ + global $DB; + + $ret = ''; + $recs = $DB->get_records_select( 'game_queries', "attemptid=$attempt->id", null, '', 'id,questionid,sourcemodule,glossaryentryid'); + if( $recs){ + foreach( $recs as $rec){ + if( $rec->sourcemodule == 'glossary'){ + $ret .= $rec->glossaryentryid.'G,'; + }else{ + $ret .= $rec->questionid.','; + } + } + } + + $attempt->layout = $ret.'0'; +} + +/** + * Combines the review options from a number of different game attempts. + * Returns an array of two ojects, so he suggested way of calling this + * funciton is: + * list($someoptions, $alloptions) = game_get_combined_reviewoptions(...) + * + * @param object $game the game instance. + * @param array $attempts an array of attempt objects. + * @param $context the roles and permissions context, + * normally the context for the game module instance. + * + * @return array of two options objects, one showing which options are true for + * at least one of the attempts, the other showing which options are true + * for all attempts. + */ +function game_get_combined_reviewoptions($game, $attempts, $context=null) { + $fields = array('readonly', 'scores', 'feedback', 'correct_responses', 'solutions', 'generalfeedback', 'overallfeedback'); + $someoptions = new stdClass; + $alloptions = new stdClass; + foreach ($fields as $field) { + $someoptions->$field = false; + $alloptions->$field = true; + } + foreach ($attempts as $attempt) { + $attemptoptions = game_get_reviewoptions( $game, $attempt, $context); + foreach ($fields as $field) { + $someoptions->$field = $someoptions->$field || $attemptoptions->$field; + $alloptions->$field = $alloptions->$field && $attemptoptions->$field; + } + } + return array( $someoptions, $alloptions); +} + +/** + * Save the overall grade for a user at a game in the game_grades table + * + * @param object $quiz The game for which the best grade is to be calculated and then saved. + * @param integer $userid The userid to calculate the grade for. Defaults to the current user. + * @return boolean Indicates success or failure. + */ +function game_save_best_score($game) { + global $DB, $USER; + + // Get all the attempts made by the user + if (!$attempts = game_get_user_attempts( $game->id, $USER->id, 'all')) { + print_error( 'Could not find any user attempts gameid='.$game->id.' userid='.$USER->id); + } + + // Calculate the best grade + $bestscore = game_calculate_best_score( $game, $attempts); + + // Save the best grade in the database + if ($grade = $DB->get_record('game_grades', array( 'gameid' => $game->id, 'userid' => $USER->id))) { + $grade->score = $bestscore; + $grade->timemodified = time(); + if (!$DB->update_record('game_grades', $grade)) { + print_error('Could not update best grade'); + } + } else { + $grade = new stdClass(); + $grade->gameid = $game->id; + $grade->userid = $USER->id; + $grade->score = $bestscore; + $grade->timemodified = time(); + if (!$DB->insert_record( 'game_grades', $grade)) { + print_error( 'Could not insert new best grade'); + } + } + + // update gradebook + $grades = new stdClass(); + $grades->userid = $USER->id; + $grades->rawgrade = game_score_to_grade($bestscore, $game); + $grades->datesubmitted = time(); + game_grade_item_update( $game, $grades); + + return true; +} + +/** +* Calculate the overall score for a game given a number of attempts by a particular user. +* +* @return double The overall score +* @param object $game The game for which the best score is to be calculated +* @param array $attempts An array of all the attempts of the user at the game +*/ +function game_calculate_best_score($game, $attempts) { + + switch ($game->grademethod) { + + case GAME_GRADEMETHOD_FIRST: + foreach ($attempts as $attempt) { + return $attempt->score; + } + break; + + case GAME_GRADEMETHOD_LAST: + foreach ($attempts as $attempt) { + $final = $attempt->score; + } + return $final; + + case GAME_GRADEMETHOD_AVERAGE: + $sum = 0; + $count = 0; + foreach ($attempts as $attempt) { + $sum += $attempt->score; + $count++; + } + return (float)$sum/$count; + + default: + case GAME_GRADEMETHOD_HIGHEST: + $max = 0; + foreach ($attempts as $attempt) { + if ($attempt->score > $max) { + $max = $attempt->score; + } + } + return $max; + } +} + +/** +* Return the attempt with the best score for a game +* +* Which attempt is the best depends on $game->grademethod. If the grade +* method is GRADEAVERAGE then this function simply returns the last attempt. +* @return object The attempt with the best grade +* @param object $game The game for which the best grade is to be calculated +* @param array $attempts An array of all the attempts of the user at the game +*/ +function game_calculate_best_attempt($game, $attempts) { + + switch ($game->grademethod) { + + case GAME_ATTEMPTFIRST: + foreach ($attempts as $attempt) { + return $attempt; + } + break; + + case GAME_GRADEAVERAGE: // need to do something with it :-) + case GAME_ATTEMPTLAST: + foreach ($attempts as $attempt) { + $final = $attempt; + } + return $final; + + default: + case GAME_GRADEHIGHEST: + $max = -1; + foreach ($attempts as $attempt) { + if ($attempt->sumgrades > $max) { + $max = $attempt->sumgrades; + $maxattempt = $attempt; + } + } + return $maxattempt; + } +} + + +/** +* Loads the most recent state of each question session from the database +* +* For each question the most recent session state for the current attempt +* is loaded from the game_questions table and the question type specific data +* +* @return array An array of state objects representing the most recent +* states of the question sessions. +* @param array $questions The questions for which sessions are to be restored or +* created. +* @param object $cmoptions +* @param object $attempt The attempt for which the question sessions are +* to be restored or created. +* @param mixed either the id of a previous attempt, if this attmpt is +* building on a previous one, or false for a clean attempt. +*/ +function game_get_question_states(&$questions, $cmoptions, $attempt, $lastattemptid = false) { + global $DB, $QTYPES; + + // get the question ids + $ids = array_keys( $questions); + $questionlist = implode(',', $ids); + + $statefields = 'questionid as question, manualcomment, score as grade'; + + $sql = "SELECT $statefields". + " FROM {game_questions} ". + " WHERE attemptid = '$attempt->id'". + " AND questionid IN ($questionlist)"; + $states = $DB->get_records_sql($sql); + + // loop through all questions and set the last_graded states + foreach ($ids as $i) { + // Create the empty question type specific information + if (!$QTYPES[$questions[$i]->qtype]->create_session_and_responses( + $questions[$i], $states[$i], $cmoptions, $attempt)) { + return false; + } + + $states[$i]->last_graded = clone($states[$i]); + } + return $states; +} + +function game_sudoku_getquestions( $questionlist) +{ + global $DB; + + // Load the questions + if (!$questions = $DB->get_records_select( 'question', "id IN ($questionlist)")) { + print_error( get_string( 'no_questions', 'game')); + } + + // Load the question type specific information + if (!get_question_options($questions)) { + print_error('Could not load question options'); + } + + return $questions; +} + +function game_filterglossary( $text, $entryid, $contextid, $courseid) +{ + global $CFG, $DB; + + for(;;) + { + $find='@@PLUGINFILE@@'; + $pos = strpos( $text, $find); + if( $pos === false) + break; + + $pos2 = strpos( $text,'/', $pos); + if( $pos2 === false) + break; + + $pos3 = strpos( $text,'"', $pos); + if( $pos3 === false) + break; + + $file = substr( $text, $pos2+1, $pos3-$pos2-1); + + $new = $CFG->wwwroot."/pluginfile.php/$contextid/mod_glossary/entry/$entryid/$file"; + $text = substr( $text, 0, $pos).$new.substr( $text,$pos3); + } + $questiontext = str_replace( '$$'.'\\'.'\\'.'frac', '$$\\'.'frac', $text); + return game_filtertext( $text, $courseid); + +} + +function game_filterquestion( $questiontext, $questionid, $contextid, $courseid) +{ + global $CFG, $DB; + + for(;;) + { + $find='@@PLUGINFILE@@'; + $pos = strpos( $questiontext, $find); + if( $pos === false) + break; + + $pos2 = strpos( $questiontext,'/', $pos); + if( $pos2 === false) + break; + + $pos3 = strpos( $questiontext,'"', $pos); + if( $pos3 === false) + break; + + $file = substr( $questiontext, $pos2+1, $pos3-$pos2-1); + + $new = $CFG->wwwroot."/pluginfile.php/$contextid/mod_game/questiontext/$questionid/$file"; + $questiontext = substr( $questiontext, 0, $pos).$new.substr( $questiontext,$pos3); + } + $questiontext = str_replace( '$$'.'\\'.'\\'.'frac', '$$\\'.'frac', $questiontext); + return game_filtertext( $questiontext, $courseid); + +} + +function game_filterquestion_answer( $questiontext, $questionid, $contextid, $courseid) +{ + global $CFG, $DB; + + for(;;) + { + $find='@@PLUGINFILE@@'; + $pos = strpos( $questiontext, $find); + if( $pos === false) + break; + + $pos2 = strpos( $questiontext,'/', $pos); + if( $pos2 === false) + break; + + $pos3 = strpos( $questiontext,'"', $pos); + if( $pos3 === false) + break; + + $file = substr( $questiontext, $pos2+1, $pos3-$pos2-1); + + $new = $CFG->wwwroot."/pluginfile.php/$contextid/mod_game/answer/$questionid/$file"; + $questiontext = substr( $questiontext, 0, $pos).$new.substr( $questiontext,$pos3); + } + + return game_filtertext( $questiontext, $courseid); +} + +function game_filtertext( $text, $courseid){ + $formatoptions = new stdClass(); + $formatoptions->noclean = true; + $formatoptions->filter = 1; + $text = trim( format_text( $text, FORMAT_MOODLE, $formatoptions, $courseid)); + + $start = '
      '; + if( substr( $text, 0, strlen( $start)) == $start){ + if( substr( $text, -6) == '
      '){ + $text = substr( $text, strlen( $start), -6); + } + } + if( substr( $text, 0, 3) == '

      '){ + if( substr( $text, -4) == '

      '){ + $text = substr( $text, 3, -4); + } + } + + return $text; +} + +function game_tojavascriptstring( $text) +{ + $from = array('"',"\r", "\n"); + $to = array('\"', ' ', ' '); + + $from[] = ''; + echo ''; + } + // Close form + echo ''; + echo ''; + + if (!empty($attempts)) { + echo ''; + $options = array(); + $options["id"] = "$cm->id"; + $options["q"] = "$game->id"; + $options["mode"] = "overview"; + $options['sesskey'] = sesskey(); + $options["noheader"] = "yes"; + $options['noattempts'] = $noattempts; + $options['detailedmarks'] = $detailedmarks; + echo '\n"; + echo '\n"; + echo '\n"; + echo "\n"; + echo '
      '; + $options["download"] = "ODS"; + print_single_button("report.php", $options, get_string("downloadods", 'game')); ///check bdaloukas + echo "'; + $options["download"] = "Excel"; + print_single_button("report.php", $options, get_string("downloadexcel")); + echo "'; + $options["download"] = "CSV"; + print_single_button('report.php', $options, get_string("downloadtext")); + echo ""; + helpbutton('overviewdownload', get_string('overviewdownload', 'quiz'), 'game'); + echo "
      '; + } + } else if ($download == 'Excel' or $download == 'ODS') { + $workbook->close(); + exit; + } else if ($download == 'CSV') { + exit; + } + + } else { + if (!$download) { + $table->print_html(); + } + } + // Print display options + echo '
      '; + echo '
      '; + echo '
      '; + echo '

      '.get_string('displayoptions', 'game').':

      '; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '
      '; + $options = array(0 => get_string('attemptsonly','game', $course->students)); + if ($course->id != SITEID) { + $options[1] = get_string('noattemptsonly', 'game', $course->students); + $options[2] = get_string('allstudents','game', $course->students); + $options[3] = get_string('allattempts','game'); + } + choose_from_menu($options,'noattempts',$noattempts,''); + echo '
      '; + echo '
      '; + echo ''; + echo '
      '; + echo '
      '; + echo '
      '; + echo '
      '; + echo "\n"; + + return true; + } +} + +?> diff --git a/review.php b/review.php new file mode 100644 index 0000000..4a0fae1 --- /dev/null +++ b/review.php @@ -0,0 +1,327 @@ +get_record('game_attempts', array( 'id' => $attempt))) { + print_error("No such attempt ID exists"); + } + if (! $game = $DB->get_record('game', array( 'id' => $attempt->gameid))) { + print_error("The game with id $attempt->gameid belonging to attempt $attempt is missing"); + } + + game_compute_attempt_layout( $game, $attempt); + + if (! $course = $DB->get_record('course', array( 'id' => $game->course))) { + print_error("The course with id $game->course that the game with id $game->id belongs to is missing"); + } + if (! $cm = get_coursemodule_from_instance("game", $game->id, $course->id)) { + print_error("The course module for the game with id $game->id is missing"); + } + + $grade = game_score_to_grade( $attempt->score, $game); + $feedback = game_feedback_for_grade( $grade, $attempt->gameid); + + require_login( $course->id, false, $cm); + $context = get_context_instance( CONTEXT_MODULE, $cm->id); + $coursecontext = get_context_instance( CONTEXT_COURSE, $cm->course); + $isteacher = isteacher( $game->course, $USER->id); + $options = game_get_reviewoptions( $game, $attempt, $context); + $popup = $isteacher ? 0 : $game->popup; // Controls whether this is shown in a javascript-protected window. + + add_to_log($course->id, "game", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$game->id", "$cm->id"); + +/// Print the page header + + $strgames = get_string('modulenameplural', 'game'); + $strreview = get_string('review', 'game'); + $strscore = get_string('score', "game"); + $strgrade = get_string('grade'); + $strbestgrade = get_string('bestgrade', 'quiz'); + $strtimetaken = get_string('timetaken', 'game'); + $strtimecompleted = get_string('completedon', 'game'); + + + $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext) + ? update_module_button($cm->id, $course->id, get_string('modulename', 'game')) + : ""; + + $strgames = get_string("modulenameplural", "game"); + $strgame = get_string("modulename", "game"); + + if( function_exists( 'build_navigation')){ + $navigation = build_navigation('', $cm); + echo $OUTPUT->heading("$course->shortname: $game->name", "$course->shortname: $game->name", $navigation, + "", "", true, update_module_button($cm->id, $course->id, $strgame), + navmenu($course, $cm)); + }else{ + if ($course->category) { + $navigation = "wwwroot}/course/view.php?id=$course->id\">$course->shortname ->"; + } else { + $navigation = ''; + } + echo $OUTPUT->heading("$course->shortname: $game->name", "$course->fullname", + "$navigation id>$strgames -> $game->name", + "", "", true, update_module_button($cm->id, $course->id, $strgame), + navmenu($course, $cm)); + } + + + echo ''; // for overlib +/// Print heading and tabs if this is part of a preview + //if (has_capability('mod/game:preview', $context)) { + if ($attempt->userid == $USER->id) { // this is the report on a preview + $currenttab = 'preview'; + } else { + $currenttab = 'reports'; + $mode = ''; + } + include('tabs.php'); + //} else { + // print_heading(format_string($game->name)); + //} + +/// Load all the questions and states needed by this script + + // load the questions needed by page + $pagelist = $showall ? game_questions_in_game( $attempt->layout) : game_questions_on_page( $attempt->layout, $page); + $a = explode( ',', $pagelist); + $pagelist = ''; + foreach( $a as $item){ + if( substr( $item, 0, 1)){ + if( substr( $item, -1) != 'G'){ + $pagelist .= ','.$item; + } + } + } + $pagelist = substr( $pagelist, 1); + + if( $pagelist != ''){ + $sql = "SELECT q.*, i.id AS instance,i.id as iid,". + "i.score AS score,i.studentanswer". + " FROM {question} q,". + " {game_queries} i". + " WHERE i.attemptid = '$attempt->id' AND q.id = i.questionid AND (i.sourcemodule='question' or i.sourcemodule = 'quiz')". + " AND q.id IN ($pagelist)"; + + if (!$questions = $DB->get_records_sql( $sql)) { + print_error('No questions found'); + } + }else + { + $questions = array(); + } + + // Load the question type specific information + if (!get_question_options( $questions)) { + print_error('Could not load question options'); + } + + $states = game_compute_states( $game, $questions); +/// Print infobox + + //$timelimit = (int)$game->timelimit * 60; + $timelimit = 0; + $overtime = 0; + + if ($attempt->timefinish) { + if ($timetaken = ($attempt->timefinish - $attempt->timestart)) { + if($timelimit && $timetaken > ($timelimit + 60)) { + $overtime = $timetaken - $timelimit; + $overtime = format_time($overtime); + } + $timetaken = format_time($timetaken); + } else { + $timetaken = "-"; + } + } else { + $timetaken = get_string('unfinished', 'game'); + } + + $table->align = array("right", "left"); + if ($attempt->userid <> $USER->id) { + $student = $DB->get_record('user', array( 'id' => $attempt->userid)); + $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); + $table->data[] = array($picture, ''.fullname($student, true).''); + } + //if (has_capability('mod/game:grade', $context)){ + if( count($attempts = $DB->get_records('game_attempts', array( 'gameid' => $game->id, 'userid' => $attempt->userid), 'attempt ASC')) > 1) { + // print list of attempts + $attemptlist = ''; + foreach ($attempts as $at) { + $attemptlist .= ($at->id == $attempt->id) + ? ''.$at->attempt.', ' + : ''.$at->attempt.', '; + } + $table->data[] = array(get_string('attempts', 'game').':', trim($attemptlist, ' ,')); + } + //} + + $table->data[] = array(get_string('startedon', 'game').':', userdate($attempt->timestart)); + if ($attempt->timefinish) { + $table->data[] = array("$strtimecompleted:", userdate($attempt->timefinish)); + $table->data[] = array("$strtimetaken:", $timetaken); + } + //if the student is allowed to see their score + if ($options->scores) { + if ($game->grade) { + if($overtime) { + $result->sumgrades = "0"; + $result->grade = "0.0"; + } + + $a = new stdClass; + $percentage = round($attempt->score*100, 0); + $a->grade = game_score_to_grade( $attempt->score, $game); + $a->maxgrade = $game->grade; + $table->data[] = array("$strscore:", "{$a->grade}/{$game->grade} ($percentage %)"); + //$table->data[] = array("$strgrade:", get_string('outof', 'game', $a)); + } + } + if ($options->overallfeedback && $feedback) { + $table->data[] = array(get_string('feedback', 'game'), $feedback); + } + if ($isteacher and $attempt->userid == $USER->id) { + // the teacher is at the end of a preview. Print button to start new preview + unset($buttonoptions); + $buttonoptions['q'] = $game->id; + $buttonoptions['forcenew'] = true; + echo '
      '; + print_single_button($CFG->wwwroot.'/mod/game/attempt.php', $buttonoptions, get_string('startagain', 'game')); + echo '
      '; + } else { // print number of the attempt + print_heading(get_string('reviewofattempt', 'game', $attempt->attempt)); + } + print_table($table); + + // print javascript button to close the window, if necessary + if (!$isteacher) { + include('attempt_close_js.php'); + } + +/// Print the navigation panel if required + $numpages = game_number_of_pages( $attempt->layout); + if ($numpages > 1 and !$showall) { + print_paging_bar($numpages, $page, 1, 'review.php?attempt='.$attempt->id.'&'); + echo ''; + } + +/// Print all the questions + if( $pagelist){ + game_print_questions( $pagelist, $attempt, $questions, $options, $states, $game); + } + + // Print the navigation panel if required + if ($numpages > 1 and !$showall) { + print_paging_bar($numpages, $page, 1, 'review.php?attempt='.$attempt->id.'&'); + } + + // print javascript button to close the window, if necessary + if (!$isteacher) { + include('attempt_close_js.php'); + } + + if (empty($popup)) { + echo $OUTPUT->footer($course); + } + + function game_compute_states( $game, $questions) + { + global $QTYPES; + + // Restore the question sessions to their most recent states + // creating new sessions where required + + $states = array(); + foreach ($questions as $question) { + $state = new StdClass; + + $cmoptions->course = $game->course; + $cmoptions->optionflags->optionflags = 0; + $cmoptions->id = 0; + $cmoptions->shuffleanswers = 1; + + $state->last_graded = new StdClass; + $state->last_graded->event = QUESTION_EVENTOPEN; + + $state->raw_grade = 0; + + $attempt = 0; + if (!$QTYPES[$question->qtype]->create_session_and_responses( $question, $state, $cmoptions, $attempt)) { + print_error( 'game_compute_states: problem'); + } + + $state->event = QUESTION_EVENTOPEN; + //$question->maxgrade = 100; + $state->manualcomment = ''; + + $state->responses = array( '' => $question->studentanswer); + $state->attempt = $question->iid; + + $states[ $question->id] = $state; + } + return $states; + } + + + + function game_print_questions( $pagelist, $attempt, $questions, $options, $states, $game) + { + $pagequestions = explode(',', $pagelist); + $number = game_first_questionnumber( $attempt->layout, $pagelist); + foreach ($pagequestions as $i) { + if (!isset($questions[$i])) { + echo $OUTPUT->box_start('center', '90%'); + echo '' . $number . '
      '; + notify(get_string('errormissingquestion', 'quiz', $i)); + echo $OUTPUT->box_end(); + $number++; // Just guessing that the missing question would have lenght 1 + continue; + } + $options->validation = QUESTION_EVENTVALIDATE === $states[$i]->event; + //$options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded'; + $options->history = false; + unset( $options->questioncommentlink); + // Print the question + if ($i > 0) { + echo "
      \n"; + } + $questions[$i]->maxgrade = 0; + + $options->correct_responses = 0; + $options->feedback = 0; + $options->readonly = 0; + + global $QTYPES; + + unset( $cmoptions); + $cmoptions->course = $game->course; + $cmoptions->optionflags->optionflags = 0; + $cmoptions->id = 0; + $cmoptions->shuffleanswers = 1; + $attempt = 0; + $question = $questions[ $i]; + if (!$QTYPES[$question->qtype]->create_session_and_responses( $question, $state, $cmoptions, $attempt)) { + print_error( 'game_sudoku_showquestions_quiz: problem'); + } + $cmoptions->optionflags = 0; + print_question( $question, $states[$i], $number, $cmoptions, $options); + $number += $questions[$i]->length; + } + } + +?> diff --git a/showanswers.php b/showanswers.php new file mode 100644 index 0000000..c5949e1 --- /dev/null +++ b/showanswers.php @@ -0,0 +1,405 @@ +navbar->add(get_string('showanswers', 'game')); + + $action = optional_param('action', "", PARAM_ALPHANUM); // action + if( $action == 'delstats') + $DB->delete_records('game_repetitions', array('gameid' => $game->id, 'userid' => $USER->id)); + if( $action == 'computestats') + game_compute_repetitions($game); + + echo ''.get_string('repetitions', 'game').':   '; + echo get_string('user').': '; + game_showusers($game); + echo "  wwwroot}/mod/game/showanswers.php?q=$q&action=delstats\">".get_string('clearrepetitions','game').''; + echo "   wwwroot}/mod/game/showanswers.php?q=$q&action=computestats\">".get_string('computerepetitions','game').''; + echo '

      '; + + $existsbook = ($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')); + game_showanswers( $game, $existsbook); + + echo $OUTPUT->footer(); + +function game_compute_repetitions($game){ + global $DB, $USER; + + $DB->delete_records('game_repetitions', array('gameid' => $game->id,'userid' => $USER->id)); + + $sql = "INSERT INTO {game_repetitions}( gameid,userid,questionid,glossaryentryid,repetitions) ". + "SELECT $game->id,$USER->id,questionid,glossaryentryid,COUNT(*) ". + "FROM {game_queries} WHERE gameid=$game->id AND userid=$USER->id GROUP BY questionid,glossaryentryid"; + + if( !$DB->execute( $sql)) + print_error('Problem on computing statistics for repetitions'); +} + +function game_showusers($game) +{ + global $CFG, $USER; + + $users = array(); + + $context = get_context_instance(CONTEXT_COURSE, $game->course); + + if ($courseusers = get_enrolled_users($context)) { + foreach ($courseusers as $courseuser) { + $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context)); + } + } + if ($guest = guest_user()) { + $users[$guest->id] = fullname($guest); + } + ?> + + id,PARAM_INT); + + $output = '' . "\n"; +} + +function game_showanswers( $game, $existsbook) +{ + if( $game->gamekind == 'bookquiz' and $existsbook){ + game_showanswers_bookquiz( $game); + return; + } + + switch( $game->sourcemodule){ + case 'question': + game_showanswers_question( $game); + break; + case 'glossary': + game_showanswers_glossary( $game); + break; + case 'quiz': + game_showanswers_quiz( $game); + break; + } +} + +function game_showanswers_appendselect( $game) +{ + switch( $game->gamekind){ + case 'hangman': + case 'cross': + case 'crypto': + return " AND qtype='shortanswer'"; + case 'millionaire': + return " AND qtype = 'multichoice'"; + case 'sudoku': + case 'bookquiz': + case 'snakes': + return " AND qtype in ('shortanswer', 'truefalse', 'multichoice')"; + } + + return ''; +} + +function game_showanswers_question( $game) +{ + global $DB; + + if( $game->gamekind != 'bookquiz'){ + $select = ' category='.$game->questioncategoryid; + + if( $game->subcategories){ + $cats = question_categorylist( $game->questioncategoryid); + if( strpos( $cats, ',') > 0){ + $select = ' category in ('.$cats.')'; + } + } + }else + { + $context = get_context_instance(50, $COURSE->id); + $select = " contextid in ($context->id)"; + $select2 = ''; + if( $recs = $DB->get_records_select( 'question_categories', $select, null, 'id,id')){ + foreach( $recs as $rec){ + $select2 .= ','.$rec->id; + } + } + $select = ' AND category IN ('.substr( $select2, 1).')'; + } + + $select .= ' AND hidden = 0 '; + $select .= game_showanswers_appendselect( $game); + + $showcategories = ($game->gamekind == 'bookquiz'); + $order = ($showcategories ? 'category,questiontext' : 'questiontext'); + game_showanswers_question_select( $game, '{question} q', $select, '*', $order, $showcategories, $game->course); +} + + +function game_showanswers_quiz( $game) +{ + global $CFG; + + $select = "quiz='$game->quizid' ". + ' AND qqi.question=q.id'. + ' AND q.hidden=0'. + showanswers_appendselect( $game); + $table = '{question} q,{quiz_question_instances} qqi'; + + game_showanswers_question_select( $game, $table, $select, 'q.*', 'category,questiontext', false, $game->course); +} + + +function game_showanswers_question_select( $game, $table, $select, $fields='*', $order='questiontext', $showcategoryname=false, $courseid=0) +{ + global $CFG, $DB, $OUTPUT; + + $sql = "SELECT $fields FROM $table WHERE $select ORDER BY $order"; + if( ($questions = $DB->get_records_sql( $sql)) === false){ + return; + } + + $table .= ",{game_repetitions} gr"; + $select .= " AND gr.questionid=q.id AND gr.glossaryentryid=0 AND gr.gameid=".$game->id; + $userid = optional_param('userid',0,PARAM_INT); + if( $userid) + $select .= " AND gr.userid=$userid"; + $sql = "SELECT q.id as id,SUM(repetitions) as c FROM {$table} WHERE $select GROUP BY q.id"; + $reps = $DB->get_records_sql( $sql); + + $categorynames = array(); + if( $showcategoryname){ + $select = ''; + $recs = $DB->get_records( 'question_categories', null, '', '*', 0, 1); + foreach( $recs as $rec){ + if( array_key_exists( 'course', $rec)){ + $select = "course=$courseid"; + }else{ + $context = get_context_instance(50, $courseid); + $select = " contextid in ($context->id)"; + } + break; + } + + if( ($categories = $DB->get_records_select( 'question_categories', $select, null, '', 'id,name'))){ + foreach( $categories as $rec){ + $categorynames[ $rec->id] = $rec->name; + } + } + } + + echo ''; + echo ''; + if( $showcategoryname){ + echo ''; + } + echo ''; + echo ''; + echo ''; + if( $reps) + echo ''; + echo "\r\n"; + $line = 0; + foreach( $questions as $question){ + echo ''; + echo ''; + + if( $showcategoryname){ + echo ''; + } + + echo ''; + + switch( $question->qtype){ + case 'shortanswer': + $recs = $DB->get_records( 'question_answers', array( 'question' => $question->id), 'fraction DESC', 'id,answer,feedback'); + if( $recs == false){ + $rec = false; + }else{ + foreach( $recs as $rec) + break; + } + echo ""; + if( $rec->feedback == '') + $rec->feedback = ' '; + echo ""; + break; + case 'multichoice': + case 'truefalse': + $recs = $DB->get_records( 'question_answers', array( 'question' => $question->id)); + $feedback = ''; + echo ''; + if( $feedback == '') + $feedback = ' '; + echo ""; + break; + default: + echo ""; + break; + } + + //Show repetitions + if( $reps){ + if( array_key_exists( $question->id, $reps)){ + $rep = $reps[ $question->id]; + echo ''; + }else + echo ''; + } + + echo "\r\n"; + } + echo "
      '.get_string( 'categories', 'quiz').''.get_string( 'questions', 'quiz').''.get_string( 'answers', 'quiz').''.get_string( 'feedbacks', 'game').''.get_string( 'repetitions', 'game').'
      '.(++$line); + echo ''; + if( array_key_exists( $question->category, $categorynames)){ + echo $categorynames[ $question->category]; + }else{ + echo ' '; + } + echo ''; + echo "wwwroot}/question/question.php?inpopup=1&id=$question->id&courseid=$courseid\" target=\"_blank\">pix_url('t/edit')."\" alt=\"Edit\" /> "; + echo $question->questiontext.'$rec->answer$rec->feedback'; + $i = 0; + foreach( $recs as $rec){ + if( $i++ > 0) + echo '
      '; + if( $rec->fraction == 1){ + echo " $rec->answer"; + if( $rec->feedback == '') + $feedback .= '
      '; + else + $feedback .= "$rec->feedback
      "; + + }else + { + echo " $rec->answer"; + if( $rec->feedback == '') + $feedback .= '
      '; + else + $feedback .= "
      "; + } + } + echo '
      $feedback$question->qtype
      '.$rep->c.'
       

      \r\n\r\n"; +} + +function game_showanswers_glossary( $game) +{ + global $CFG, $DB; + + $table = '{glossary_entries} ge'; + $select = "glossaryid={$game->glossaryid}"; + if( $game->glossarycategoryid){ + $select .= " AND gec.entryid = ge.id ". + " AND gec.categoryid = {$game->glossarycategoryid}"; + $table .= ",{glossary_entries_categories} gec"; + } + $sql = "SELECT id,definition,concept FROM $table WHERE $select ORDER BY definition"; + if( ($questions = $DB->get_records_sql( $sql)) === false){ + return; + } + + //Show repetiotions of questions + $table = "{glossary_entries} ge, {game_repetitions} gr"; + $select = "glossaryid={$game->glossaryid} AND gr.glossaryentryid=ge.id AND gr.gameid=".$game->id; + $userid = optional_param('userid',0,PARAM_INT); + if( $userid) + $select .= " AND gr.userid=$userid"; + if( $game->glossarycategoryid){ + $select .= " AND gec.entryid = ge.id ". + " AND gec.categoryid = {$game->glossarycategoryid}"; + $table .= ",{glossary_entries_categories} gec"; + } + $sql = "SELECT ge.id,SUM(repetitions) as c FROM {$table} WHERE $select GROUP BY ge.id"; + $reps = $DB->get_records_sql( $sql); + + echo ''; + echo ''; + echo ''; + echo ''; + if( $reps != false) + echo ''; + echo "\r\n"; + $line = 0; + foreach( $questions as $question){ + if( $game->param7 == 0){ //Not allowed spaces + if(!( strpos( $question->concept, ' ') === false)) + continue; + } + if( $game->param8 == 0){ //Not allowed - + if(!( strpos( $question->concept, '-') === false)) + continue; + } + + echo ''; + echo ''; + + echo ''; + echo ''; + if( $reps != false){ + if( array_key_exists( $question->id, $reps)) + { + $rep = $reps[ $question->id]; + echo ''; + }else + echo ''; + } + echo "\r\n"; + } + echo "
      '.get_string( 'questions', 'quiz').''.get_string( 'answers', 'quiz').''.get_string( 'repetitions', 'game').'
      '.(++$line); + echo ''.$question->definition.''.$question->concept.'
      '.$rep->c.'
       

      \r\n\r\n"; +} + +function game_showanswers_bookquiz( $game) +{ + global $CFG; + + $select = "gbq.questioncategoryid=q.category ". + " AND gbq.gameid = $game->id ". + " AND bc.id = gbq.chapterid"; + $table = "{question} q,{game_bookquiz_questions} gbq,{book_chapters} bc"; + + game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", "bc.pagenum,questiontext"); +} diff --git a/showattempts.php b/showattempts.php new file mode 100644 index 0000000..aa3aecb --- /dev/null +++ b/showattempts.php @@ -0,0 +1,256 @@ +navbar->add(get_string('showattempts', 'game')); + + $action = optional_param('action', "", PARAM_ALPHANUM); // action + if( $action == 'delete'){ + game_ondeleteattempt( $game); + } + + echo get_string( 'group').': '; + game_showgroups( $game); + echo '   '.get_string('user').': '; + game_showusers( $game);echo '

      '; + + game_showattempts( $game); + + echo $OUTPUT->footer(); + + + function game_showusers($game) + { + global $CFG, $USER, $DB; + + $users = array(); + + $context = get_context_instance(CONTEXT_COURSE, $game->course); + + $groupid = optional_param('groupid',0, PARAM_INT); + $sql = "SELECT DISTINCT ra.userid,u.lastname,u.firstname FROM {role_assignments} ra, {user} u ". + " WHERE ra.contextid={$context->id} AND ra.userid=u.id"; + if( $groupid != 0) + $sql .= " AND ra.userid IN (SELECT gm.userid FROM {groups_members} gm WHERE gm.groupid=$groupid)"; + if( ($recs = $DB->get_records_sql( $sql))){ + foreach( $recs as $rec){ + $users[ $rec->userid] = $rec->lastname.' '.$rec->firstname; + } + } + + + if ($guest = guest_user()) { + $users[$guest->id] = fullname($guest); + } + ?> + + ' . "\n"; + $output .= ' ' . "\n"; + } + } + } + echo $output . '' . "\n"; + } + + function game_showgroups($game) + { + global $CFG, $USER, $DB; + + $groups = array(); + if( ($recs = $DB->get_records_sql( "SELECT id,name FROM {groups} WHERE courseid=$game->course ORDER BY name"))){ + foreach( $recs as $rec){ + $groups[ $rec->id] = $rec->name; + } + } + + ?> + + ' . "\n"; + $output .= ' ' . "\n"; + } + } + } + echo $output . '' . "\n"; + } + + function game_showattempts($game){ + global $CFG, $DB, $OUTPUT; + + $userid = optional_param('userid',0,PARAM_INT); + $limitfrom = optional_param('limitfrom', 0, PARAM_INT); + $gamekind = $game->gamekind; + $update = get_coursemodule_from_instance( 'game', $game->id, $game->course)->id; + + //Here are user attempts + $table = "{game_attempts} as ga, {user} u, {game} as g"; + $select = "ga.userid=u.id AND ga.gameid={$game->id} AND g.id={$game->id}"; + $fields = "ga.id, u.lastname, u.firstname, ga.attempts,". + "timestart, timefinish, timelastattempt, score, ga.lastip, ga.lastremotehost"; + if( $userid != 0) + $select .= ' AND u.id='.$userid; + $sql = "SELECT COUNT(*) AS c FROM $table WHERE $select"; + $count = $DB->count_records_sql( $sql); + $maxlines = 20; + $recslimitfrom = $recslimitnum = ''; + if( $count > $maxlines){ + $recslimitfrom = ( $limitfrom ? $limitfrom * $maxlines : ''); + $recslimitnum = $maxlines; + + for($i=0; $i*$maxlines < $count; $i++){ + if( $i == $limitfrom){ + echo ($i+1).' '; + }else + { + echo "wwwroot}/mod/game/preview.php?action=showattempts&update=$update&q={$game->id}&limitfrom=$i&\">".($i+1).""; + echo '  '; + } + } + echo "
      "; + } + + $sql = "SELECT $fields FROM $table WHERE $select ORDER BY timelastattempt DESC,timestart DESC"; + if( ($recs = $DB->get_records_sql( $sql, null, $recslimitfrom, $recslimitnum)) != false){ + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo "\r\n"; + + foreach( $recs as $rec){ + echo ''; + echo ''; + echo ''; + echo ''; + echo '\r\n"; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + //Show solution + echo ''; + echo "\r\n"; + } + echo "
      '.get_string( 'delete').''.get_string('user').''.get_string('lastip', 'game').''.get_string('timestart', 'game').''.get_string('timelastattempt', 'game').''.get_string('timefinish', 'game').''.get_string('score', 'game').''.get_string('attempts', 'game').''.get_string('preview', 'game').''.get_string('showsolution', 'game').'
      '; + if( $rec->timefinish == 0){ + echo "\r\nwwwroot}/mod/game/showattempts.php?attemptid={$rec->id}&q={$game->id}&action=delete\">"; + echo ''.get_string( 'delete').''; + } + echo '
      '.$rec->firstname. ' '.$rec->lastname.'
      '.(strlen( $rec->lastremotehost) > 0 ? $rec->lastremotehost : $rec->lastip).'
      '.( $rec->timestart != 0 ? userdate($rec->timestart) : '')."
      '.( $rec->timelastattempt != 0 ? userdate($rec->timelastattempt) : '').'
      '.( $rec->timefinish != 0 ? userdate($rec->timefinish) : '').'
      '.round($rec->score * 100).'
      '.$rec->attempts.'
      '; + //Preview + if( ($gamekind == 'cross') or ($gamekind == 'sudoku') or ($gamekind == 'hangman') or ($gamekind == 'cryptex')){ + echo "\r\nwwwroot}/mod/game/preview.php?action=preview&attemptid={$rec->id}&gamekind=$gamekind"; + echo '&update='.$update."&q={$game->id}\">"; + echo ''.get_string( 'preview', 'game').''; + } + echo '
      '; + if( ($gamekind == 'cross') or ($gamekind == 'sudoku') or ($gamekind == 'hangman') or ($gamekind == 'cryptex') ){ + echo "\r\nwwwroot}/mod/game/preview.php?action=solution&attemptid={$rec->id}&gamekind={$gamekind}&update=$update&&q={$game->id}\">"; + echo ''.get_string( 'showsolution', 'game').''; + } + echo '
      \r\n"; + } + } + + function game_ondeleteattempt( $game) + { + global $CFG, $DB; + + $attemptid = required_param('attemptid', PARAM_INT); + + $attempt = $DB->get_record( 'game_attempts', array( 'id' => $attemptid)); + + switch( $game->gamekind) + { + case 'bookquiz': + $DB->delete_records( 'game_bookquiz_chapters', array( 'attemptid' => $attemptid)); + break; + } + $DB->delete_records( 'game_queries', array( 'attemptid' => $attemptid)); + $DB->delete_records( 'game_attempts', array( 'id' => $attemptid)); + } diff --git a/snakes/1/dice1.png b/snakes/1/dice1.png new file mode 100644 index 0000000..95eb0f0 Binary files /dev/null and b/snakes/1/dice1.png differ diff --git a/snakes/1/dice2.png b/snakes/1/dice2.png new file mode 100644 index 0000000..7d83164 Binary files /dev/null and b/snakes/1/dice2.png differ diff --git a/snakes/1/dice3.png b/snakes/1/dice3.png new file mode 100644 index 0000000..71271b2 Binary files /dev/null and b/snakes/1/dice3.png differ diff --git a/snakes/1/dice4.png b/snakes/1/dice4.png new file mode 100644 index 0000000..a0c8700 Binary files /dev/null and b/snakes/1/dice4.png differ diff --git a/snakes/1/dice5.png b/snakes/1/dice5.png new file mode 100644 index 0000000..8ad2551 Binary files /dev/null and b/snakes/1/dice5.png differ diff --git a/snakes/1/dice6.png b/snakes/1/dice6.png new file mode 100644 index 0000000..e625d08 Binary files /dev/null and b/snakes/1/dice6.png differ diff --git a/snakes/1/la01.png b/snakes/1/la01.png new file mode 100644 index 0000000..2fdfd90 Binary files /dev/null and b/snakes/1/la01.png differ diff --git a/snakes/1/la02.png b/snakes/1/la02.png new file mode 100644 index 0000000..1a1729d Binary files /dev/null and b/snakes/1/la02.png differ diff --git a/snakes/1/la03.png b/snakes/1/la03.png new file mode 100644 index 0000000..a54f5c3 Binary files /dev/null and b/snakes/1/la03.png differ diff --git a/snakes/1/la04.png b/snakes/1/la04.png new file mode 100644 index 0000000..3bb752a Binary files /dev/null and b/snakes/1/la04.png differ diff --git a/snakes/1/la11.png b/snakes/1/la11.png new file mode 100644 index 0000000..02e5340 Binary files /dev/null and b/snakes/1/la11.png differ diff --git a/snakes/1/la12.png b/snakes/1/la12.png new file mode 100644 index 0000000..a86533e Binary files /dev/null and b/snakes/1/la12.png differ diff --git a/snakes/1/la13.png b/snakes/1/la13.png new file mode 100644 index 0000000..fcf3326 Binary files /dev/null and b/snakes/1/la13.png differ diff --git a/snakes/1/la14.png b/snakes/1/la14.png new file mode 100644 index 0000000..b33f8d6 Binary files /dev/null and b/snakes/1/la14.png differ diff --git a/snakes/1/la21.png b/snakes/1/la21.png new file mode 100644 index 0000000..389ea8e Binary files /dev/null and b/snakes/1/la21.png differ diff --git a/snakes/1/la22.png b/snakes/1/la22.png new file mode 100644 index 0000000..458eecc Binary files /dev/null and b/snakes/1/la22.png differ diff --git a/snakes/1/la23.png b/snakes/1/la23.png new file mode 100644 index 0000000..e0d222c Binary files /dev/null and b/snakes/1/la23.png differ diff --git a/snakes/1/la24.png b/snakes/1/la24.png new file mode 100644 index 0000000..33c1d35 Binary files /dev/null and b/snakes/1/la24.png differ diff --git a/snakes/1/la31.png b/snakes/1/la31.png new file mode 100644 index 0000000..2d5ea59 Binary files /dev/null and b/snakes/1/la31.png differ diff --git a/snakes/1/la33.png b/snakes/1/la33.png new file mode 100644 index 0000000..f0259a7 Binary files /dev/null and b/snakes/1/la33.png differ diff --git a/snakes/1/la34.png b/snakes/1/la34.png new file mode 100644 index 0000000..7a38631 Binary files /dev/null and b/snakes/1/la34.png differ diff --git a/snakes/1/la44.png b/snakes/1/la44.png new file mode 100644 index 0000000..79b6493 Binary files /dev/null and b/snakes/1/la44.png differ diff --git a/snakes/1/meter.png b/snakes/1/meter.png new file mode 100644 index 0000000..fe8adf0 Binary files /dev/null and b/snakes/1/meter.png differ diff --git a/snakes/1/numbers.png b/snakes/1/numbers.png new file mode 100644 index 0000000..d8a282a Binary files /dev/null and b/snakes/1/numbers.png differ diff --git a/snakes/1/player1.png b/snakes/1/player1.png new file mode 100644 index 0000000..7d9e39a Binary files /dev/null and b/snakes/1/player1.png differ diff --git a/snakes/1/sa01.png b/snakes/1/sa01.png new file mode 100644 index 0000000..c31fdb3 Binary files /dev/null and b/snakes/1/sa01.png differ diff --git a/snakes/1/sa02.png b/snakes/1/sa02.png new file mode 100644 index 0000000..b0df8a3 Binary files /dev/null and b/snakes/1/sa02.png differ diff --git a/snakes/1/sa03.png b/snakes/1/sa03.png new file mode 100644 index 0000000..df46bd2 Binary files /dev/null and b/snakes/1/sa03.png differ diff --git a/snakes/1/sa04.png b/snakes/1/sa04.png new file mode 100644 index 0000000..30e7f6f Binary files /dev/null and b/snakes/1/sa04.png differ diff --git a/snakes/1/sa11.png b/snakes/1/sa11.png new file mode 100644 index 0000000..28f0837 Binary files /dev/null and b/snakes/1/sa11.png differ diff --git a/snakes/1/sa12.png b/snakes/1/sa12.png new file mode 100644 index 0000000..7dc817c Binary files /dev/null and b/snakes/1/sa12.png differ diff --git a/snakes/1/sa13.png b/snakes/1/sa13.png new file mode 100644 index 0000000..b508d96 Binary files /dev/null and b/snakes/1/sa13.png differ diff --git a/snakes/1/sa14.png b/snakes/1/sa14.png new file mode 100644 index 0000000..28a0866 Binary files /dev/null and b/snakes/1/sa14.png differ diff --git a/snakes/1/sa21.png b/snakes/1/sa21.png new file mode 100644 index 0000000..9c6a0d9 Binary files /dev/null and b/snakes/1/sa21.png differ diff --git a/snakes/1/sa22.png b/snakes/1/sa22.png new file mode 100644 index 0000000..24aec34 Binary files /dev/null and b/snakes/1/sa22.png differ diff --git a/snakes/1/sa23.png b/snakes/1/sa23.png new file mode 100644 index 0000000..324d606 Binary files /dev/null and b/snakes/1/sa23.png differ diff --git a/snakes/1/sa24.png b/snakes/1/sa24.png new file mode 100644 index 0000000..04ed70f Binary files /dev/null and b/snakes/1/sa24.png differ diff --git a/snakes/1/sa33.png b/snakes/1/sa33.png new file mode 100644 index 0000000..26b4599 Binary files /dev/null and b/snakes/1/sa33.png differ diff --git a/snakes/1/sa34.png b/snakes/1/sa34.png new file mode 100644 index 0000000..b7b1ca6 Binary files /dev/null and b/snakes/1/sa34.png differ diff --git a/snakes/1/sa42.png b/snakes/1/sa42.png new file mode 100644 index 0000000..593ed7e Binary files /dev/null and b/snakes/1/sa42.png differ diff --git a/snakes/1/sa44.png b/snakes/1/sa44.png new file mode 100644 index 0000000..55a9a10 Binary files /dev/null and b/snakes/1/sa44.png differ diff --git a/snakes/boards/fidaki.jpg b/snakes/boards/fidaki.jpg new file mode 100644 index 0000000..52f7a90 Binary files /dev/null and b/snakes/boards/fidaki.jpg differ diff --git a/snakes/boards/fidaki2.jpg b/snakes/boards/fidaki2.jpg new file mode 100644 index 0000000..aa2d4e4 Binary files /dev/null and b/snakes/boards/fidaki2.jpg differ diff --git a/snakes/createboard.php b/snakes/createboard.php new file mode 100644 index 0000000..7cabd7c --- /dev/null +++ b/snakes/createboard.php @@ -0,0 +1,317 @@ +dirroot.'/mod/game/snakes/1'; + + $im = imagecreatefromstring($imageasstring); + + //check if need resize + if( $setwidth >0 or $setheight > 0) + { + $source = $im; + $width = imagesx($source); + $height = imagesy($source); + $factorx = $setwidth / $width; + $factory = $setheight / $height; + $factor = ($factorx < $factory || $factory == 0 ? $factorx : $factory); + + $newwidth = $width * $factor; + $newheight = $height * $factor; + + $im = imagecreatetruecolor($newwidth, $newheight); + imagecopyresized($im, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); + } + + $cx = imagesx($im) - $ofsright - $ofsleft; + $cy = imagesy($im) - $ofstop - $ofsbottom; + + $color = 0xFF0000; + for( $i=0; $i <= $colsx; $i++) + { + imageline( $im, $ofsleft+$i * $cx / $colsx, $ofstop, $ofsleft+$i * $cx / $colsx, $cy+$ofstop, $color); + } + + for( $i=0; $i <= $colsy; $i++) + { + imageline( $im, $ofsleft, $ofstop+$i * $cy / $colsy, $cx+$ofsleft, $ofstop+$i * $cy / $colsy, $color); + } + + $filenamenumbers=$dir.'/numbers.png'; + $img_numbers = imageCreateFrompng( $filenamenumbers); + $size_numbers = getimagesize ($filenamenumbers); + + for( $iy=0; $iy < $colsy; $iy++) + { + if( $iy % 2 == 0){ + $inc=false; + $num = ($colsy-$iy)*$colsy; + }else + { + $inc=true; + $num = ($colsy-$iy)*$colsy-($colsy-1); + } + $ypos = $iy * $cy / $colsy+$ofstop; + for( $ix=0; $ix < $colsx; $ix++) + { + $xpos = $ix * $cx / $colsx + $ofsleft; + shownumber( $im, $img_numbers, $num, $xpos, $ypos, $cx/4, $cy/4, $size_numbers); + $num = ($inc ? $num+1 : $num-1); + } + } + + makeboard( $im, $dir, $cx, $cy, $board, $colsx, $colsy, $ofsleft, $ofstop); + + return $im; +} + +function computexy( $pos, &$x, &$y, $colsx, $colsy) +{ + $x = ($pos - 1) % $colsx; + $y = ($colsy-1) - floor( ($pos - 1) / $colsy); + if($y % 2 == 0) + $x = ($colsx-1) - $x; +} + +function makeboard( $im, $dir, $cx, $cy, $board, $colsx, $colsy, $ofsleft, $ofstop) +{ + $a = explode( ',', $board); + foreach( $a as $s) + { + if( substr( $s,0,1) == 'L') + makeboardL( $im, $dir, $cx, $cy, substr( $s, 1), $colsx, $colsy, $ofsleft, $ofstop); + else + makeboardS( $im, $dir, $cx, $cy, substr( $s, 1), $colsx, $colsy, $ofsleft, $ofstop); + } +} + +function makeboardL( $im, $dir, $cx, $cy, $s, $colsx, $colsy, $ofsleft, $ofstop) +{ + $pos = strpos( $s, '-'); + $from = substr( $s, 0, $pos); + $to = substr( $s, $pos+1); + + computexy( $from, $startx, $starty, $colsx, $colsy); + computexy( $to, $x2, $y2, $colsx, $colsy); + if( ($x2 < $startx) and ($y2 < $starty)) + { + $temp = $x2; $x2 = $startx; $startx = $temp; + $temp = $y2; $y2 = $starty; $starty = $temp; + } + $movex = $x2 - $startx; + $movey = $y2 - $starty; + + $letter = ( $movex * $movey < 0 ? 'b' : 'a'); + + $_startx = $startx; $_movex=$movex; $_starty = $starty; $_movey=$movey; + + if( $movex < 0) + { + $startx += $movex; + $movex = -$movex; + } + if( $movey < 0) + { + $starty += $movey; + $movey = -$movey; + } + $stamp = 0; + if( $letter == 'b'){ + $file = $dir.'/l'.$letter.$movey.$movex.'.png'; + if( file_exists( $file)){ + $stamp = game_imagecreatefrompng( $file); + }else + { + $file = $dir.'/la'.$movey.$movex.'.png'; + + $source = game_imagecreatefrompng( $file); + if( $source != 0) + $stamp = imagerotate($source, 90, 0); + } + }else + { + $file = $dir.'/la'.$movex.$movey.'.png'; + $stamp = game_imagecreatefrompng( $file); + } + + $dst_x = $startx*$cx/$colsx; + $dst_y = $starty*$cy/$colsy; + $dst_w = ($movex+1) * $cx / $colsx; + $dst_h = ($movey+1) * $cy / $colsy; + + if( $stamp == 0) + { + game_printladder( $im, $file, $dst_x+$ofsleft, $dst_y+$ofstop, $dst_w, $dst_h, $cx/$colsx, $cy/$colsy); + }else + { + imagecopyresampled( $im, $stamp, $ofsleft+$dst_x, $ofstop+$dst_y, 0, 0, $dst_w, $dst_h, 100*$movex+100, 100*$movey+100); + } +} + +function makeboardS( $im, $dir, $cx, $cy, $s, $colsx, $colsy, $ofsleft, $ofstop) +{ + $pos = strpos( $s, '-'); + $from = substr( $s, 0, $pos); + $to = substr( $s, $pos+1); + + computexy( $from, $startx, $starty, $colsx, $colsy); + computexy( $to, $x2, $y2, $colsx, $colsy); + $swap=0; + if( ($x2 < $startx) and ($y2 < $starty)) + { + $temp = $x2; $x2 = $startx; $startx = $temp; + $temp = $y2; $y2 = $starty; $starty = $temp; + $swap=1; + } + $movex = $x2 - $startx; + $movey = $y2 - $starty; + + //a*d + //*** + //b*c + $stamp = $rotate = 0; + if( $movex >= 0 and $movey < 0){ + $letter = 'b'; + $file = $dir.'/sa'.$movey.$movex.'.png'; + $source = game_imagecreatefrompng( $file); + if( $source != 0) + { + $stamp = imagerotate($source, 270, 0); + $starty += $movey; $movey = -$movey; + }else + $rotate = 270; + }else if( $movex < 0 and $movey < 0){ + $letter = 'c'; + $file = $dir.'/sa'.$movey.$movex.'.png'; + $source = game_imagecreatefrompng( $file); + if( $source != 0) + { + $stamp = imagerotate($source, 180, 0); + $startx += $movex; $movex = -$movex; + $starty += $movey; $movey = -$movey; + }else + $rotate = 180; + }else if( ($movex < 0) and ($movey >= 0)){ + $letter = 'd'; + $file = $dir.'/sa'.$movey.$movex.'.png'; + $source = game_imagecreatefrompng( $file); + if( $source != 0) + { + $stamp = imagerotate($source, 270, 0); + $startx += $movex; $movex = -$movex; + }else + $rotate=270; + }else + { + $file = $dir.'/sa'.$movex.$movey.'.png'; + $stamp = game_imagecreatefrompng( $file); + } + + if( ($swap != 0) and ($stamp == 0)) + { + $temp = $x2; $x2 = $startx; $startx = $temp; + $temp = $y2; $y2 = $starty; $starty = $temp; + $movex = $x2 - $startx; + $movey = $y2 - $starty; + } + + $dst_x = $startx*$cx/$colsx; + $dst_y = $starty*$cy/$colsy; + $dst_w = ($movex+1) * $cx / $colsx; + $dst_h = ($movey+1) * $cy / $colsy; + + if( $stamp == 0) + { + game_printsnake( $im, $file, $dst_x+$ofsleft, $dst_y+$ofstop, $dst_w, $dst_h, $cx/$colsx, $cy/$colsy); + }else + imagecopyresampled( $im, $stamp, $dst_x+$ofsleft, $dst_y+$ofstop, 0, 0, $dst_w, $dst_h, 100*$movex+100, 100*$movey+100); +} + +function game_imagecreatefrompng( $file){ + if( file_exists( $file)) + return imagecreatefrompng( $file); + + return 0; +} + +function shownumber( $img_handle, $img_numbers, $number, $x1 , $y1, $width, $height, $size_numbers){ + if( $number < 10){ + $width_number = $size_numbers[ 0] / 10; + $dstX = $x1 + $width / 10; + $dstY = $y1 + $height / 10; + $srcX = $number * $size_numbers[ 0] / 10; + $srcW = $size_numbers[ 0]/10; + $srcH = $size_numbers[ 1]; + $dstW = $width / 10; + $dstH = $dstW * $srcH / $srcW; + imagecopyresampled( $img_handle, $img_numbers, $dstX, $dstY, $srcX, 0, $dstW, $dstH, $srcW, $srcH); + }else + { + $number1 = floor( $number / 10); + $number2 = $number % 10; + shownumber( $img_handle, $img_numbers, $number1, $x1-$width/20, $y1, $width, $height, $size_numbers); + shownumber( $img_handle, $img_numbers, $number2, $x1+$width/20, $y1, $width, $height, $size_numbers); + } +} + +function returnRotatedPoint($x,$y,$cx,$cy,$a) + { + // radius using distance formula + $r = sqrt(pow(($x-$cx),2)+pow(($y-$cy),2)); + // initial angle in relation to center + $iA = rad2deg(atan2(($y-$cy),($x-$cx))); + + $nx = $r * cos(deg2rad($a + $iA)); + $ny = $r * sin(deg2rad($a + $iA)); + + return array("x"=>$cx+$nx,"y"=>$cy+$ny); + } + +function game_printladder( $im, $file, $x, $y, $width, $height, $cellx, $celly) +{ + $color = imagecolorallocate($im, 0, 0, 255); + $x2 = $x+$width-$cellx/2; + $y2 = $y+$height-$celly/2; + $x1 = $x+$cellx/2; + $y1 = $y+$celly/2; + imageline( $im, $x1, $y1, $x2, $y2, $color); + $r = sqrt(pow(($x2-$x1),2)+pow(($y2-$y1),2)); + $mul = 100 / $r; + $x1 = $x2 - ($x2-$x1) * $mul; + $y1 = $y2 - ($y2-$y1) * $mul; + $a = returnRotatedPoint( $x1, $y1, $x2, $y2, 20); + imageline( $im, $x2, $y2, $a[ 'x'], $a[ 'y'], $color); + $a = returnRotatedPoint( $x1, $y1, $x2, $y2, -20); + imageline( $im, $x2, $y2, $a[ 'x'], $a[ 'y'], $color); +} + +function game_printsnake( $im, $file, $x, $y, $width, $height, $cellx, $celly) +{ + $color = imagecolorallocate($im, 0, 255, 0); + $x2 = $x+$width-$cellx/2; + $y2 = $y+$height-$celly/2; + $x1 = $x+$cellx/2; + $y1 = $y+$celly/2; + imageline( $im, $x1, $y1, $x2, $y2, $color); + + $r = sqrt(pow(($x2-$x1),2)+pow(($y2-$y1),2)); + $mul = 100 / $r; + $x2 = $x1 + ($x2-$x1) * $mul; + $y2 = $y1 + ($y2-$y1) * $mul; + $a = returnRotatedPoint( $x1, $y1, $x2, $y2, 80); + imageline( $im, $x1, $y1, $a[ 'x'], $a[ 'y'], $color); + $a = returnRotatedPoint( $x1, $y1, $x2, $y2, -80); + imageline( $im, $x1, $y1, $a[ 'x'], $a[ 'y'], $color); +} diff --git a/snakes/play.php b/snakes/play.php new file mode 100644 index 0000000..17f4641 --- /dev/null +++ b/snakes/play.php @@ -0,0 +1,439 @@ +id = $attempt->id; + $newrec->snakesdatabaseid = $game->param3; + if( $newrec->snakesdatabaseid == 0) + $newrec->snakesdatabaseid = 1; + $newrec->position = 1; + $newrec->queryid = 0; + $newrec->dice = rand( 1, 6); + if( !game_insert_record( 'game_snakes', $newrec)){ + print_error( 'game_snakes_continue: error inserting in game_snakes'); + } + + game_updateattempts( $game, $attempt, 0, 0); + + return game_snakes_play( $id, $game, $attempt, $newrec, $context); +} + +function game_snakes_play( $id, $game, $attempt, $snakes, $context) +{ + global $CFG, $DB, $OUTPUT; + + $board = game_snakes_get_board( $game); + $showboard = false; + + if( $snakes->position > $board->cols * $board->rows && $snakes->queryid <> 0){ + $finish = true; + + if (! $cm = $DB->get_record('course_modules', array( 'id' => $id))) { + print_error("Course Module ID was incorrect id=$id"); + } + + echo ''.get_string( 'win', 'game').'
      '; + echo '
      '; + echo "wwwroot/mod/game/attempt.php?id=$id\">".get_string( 'nextgame', 'game').'         '; + echo "wwwroot/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').' '; + + $gradeattempt = 1; + $finish = 1; + game_updateattempts( $game, $attempt, $gradeattempt, $finish); + }else + { + $finish = false; + if( $snakes->queryid == 0){ + game_snakes_computenextquestion( $game, $snakes, $query); + }else + { + $query = $DB->get_record( 'game_queries', array( 'id' => $snakes->queryid)); + } + if( $game->toptext != ''){ + echo $game->toptext.'
      '; + } + $showboard = true; + } + + if( $showboard and $game->param8 == 0) + game_snakes_showquestion( $id, $game, $snakes, $query, $context); + +?> + + + + + + +
      + +
      + +
      + + +
      +bottomtext != ''){ + echo '
      '.$game->bottomtext; + } + + if( $showboard and $game->param8 != 0) + game_snakes_showquestion( $id, $game, $snakes, $query, $context); +} + +function game_snakes_showdice( $snakes, $board) +{ + $pos = game_snakes_computeplayerposition( $snakes, $board); +?> +
      +<?php print_string('snakes_player', 'game', ($snakes->position +1)); /*Accessibility. */ ?> +
      + +
      + <?php print_string('snakes_dice', 'game', $snakes->dice) ?> +
      +position - 1) % $board->cols; + $y = floor( ($snakes->position-1) / $board->cols); + + $cellwidth = ($board->width - $board->headerx - $board->footerx) / $board->cols; + $cellheight = ($board->height - $board->headery - $board->footery) / $board->rows; + + $pos = new stdClass(); + $pos->width = 22; + $pos->height = 22; + + $pos->ofsx = 0; + $pos->ofsy = $pos->height; + + switch( $board->direction){ + case 1: + if( ($y % 2) == 1){ + $x = $board->cols - $x - 1; + } + $pos->x = $board->headerx + $x * $cellwidth + ($cellwidth - $pos->width)/2+ $pos->ofsx; + $pos->y = $board->footery + $y * $cellheight + ($cellheight - $pos->height)/2 + $pos->ofsy; + $pos->x = round( $pos->x); + $pos->y = round( -$pos->y); + break; + } + + return $pos; +} + +function game_snakes_computenextquestion( $game, &$snakes, &$query) +{ + global $DB, $USER; + + //Retrieves CONST_GAME_TRIES_REPETITION words and select the one which is used fewer times + if( ($recs = game_questions_selectrandom( $game, 1, CONST_GAME_TRIES_REPETITION)) == false){ + return false; + } + + $glossaryid = 0; + $questionid = 0; + $min_num = 0; + $query = new stdClass(); + foreach( $recs as $rec){ + $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); + if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ + if( ($rec2->r < $min_num) or ($min_num == 0)){ + $min_num = $rec2->r; + $query->glossaryentryid = $rec->glossaryentryid; + $query->questionid = $rec->questionid; + } + } + else{ + $query->glossaryentryid = $rec->glossaryentryid; + $query->questionid = $rec->questionid; + break; + } + } + + if( ($query->glossaryentryid == 0) AND ($query->questionid == 0)) + return false; + + $query->attemptid = $snakes->id; + $query->gameid = $game->id; + $query->userid = $USER->id; + $query->sourcemodule = $game->sourcemodule; + $query->score = 0; + $query->timelastattempt = time(); + if( !($query->id = $DB->insert_record( 'game_queries', $query))){ + print_error( "Can't insert to table game_queries"); + } + + $snakes->queryid = $query->id; + + $updrec = new stdClass(); + $updrec->id = $snakes->id; + $updrec->queryid = $query->id; + $updrec->dice = $snakes->dice = rand( 1, 6); + + if( !$DB->update_record( 'game_snakes', $updrec)){ + print_error( 'game_questions_selectrandom: error updating in game_snakes'); + } + + game_update_repetitions($game->id, $USER->id, $query->questionid, $query->glossaryentryid); + + return true; +} + +function game_snakes_showquestion( $id, $game, $snakes, $query, $context) +{ + if( $query->sourcemodule == 'glossary'){ + game_snakes_showquestion_glossary( $id, $snakes, $query, $game); + }else + { + game_snakes_showquestion_question( $game, $id, $snakes, $query, $context); + } +} + +function game_snakes_showquestion_question( $game, $id, $snakes, $query, $context) +{ + global $CFG; + + $questionlist = $query->questionid; + $questions = game_sudoku_getquestions( $questionlist); + + /// Start the form + echo "
      wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + echo "
      \n"; + + // Add a hidden field with the quiz id + echo '\n"; + echo ''; + echo '\n"; + + /// Print all the questions + foreach( $questions as $question) + game_print_question( $game, $question, $context); + // Add a hidden field with questionids + echo '\n"; + + echo "
      \n"; +} + +function game_snakes_showquestion_glossary( $id, $snakes, $query, $game) +{ + global $CFG, $DB; + + $entry = $DB->get_record( 'glossary_entries', array('id' => $query->glossaryentryid)); + + /// Start the form + echo "
      wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + echo "
      \n"; + + // Add a hidden field with the queryid + echo '\n"; + echo ''; + echo '\n"; + + /// Print all the questions + + // Add a hidden field with glossaryentryid + echo '\n"; + + $cmglossary = get_coursemodule_from_instance('glossary', $game->glossaryid, $game->course); + $contextglossary = get_context_instance(CONTEXT_MODULE, $cmglossary->id); + $s = game_filterglossary(str_replace( '\"', '"', $entry->definition), $query->glossaryentryid, $contextglossary->id, $game->course); + echo $s.'
      '; + + echo get_string( 'answer').': '; + echo "
      "; + + echo "
      \n"; +} + + +function game_snakes_check_questions( $id, $game, $attempt, $snakes, $context) +{ + global $QTYPES, $CFG, $DB; + + $responses = data_submitted(); + + if( $responses->queryid != $snakes->queryid){ + game_snakes_play( $id, $game, $attempt, $snakes, $context); + return; + } + + $questionlist = $DB->get_field( 'game_queries', 'questionid', array( 'id' => $responses->queryid)); + + $questions = game_sudoku_getquestions( $questionlist); + $correct = false; + $query = ''; + foreach($questions as $question) { + $query = new stdClass(); + $query->id = $snakes->queryid; + + $grade = game_grade_responses( $question, $responses, 100, $answertext); + if( $grade < 50){ + //wrong answer + game_update_queries( $game, $attempt, $query, 0, $answertext); + continue; + } + + //correct answer + $correct = true; + + game_update_queries( $game, $attempt, $query, 1, ''); + } + + //set the grade of the whole game + game_snakes_position( $id, $game, $attempt, $snakes, $correct, $query, $context); +} + + +function game_snakes_check_glossary( $id, $game, $attempt, $snakes, $context) +{ + global $QTYPES, $CFG, $DB; + + $responses = data_submitted(); + + if( $responses->queryid != $snakes->queryid){ + game_snakes_play( $id, $game, $attempt, $snakes, $context); + return; + } + + $query = $DB->get_record( 'game_queries', array( 'id' => $responses->queryid)); + + $glossaryentry = $DB->get_record( 'glossary_entries', array( 'id' => $query->glossaryentryid)); + + $name = 'resp'.$query->glossaryentryid; + $useranswer = $responses->answer; + + if( game_upper( $useranswer) != game_upper( $glossaryentry->concept)){ + //wrong answer + $correct = false; + game_update_queries( $game, $attempt, $query, 0, $useranswer);//last param is grade + }else + { + //correct answer + $correct = true; + + game_update_queries( $game, $attempt, $query, 1, $useranswer);//last param is grade + } + + //set the grade of the whole game + game_snakes_position( $id, $game, $attempt, $snakes, $correct, $query, $context); +} + + +function game_snakes_position( $id, $game, $attempt, $snakes, $correct, $query, $context) +{ + global $DB; + + $data = $DB->get_field( 'game_snakes_database', 'data', array( 'id' => $snakes->snakesdatabaseid)); + + if( $correct){ + if( ($next=game_snakes_foundlander( $snakes->position + $snakes->dice, $data))){ + $snakes->position = $next; + }else + { + $snakes->position = $snakes->position + $snakes->dice; + } + }else + { + if( ($next=game_snakes_foundsnake( $snakes->position, $data))){ + $snakes->position = $next; + } + } + + $updrec = new stdClass(); + $updrec->id = $snakes->id; + $updrec->position = $snakes->position; + $updrec->queryid = 0; + + if( !$DB->update_record( 'game_snakes', $updrec)){ + print_error( "game_snakes_position: Can't update game_snakes"); + } + + $board = $DB->get_record_select( 'game_snakes_database', "id=$snakes->snakesdatabaseid"); + $gradeattempt = $snakes->position / ($board->cols * $board->rows); + $finished = ( $snakes->position > $board->cols * $board->rows ? 1 : 0); + + game_updateattempts( $game, $attempt, $gradeattempt, $finished); + + game_snakes_computenextquestion( $game, $snakes, $query); + + game_snakes_play( $id, $game, $attempt, $snakes, $context); +} + +//in lander go forward +function game_snakes_foundlander( $position, $data) +{ + preg_match( "/L$position-([0-9]*)/", $data, $matches); + + if( count( $matches)){ + return $matches[ 1]; + } + + return 0; +} + +//in snake go backward +function game_snakes_foundsnake( $position, $data) +{ + preg_match( "/S([0-9]*)-$position,/", $data.',', $matches); + + if( count( $matches)){ + return $matches[ 1]; + } + + return 0; +} + +function game_snakes_remove_attemptdata ($questionusageid, $questionid) { + global $DB; + + $sql = "SELECT qas.id + FROM mdl_question_attempts qa + LEFT JOIN mdl_question_attempt_steps qas + ON qa.id=qas.questionattemptid + WHERE questionusageid = $questionusageid + AND questionid = $questionid + AND state != 'todo'"; + + if ($stepdata = $DB->get_records_sql($sql)) { + foreach($stepdata as $step) { + if ($step->id > 0) { + $DB->delete_records('question_attempt_step_data', array('attemptstepid' => $step->id)); + $DB->get_records_sql("update {question_attempt_steps} set state='todo' where id = {$step->id}"); + } + } + } +} diff --git a/sudoku/class.Sudoku.php b/sudoku/class.Sudoku.php new file mode 100644 index 0000000..b586c57 --- /dev/null +++ b/sudoku/class.Sudoku.php @@ -0,0 +1,2181 @@ + + * @copyright copyright @ 2005 by Dick Munroe, Cottage Software Works, Inc. + * @license http://www.csworks.com/publications/ModifiedNetBSD.html + * @version 2.2.0 + * @package Sudoku + */ + +/** + * Basic functionality needed for ObjectSs in the Sudoku solver. + * + * Technically speaking these aren't restricted to the Sudoku classes + * and are of use generally. + * + * @package Sudoku + */ + +class ObjectS +{ + /** + * @desc Are two array's equal (have the same contents). + * @param array + * @param array + * @return boolean + */ + + function array_equal($theArray1, $theArray2) + { + if (!(is_array($theArray1) && is_array($theArray2))) + { + return false ; + } + + if (count($theArray1) != count($theArray2)) + { + return false ; + } + + $xxx = array_diff($theArray1, $theArray2) ; + + return (count($xxx) == 0) ; + } + + /** + * Deep copy anything. + * + * @access public + * @param array $theArray [optional] Something to be deep copied. [Default is the current + * ObjectS. + * @return mixed The deep copy of the input. All references embedded within + * the array have been resolved into copies allowing things like the + * board array to be copied. + */ + + function deepCopy($theArray = NULL) + { + if ($theArray === NULL) + { + return unserialize(serialize($this)) ; + } + else + { + return unserialize(serialize($theArray)) ; + } + } + + /** + * @desc Debugging output interface. + * @access public + * @param mixed $theValue The "thing" to be pretty printed. + * @param boolean $theHTMLFlag True if the output will be seen in a browser, false otherwise. + */ + + function print_d(&$theValue, $theHTMLFlag = true) + { + print SDD::dump($theValue, $theHTMLFlag) ; + } +} + +/** + * The individual cell on the Sudoku board. + * + * These cells aren't restricted to 9x9 Sudoku (although pretty much everything else + * at the moment). This class provides the state manipulation and searching capabilities + * needed by the inference engine (class RCS). + * + * @package Sudoku + */ + +class Cell extends ObjectS +{ + var $r ; + var $c ; + + var $state = array() ; + var $applied = false ; + + + /** + * @desc Constructor + * @param integer $r row address of this cell (not used, primarily for debugging purposes). + * @param integer $c column address of this cell (ditto). + * @param integer $nStates The number of states each cell can have. Looking forward to + * implementing Super-doku. + */ + + function Cell($r, $c, $nStates = 9) + { + + $this->r = $r ; + $this->c = $c ; + + for ($i = 1; $i <= $nStates; $i++) + { + $this->state[$i] = $i ; + } + } + + /** + * @desc This cell has been "applied", i.e., solved, to the board. + */ + + function applied() + { + $this->applied = true ; + } + + /** + * Only those cells which are not subsets of the tuple have the + * contents of the tuple removed. + * + * @desc apply a 23Tuple to a cell. + * @access public + * @param array $aTuple the tuple to be eliminated. + */ + + function apply23Tuple($aTuple) + { + if (is_array($this->state)) + { + $xxx = array_intersect($this->state, $aTuple) ; + if ((count($xxx) > 0) && (count($xxx) != count($this->state))) + { + return $this->un_set($aTuple) ; + } + else + { + return false ; + } + } + else + { + return false ; + } + } + + /** + * For more details on the pair tuple algorithm, see RCS::_pairSolution. + * + * @desc Remove all values in the tuple, but only if the cell is a superset. + * @access public + * @param array A tuple to be eliminated from the cell's state. + */ + + function applyTuple($aTuple) + { + if (is_array($this->state)) + { + if (!$this->array_equal($aTuple, $this->state)) + { + return $this->un_set($aTuple) ; + } + } + + return false ; + } + + /** + * @desc Return the string representation of the cell. + * @access public + * @param boolean $theFlag true if the intermediate states of the cell are to be visible. + * @return string + */ + + function asString($theFlag = false) + { + if (is_array($this->state)) + { + if (($theFlag) || (count($this->state) == 1)) + { + return implode(", ", $this->state) ; + } + else + { + return " " ; + } + } + else + { + return $this->state ; + } + } + + /** + * Used to make sure that solved positions show up at print time. + * The value is used as a candidate for "slicing and dicing" by elimination in + * Sudoku::_newSolvedPosition. + * + * @desc Assert pending solution. + * @access public + * @param integer $value The value for the solved position. + */ + + function flagSolvedPosition($value) + { + $this->state = array($value => $value) ; + } + + /** + * @desc return the state of a cell. + * @access protected + * @return mixed Either solved state or array of state pending solution. + */ + + function &getState() + { + return $this->state ; + } + + /** + * @desc Has the state of this cell been applied to the board. + * @access public + * @return boolean True if it has, false otherwise. Implies that IsSolved is true as well. + */ + + function IsApplied() + { + return $this->applied ; + } + + /** + * @desc Has this cell been solved? + * @access public + * @return boolean True if this cell has hit a single state. + */ + + function IsSolved() + { + return !is_array($this->state) ; + } + + /** + * This is used primarily by the pretty printer, but has other applications + * in the code. + * + * @desc Return information about the state of a cell. + * @access public + * @return integer 0 => the cell has been solved. + * 1 => the cell has been solved but not seen a solved. + * 2 => the cell has not been solved. + */ + + function solvedState() + { + if (is_array($this->state)) + { + if (count($this->state) == 1) + { + return 1 ; + } + else + { + return 2 ; + } + } + else + { + return 0 ; + } + } + + /** + * This is the negative inference of Sudoku. By eliminating values the + * cells approach solutions. Once a cell has been completely eliminated, + * the value causing the complete elimination must be the solution and the + * cell is promoted into the solved state. + * + * @desc Eliminate one or more values from the state information of the cell. + * @access public + * @param mixed The value or values to be removed from the cell state. + * @return boolean True if the cell state was modified, false otherwise. + */ + + function un_set($theValues) + { + if (is_array($theValues)) + { + $theReturn = FALSE ; + + foreach ($theValues as $theValue) + { + $theReturn |= $this->un_set($theValue) ; + } + + return $theReturn ; + } + + if (is_array($this->state)) + { + $theReturn = isset($this->state[$theValues]) ; + unset($this->state[$theValues]) ; + if (count($this->state) == 0) + { + $this->state = $theValues ; + } + return $theReturn ; + } + else + { + return false ; + } + } +} + +/** + * The individual row column or square on the Sudoku board. + * + * @package Sudoku + */ + +class RCS extends ObjectS +{ + var $theIndex ; + + var $theRow = array() ; + + var $theHeader = "" ; + + var $theTag = "" ; + + /** + * This + * @desc Constructor + * @access public + * @param string $theTag "Row", "Column", "Square", used primarily in debugging. + * @param integer $theIndex 1..9, where is this on the board. Square are numbered top + * left, ending bottom right + * @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what + * limts things to 9x9 Sudoku currently. + */ + + function RCS($theTag, $theIndex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) + { + $this->theTag = $theTag ; + $this->theIndex = $theIndex ; + $this->theRow[1] = &$a1 ; + $this->theRow[2] = &$a2 ; + $this->theRow[3] = &$a3 ; + $this->theRow[4] = &$a4 ; + $this->theRow[5] = &$a5 ; + $this->theRow[6] = &$a6 ; + $this->theRow[7] = &$a7 ; + $this->theRow[8] = &$a8 ; + $this->theRow[9] = &$a9 ; + } + + /** + * There is a special case that comes up a lot in Sudoku. If there + * are values i, j, k and cells of the form (i, j), (j, k), (i, j, k) + * the the values i, j, and k cannot appear in any other cells. The + * proof is a simple "by contradiction" proof. Assume that the values + * do occur elsewhere and you always get a contradiction for these + * three cells. I'm pretty sure that this is a general rule, but for + * 9x9 Sudoku, they probably aren't of interested. + * + * @desc + * @access private + * @return boolean True if a 23 solution exists and has been applied. + */ + + function _23Solution() + { + $theCounts = array() ; + $theTuples = array() ; + $theUnsolved = 0 ; + + for ($i = 1; $i <= 9; $i++) + { + $j = count($this->theRow[$i]->getState()); + $theCounts[ $j][] = $i ; + $theUnsolved++ ; + } + + if( array_key_exists( 2, $theCounts) and array_key_exists( 3, $theCounts)) + { + if ((count($theCounts[2]) < 2) || (count($theCounts[3]) < 1)) + return false ; + } + + /* + * Look at each pair of 2 tuples and see if their union exists in the 3 tuples. + * If so, eliminate everything from the set and bail. + */ + + $the2Tuples = &$theCounts[2] ; + $the3Tuples = &$theCounts[3] ; + $theCount2 = count($the2Tuples) ; + $theCount3 = count($the3Tuples) ; + + for ($i = 0; $i < $theCount2 - 1; $i++) + { + for ($j = $i + 1; $j < $theCount2; $j++) + { + $xxx = array_unique(array_merge($this->theRow[$the2Tuples[$i]]->getState(), + $this->theRow[$the2Tuples[$j]]->getState())) ; + for ($k = 0; $k < $theCount3; $k++) + { + if ($this->array_equal($xxx, $this->theRow[$the3Tuples[$k]]->getState())) + { + $theTuples[] = $xxx ; + break ; + } + } + } + } + + /* + * Since it takes 3 cells to construct the 23 tuple, unless there are more than 3 + * unsolved cells, further work doesn't make any sense. + */ + + $theReturn = false ; + + if ((count($theTuples) != 0) && ($theUnsolved > 3)) + { + foreach ($theTuples as $aTuple) + { + foreach($this->theRow as $theCell) + { + $theReturn |= $theCell->apply23Tuple($aTuple) ; + } + } + } + + if ($theReturn) + { + $this->theHeader[] = sprintf("
      Apply %s[%d] 23 Tuple Inference:", $this->theTag, $this->theIndex) ; + } + + return $theReturn ; + } + + /** + * @desc apply a tuple to exclude items from within the row/column/square. + * @param array $aTuple the tuple to be excluded. + * @access private + * @return boolean true if anything changes. + */ + + function _applyTuple(&$aTuple) + { + $theReturn = FALSE ; + + for ($i = 1; $i <=9; $i++) + { + $theReturn |= $this->theRow[$i]->applyTuple($aTuple) ; + } + + return $theReturn ; + } + + /** + * This is a placeholder to be overridden to calculate the "coupling" for + * a cell. Coupling is defined to be the sum of the sizes of the intersection + * between this cell and all others in the row/column/square. This provides + * a metric for deciding placement of clues within puzzles. In effect, this + * forces the puzzle generator to select places for new clues depending upon + * how little information is changed by altering the state of a cell. The larger + * the number returned by the coupling, function, the less information is currently + * available for the state of the cell. By selecting areas with the least information + * the clue sets are substantially smaller than simple random placement. + * + * @desc Calculate the coupling for a cell within the row/column/square. + * @access abstract + * @param integer $theRow the row coordinate on the board of the cell. + * @param integer $theColumn the column coordinate on the board of the cell. + * @return integer the degree of coupling between the cell and the rest of the cells + * within the row/column/square. + */ + + function coupling($theRow, $theColumn) + { + return 0 ; + } + + /** + * I think that the goal of the inference engine is to eliminate + * as much "junk" state as possible on each pass. Therefore the + * order of the inferences should be 23 tuple, pair, unique because + * the 23 tuple allows you to eliminate 3 values (if it works), and the + * pair (generally) only 2. The unique solution adds no new information. + * + * @desc Run the inference engine for a row/column/square. + * @access public + * @param array theRow A row/column/square data structure. + * @param string theType A string merged with the standard headers during + * intermediate solution printing. + * @return boolean True when at least one inference has succeeded. + */ + + function doAnInference() + { + $this->theHeader = NULL ; + + $theReturn = $this->_23Solution() ; + $theReturn |= $this->_pairSolution() ; + $theReturn |= $this->_uniqueSolution() ; + + return $theReturn ; + } + + /** + * @desc Find all tuples with the same contents. + * @param array Array of n size tuples. + * @returns array of tuples that appear the same number of times as the size of the contents + */ + + function _findTuples(&$theArray) + { + $theReturn = array() ; + for ($i = 0; $i < count($theArray); $i++) + { + $theCount = 1 ; + + for ($j = $i + 1; $j < count($theArray); $j++) + { + $s1 = &$this->theRow[$theArray[$i]] ; + $s1 =& $s1->getState() ; + + $s2 = &$this->theRow[$theArray[$j]] ; + $s2 =& $s2->getState() ; + + $aCount = count($s1) ; + + if ($this->array_equal($s1, $s2)) + { + $theCount++ ; + + if ($theCount == $aCount) + { + $theReturn[] = $s1 ; + break ; + } + } + } + } + + return $theReturn ; + } + + /** + * @desc Get a reference to the specified cell. + * @access public + * @return reference to ObjectS of class Cell. + */ + + function &getCell($i) + { + return $this->theRow[$i] ; + } + + /** + * @desc Get the header set by the last call to doAnInference. + * + */ + + function getHeader() + { + return $this->theHeader ; + } + + /** + * Turns out if you every find a position of n squares which can only contain + * the same values, then those values cannot appear elsewhere in the structure. + * This is a second positive inference that provides additional negative information. + * Thanks to Ghica van Emde Boas (also an author of a Sudoku class) for convincing + * me that these situations really occurred. + * + * @desc Eliminate tuple-locked alternatives. + * @access private + * @return boolean True if something changed. + */ + + function _pairSolution() + { + $theCounts = array() ; + $theTuples = array() ; + + for ($i = 1; $i <= 9; $i++) + { + $c = &$this->theRow[$i] ; + $theCounts[count($c->getState())][] = $i ; + } + + unset($theCounts[1]) ; + + /* + ** Get rid of any set of counts which cannot possibly meet the + ** requirements. + */ + + $thePossibilities = $theCounts ; + + foreach ($theCounts as $theKey => $theValue) + { + if (count($theValue) < $theKey) + { + unset($thePossibilities[$theKey]) ; + } + } + + if (count($thePossibilities) == 0) + { + return false ; + } + + /* + * At this point there are 1 or more tuples which MAY satisfy the conditions. + */ + + $theReturn = false ; + + foreach ($thePossibilities as $theValue) + { + $theTuples = $this->_findTuples($theValue) ; + + if (count($theTuples) != 0) + { + foreach ($theTuples as $aTuple) + { + $theReturn |= $this->_applyTuple($aTuple) ; + } + } + } + + if ($theReturn) + { + $this->theHeader[] = sprintf("
      Apply %s[%d] Pair Inference:", $this->theTag, $this->theIndex) ; + } + + return $theReturn ; + } + + function un_set($theValues) + { + $theReturn = false ; + + for ($i = 1; $i <= 9; $i++) + { + $c = &$this->theRow[$i] ; + $theReturn |= $c->un_set($theValues) ; + } + + return $theReturn ; + } + + /** + * Find a solution to a row/column/square. + * + * Find any unique numbers within the row/column/square under consideration. + * Look through a row structure for a value that appears in only one cell. + * When you find one, that's a solution for that cell. + * + * There is a second inference that can be taken. Given "n" cells in a row/column/square + * and whose values can only consist of a set of size "n", then those values may obtain + * there and ONLY there and may be eliminated from consideration in the rest of the set. + * For example, if two cells must contain the values 5 or 6, then no other cell in that + * row/column/square may contain those values, similarly for 3 cells, etc. + * + * @access private + * @return boolean True if one or more values in the RCS has changed state. + */ + + function _uniqueSolution() + { + $theSet = array() ; + + for ($i = 1; $i <= 9; $i++) + { + $c = &$this->theRow[$i] ; + if (!$c->IsSolved()) + { + foreach ($c->getState() as $theValue) + { + $theSet[$theValue][] = $i ; + } + } + } + + /* + * If there were no unsolved positions, then we're done and nothing has + * changed. + */ + + if (count($theSet) == 0) + { + return false ; + } + + /* + * Pull out all those keys having only one occurrance in the RCS. + */ + + foreach ($theSet as $theKey => $theValues) + { + if (count($theValues) != 1) + { + unset($theSet[$theKey]) ; + } + } + + /* + * If there aren't any unique values, we're done. + */ + + if (count($theSet) == 0) + { + return false ; + } + + foreach ($theSet as $theValue => $theIndex) + { + $this->theRow[$theIndex[0]]->flagSolvedPosition($theValue) ; + } + + $this->theHeader[] = sprintf("
      Apply %s[%d] Unique Inference:", $this->theTag, $this->theIndex) ; + + return true ; + } + + /** + * @desc Check to see if the RCS contains a valid state. + * @access public + * @return boolean True if the state of the RCS could be part of a valid + * solution, false otherwise. + */ + + function validateSolution() + { + $theNewSet = array() ; + + foreach ($this->theRow as $theCell) + { + if ($theCell->solvedState() == 0) + { + $theNewSet[] = $theCell->getState() ; + } + } + + $xxx = array_unique($theNewSet) ; + + return (count($xxx) == count($this->theRow)) ; + } + + /** + * Validate a part of a trial solution. + * + * Check a row/column/square to see if there are any invalidations on this solution. + * Only items that are actually solved are compared. This is used during puzzle + * generation. + * + * @access public + * @return True if the input parameter contains a valid solution, false otherwise. + */ + + function validateTrialSolution() + { + $theNewSet = array() ; + + foreach($this->theRow as $theCell) + { + if ($theCell->solvedState() == 0) + { + $theNewSet[] = $theCell->getState() ; + } + } + + $xxx = array_unique($theNewSet) ; + + return ((count($xxx) == count($theNewSet) ? TRUE : FALSE)) ; + } +} + +/** + * Row ObjectS. + * + * @package Sudoku + */ + +class R extends RCS +{ + /** + * @desc Constructor + * @access public + * @param string $theTag "Row", "Column", "Square", used primarily in debugging. + * @param integer $theIndex 1..9, where is this on the board. Square are numbered top + * left, ending bottom right + * @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what + * limts things to 9x9 Sudoku currently. + */ + + function R($theTag, $theIndex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) + { + $this->RCS($theTag, $theIndex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9) ; + } + + /** + * @see RCS::coupling + */ + + function coupling($theRow, $theColumn) + { + return $theState = $this->_coupling($theColumn) ; + } + + /** + * @see RCS::coupling + * @desc Heavy lifting for row/column coupling calculations. + * @access private + * @param integer $theIndex the index of the cell within the row or column. + * @return integer the "coupling coefficient" for the cell. The sum of the + * sizes of the intersection between this and all other + * cells in the row or column. + */ + + function _coupling($theIndex) + { + $theCommonState =& $this->getCell($theIndex) ; + $theCommonState =& $theCommonState->getState() ; + + $theCoupling = 0 ; + + for ($i = 1; $i <= count($this->theRow); $i++) + { + if ($i != $theIndex) + { + $theCell =& $this->getCell($i) ; + if ($theCell->solvedState() != 0) + { + $theCoupling += count(array_intersect($theCommonState, $theCell->getState())) ; + } + } + } + + return $theCoupling ; + } +} + +/** + * The column ObjectS. + * + * @package Sudoku + */ + +class C extends R +{ + /** + * @desc Constructor + * @access public + * @param string $theTag "Row", "Column", "Square", used primarily in debugging. + * @param integer $theIndex 1..9, where is this on the board. Square are numbered top + * left, ending bottom right + * @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what + * limts things to 9x9 Sudoku currently. + */ + + function C($theTag, $theIndex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) + { + $this->R($theTag, $theIndex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9) ; + } + + /** + * @see R::coupling + */ + + function coupling($theRow, $theColumn) + { + return $theState = $this->_coupling($theRow) ; + } + +} + +/** + * The Square ObjectS. + * + * @package Sudoku + */ + +class S extends RCS +{ + /** + * The cells within the 3x3 sudoku which participate in the coupling calculation for a square. + * Remember that the missing cells have already participated in the row or column coupling + * calculation. + * + * @access private + * @var array + */ + + var $theCouplingOrder = + array( 1 => array(5, 6, 8, 9), + 2 => array(4, 6, 7, 9), + 3 => array(4, 5, 7, 8), + 4 => array(2, 3, 8, 9), + 5 => array(1, 3, 7, 9), + 6 => array(1, 2, 7, 8), + 7 => array(2, 3, 5, 6), + 8 => array(1, 3, 4, 6), + 9 => array(1, 2, 4, 5)) ; + + /** + * @desc Constructor + * @access public + * @param string $theTag "Row", "Column", "Square", used primarily in debugging. + * @param integer $theIndex 1..9, where is this on the board. Square are numbered top + * left, ending bottom right + * @param ObjectS $a1..9 of class Cell. The cells comprising this entity. This interface is what + * limts things to 9x9 Sudoku currently. + */ + + function S($theTag, $theIndex, &$a1, &$a2, &$a3, &$a4, &$a5, &$a6, &$a7, &$a8, &$a9) + { + $this->RCS($theTag, $theIndex, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9) ; + } + + /** + * @see RCS::coupling + */ + + function coupling($theRow, $theColumn) + { + $theIndex = ((($theRow - 1) % 3) * 3) + (($theColumn - 1) % 3) + 1 ; + $theCommonState =& $this->getCell($theIndex) ; + $theCommonState =& $theCommonState->getState() ; + + $theCoupling = 0 ; + + foreach ($this->theCouplingOrder[$theIndex] as $i) + { + $theCell =& $this->getCell($i) ; + if ($theCell->solvedState() != 0) + { + $theCoupling += count(array_intersect($theCommonState, $theCell->getState())) ; + } + } + + return $theCoupling ; + } +} + +/** + * Solve and generate Sudoku puzzles. + * + * Solve and generate Sudoku. A simple output interface is provided for + * web pages. The primary use of this class is as infra-structure for + * Sudoku game sites. + * + * The solver side of this class (solve) relies on the usual characteristic + * of logic puzzles, i.e., at any point in time there is one (or more) + * UNIQUE solution to some part of the puzzle. This solution can be + * applied, then iterated upon to find the next part of the puzzle. A + * properly constructed Sudoku can have only one solution which guarangees + * that this is the case. (Sudoku with multiple solutions will always + * require guessing at some point which is specifically disallowed by + * the rules of Sudoku). + * + * While the solver side is algorithmic, the generator side is much more + * difficult and, in fact, the generation of Sudoku appears to be NP + * complete. That being the case, I observed that most successful + * generated initial conditions happened quickly, typically with < 40 + * iterations. So the puzzle generator runs "for a while" until it + * either succeeds or doesn't generated a solveable puzzle. If we get + * to that position, I just retry and so far I've always succeeded in + * generating an initial state. Not guarateed, but in engineering terms + * "close enough". + * + * @package Sudoku + * @example ./example.php + * @example ./example1.php + * @example ./example2.php + * @example ./example3.php +*/ + +class Sudoku extends ObjectS +{ + /** + * An array of Cell ObjectSs, organized into rows and columns. + * + * @access private + * @var array of ObjectSs of type Cell. + */ + + var $theBoard = array() ; + + /** + * True if debugging output is to be provided during a run. + * + * @access private + * @var boolean + */ + + var $theDebug = FALSE ; + + /** + * An array of RCS ObjectSs, one ObjectS for each row. + * + * @access private + * @var ObjectS of type R + */ + + var $theRows = array() ; + + /** + * An array of RCS ObjectSs, one ObjectS for each Column. + * + * @access private + * @var ObjectS of type C + */ + + var $theColumns = array() ; + + /** + * An array of RCS ObjectSs, one ObjectS for each square. + * + * @access private + * @var ObjectS of type S + */ + + var $theSquares = array() ; + + /** + * Used during puzzle generation for debugging output. There may + * eventually be some use of theLevel to figure out where to stop + * the backtrace when puzzle generation fails. + * + * @access private + * @var integer. + */ + + var $theLevel = 0 ; + + /** + * Used during puzzle generation to determine when the generation + * will fail. Failure, in this case, means to take a LONG time. The + * backtracing algorithm used in the puzzle generator will always find + * a solution, it just might take a very long time. This is a way to + * limit the damage before taking another guess. + * + * @access private + * @var integer. + */ + + var $theMaxIterations = 50 ; + + /** + * Used during puzzle generation to limit the number of trys at + * generation a puzzle in the event puzzle generation fails + * (@see Suduko::$theMaxIterations). I've never seen more than + * a couple of failures in a row, so this should be sufficient + * to get a puzzle generated. + * + * @access private + * @var integer. + */ + + var $theTrys = 10 ; + + /** + * Used during puzzle generation to count the number of iterations + * during puzzle generation. It the number gets above $theMaxIterations, + * puzzle generation has failed and another try is made. + * + * @access private + * @var integer. + */ + + var $theGenerationIterations = 0 ; + + function Sudoku($theDebug = FALSE) + { + $this->theDebug = $theDebug ; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + $this->theBoard[$i][$j] = new Cell($i, $j) ; + } + } + + $this->_buildRCS() ; + } + + /** + * Apply a pending solved position to the row/square/column. + * + * At this point, the board has been populated with any pending solutions. + * This applies the "negative" inference that no row, column, or square + * containing the value within the cell. + * + * @access private + * @param integer $row The row of the board's element whose value is now fixed. + * @param integer $col The column of the board's element whose value is now fixed. + */ + + function _applySolvedPosition($row, $col) + { + $theValue = $this->theBoard[$row][$col]->getState() ; + + /* + ** No other cell in the row, column, or square can take on the value "value" any longer. + */ + + $i = (((int)(($row - 1) / 3)) * 3) ; + $i = $i + ((int)(($col - 1) / 3)) + 1 ; + + $this->theRows[$row]->un_set($theValue) ; + + $this->theColumns[$col]->un_set($theValue) ; + + $this->theSquares[$i]->un_set($theValue) ; + } + + /** + * @desc Apply all pending solved positions to the board. + * @access private + * @return boolean True if at least one solved position was applied, false + * otherwise. + */ + + function _applySolvedPositions() + { + $theReturn = false ; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + if (!$this->theBoard[$i][$j]->IsApplied()) + { + if ($this->theBoard[$i][$j]->solvedState() == 0) + { + $this->_applySolvedPosition($i, $j) ; + + /* + ** Update the solved position matrix and make sure that the board actually + ** has a value in place. + */ + + $this->theBoard[$i][$j]->applied() ; + $theReturn = TRUE ; + } + } + } + } + + return $theReturn ; + } + + /** + * @desc build the row/column/square structures for the board. + * @access private + */ + + function _buildRCS() + { + for ($i = 1; $i <= 9; $i++) + { + $this->theRows[$i] = + new R("Row", + $i, + $this->theBoard[$i][1], + $this->theBoard[$i][2], + $this->theBoard[$i][3], + $this->theBoard[$i][4], + $this->theBoard[$i][5], + $this->theBoard[$i][6], + $this->theBoard[$i][7], + $this->theBoard[$i][8], + $this->theBoard[$i][9]) ; + $this->theColumns[$i] = + new C("Column", + $i, + $this->theBoard[1][$i], + $this->theBoard[2][$i], + $this->theBoard[3][$i], + $this->theBoard[4][$i], + $this->theBoard[5][$i], + $this->theBoard[6][$i], + $this->theBoard[7][$i], + $this->theBoard[8][$i], + $this->theBoard[9][$i]) ; + + $r = ((int)(($i - 1) / 3)) * 3 ; + $c = (($i - 1) % 3) * 3 ; + + $this->theSquares[$i] = + new S("Square", + $i, + $this->theBoard[$r + 1][$c + 1], + $this->theBoard[$r + 1][$c + 2], + $this->theBoard[$r + 1][$c + 3], + $this->theBoard[$r + 2][$c + 1], + $this->theBoard[$r + 2][$c + 2], + $this->theBoard[$r + 2][$c + 3], + $this->theBoard[$r + 3][$c + 1], + $this->theBoard[$r + 3][$c + 2], + $this->theBoard[$r + 3][$c + 3]) ; + } + } + + /** + * Seek alternate solutions in a solution set. + * + * Given a solution, see if there are any alternates within the solution. + * In theory this should return the "minimum" solution given any solution. + * + * @access public + * @param array $theInitialState (@see Sudoku::initializePuzzleFromArray) + * @return array A set of triples containing the minimum solution. + */ + + function findAlternateSolution($theInitialState) + { + $j = count($theInitialState) ; + + for ($i = 0; $i < $j; $i++) + { + $xxx = $theInitialState ; + + $xxx = array_splice($xxx, $i, 1) ; + + $this->Sudoku() ; + + $this->initializePuzzleFromArray($xxx) ; + + if ($this->solve()) + { + return $this->findAlternateSolution($xxx) ; + } + } + + return $theInitialState ; + } + + /** + * Initialize Sudoku puzzle generation and generate a puzzle. + * + * Turns out that while the solution of Sudoku is mechanical, the creation of + * Sudoku is an NP-Complete problem. Which means that I can use the inference + * engine to help generate puzzles, but I need to test the solution to see if + * I've gone wrong and back up and change my strategy. So something in the + * recursive descent arena will be necessary. Since the generation can take + * a long time to force a solution, it's easier to probe for a solution + * if you go "too long". + * + * @access public + * @param integer $theDifficultyLevel [optional] Since virtually everybody who + * plays sudoku wants a variety of difficulties this controls that. + * 1 is the easiest, 10 the most difficult. The easier Sudoku have + * extra information. + * @param integer $theMaxInterations [optional] Controls the number of iterations + * before the puzzle generator gives up and trys a different set + * of initial parameters. + * @param integer $theTrys [optional] The number of attempts at resetting the + * initial parameters before giving up. + * @return array A set of triples suitable for initializing a new Sudoku class + * (@see Sudoku::initializePuzzleFromArray). + */ + + function generatePuzzle($theDifficultyLevel = 10, $theMaxIterations = 50, $theTrys = 10) + { + $theDifficultyLevel = min($theDifficultyLevel, 10) ; + $theDifficultyLevel = max($theDifficultyLevel, 1) ; + + $this->theLevel = 0 ; + $this->theTrys = $theTrys ; + $this->theMaxIterations = $theMaxIterations ; + $this->theGenerationIterations = 0 ; + + for ($theTrys = 0; $theTrys < $this->theTrys ; $theTrys++) + { + $theAvailablePositions = array() ; + $theCluesPositions = array() ; + $theClues = array() ; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + $theAvailablePositions[] = array($i, $j) ; + } + + $theInitialState = $this->_generatePuzzle($theAvailablePositions, $theCluesPositions, $theClues) ; + + if ($theInitialState) + { + if ($theDifficultyLevel != 10) + { + $xxx = array() ; + + foreach ($theInitialState as $yyy) + $xxx[] = (($yyy[0] - 1) * 9) + ($yyy[1] - 1) ; + + /* + ** Get rid of the available positions already used in the initial state. + */ + + sort($xxx) ; + $xxx = array_reverse($xxx) ; + + foreach ($xxx as $i) + array_splice($theAvailablePositions, $i, 1) ; + + /* + ** Easy is defined as the number of derivable clues added to the minimum + ** required information to solve the puzzle as returned by _generatePuzzle. + */ + + for ($i = 0; $i < (10 - $theDifficultyLevel); $i++) + { + $xxx = mt_rand(0, count($theAvailablePositions)-1) ; + $row = $theAvailablePositions[$xxx][0] ; + $col = $theAvailablePositions[$xxx][1] ; + $theInitialState[] = array($row, $col, $this->theBoard[$row][$col]) ; + array_splice($theAvailablePositions, $xxx, 1) ; + } + } + + //echo "found $theTrys
      "; + return $theInitialState ; + } + + if ($this->theDebug) + printf("
      Too many iterations (%d), %d\n", $this->theMaxIterations, $theTrys); + + $this->Sudoku($this->theDebug) ; + } + + /* + ** No solution possible, we guess wrong too many times. + */ + + //echo "try=$theTrys
      "; + return array() ; + } + + /** + * Sudoku puzzle generator. + * + * This is the routine that does the heavy lifting + * for the puzzle generation. It works by taking a guess for a value of a cell, applying + * the solver, testing the solution, and if it's a valid solution, calling itself + * recursively. If during this process, a solution cannot be found, the generator backs + * up (backtrace in Computer Science parlance) and trys another value. Since the generation + * appears to be an NP complete problem (according to the literature) limits on the number + * of iterations are asserted. Once these limits are passed, the generator gives up and + * makes another try. If enough tries are made, the generator gives up entirely. + * + * @access private + * @param array $theAvailablePositions A set of pairs for all positions which have not been + * filled by the solver or the set of guesses. When we run out of available + * positions, the solution is in hand. + * @param array $theCluesPositions A set of pairs for which values have been set by the + * puzzle generator. + * @param array $theClues A set of values for each pair in $theCluesPositions. + * @return array NULL array if no solution is possible, otherwise a set of triples + * suitable for feeding to {@link Sudoku::initializePuzzleFromArray} + */ + + function _generatePuzzle($theAvailablePositions, $theCluesPositions, $theClues) + { + $this->theLevel++ ; + + $this->theGenerationIterations++ ; + + /* + ** Since the last solution sequence may have eliminated one or more positions by + ** generating forced solutions for them, go through the list of available positions + ** and get rid of any that have already been solved. + */ + + $j = count($theAvailablePositions) ; + + for ($i = 0; $i < $j; $i++) + { + if ($this->theBoard[$theAvailablePositions[$i][0]][$theAvailablePositions[$i][1]]->IsApplied()) + { + array_splice($theAvailablePositions, $i, 1) ; + $i = $i - 1; + $j = $j - 1; + } + } + + if (count($theAvailablePositions) == 0) + { + /* + ** We're done, so we can return the clues and their positions to the caller. + ** This test is being done here to accommodate the eventual implementation of + ** generation from templates in which partial boards will be fed to the solver + ** and then the remaining board fed in. + */ + + for ($i = 0; $i < count($theCluesPositions); $i++) + array_push($theCluesPositions[$i], $theClues[$i]) ; + + return $theCluesPositions ; + } + + /* + ** Calculate the coupling for each available position. + ** + ** "coupling" is a measure of the amount of state affected by any change + ** to a given cell. In effect, the larger the coupling, the less constrained + ** the state of the cell is and the greater the effect of any change made to + ** the cell. There is some literature to this effect associated with Roku puzzles + ** (4x4 grid). I'm trying this attempting to find a way to generate consistently + ** more difficult Sudoku and it seems to have worked; the clue count drops to 25 or + ** fewer, more in line with the numbers predicted by the literature. The remainder + ** of the work is likely to be associated with finding better algorithms to solve + ** Sudoku (which would have the effect of generating harder ones). + */ + + $theCouplings = array() ; + + foreach ($theAvailablePositions as $xxx) + { + $theRowCoupling = $this->theRows[$xxx[0]]->coupling($xxx[0], $xxx[1]) ; + $theColumnCoupling = $this->theColumns[$xxx[1]]->coupling($xxx[0], $xxx[1]) ; + $theSquareCoupling = $this->theSquares[$this->_squareIndex($xxx[0], $xxx[1])]->coupling($xxx[0], $xxx[1]) ; + $theCouplings[$theRowCoupling + $theColumnCoupling + $theSquareCoupling][] = $xxx ; + } + + $theMaximumCoupling = max(array_keys($theCouplings)) ; + + /* + ** Pick a spot on the board and get the clues set up. + */ + + $theChoice = mt_rand(0, count($theCouplings[$theMaximumCoupling])-1) ; + $theCluesPositions[] = $theCouplings[$theMaximumCoupling][$theChoice] ; + $theRow = $theCouplings[$theMaximumCoupling][$theChoice][0] ; + $theColumn = $theCouplings[$theMaximumCoupling][$theChoice][1] ; + + /* + ** Capture the necessary global state of the board + */ + + $theCurrentBoard = $this->deepCopy($this->theBoard) ; + + /* + ** This is all possible states for the chosen cell. All values will be + ** randomly tried to see if a solution results. If all solutions fail, + ** the we'll back up in time and try again. + */ + + $thePossibleClues = array_keys($this->theBoard[$theRow][$theColumn]->getState()) ; + + while (count($thePossibleClues) != 0) + { + if ($this->theGenerationIterations > $this->theMaxIterations) + { + $this->theLevel = $this->theLevel - 1 ; + return array() ; + } + + $theClueChoice = mt_rand(0, count($thePossibleClues)-1) ; + $theValue = $thePossibleClues[$theClueChoice] ; + array_splice($thePossibleClues, $theClueChoice, 1) ; + + $theClues[] = $theValue ; + + $this->theBoard[$theRow][$theColumn]->flagSolvedPosition($theValue) ; + + if ($this->theDebug ) { printf("
      (%03d, %03d) Trying (%d, %d) = %d\n", $this->theLevel, $this->theGenerationIterations, $theRow, $theColumn, $theValue) ; } ; + + $theFlag = $this->solve(false) ; + + if ($this->_validateTrialSolution()) + { + if ($theFlag) + { + /* + ** We're done, so we can return the clues and their positions to the caller. + */ + + for ($i = 0; $i < count($theCluesPositions); $i++) + { + array_push($theCluesPositions[$i], $theClues[$i]) ; + } + + return $theCluesPositions ; + } + else + { + $xxx = $this->_generatePuzzle($theAvailablePositions, $theCluesPositions, $theClues) ; + + if ($xxx) + { + return $xxx ; + } + } + } + + /* + ** We failed of a solution, back out the state and try the next possible value + ** for this position. + */ + + $this->theBoard = $theCurrentBoard ; + $this->_buildRCS() ; + array_pop($theClues) ; + } + + $this->theLevel = $this->theLevel - 1 ; + + /* + ** If we get here, we've tried all possible values remaining for the chosen + ** position and couldn't get a solution. Back out and try something else. + */ + + return array() ; + } + + /** + * Return the contents of the board as a string of digits and blanks. Blanks + * are used where the corresponding board item is an array, indicating the cell + * has not yet been solved. + * + * @desc Get the current state of the board as a string. + * @access public + */ + + function getBoardAsString() + { + $theString = "" ; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + $theString .= $this->theBoard[$i][$j]->asString() ; + } + } + + return $theString ; + } + + function &getCell($r, $c) + { + return $this->theBoard[$r][$c] ; + } + + /** + * Each element of the input array is a triple consisting of (row, column, value). + * Each of these values is in the range 1..9. + * + * @access public + * @param array $theArray + */ + + function initializePuzzleFromArray($theArray) + { + foreach ($theArray as $xxx) + { + $c =& $this->getCell($xxx[0], $xxx[1]) ; + $c->flagSolvedPosition($xxx[2]) ; + } + } + + /** + * Initialize puzzle from an input file. + * + * The input file is a text file, blank or tab delimited, with each line being a + * triple consisting of "row column value". Each of these values is in the range + * 1..9. Input lines that are blank (all whitespace) or which begin with whitespace + * followed by a "#" character are ignored. + * + * @access public + * @param mixed $theHandle [optional] defaults to STDIN. If a string is passed + * instead of a file handle, the file is opened. + */ + + function initializePuzzleFromFile($theHandle = STDIN) + { + $theOpenedFileFlag = FALSE ; + + /* + ** If a file name is passed instead of a resource, open the + ** file and process it. + */ + + if (is_string($theHandle)) + { + $theHandle = fopen($theHandle, "r") ; + if ($theHandle === FALSE) + { + exit() ; + } + } + + $yyy = array() ; + + if ($theHandle) + { + while (!feof($theHandle)) + { + $theString = trim(fgets($theHandle)) ; + if (($theString != "") && + (!preg_match('/^\s*#/', $theString))) + { + $xxx = preg_split('/\s+/', $theString) ; + if (!feof($theHandle)) + { + $yyy[] = array((int)$xxx[0], (int)$xxx[1], (int)$xxx[2]) ; + } + } + } + } + + $this->initializePuzzleFromArray($yyy) ; + + if ($theOpenedFileFlag) + { + fclose($theHandle) ; + } + } + + /** + * The input parameter consists of a string of 81 digits and blanks. If fewer characters + * are provide, the string is padded on the right. + * + * @desc Initialize puzzle from a string. + * @access public + * @param string $theString The initial state of each cell in the puzzle. + */ + + function initializePuzzleFromString($theString) + { + $theString = str_pad($theString, 81, " ") ; + + for ($i = 0; $i < 81; $i++) + { + if ($theString{$i} != " ") + { + $theArray[] = array((int)($i/9) + 1, ($i % 9) + 1, (int)$theString{$i}) ; + } + } + + $this->initializePuzzleFromArray($theArray) ; + } + + /** + * @desc predicate to determine if the current puzzle has been solved. + * @access public + * @return boolean true if the puzzle has been solved. + */ + + function isSolved() + { + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <=9; $j++) + { + if (!$this->theBoard[$i][$j]->IsSolved()) + { + return false ; + } + } + } + + return true ; + } + + /** + * Convert pending to actual solutions. + * + * This step is actually unnecessary unless you want a pretty output of the + * intermediate. + * + * @access private + * @return boolean True if at least on pending solution existed, false otherwise. + */ + + function _newSolvedPosition() + { + $theReturn = false ; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + if ($this->theBoard[$i][$j]->solvedState() == 1) + { + $this->theBoard[$i][$j]->un_set($this->theBoard[$i][$j]->getState()) ; + $theReturn = true ; + } + } + } + + return $theReturn ; + } + + /** + * Print the contents of the board in HTML format. + * + * A "hook" so that extension classes can show all the steps taken by + * the solve function. + * + * @see SudokuIntermediateSolution. + * + * @access private + * @param string $theHeader [optional] The header line to be output along + * with the intermediate solution. + */ + + function _printIntermediateSolution($theHeader = NULL) + { + if ($this->theDebug) + $this->printSolution($theHeader) ; + } + + /** + * Print the contents of the board in HTML format. + * + * Simple output, is tailored by hand so that an initial state and + * a solution will find nicely upon a single 8.5 x 11 page of paper. + * + * @access public + * @param mixed $theHeader [optional] The header line[s] to be output along + * with the solution. + */ + + function printSolution($theHeader = NULL) + { + if (($this->theDebug) && ($theHeader != NULL)) + { + if (is_array($theHeader)) + { + foreach ($theHeader as $aHeader) + print $aHeader ; + } + else + print $theHeader ; + } + + $theColors = array("green", "blue", "red") ; + $theFontSize = array("1em", "1em", ".8em") ; + $theFontWeight = array("bold", "bold", "lighter") ; + + printf("
      \n") ; + + $theLast = 2 ; + + for ($i = 1; $i <= 9; $i++) + { + if ($theLast == 2) + printf("\n") ; + + printf("\n") ; + + $theLast = ($i - 1) % 3 ; + if ($theLast == 2) + printf("\n") ; + } + + printf("
      \n") ; + + $theLast1 = 2 ; + + for ($j = 1; $j <=9; $j++) + { + if ($theLast1 == 2) + printf("\n") ; + + $c = &$this->theSquares[$i] ; + $c =& $c->getCell($j) ; ; + $theSolvedState = $c->solvedState() ; + + printf("\n") ; + + $theLast1 = ($j - 1) % 3 ; + if ($theLast1 == 2) + printf("\n") ; + } + + printf("
      ", + $theColors[$theSolvedState], + $theFontWeight[$theSolvedState], + $theFontSize[$theSolvedState]) ; + $xxx = $c->asString($this->theDebug) ; + print ($xxx == " " ? " " : $xxx) ; + printf("
      \n") ; + } + + /** + * Solve a Sudoku. + * + * As explained earlier, this works by iterating upon three different + * types of inference: + * + * 1. A negative one, in which a value used within a row/column/square + * may not appear elsewhere within the enclosing row/column/square. + * 2. A positive one, in which any value with is unique in a row + * or column or square must be the solution to that position. + * 3. A tuple based positive one which comes in a number of flavors: + * 3a. The "Pair" rule as stated by the author of the "other" Sudoku + * class on phpclasses.org and generalized by me, e.g., in any RCS + * two cells containing a pair of values eliminate those values from + * consideration in the rest of the RC or S. + * 3b. The n/n+1 set rule as discovered by me, e.g., in any RCS, three cells + * containing the following pattern, (i, j)/(j, k)/(i, j, k) eliminate + * the values i, j, k from consideration in the rest of the RC or S. + * + * During processing I explain which structures (row, column, square) + * are being used to infer solutions. + * + * @access public + * @param boolean $theInitialStateFlag [optional] True if the initial + * state of the board is to be printed upon entry, false + * otherwise. [Default = true] + * @return boolean true if a solution was possible, false otherwise. + */ + + function solve($theInitialStateFlag = true) + { + $theHeader = "
      Initial Position:" ; + + do + { + do + { + $this->_applySolvedPositions() ; + if ($theInitialStateFlag) + { + $this->_printIntermediateSolution($theHeader) ; + $theHeader = NULL ; + } + else + { + $theInitialStateFlag = true ; + $theHeader = "
      Apply Slice and Dice:" ; + } + } while ($this->_newSolvedPosition()) ; + + $theRowIteration = FALSE ; + + for ($i = 1; $i <= 9; $i++) + { + if ($this->theRows[$i]->doAnInference()) + { + $theHeader = $this->theRows[$i]->getHeader() ; + $theRowIteration = TRUE ; + break ; + } + } + + $theColumnIteration = FALSE ; + + if (!$theRowIteration) + { + for ($i = 1; $i <= 9; $i++) + { + if ($this->theColumns[$i]->doAnInference()) + { + $theHeader = $this->theColumns[$i]->getHeader() ; + $theColumnIteration = TRUE ; + break ; + } + } + } + + $theSquareIteration = FALSE ; + + if (!($theRowIteration || $theColumnIteration)) + { + for ($i = 1; $i <= 9; $i++) + { + if ($this->theSquares[$i]->doAnInference()) + { + $theHeader = $this->theSquares[$i]->getHeader() ; + $theSquareIteration = TRUE ; + break ; + } + } + } + } while ($theRowIteration || $theColumnIteration || $theSquareIteration) ; + + return $this->IsSolved() ; + } + + /** + * Here there be dragons. In conversations with other Sudoku folks, I find that there ARE Sudoku with + * unique solutions for which a clue set may be incomplete, i.e., does not lead to a solution. The + * solution may only be found by guessing the next move. I'm of the opinion that this violates the + * definition of Sudoku (in which it's frequently said "never guess") but if it's possible to find + * a solution, this will do it. + * + * The problem is that it can take a LONG time if there ISN'T a solution since this is basically a + * backtracing solution trier. + * + * The basic algorithm is pretty simple: + * + * 1. Find the first unsolved cell. + * 2. For every possible value, substutite value for the cell, apply inferences. + * 3. If a solution was found, we're done. + * 4. Recurse looking for the next cell to try a value for. + * + * There's a bit of bookkeeping to keep the state right when backing up, but that's pretty + * straightforward and looks a lot like that of generatePuzzle. + * + * @desc Brute force additional solutions. + * @access public + * @returns array The clues added sufficient to solve the puzzle. + */ + + function solveBruteForce($i = 1, $j = 1) + { + for (; $i <= 9; $i++) + { + for (; $j <= 9; $j++) + { + if ($this->theBoard[$i][$j]->solvedState() != 0) + { + if ($this->theDebug) + { + printf("
      Applying Brute Force to %d, %d\n", $i, $j) ; + } + + $theCurrentBoard = $this->deepCopy($this->theBoard) ; + $theValues = $this->theBoard[$i][$j]->getState() ; + + foreach ($theValues as $theValue) + { + $this->theBoard[$i][$j]->flagSolvedPosition($theValue) ; + + $theSolutionFlag = $this->solve() ; + $theTrialSolutionFlag = $this->_validateTrialSolution() ; + + if ($theTrialSolutionFlag && $theSolutionFlag) + { + return array(array($i, $j, $theValue)) ; + } + + if ($theTrialSolutionFlag) + { + $theNewGuesses = $this->solveBruteForce($i, $j+1) ; + + if ($theNewGuesses) + { + $theNewGuesses[] = array($i, $j, $theValue) ; + + return $theNewGuesses ; + } + } + + if ($this->theDebug) + { + printf("
      Backing out\n") ; + } + + $this->theBoard = $theCurrentBoard ; + $this->_buildRCS() ; + } + + return array() ; + } + } + } + } + + /** + * @desc Calculate the index of the square containing a specific cell. + * @param integer $theRow the row coordinate. + * @param integer $theColumn the column coordinate. + * @return integer the square index in the range 1..9 + */ + + function _squareIndex($theRow, $theColumn) + { + $theIndex = ((int)(($theRow - 1) / 3) * 3) + (int)(($theColumn - 1) / 3) + 1 ; + return $theIndex ; + } + + /** + * Validate a complete solution. + * + * After a complete solution has been generated check the board and + * report any inconsistencies. This is primarily intended for debugging + * purposes. + * + * @access public + * @return mixed true if the solution is valid, an array containing the + * error details. + */ + + function validateSolution() + { + $theReturn = array() ; + + for ($i = 1; $i <= 9; $i++) + { + if (!$this->theRows[$i]->validateSolution()) + { + $theReturn[0][] = $i ; + } + if (!$this->theColumns[$i]->validateSolution()) + { + $theReturn[1][] = $i ; + } + if (!$this->theSquares[$i]->validateSolution()) + { + $theReturn[2][] = $i ; + } + } + + return (count($theReturn) == 0 ? TRUE : $theReturn) ; + } + + /** + * Validate an entire trial solution. + * + * Used during puzzle generation to determine when to backtrace. + * + * @access private + * @return True when the intermediate soltuion is valid, false otherwise. + */ + + function _validateTrialSolution() + { + + for ($i = 1; $i <= 9; $i++) + { + if (!(($this->theRows[$i]->validateTrialSolution()) && + ($this->theColumns[$i]->validateTrialSolution()) && + ($this->theSquares[$i]->validateTrialSolution()))) + { + return FALSE ; + } + } + + return TRUE ; + } +} + +/** + * Extend Sudoku to generate puzzles based on templates. + * + * Templates are either input files or arrays containing doubles. + * + * @package Sudoku + */ + +class SudokuTemplates extends Sudoku +{ + function SudokuTemplates($theDebug = FALSE) + { + $this->Sudoku($theDebug) ; + } + + function generatePuzzleFromFile($theHandle = STDIN, $theDifficultyLevel = 10) + { + $yyy = array() ; + + if ($theHandle) + { + while (!feof($theHandle)) + { + $theString = trim(fgets($theHandle)) ; + $xxx = preg_split("/\s+/", $theString) ; + if (!feof($theHandle)) + { + $yyy[] = array((int)$xxx[0], (int)$xxx[1]) ; + } + } + } + + return $this->generatePuzzleFromArray($yyy, $theDifficultyLevel) ; + } + + function generatePuzzleFromArray($theArray, $theDifficultyLevel = 10) + { + $this->_generatePuzzle($theArray, array(), array()) ; + + /* + ** Because the generation process may infer values for some of the + ** template cells, we construct the clues from the board and the + ** input array before continuing to generate the puzzle. + */ + + foreach ($theArray as $theKey => $thePosition) + { + $theTemplateClues[] = array($thePosition[0], $thePosition[1], $this->theBoard[$thePosition[0]][$thePosition[1]]) ; + } + + $theOtherClues = $this->generatePuzzle($theDifficultyLevel) ; + + return array_merge($theTemplateClues, $theOtherClues) ; + } +} + +/** + * Extend Sudoku to print all intermediate results. + * + * @package Sudoku + */ + +class SudokuIntermediateSolution extends Sudoku +{ + function SudokuIntermediateResults($theDebug = FALSE) + { + $this->Sudoku($theDebug) ; + } + + function _printIntermediateSolution($theHeader = NULL) + { + $this->printSolution($theHeader) ; + } +} + +function make_seed() +{ + list($usec, $sec) = explode(' ', microtime()); + return (float) $sec + ((float) $usec * 100000); +} + +?> \ No newline at end of file diff --git a/sudoku/create.php b/sudoku/create.php new file mode 100644 index 0000000..7022db8 --- /dev/null +++ b/sudoku/create.php @@ -0,0 +1,144 @@ + +
      +
      + + + + + + +
      : +
      +

      + + + + + + + data = PackSudoku( $si, $sp); + if( strlen( $newrec->data) != 81){ + return 0; + } + $newrec->level = $level; + $newrec->opened = GetOpened( $si); + + $DB->insert_record( 'game_sudoku_database', $newrec, true); + + $level++; + if( $level > $level2){ + $level = $level1; + } + + echo get_string( 'sudoku_creating', 'game', $i)."
      \r\n"; + } +} + +function PackSudoku( $si, $sp) +{ + $data = ""; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + $c = &$sp->theSquares[$i]; + $c = &$c->getCell($j) ; + $solution = $c->asString( false); + + $c = &$si->theSquares[$i] ; + $c = &$c->getCell($j) ; + $theSolvedState = $c->solvedState() ; + + if( $theSolvedState == 1) { //hint + $solution = substr( 'ABCDEFGHI', $c->asString( false) - 1, 1); + } + + $data .= $solution; + } + } + + return $data; +} + + +function create( &$si, &$sp, $level=1) +{ + for( $i=1; $i <= 40; $i++) + { + set_time_limit( 30); + $sp = new Sudoku() ; + $theInitialPosition = $sp->generatePuzzle( 10, 50, $level) ; + if( count( $theInitialPosition)){ + break; + } + } + if( $i > 40){ + return false; + } + + $si = new Sudoku() ; + + $si->initializePuzzleFromArray($theInitialPosition); + + return true; +} + +function GetOpened( $si) +{ + $count = 0; + + for ($i = 1; $i <= 9; $i++) + { + for ($j = 1; $j <= 9; $j++) + { + $c = &$si->theSquares[$i] ; + $c = &$c->getCell($j) ; + $theSolvedState = $c->solvedState() ; + + if( $theSolvedState == 1) //hint + $count++; + } + } + + return $count; +} + diff --git a/sudoku/export.php b/sudoku/export.php new file mode 100644 index 0000000..a4e1d88 --- /dev/null +++ b/sudoku/export.php @@ -0,0 +1,33 @@ +level, $rec->opened, '$rec->data')\", false);\r\n"); + if( ++$i % 10 == 0) + fwrite( $h, "\r\n"); + } + fwrite( $h, "\r\necho'Finished importing';"); + + fclose($h); + +} diff --git a/sudoku/license.htm b/sudoku/license.htm new file mode 100644 index 0000000..1f4a8c3 --- /dev/null +++ b/sudoku/license.htm @@ -0,0 +1,44 @@ + + + + Cottage Software Works, Inc. modified NetBSD License + + + +
      +/*-
      + * Copyright (c) 2005 Dick Munroe (munroe@csworks.com), Cottage Software Works, Inc.
      + * All rights reserved.
      + *
      + * Redistribution and use in source and binary forms, with or without
      + * modification, are permitted provided that the following conditions
      + * are met:
      + *
      + * 1. Redistributions of source code must retain the above copyright
      + *    notice, this list of conditions and the following disclaimer.
      + * 2. Redistributions in binary form must reproduce the above copyright
      + *    notice, this list of conditions and the following disclaimer in the
      + *    documentation and/or other materials provided with the distribution.
      + * 3. All advertising materials mentioning features or use of this software
      + *    must display the following acknowledgement:
      + *        This product includes software developed by Dick Munroe
      + *        (munroe@csworks.com) of Cottage Software Works (www.csworks.com).
      + * 4. Neither the name of Cottage Software Works, Inc. nor the names of its
      + *    developers may be used to endorse or promote products derived
      + *    from this software without specific prior written permission.
      + *
      + * THIS SOFTWARE IS PROVIDED BY COTTAGE SOFTWARE WORKS, INC. AND CONTRIBUTORS
      + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
      + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
      + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
      + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
      + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
      + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
      + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      + * POSSIBILITY OF SUCH DAMAGE.
      + */
      +    
      + + \ No newline at end of file diff --git a/sudoku/play.php b/sudoku/play.php new file mode 100644 index 0000000..cb60e94 --- /dev/null +++ b/sudoku/play.php @@ -0,0 +1,631 @@ +id = $attempt->id; + $newrec->guess = ''; + $newrec->data = $recsudoku->data; + $newrec->opened = $recsudoku->opened; + + $need = 81 - $recsudoku->opened; + $closed = game_sudoku_getclosed( $newrec->data); + $n = min( count($closed), $need); + //if the teacher set the maximum number of questions + if( $game->param2 > 0){ + if( $game->param2 < $n){ + $n = $game->param2; + } + } + $recs = game_questions_selectrandom( $game, CONST_GAME_TRIES_REPETITION*$n); + + if( $recs === false){ + mysql_execute( "DELETE FROM {game_sudoku} WHERE id={$game->id}"); + print_error( get_string( 'no_questions', 'game')); + } + + $closed = array_rand($closed, $n); + + $selected_recs = game_select_from_repetitions( $game, $recs, $n); + + if(!game_insert_record('game_sudoku', $newrec)){ + print_error('error inserting in game_sudoku'); + } + + $i = 0; + $field = ($game->sourcemodule == 'glossary' ? 'glossaryentryid' : 'questionid'); + foreach( $recs as $rec) + { + if( $game->sourcemodule == 'glossary') + $key = $rec->glossaryentryid; + else + $key = $rec->questionid; + + if( !array_key_exists( $key, $selected_recs)) + continue; + + $query = new stdClass(); + $query->attemptid = $newrec->id; + $query->gamekind = $game->gamekind; + $query->gameid = $game->id; + $query->userid = $USER->id; + $query->col = $closed[ $i++]; + $query->sourcemodule = $game->sourcemodule; + $query->questionid = $rec->questionid; + $query->glossaryentryid = $rec->glossaryentryid; + $query->score = 0; + if( ($query->id = $DB->insert_record( 'game_queries', $query)) == 0){ + print_error( 'error inserting in game_queries'); + } + + game_update_repetitions($game->id, $USER->id, $query->questionid, $query->glossaryentryid); + } + + game_updateattempts( $game, $attempt, 0, 0); + + game_sudoku_play( $id, $game, $attempt, $newrec, false, false, $context); +} + +function game_sudoku_play( $id, $game, $attempt, $sudoku, $onlyshow, $showsolution, $context) +{ + $offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); + + if( $game->toptext != ''){ + echo $game->toptext.'
      '; + } + + game_sudoku_showsudoku( $sudoku->data, $sudoku->guess, true, $showsolution, $offsetquestions, $correctquestions, $id, $attempt, $game); + switch( $game->sourcemodule) + { + case 'quiz': + case 'question': + game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution, $context); + break; + case 'glossary': + game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution); + break; + } + + if( $game->bottomtext != ''){ + echo '
      '.$game->bottomtext; + } +} + +//returns a map with an offset and id of each question +function game_sudoku_compute_offsetquestions( $sourcemodule, $attempt, &$numbers, &$correctquestions) +{ + global $CFG,$DB; + + $select = "attemptid = $attempt->id"; + + $fields = 'id, col, score'; + switch( $sourcemodule) + { + case 'quiz': + case 'question': + $fields .= ',questionid as id2'; + break; + case 'glossary': + $fields .= ',glossaryentryid as id2'; + break; + } + if( ($recs = $DB->get_records_select( 'game_queries', $select, null, '', $fields)) == false){ + $DB->execute( "DELETE FROM {$CFG->prefix}game_sudoku WHERE id={$attempt->id}"); + print_error( 'There are no questions '.$attempt->id); + } + $offsetquestions = array(); + $numbers = array(); + $correctquestions = array(); + foreach( $recs as $rec){ + $offsetquestions[ $rec->col] = $rec->id2; + $numbers[ $rec->id2] = $rec->col; + if($rec->score == 1) + $correctquestions[ $rec->col] = 1; + } + + ksort( $offsetquestions); + + return $offsetquestions; +} + +function getrandomsudoku() +{ + global $DB; + + $count = $DB->count_records( 'game_sudoku_database'); + if( $count == 0) + { + require_once(dirname(__FILE__) . '/../db/importsudoku.php'); + + $count = $DB->count_records( 'game_sudoku_database'); + if( $count == 0) + return false; + } + + $i = mt_rand( 0, $count - 1); + + if( ($recs = $DB->get_records( 'game_sudoku_database', null, '', '*', $i, 1)) != false) + { + foreach( $recs as $rec){ + return $rec; + } + } + + return false; +} + + +function game_sudoku_getclosed( $data) +{ + $a = array(); + + $n = textlib::strlen( $data); + for( $i=1; $i <= $n; $i++) + { + $c = textlib::substr( $data, $i-1, 1); + if( $c >= "1" and $c <= "9") + $a[ $i] = $i; + } + + return $a; +} + +function game_sudoku_showsudoku( $data, $guess, $bShowLegend, $bShowSolution, $offsetquestions, $correctquestions, $id, $attempt, $game) +{ + global $CFG, $DB; + + $correct = $count = 0; + + echo "
      \r\n"; + echo ''; + $pos=0; + for( $i=0; $i <= 2; $i++) + { + echo ""; + for( $j=0; $j <= 2; $j++) + { + echo '\r\n"; + } + echo ""; + } + echo "
      '; + for( $k1=0; $k1 <= 2; $k1++) + { + echo ""; + for( $k2=0; $k2 <= 2; $k2++) + { + $s = substr( $data, $pos, 1); + $g = substr( $guess, $pos, 1); + $pos++; + if( $g != 0){ + $s = $g; + } + if( $s >= "1" and $s <= "9") + { + //closed number + if( $bShowLegend) + { + //show legend + if( $bShowSolution == false) + { + if( !array_key_exists( $pos, $correctquestions)){ + if( array_key_exists( $pos, $offsetquestions)) + { + if( $s != $g){ + $s = ''; + } + }else if( $g == 0) + { + $s = ''; + } + }else + { + //correct question + $count++; + } + } + echo ''; + }else + { + //not show legend + echo ''; + } + }else + { + $s = strpos( "-ABCDEFGHI", $s); + $count++; + echo ''; + } + } + echo ""; + } + echo "
      '.$s.' '.$s.'
      \r\n"; + + ?> + + timefinish){ + return $count; + } + + if( count($offsetquestions) != count( $correctquestions)){ + return $count; + } + + if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { + print_error( "Course Module ID was incorrect id=$id"); + } + + echo '
      '.get_string( 'win', 'game').'

      '; + echo '
      '; + echo "wwwroot/mod/game/attempt.php?id=$id\">".get_string( 'nextgame', 'game').'         '; + echo "wwwroot/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').' '; + + game_updateattempts( $game, $attempt, 1, 1); + + return $count; +} + + +function game_sudoku_getquestionlist( $offsetquestions) +{ + $questionlist = ''; + foreach( $offsetquestions as $q){ + if( $q != 0){ + $questionlist .= ','.$q; + } + } + $questionlist = substr( $questionlist, 1); + + if ($questionlist == '') { + print_error( get_string('no_questions', 'game')); + } + + return $questionlist; +} + +function game_sudoku_getglossaryentries( $game, $offsetentries, &$entrylist, $numbers) +{ + global $DB; + + $entrylist = implode( ',', $offsetentries); + + if ($entrylist == '') { + print_error( get_string( 'sudoku_noentriesfound', 'game')); + } + + // Load the questions + if (!$entries = $DB->get_records_select( 'glossary_entries', "id IN ($entrylist)")) { + print_error( get_string('sudoku_noentriesfound', 'game')); + } + + return $entries; +} + +function game_sudoku_showquestions_quiz( $id, $game, $attempt, $sudoku, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution, $context) +{ + global $CFG; + + $questionlist = game_sudoku_getquestionlist( $offsetquestions); + $questions = game_sudoku_getquestions( $questionlist); + + //I will sort with the number of each question + $questions2 = array(); + foreach( $questions as $q){ + $ofs = $numbers[ $q->id]; + $questions2[ $ofs] = $q; + } + ksort( $questions2); + + if( count( $questions2) == 0){ + game_sudoku_showquestion_onfinish( $id, $game, $attempt, $sudoku); + return; + } + + $number=0; + $found = false; + foreach ($questions2 as $question) { + $ofs = $numbers[ $question->id]; + if( array_key_exists( $ofs, $correctquestions)){ + continue; //I don't show the correct answers + } + + if( $found == false) + { + $found = true; + // Start the form + echo "
      wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + if( ($onlyshow === false) and ($showsolution === false)){ + echo "
      "; + + echo "      "; + } + + // Add a hidden field with the quiz id + echo '
      '; + echo '\n"; + echo ''; + + // Print all the questions + + // Add a hidden field with questionids + echo '\n"; + } + + $number = "A$ofs"; + + game_print_question( $game, $question, $context); + } + + if( $found) + { + echo "
      "; + + // Finish the form + echo ''; + if( ($onlyshow === false) and ($showsolution === false)){ + echo "
      \n"; + } + + echo "\n"; + } +} + +//show the sudoku and glossaryentries +function game_sudoku_showquestions_glossary( $id, $game, $attempt, $sudoku, $offsetentries, $numbers, $correctentries, $onlyshow, $showsolution) +{ + global $CFG; + + $entries = game_sudoku_getglossaryentries( $game, $offsetentries, $questionlist, $numbers); + + //I will sort with the number of each question + $entries2 = array(); + foreach( $entries as $q){ + $ofs = $numbers[ $q->id]; + $entries2[ $ofs] = $q; + } + ksort( $entries2); + + if( count( $entries2) == 0){ + game_sudoku_showquestion_onfinish( $id, $game, $attempt, $sudoku); + return; + } + + /// Start the form + echo "
      wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n"; + + if( $onlyshow) + $hasquestions = false; + else + $hasquestions = ( count($correctentries) < count( $entries2)); + + if( $hasquestions){ + echo "
      \n"; + } + + // Add a hidden field with the quiz id + echo '
      '; + echo '\n"; + echo ''; + + /// Print all the questions + + // Add a hidden field with questionids + echo '\n"; + + $number=0; + foreach ($entries2 as $entry) { + $ofs = $numbers[ $entry->id]; + if( array_key_exists( $ofs, $correctentries)){ + continue; //I don't show the correct answers + } + + $s = 'A'.$ofs.'. '.game_filtertext( $entry->definition, 0).'
      '; + if( $showsolution){ + $s .= get_string( 'answer').': '; + $s .= "id}\" value=\"$entry->concept\"size=30 />
      "; + }else if( $onlyshow === false){ + $s .= get_string( 'answer').': '; + $s .= "id}\" size=30 />
      "; + } + echo $s."
      \r\n"; + } + + echo "
      "; + + // Finish the form + if( $hasquestions){ + echo "
      \n"; + } + + echo "
      \n"; +} + +function game_sudoku_showquestion_onfinish( $id, $game, $attempt, $sudoku) +{ + if( !set_field( 'game_attempts', 'finish', 1, 'id', $attempt->id)){ + print_error( "game_sudoku_showquestion_onfinish: Can't update game_attempts id=$attempt->id"); + } + + echo ''.get_string( 'win', 'game').'
      '; + echo '
      '; + echo "wwwroot}/mod/game/attempt.php?id=$id\">".get_string( 'nextgame', 'game').'         '; + echo "wwwroot}?id=$id\">".get_string( 'finish', 'game').' '; +} + +function game_sudoku_checkanswers() +{ + $responses = data_submitted(); + + $actions = question_extract_responses($questions, $responses, $event); +} + +function game_sudoku_check_questions( $id, $game, $attempt, $sudoku, $finishattempt, $course) +{ + global $QTYPES, $DB; + + $responses = data_submitted(); + + $offsetquestions = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); + + $questionlist = game_sudoku_getquestionlist( $offsetquestions); + + $questions = game_sudoku_getquestions( $questionlist); + + foreach($questions as $question) { + $query = new stdClass(); + + $select = "attemptid=$attempt->id"; + $select .= " AND questionid=$question->id"; + + if( ($query->id = $DB->get_field_select( 'game_queries', 'id', $select)) == 0){ + die( "problem game_sudoku_check_questions (select=$select)"); + continue; + } + + $name = "resp{$question->id}_"; + if( !isset( $responses->$name)) + continue; + + $grade = game_grade_responses( $question, $responses, 100, $answertext); + if( $grade < 50){ + //wrong answer + game_update_queries( $game, $attempt, $query, $grade/100, $answertext); + continue; + } + + //correct answer + game_update_queries( $game, $attempt, $query, 1, $answertext); + } + + game_sudoku_check_last( $id, $game, $attempt, $sudoku, $finishattempt, $course); +} + +function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $finishattempt, $course) +{ + global $QTYPES, $DB; + + $responses = data_submitted(); + + //this function returns offsetentries, numbers, correctquestions + $offsetentries = game_sudoku_compute_offsetquestions( $game->sourcemodule, $attempt, $numbers, $correctquestions); + + $entrieslist = game_sudoku_getquestionlist( $offsetentries ); + + // Load the glossary entries + if (!($entries = $DB->get_records_select( 'glossary_entries', "id IN ($entrieslist)"))) { + print_error( get_string('noglossaryentriesfound', 'game')); + } + foreach($entries as $entry) { + $answerundefined = optional_param('resp'.$entry->id, 'undefined', PARAM_TEXT); + if( $answerundefined == 'undefined'){ + continue; + } + $answer = optional_param('resp'.$entry->id, '', PARAM_TEXT); + if( $answer == ''){ + continue; + } + if( game_upper( $entry->concept) != game_upper( $answer)){ + continue; + } + //correct answer + $select = "attemptid=$attempt->id"; + $select .= " AND glossaryentryid=$entry->id"; + + $query = new stdClass(); + if( ($query->id = $DB->get_field_select( 'game_queries', 'id', $select)) == 0){ + echo "not found $select
      "; + continue; + } + + game_update_queries( $game, $attempt, $query, 1, $answer); + } + + game_sudoku_check_last( $id, $game, $attempt, $sudoku, $finishattempt, $course); + + return true; +} + + +//this is the last function after submiting the answers. +function game_sudoku_check_last( $id, $game, $attempt, $sudoku, $finishattempt, $course) +{ + global $CFG, $DB; + + $correct = $DB->get_field_select( 'game_queries', 'COUNT(*) AS c', "attemptid=$attempt->id AND score > 0.9"); + $all = $DB->get_field_select( 'game_queries', 'COUNT(*) AS c', "attemptid=$attempt->id"); + + if( $all){ + $grade = $correct / $all; + }else + { + $grade = 0; + } + game_updateattempts( $game, $attempt, $grade, $finishattempt); +} + +function game_sudoku_check_number( $id, $game, $attempt, $sudoku, $pos, $num, $context) +{ + global $DB; + + $correct = textlib::substr( $sudoku->data, $pos-1, 1); + + if( $correct != $num) + { + game_sudoku_play( $id, $game, $attempt, $sudoku, false, false, $context); + return; + } + + $leng = textlib::strlen( $sudoku->guess); + $lend = textlib::strlen( $sudoku->data); + if( $leng < $lend){ + $sudoku->guess .= str_repeat( ' ', $lend - $leng); + } + game_setchar( $sudoku->guess, $pos-1, $correct); + + if( !$DB->set_field_select('game_sudoku', 'guess', $sudoku->guess, "id=$sudoku->id")){ + print_error( 'game_sudoku_check_number: Cannot update table game_sudoku'); + } + + game_sudoku_play( $id, $game, $attempt, $sudoku, false, false, $context); +} diff --git a/sudoku/sdd/class.SDD.php b/sudoku/sdd/class.SDD.php new file mode 100644 index 0000000..849fa16 --- /dev/null +++ b/sudoku/sdd/class.SDD.php @@ -0,0 +1,495 @@ + + * @copyright copyright @ by Dick Munroe, 2004 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @package StructuredDataDumper + * @version 1.0.4 + */ + +// +// Edit History: +// +// Dick Munroe munroe@cworks.com 04-Dec-2004 +// Initial version created. +// +// Dick Munroe munroe@csworks.com 08-Dec-2004 +// Translate < to < for html output. +// +// Dick Munroe munroe@csworks.com 23-Dec-2004 +// Add interface for writing "stuff". Extend SDD +// to get things "written". +// +// Dick Munroe munroe@csworks.com 25-Dec-2004 +// If a class extends a base class, but doesn't add +// data members, a warning winds up appearing when +// printing. +// Added a memeber to fetch the state of the logging +// flag. +// +// Dick Munroe munroe@csworks.com 11-Mar-2006 +// The test for html flag should have assumed that +// $this can be defined for objects calling SDD::dump. +// +// Dick Munroe (munroe@csworks.com) 22-Mar-2006 +// Add a function to generate "newlines". +// + +class SDD +{ + /** + * HTML to be generated flag. + */ + + var $m_htmlFlag ; + + /** + * logging flag. + */ + + var $m_logging = false ; + + /** + * In memory log file. + */ + + var $m_log = array() ; + + /** + * Constructor. + * + * @access public + * @param boolean $theHTMLFlag [optional] True if HTML is to be generated. + * If omitted, $_SERVER is used to "guess" the state of + * the HTML flag. Be default, HTML is generated when + * accessed by a web server. + * @param boolean $theLoggingFlag [optional] the state of logging for + * this object. By default, logging is off. + */ + + function SDD($theHtmlFlag=null, $theLoggingFlag=false) + { + if ($theHtmlFlag === null) + { + $theHtmlFlag = (!empty($_SERVER['DOCUMENT_ROOT'])) ; + } + + $this->m_htmlFlag = $theHtmlFlag ; + $this->m_logging = $theLoggingFlag ; + } + + /** + * Close the log file. + * + * @access public + * @abstract + */ + + function close() + { + } + + /** + * Dump a structured variable. + * + * @static + * @param mixed $theVariable the variable to be dumped. + * @param boolean $theHtmlFlag [optional] true if HTML is to be generated, + * false if plain text is to be generated, null (default) if + * dump is to guess which to display. + * @return string The data to be displayed. + * @link http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server Uses $_SERVER + */ + + function dump(&$theVariable, $theHtmlFlag=null) + { + if ($theHtmlFlag === null) + { + if (empty($this)) + { + $theHtmlFlag = (!empty($_SERVER['DOCUMENT_ROOT'])) ; + } + else + { + if (is_subclass_of($this, "sdd")) + { + $theHtmlFlag = $this->m_htmlFlag ; + } + else + { + $theHtmlFlag = (!empty($_SERVER['DOCUMENT_ROOT'])) ; + } + } + } + + switch (gettype($theVariable)) + { + case 'array': + { + return SDD::dArray($theVariable, $theHtmlFlag) ; + } + + case 'object': + { + return SDD::dObject($theVariable, $theHtmlFlag) ; + } + + default: + { + return SDD::scalar($theVariable, $theHtmlFlag) ; + } + } + } + + /** + * Dump the contents of an array. + * + * @param array $theArray the array whose contents are to be displayed. + * @param boolean $theHTMLFlag True if an HTML table is to be generated, + * false otherwise. + * @param string $theIndent [optional] Used by SDD::dArray during recursion + * to get indenting right. + * @return string The display form of the array. + */ + + function dArray(&$theArray, $theHTMLFlag, $theIndent = "") + { + $theOutput = array() ; + + foreach($theArray as $theIndex => $theValue) + { + if (is_array($theValue)) + { + $theString = SDD::dArray($theValue, $theHTMLFlag, $theIndent . " ") ; + $theOutput[$theIndex] = substr($theString, 0, strlen($theString) - 1) ; + } + else if (is_object($theValue)) + { + $theOutput[$theIndex] = SDD::dObject($theValue, $theHTMLFlag) ; + } + else + { + $theOutput[$theIndex] = ($theHTMLFlag ? + preg_replace('|<|s', '<', var_export($theValue, true)) : + var_export($theValue, true)) ; + } + } + + if ($theHTMLFlag) + { + $theString = "\n" ; + $theString .= "\n" ; + + foreach ($theOutput as $theIndex => $theVariableOutput) + { + $theString .= "\n\n\n" ; + } + + $theString .= "\n" ; + $theString .= "
      Array (
      $theIndex = >\n$theVariableOutput\n
      )
      \n" ; + } + else + { + $theString = "Array\n$theIndent(\n" ; + + foreach ($theOutput as $theIndex => $theVariableOutput) + { + $theString .= "$theIndent [$theIndex] => " . $theVariableOutput . "\n" ; + } + + $theString .= "$theIndent)\n" ; + } + + return $theString ; + } + + /** + * Dump the contents of an object. + * + * Provide a structured display of an object and all the + * classes from which it was derived. The contents of + * the object is displayed from most derived to the base + * class, in order. + * + * @param object $theObject the object to be dumped. + * @param boolean $theHTMLFlag true if HTML is to be generated. + * @return string the display form of the object. + */ + + function dObject(&$theObject, $theHTMLFlag) + { + $theObjectVars = get_object_vars($theObject) ; + + // + // Get the inheritance tree starting with the object and going + // through all the parent classes from there. + // + + $theClass = get_class($theObject) ; + + $theClasses[] = $theClass ; + + while ($theClass = get_parent_class($theClass)) + { + $theClasses[] = $theClass ; + } + + // + // Get all the class variables for each class in the inheritance + // tree. There will be some duplication, but we'll sort that out + // in the output process. + // + + foreach($theClasses as $theClass) + { + $theClassVars[$theClass] = get_class_vars($theClass) ; + } + + // + // Put the inheritance tree from base class to most derived order + // (this is how we get rid of duplication of the variable names) + // Go through the object variables starting with the base class, + // capture the output and delete the variable from the object + // variables. + // + + $theClasses = array_reverse($theClasses) ; + + $theOutput = array() ; + + foreach ($theClasses as $theClass) + { + $theOutput[$theClass] = array() ; + + foreach ($theClassVars[$theClass] as $theVariable => $value) + { + if (array_key_exists($theVariable, $theObjectVars)) + { + if (is_array($theObjectVars[$theVariable])) + { + $theOutput[$theClass][] = $theVariable . " = " . SDD::dArray($theObjectVars[$theVariable], $theHTMLFlag) ; + } + else if (is_object($theObjectVars[$theVariable])) + { + $theOutput[$theClass][] = $theVariable . " = " . SDD::dObject($theObjectVars[$theVariable], $theHTMLFlag) ; + } + else + { + $theOutput[$theClass][] = + $theVariable . " = " . + ($theHTMLFlag ? + preg_replace('|<|s', '<', var_export($theObjectVars[$theVariable], true)) : + var_export($theObjectVars[$theVariable], true)) ; + } + + unset($theObjectVars[$theVariable]) ; + } + } + } + + // + // Put the classes back in most derived order for generating printable + // output. + // + + $theClasses = array_reverse($theClasses) ; + + if ($theHTMLFlag) + { + $theString = "\n\n" ; + + foreach ($theClasses as $theClass) + { + $theString .= "\n" ; + } + + $theString .= "\n\n" ; + + foreach ($theClasses as $theClass) + { + $theString .= "\n" ; + } + + $theString .= "\n
      \n$theClass\n
      \n\n" ; + + foreach ($theOutput[$theClass] as $theVariableOutput) + { + $theString .= "\n\n\n" ; + } + + $theString .= "
      \n$theVariableOutput\n
      \n
      \n" ; + } + else + { + + $classIndent = "" ; + + $classDataIndent = " " ; + + $theString = "" ; + + foreach ($theClasses as $theClass) + { + $theString .= "{$classIndent}class $theClass\n\n" ; + + foreach ($theOutput[$theClass] as $theVariableOutput) + { + $theString .= "$classDataIndent$theVariableOutput\n" ; + } + + $theString .= "\n" ; + + $classIndent .= " " ; + + $classDataIndent .= " " ; + } + } + + return $theString ; + } + + /** + * Write a debugging value to a log file. + * + * @access public + * @abstract + * @param mixed Data to be logged. + * @param string $theHeader [optional] string to be emitted prior to + * logging the data. By default it is a date/time + * stamp. + */ + + function log(&$theData, $theHeader=null) + { + $theHeader = date('[Y-m-d H:i:s]: ') . $theHeader ; + + if ($this->m_logging) + { + if ($this->m_htmlFlag) + { + $xxx = $this->dump($theData) ; + if (substr($xxx, 0, 5) == '
      ')
      +                {
      +                  $xxx = '
      ' . $theHeader . substr($xxx, 5) ;
      +                }
      +              else
      +                {
      +                  $xxx = $theHeader . $xxx ;
      +                }
      +
      +              $this->writeLog($xxx) ;
      +            }
      +          else
      +            {
      +              $xxx = $theHeader . $this->dump($theData) ;
      +              $this->writeLog($xxx) ;
      +            }
      +        }
      +    }
      +
      +  /**
      +   * @desc Generate context specific new line equivalents.
      +   * @param integer [optional] the number of newlines.
      +   * @param boolean [optional] true if generating html newlines.
      +   * @return string newlines.
      +   * @access public
      +   */
      +   
      +  function newline($theCount=1, $theHtmlFlag=null)
      +    {
      +      if ($theHtmlFlag === null)
      +        {
      +          if (empty($this))
      +            {
      +              $theHtmlFlag = (!empty($_SERVER['DOCUMENT_ROOT'])) ;
      +            }
      +          else
      +            {
      +              if (is_subclass_of($this, "sdd"))
      +              {
      +                $theHtmlFlag = $this->m_htmlFlag ;
      +              }
      +              else
      +              {
      +                $theHtmlFlag = (!empty($_SERVER['DOCUMENT_ROOT'])) ;
      +              }
      +            }
      +        }
      +       
      +      if ($theHtmlFlag)
      +        {
      +          return str_repeat("
      ", max($theCount, 0)) . "\n" ; + } + else + { + return str_repeat("\n", max($theCount, 0)) ; + } + } + + /** + * Dump any scalar value + * + * @param mixed $theVariable the variable to be dumped. + * @param boolean $theHtmlFlag true if html is to be generated. + */ + + function scalar(&$theVariable, $theHtmlFlag) + { + if ($theHtmlFlag) + { + return "
      " . preg_replace('|<|s', '<', var_export($theVariable, true)) . "
      " ; + } + else + { + return var_export($theVariable, true) ; + } + } + + /** + * Write data to the log file. + * + * @access public + * @abstract + * @parameter string $theData [by reference] the data to be written + * into the log file. + * @return integer the number of bytes written into the log file. + */ + + function writeLog(&$theData) + { + return strlen($this->m_log[] = $theData) ; + } + + /** + * Return the state of the logging flag. + * + * @access public + * @return boolean + */ + + function getLogging() + { + return $this->m_logging ; + } + + /** + * Set the state of the logging flag. + * + * @access public + * @return boolean + */ + + function setLogging($theLogging=false) + { + $this->m_logging = $theLogging ; + } +} +?> \ No newline at end of file diff --git a/sudoku/sdd/class.logfile.php b/sudoku/sdd/class.logfile.php new file mode 100644 index 0000000..146b4aa --- /dev/null +++ b/sudoku/sdd/class.logfile.php @@ -0,0 +1,69 @@ + + * @copyright copyright @ by Dick Munroe, 2004 + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @package StructuredDataDumper + * @version 1.0.1 + */ + +// +// Edit History: +// +// Dick Munroe munroe@cworks.com 23-Dec-2004 +// Initial version created/ +// + +include_once('SDD/class.SDD.php') ; + +class logfile extends SDD +{ + + /** + * The open file handle. + * + * @access private + */ + + var $m_handle ; + + /** + * Constructor + * + * @access public + */ + + function logfile($theFileName) + { + if (file_exists($theFileName)) + { + $this->m_handle = fopen($theFileName, 'a') ; + } + else + { + $this->m_handle = fopen($theFileName, 'w') ; + } + } + + function close() + { + fclose($this->m_handle) ; + } + + /** + * Write a debugging value to a log file. + * + * @access public + * @abstract + * @param mixed Data to be logged. + * @return integer number of bytes written to the log. + */ + + function log(&$theData) + { + return fwrite($this->m_handle, date('[Y-m-d H:i:s]: ') . $this->dump($theData) . "\n") ; + } + +} +?> \ No newline at end of file diff --git a/tabs.php b/tabs.php new file mode 100644 index 0000000..d89168b --- /dev/null +++ b/tabs.php @@ -0,0 +1,102 @@ +id); +} +if (!isset($course)) { + $course = $DB->get_record('course', array( 'id' => $game->course)); +} + +$context = get_context_instance(CONTEXT_MODULE, $cm->id); + +$tabs = array(); +$row = array(); +$inactive = array(); +$activated = array(); + +global $USER; + + +if (has_capability('mod/game:view', $context)) { + $row[] = new tabobject('info', "{$CFG->wwwroot}/mod/game/view.php?q=$game->id", get_string('info', 'game')); +} +if (has_capability('mod/game:viewreports', $context)) { +//if( isteacher( $game->course, $USER->id)){ + $row[] = new tabobject('reports', "{$CFG->wwwroot}/mod/game/report.php?q=$game->id", get_string('results', 'game')); +//} +} +if (has_capability('mod/game:preview', $context)) { + $row[] = new tabobject('preview', "{$CFG->wwwroot}/mod/game/attempt.php?a=$game->id", get_string('preview', 'game')); +} +if (has_capability('mod/game:manage', $context)) { +//if( isteacher( $game->course, $USER->id)){ + global $USER; + $sesskey = $USER->sesskey; + $url = "{$CFG->wwwroot}/course/mod.php?update=$cm->id&return=true&sesskey=$sesskey"; + $row[] = new tabobject('edit', $url, get_string('edit')); +//} +} + +if ($currenttab == 'info' && count($row) == 1) { + // Don't show only an info tab (e.g. to students). +} else { + $tabs[] = $row; +} + +if ($currenttab == 'reports' and isset($mode)) { + $inactive[] = 'reports'; + $activated[] = 'reports'; + + $allreports = get_list_of_plugins("mod/game/report"); + $reportlist = array ('overview' /*, 'regrade' , 'grading' , 'analysis'*/); // Standard reports we want to show first + + foreach ($allreports as $report) { + if (!in_array($report, $reportlist)) { + $reportlist[] = $report; + } + } + + $row = array(); + $currenttab = ''; + foreach ($reportlist as $report) { + $row[] = new tabobject($report, "{$CFG->wwwroot}/mod/game/report.php?q=$game->id&mode=$report", + get_string($report, 'game')); + if ($report == $mode) { + $currenttab = $report; + } + } + $tabs[] = $row; +} + +if ($currenttab == 'edit' and isset($mode)) { + $inactive[] = 'edit'; + $activated[] = 'edit'; + + $row = array(); + $currenttab = $mode; + + $strgames = get_string('modulenameplural', 'game'); + $strgame = get_string('modulename', 'game'); + $streditinggame = get_string("editinga", "moodle", $strgame); + $strupdate = get_string('updatethis', 'moodle', $strgame); + $row[] = new tabobject('editq', "{$CFG->wwwroot}/mod/game/edit.php?gameid=$game->id", $strgame, $streditinggame); + questionbank_navigation_tabs($row, $context, $course->id); + $tabs[] = $row; +} + +print_tabs($tabs, $currenttab, $inactive, $activated); + +?> diff --git a/translate.php b/translate.php new file mode 100644 index 0000000..ee951f6 --- /dev/null +++ b/translate.php @@ -0,0 +1,489 @@ + + + + + Μάθημα: game23 + + + +id); +if (!has_capability('mod/game:viewreports', $context)) + error( get_string( 'only_teachers', 'game')); + +$langname = array(); +$langname['ca'] = 'Català (ca)'; +$langname['de'] = 'Deutsch (de)'; +$langname['el'] = 'Ελληνικά (el)'; +$langname['en'] = 'English (en)'; +$langname['es'] = 'Español - Internacional (es)'; +$langname['eu'] = 'Euskara (eu)'; +$langname['fr'] = 'Français (fr)'; +$langname['he'] = 'ית (he'; +$langname['hr'] = 'Hrvatski (hr)'; +$langname['it'] = 'Italiano (it)'; +$langname['lt'] = 'Lietuviškai (lt)'; +$langname['nl'] = 'Nederlands (nl)'; +$langname['no'] = 'Norsk - bokmål (no)'; +$langname['pl'] = 'Polski (pl)'; +$langname['ru'] = 'Русский (ru)'; +$langname['sq'] = 'Shqip (sq)'; +$langname['uk'] = 'Українська (uk)'; +$langname['pt_br'] = 'Português - Brasil (pt_br)'; +$langname['zh_cn'] = '简体中文 (zh_cn)'; +ksort( $langname); +$a = read_dir( $CFG->dirroot.'/mod/game','php'); +$strings = array(); +$files = array(); +foreach( $a as $file) + $files[] = $file; +sort( $files); + +foreach( $files as $file) +{ + readsourcecode( $file, $strings); +} + +$strings[ 'game:attempt'] = '/db/access.php * game:attempt'; +$strings[ 'game:deleteattempts'] = '/db/access.php * game:deleteattempts'; +$strings[ 'game:grade'] = '/db/access.php * game:grade'; +$strings[ 'game:manage'] = '/db/access.php * game:manage'; +$strings[ 'game:manageoverrides'] = '/db/access.php * game:manageoverrides'; +$strings[ 'game:preview'] = '/db/access.php * game:preview'; +$strings[ 'game:reviewmyattempts'] = '/db/access.php * game:reviewmyattempts'; +$strings[ 'game:view'] = '/db/access.php * game:view'; +$strings[ 'game:viewreports'] = '/db/access.php * game:viewreports'; +$strings[ 'pluginname'] = 'index.php * pluginname'; +$strings[ 'pluginadministration'] = 'index.php * pluginadministration'; +$strings[ 'convertfrom'] = 'locallib.php * convertfrom'; +$strings[ 'convertto'] = 'locallib.php * convertto'; +$strings[ 'helpbookquiz'] = 'index.php * helpbookquiz'; +$strings[ 'helphangman'] = 'index.php * helphangman'; +$strings[ 'helpcross'] = 'index.php * helpcross'; +$strings[ 'helpcryptex'] = 'index.php * helpcryptex'; +$strings[ 'helpbookquiz'] = 'index.php * helpbookquiz'; +$strings[ 'helpsudoku'] = 'index.php * helpsudoku'; +$strings[ 'helphiddenpicture'] = 'index.php * helphiddenpicture'; +$strings[ 'helpsnakes'] = 'index.php * helpsnakes'; +$strings[ 'helpmillionaire'] = 'index.php * helpmillionaire'; + +$en = readlangfile( 'en', $header); +unset( $en[ 'convertfrom']); +unset( $en[ 'convertto']); +$langs = computelangs(); +$sum = array(); +$destdir = game_export_createtempdir(); +foreach( $langs as $lang) +{ + if($lang != 'en' and $lang != 'CVS' and strpos( $lang, '_utf8') == 0 and strpos( $lang, '_uft8') == 0) + { + computediff( $en, $lang, $strings, $langname, $sum, $destdir, $untranslated); + $auntranslated[ $lang] = $untranslated; + } +} +$file_no_translation = 'game_lang_no_translation.zip'; +$filezip=game_create_zip( $destdir, $COURSE->id, $file_no_translation); +remove_dir( $destdir); +$ilang=0; +echo ''; +echo ""; +foreach($sum as $s) + echo ''.$s."\r\n"; +echo "
      CounterLanguageMissing wordsPercent completed
      '.(++$ilang).'
      "; + +echo "
      wwwroot}/file.php/1/export/$file_no_translation\">Words that is not translated yet in each language"; + +//Find missing strings on en/game.php +$not = array(); +$prevfile = ''; +foreach( $strings as $info) +{ + $pos = strpos( $info, '*'); + $name = substr( $info, $pos+2); + $file = substr( $info, 0, $pos-1); + if( substr( $file, 0, 1) == '/') + $file = substr( $file, 1); + if( $file != $prevfile) + { + $prevfile = $file; + } + if( !array_key_exists( $name, $en)) + $not[ $info] = $info; +} +$oldfile=''; +unset( $not[ 'tabs.php * $report']); +unset( $not[ 'mod_form.php * game_\'.$gamekin']); +unset( $not[ 'mod.html * game_\'.$form->gamekin']); +unset( $not[ '/report/overview/report.php * fullname\')."\t".get_string(\'startedon']); +unset( $not[ '/hangman/play.php * hangman_correct_\'.$ter']); + +if( count( $not)) + echo "

      Missing strings on en/game.php
      "; +foreach( $not as $key => $value) +{ + $pos = strpos( $value, '*'); + $file = trim( substr( $value, 0, $pos)); + $key = trim( substr( $value, $pos+1)); + if( $key == 'convertfrom' or $key == 'convertto') + continue; + + if( substr( $file, 0, 1) == '/') + $file = substr( $file, 1); + if( $file != $oldfile) + { + echo "
      //$file
      \r\n"; + $fileold=$file; + } + echo '$'."string[ '$key'] = \"\";
      "; +} + +//Finds translations to en that are not used now +$ret = ''; +foreach( $en as $key => $value) +{ + if( !array_key_exists( $key, $strings)) + $ret .= "$key = $value
      "; +} +if( $ret != '') + echo '
      Translations that are not used

      '.$ret; + +//Creates the zip files of translations +$destdir = game_export_createtempdir(); +sort( $strings); +foreach( $langname as $lang => $name) +{ + $strings_lang = readlangfile( $lang, $header); + $ret = ''; + + foreach( $strings_lang as $key => $value) + { + if( !array_key_exists( $key, $en)) + { + if( $key != 'convertfrom' and $key != 'convertto') + $ret .= '
      '.$key."\r\n"; + } + } + if( $ret != '') + echo '
      Unused translation for lang '.$lang.'

      '.substr( $ret, 4)."\r\n"; + + $ret = $header; + foreach( $strings as $info) + { + $pos = strpos( $info, '*'); + $name = substr( $info, $pos+2); + $file = substr( $info, 0, $pos-1); + if( substr( $file, 0, 1) == '/') + $file = substr( $file, 1); + if( $file != $prevfile) + { + $prevfile = $file; + $ret .= "\r\n//".$file."\r\n"; + } + if( array_key_exists( $name, $strings_lang)) + $ret .= '$string'."[ '$name'] = ".$strings_lang[ $name]."\r\n"; + } + if( $lang != 'en') + { + $untranslated = $auntranslated[ $lang]; + if( $untranslated != '') + $ret .= "\r\n//Untranslated\r\n".$untranslated; + } + mkdir( $destdir.'/'.$lang); + $file = $destdir.'/'.$lang.'/game.php'; + file_put_contents( $file, $ret); +} + +$file_sorted = 'game_lang_sorted.zip'; +$filezip=game_create_zip( $destdir, $COURSE->id, $file_sorted); +remove_dir( $destdir); +echo "
      wwwroot}/file.php/1/export/$file_sorted\">Sorted translation files"; + +asort( $en); +$sprev = ''; +$keyprev = ''; +$ret = ''; +foreach( $en as $key => $s) +{ + if( $s == $sprev) + $ret .= "$key$keyprev$s\r\n"; + $sprev = $s; + $keyprev = $key; +} +if( $ret != '') + echo '
      Same translations

      '.$ret.'
      Word1Word2Translation
      '; + +function readlangfile( $lang, &$header) +{ + global $CFG; + + $file = $CFG->dirroot.'/mod/game/lang/'.$lang.'/game.php'; + + $a = array(); + + $lines = file( $file); + $header = ''; + $endofheader = false; + foreach( $lines as $line) + { + if( $endofheader == false) + { + if( strpos( $line, '//') === false) + $endofheader = true; + else + $header .= $line; + } + if( splitlangdefinition($line,$name,$trans)) + $a[ $name] = $trans; + } + + if( $lang != 'en') + readlangfile_repairmoodle19( $lang, $a); + + return $a; +} + +function splitlangdefinition($line,&$name,&$trans) +{ + $pos1 = strpos( $line, '='); + if( $pos1 == 0) + return false; + + $pos2 = strpos( $line, '//'); + if( $pos2 != 0 or substr( $line, 0, 2) == '//') + { + if( $pos2 < $pos1) + return false; //Commented line + } + + $name = trim(substr( $line, 0, $pos1-1)); + $trans = trim(substr( $line, $pos1+1)); + + $pos = strpos( $name, '\''); + if( $pos) + { + $name = substr( $name, $pos+1); + $pos = strrpos( $name, '\''); + $name = substr( $name, 0, $pos); + } + + return true; +} + +function readsourcecode( $file, &$strings) +{ + global $CFG; + + $lines = file( $file); + foreach( $lines as $line) + { + parseline( &$strings, $line, $file); + } + + return $strings; +} + +function parseline( &$strings, $line, $filename) +{ + global $CFG; + + $filename = substr( $filename, strlen( $CFG->dirroot.'/mod/game/')); + if( strpos($filename, '/')) + $filename = '/'.$filename; + $pos0 = 0; + for(;;) + { + $pos = strpos( $line, 'get_string', $pos0); + if( $pos == false) + $pos = strpos( $line, 'print_string', $pos0); + if( $pos === false) + break; + $pos1 = strpos( $line, '(', $pos); + $pos2 = strpos( $line, ',', $pos); + $pos3 = strpos( $line, ')', $pos); + if( $pos1 == 0 or $pos2 == 0 or $pos3 == 0) + { + $pos0 = $pos+1; + continue; + } + $name = gets( substr( $line, $pos1+1, $pos2-$pos1-1)); + $file = gets( substr( $line, $pos2+1, $pos3-$pos2-1)); + + if( $file == 'game') + { + if( !array_key_exists( $name, $strings)) + $strings[ $name] = $filename.' * '.$name; + }else + { + $pos4 = strpos($file, '\''); + if( $pos4) + $file = substr( $file, 0, $pos4); + + $pos4 = strpos($file, '"'); + if($pos4) + $file = substr( $file, 0, $pos4); + + if( $file == 'game') + { + if( !array_key_exists( $name, $strings)) + $strings[ $name] = $filename.' * '.$name; + } + } + + $pos0 = $pos+1; + } +} + +function gets( $s) +{ + $s = trim( $s); + if( substr( $s, 0, 1) == '"') + $s = substr( $s, 1, -1); + if( substr( $s, 0, 1) == '\'') + $s = substr( $s, 1, -1); + return $s; +} + +function read_dir($dir, $ext) { + if( $ext != '') + $ext = '.' .$ext; + $len = strlen( $ext); + + $a = array( $dir); + $ret = array(); + while( count( $a)){ + $dir = array_pop( $a); + if( strpos( $dir, '/lang/') != 0) + continue; + + $d = dir($dir); + while (false !== ($entry = $d->read())) { + if($entry!='.' && $entry!='..') { + $entry = $dir.'/'.$entry; + if(is_dir($entry)) { + $a[] = $entry; + } else { + if( $len == 0) + $ret[] = $entry; + else if( substr( $entry, -$len) == $ext) + $ret[] = $entry; + } + } + } + $d->close(); + } + + return $ret; +} + +function computelangs() +{ + global $CFG; + + $dir = $CFG->dirroot.'/mod/game/lang'; + $ret = array(); + $d = dir( $dir); + while (false !== ($entry = $d->read())) { + if( $entry != '.' and $entry != '..'){ + if(is_dir($dir.'/'.$entry)) { + $ret[] = $entry; + } + } + } + + return $ret; +} + +function computediff( $en, $lang, $strings, $langname, &$sum, $outdir, &$untranslated) +{ + global $CFG; + $untranslated = ''; + $counten=count($en); + $trans = readlangfile( $lang, $header); + foreach( $trans as $s => $key) + { + unset( $en[ $s]); + } + + $file = $CFG->dirroot.'/mod/game/lang/'.$lang.'/game.php'; + $lines = file( $file); + $count = 0; + $s = ''; + foreach( $lines as $line) + { + $s .= $line; + if( ++$count >= 3) + break; + } + + $a = array(); + foreach( $en as $name => $t) + { + if( array_key_exists( $name, $strings)) + $file = $strings[ $name]; + else + $file = ''; + $t = strip_tags( $t); + $a[ $file.' * '.$name] = '$'."string[ '$name'] = $t\r\n"; + } + ksort( $a); + + if( array_key_exists( $lang, $langname)) + $langprint = $langname[ $lang]; + else + $langprint = $lang; + + $sum[]="$langprint
      ".count($a)."
      ".round(100*($counten-count($a))/$counten,0)." %"; + $prev_file = ''; + foreach( $a as $key => $line) + { + $pos = strpos( $key, '*'); + $file = trim( substr( $key, 0, $pos-1)); + if( substr( $file, 0, 1) == '/') + $file = substr( $file, 1); + if( $file != $prev_file) + { + $s .= "\r\n//$file\r\n"; + $prev_file = $file; + } + $s .= $line; + $untranslated .= "//$prev_file ".$line; + } + $file = $outdir.'/'.$lang.'.php'; + file_put_contents( $file, $s); +} + +//Copies the translation from Moodle 19 +function readlangfile_repairmoodle19( $lang, &$strings_lang) +{ + global $moodle19dir; + + if( $moodle19dir == '') + return; + + $file = $moodle19dir.'/mod/game/lang/'.$lang.'_utf8/game.php'; + + $a = array(); + + $lines = file( $file); + foreach( $lines as $line) + { + if( splitlangdefinition($line,$name,$trans)) + { + if( !array_key_exists( $name, $strings_lang)) + $strings_lang[ $name] = $trans; + } + } +} diff --git a/version.php b/version.php new file mode 100644 index 0000000..bc2640e --- /dev/null +++ b/version.php @@ -0,0 +1,16 @@ +component = 'mod_game'; // Full name of the plugin (used for diagnostics) +$module->version = 2012072301; // The current module version (Date: YYYYMMDDXX) +$module->requires = 2010112400; // Requires Moodle 2.0 +$module->cron = 0; // Period for cron to check this module (secs) diff --git a/view.php b/view.php new file mode 100644 index 0000000..e4347a7 --- /dev/null +++ b/view.php @@ -0,0 +1,294 @@ +libdir.'/gradelib.php'); + require_once($CFG->dirroot.'/mod/game/locallib.php'); + + $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or + + if (! $cm = get_coursemodule_from_id('game', $id)) { + print_error('invalidcoursemodule'); + } + if (! $course = $DB->get_record('course', array('id' => $cm->course))) { + print_error('coursemisconf'); + } + if (! $game = $DB->get_record('game', array('id' => $cm->instance))) { + print_error('invalidcoursemodule'); + } + +/// Check login and get context. + require_login($course->id, false, $cm); + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + require_capability('mod/game:view', $context); + + $timenow = time(); + +/// Cache some other capabilites we use several times. + $canattempt = true; + $strtimeopenclose = ''; + if ($timenow < $game->timeopen) { + $canattempt = false; + $strtimeopenclose = get_string('gamenotavailable', 'game', userdate($game->timeopen)); + } else if ($game->timeclose && $timenow > $game->timeclose) { + $strtimeopenclose = get_string("gameclosed", "game", userdate($game->timeclose)); + $canattempt = false; + } else { + if ($game->timeopen) { + $strtimeopenclose = get_string('gameopenedon', 'game', userdate($game->timeopen)); + } + if ($game->timeclose) { + $strtimeopenclose = get_string('gamecloseson', 'game', userdate($game->timeclose)); + } + } + if (has_capability('mod/game:manage', $context)) { + $canattempt = true; + } + + +/// Log this request. + add_to_log($course->id, 'game', 'view', "view.php?id=$cm->id", $game->id, $cm->id); + +/// Initialize $PAGE, compute blocks + $PAGE->set_url('/mod/game/view.php', array('id' => $cm->id)); + + $edit = optional_param('edit', -1, PARAM_BOOL); + if ($edit != -1 && $PAGE->user_allowed_editing()) { + $USER->editing = $edit; + } + + $PAGE->requires->yui2_lib('event'); + + $title = $course->shortname . ': ' . format_string($game->name); + + if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) { + $buttons = '
      '. + ''. + ''. + '
      '; + $PAGE->set_button($buttons); + } + + $PAGE->set_title($title); + $PAGE->set_heading($course->fullname); + + echo $OUTPUT->header(); + +/// Print game name and description + echo $OUTPUT->heading(format_string($game->name)); + +/// Display information about this game. + + echo $OUTPUT->box_start('quizinfo'); + if ($game->attempts != 1) { + echo get_string('gradingmethod', 'quiz', game_get_grading_option_name($game->grademethod)); + } + echo $OUTPUT->box_end(); + +/// Show number of attempts summary to those who can view reports. + if (has_capability('mod/game:viewreports', $context)) { + if ($strattemptnum = game_num_attempt_summary($game, $cm)) { + //echo '\n"; + echo $strattemptnum; + } + } + +/// Get this user's attempts. + $attempts = game_get_user_attempts($game->id, $USER->id); + $lastfinishedattempt = end($attempts); + $unfinished = false; + if ($unfinishedattempt = game_get_user_attempt_unfinished($game->id, $USER->id)) { + $attempts[] = $unfinishedattempt; + $unfinished = true; + } + $numattempts = count($attempts); + +/// Work out the final grade, checking whether it was overridden in the gradebook. + $mygrade = game_get_best_grade($game, $USER->id); + $mygradeoverridden = false; + $gradebookfeedback = ''; + + $grading_info = grade_get_grades($course->id, 'mod', 'game', $game->id, $USER->id); + if (!empty($grading_info->items)) { + $item = $grading_info->items[0]; + if (isset($item->grades[$USER->id])) { + $grade = $item->grades[$USER->id]; + + if ($grade->overridden) { + $mygrade = $grade->grade + 0; // Convert to number. + $mygradeoverridden = true; + } + if (!empty($grade->str_feedback)) { + $gradebookfeedback = $grade->str_feedback; + } + } + } + +/// Print table with existing attempts + if ($attempts) { + + echo $OUTPUT->heading(get_string('summaryofattempts', 'quiz')); + + // Work out which columns we need, taking account what data is available in each attempt. + list($someoptions, $alloptions) = game_get_combined_reviewoptions($game, $attempts, $context); + + $attemptcolumn = $game->attempts != 1; + + $gradecolumn = $someoptions->scores && ($game->grade > 0); + //$markcolumn = $gradecolumn && ($game->grade != $game->sumgrades); + $overallstats = $alloptions->scores; + + // Prepare table header + $table = new html_table(); + $table->attributes['class'] = 'generaltable gameattemptsummary'; + $table->head = array(); + $table->align = array(); + $table->size = array(); + if ($attemptcolumn) { + $table->head[] = get_string('attempt', 'game'); + $table->align[] = 'center'; + $table->size[] = ''; + } + $table->head[] = get_string('timecompleted', 'game'); + $table->align[] = 'left'; + $table->size[] = ''; + + if ($gradecolumn) { + $table->head[] = get_string('grade') . ' / ' . game_format_grade( $game, $game->grade); + $table->align[] = 'center'; + $table->size[] = ''; + } + + $table->head[] = get_string('timetaken', 'game'); + $table->align[] = 'left'; + $table->size[] = ''; + + // One row for each attempt + foreach ($attempts as $attempt) { + $attemptoptions = game_get_reviewoptions($game, $attempt, $context); + $row = array(); + + // Add the attempt number, making it a link, if appropriate. + if ($attemptcolumn) { + if ($attempt->preview) { + $row[] = get_string('preview', 'game'); + } else { + $row[] = $attempt->attempt; + } + } + + // prepare strings for time taken and date completed + $timetaken = ''; + $datecompleted = ''; + if ($attempt->timefinish > 0) { + // attempt has finished + $timetaken = format_time($attempt->timefinish - $attempt->timestart); + $datecompleted = userdate($attempt->timefinish); + } else + { + // The a is still in progress. + $timetaken = format_time($timenow - $attempt->timestart); + $datecompleted = ''; + } + $row[] = $datecompleted; + + // Ouside the if because we may be showing feedback but not grades. bdaloukas + $attemptgrade = game_score_to_grade($attempt->score, $game); + + if ($gradecolumn) { + if ($attemptoptions->scores && $attempt->timefinish > 0) { + $formattedgrade = game_format_grade($game, $attemptgrade); + // highlight the highest grade if appropriate + if ($overallstats && !$attempt->preview && $numattempts > 1 && !is_null($mygrade) && + $attemptgrade == $mygrade && $game->grademethod == QUIZ_GRADEHIGHEST) { + $table->rowclasses[$attempt->attempt] = 'bestrow'; + } + + $row[] = $formattedgrade; + } else { + $row[] = ''; + } + } + + $row[] = $timetaken; + + if ($attempt->preview) { + $table->data['preview'] = $row; + } else { + $table->data[$attempt->attempt] = $row; + } + } // End of loop over attempts. + echo html_writer::table($table); + } + +/// Print information about the student's best score for this game if possible. + + + if ($numattempts && $gradecolumn && !is_null($mygrade)) { + $resultinfo = ''; + + if ($overallstats) { + $a = new stdClass; + $a->grade = game_format_grade($game, $mygrade); + $a->maxgrade = game_format_grade($game, $game->grade); + $a = get_string('outofshort', 'quiz', $a); + $resultinfo .= $OUTPUT->heading(get_string('yourfinalgradeis', 'game', $a), 2, 'main'); + } + + if ($mygradeoverridden) { + $resultinfo .= '

      '.get_string('overriddennotice', 'grades')."

      \n"; + } + if ($gradebookfeedback) { + $resultinfo .= $OUTPUT->heading(get_string('comment', 'game'), 3, 'main'); + $resultinfo .= '

      '.$gradebookfeedback."

      \n"; + } + + if ($resultinfo) { + echo $OUTPUT->box($resultinfo, 'generalbox', 'feedback'); + } + } + +/// Determine if we should be showing a start/continue attempt button, +/// or a button to go back to the course page. + echo $OUTPUT->box_start('gameattempt'); + $buttontext = ''; // This will be set something if as start/continue attempt button should appear. + + if ($unfinished) { + if ($canattempt) { + $buttontext = get_string('continueattemptgame', 'game'); + } + } else { + if ($canattempt) { + echo '
      '; + if ($numattempts == 0) { + $buttontext = get_string('attemptgamenow', 'game'); + } else { + $buttontext = get_string('reattemptgame', 'game'); + } + } + } + +/// Now actually print the appropriate button. + + echo $strtimeopenclose; + + if ($buttontext) { + + global $OUTPUT; + + $strconfirmstartattempt = ''; + + /// Show the start button, in a div that is initially hidden. + echo '
      '; + $url = new moodle_url($CFG->wwwroot.'/mod/game/attempt.php', array('id' => $id)); + $button = new single_button($url, $buttontext); + echo $OUTPUT->render($button); + echo "
      \n"; + } else { + echo $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id); + } + echo $OUTPUT->box_end(); + + echo $OUTPUT->footer();