jclicmoodle-0.2.3/jclicplugin.js0000644000175000017500000002462212216575042016765 0ustar demarchidemarchi// This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . /** * jclicplugin.js file adapted for Moodle (instead of use the clic.xtec.cat one) * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ var player_files = "jclic.jar"; var player_versions = "0.2.2.0"; var author_files = "jclicauthor.jar"; var author_versions = "0.2.2.0"; var jar_cache_files = player_files; var jar_cache_versions = player_versions; var mainClass="JClicApplet"; var _info = navigator.userAgent; var _ns = false; var _mac = false; var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0); if(_info.indexOf("Opera")>=0){ _ie=false; _ns=true; } else if(_ie==false){ _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0))); _mac = _info.indexOf("Mac_PowerPC") > 0; } var jarBase='http://clic.xtec.cat/dist/jclic'; function setJarBase(base){ jarBase=base; } var useLanguage=false; var language=''; var country=''; var variant=''; function setLanguage(l, c, v){ if(l!=null){ language=l.toString(); if(c!=null) country=c.toString(); if(v!=null) variant=v.toString(); useLanguage=true; } } var useReporter=false; var reporterClass=''; var reporterParams=''; function setReporter(rClass, rParams){ if(rClass!=null){ reporterClass=rClass.toString(); if(rParams!=null) reporterParams=rParams.toString(); useReporter=true; } } var useSkin=false; var skinName=''; function setSkin(skName){ if(skName!=null){ skinName=skName.toString(); useSkin=true; } } var useCookie=false; var cookie=''; function setCookie(text){ if(text!=null){ cookie=text.toString(); useCookie=true; } } var useExitUrl=false; var exitUrl=''; function setExitUrl(text){ if(text!=null){ exitUrl=text.toString(); useExitUrl=true; } } var useInfoUrlFrame=false; var infoUrlFrame=''; function setInfoUrlFrame(text){ if(text!=null){ infoUrlFrame=text.toString(); useInfoUrlFrame=true; } } var useSequence=false; var sequence=''; function setSequence(text){ if(text!=null){ sequence=text.toString(); useSequence=true; } } var useSystemSounds=false; var systemSounds=false; function setSystemSounds(value){ if(value!=null){ systemSounds=value.toString(); useSystemSounds=true; } } var useCompressImages=false; var compressImages=true; function setCompressImages(value){ if(value!=null){ compressImages=value.toString(); useCompressImages=true; } } var useTrace=false; var trace=false; function setTrace(value){ if(value!=null){ trace=value.toString(); useTrace=true; } } var authorApplet=false; function setAuthorApplet(value){ if(value!=null){ authorApplet=value; if(authorApplet==true){ jar_cache_files = player_files+","+author_files; jar_cache_versions = player_versions+","+author_versions; mainClass="JClicAuthorApplet"; } else { jar_cache_files = player_files; jar_cache_versions = player_versions; mainClass="JClicApplet"; } } } function writePlugin(project, width, height, rWidth, rHeight){ document.writeln(getPlugin(project, width, height, rWidth, rHeight)); } function writeCacheInfo(p){ document.writeln(getCacheInfo(p)); } function writeDownloadPageInfo(){ document.writeln(getDownloadPageInfo()); } function writeParams(project, p){ document.writeln(getParams(project, p)); } function writeTable(w, h, nsw, nsh, s){ document.write(getTable(w, h, nsw, nsh, s)); } function getPlugin(project, width, height, rWidth, rHeight){ var htmlcode = ''; var w=width.toString(); var h=height.toString(); var nsw=w; var nsh=h; if(rWidth!=null) w=rWidth.toString(); if(rHeight!=null) h=rHeight.toString(); if (_ie == true){ htmlcode += ''; htmlcode += ''; htmlcode += ''; htmlcode += getCacheInfo(true); htmlcode += ''; htmlcode += ''; htmlcode += getParams(project, true); htmlcode += getDownloadPageInfo(); htmlcode += ''; } else if (_ns == true){ htmlcode += ''; htmlcode += ''; htmlcode += getDownloadPageInfo(); htmlcode += ''; htmlcode += ""; } else{ htmlcode += ''; htmlcode += ''; htmlcode += ''; htmlcode += getParams(project, true); htmlcode += ''; } return htmlcode; } function getCacheInfo(p){ var htmlcode = ''; if(p){ htmlcode += ''; htmlcode += ''; htmlcode += ''; }else{ htmlcode += ' cache_option="Plugin"'; htmlcode += ' cache_archive="' +jar_cache_files+ '"'; htmlcode += ' cache_version="' +jar_cache_versions+ '"'; } return htmlcode; } function getParams(project, p){ var htmlcode = ''; if(p) htmlcode += ''; else htmlcode += ' activityPack="' +project+ '"'; if(useSequence){ if(p) htmlcode += ''; else htmlcode += ' sequence="' +sequence+ '" '; } if(useLanguage){ if(p){ htmlcode += ''; htmlcode += ''; htmlcode += ''; } else htmlcode += ' language="' +language+ '" country="' +country+ '" variant="' +variant+ '" '; } if(useSkin){ if(p) htmlcode += ''; else htmlcode += ' skin="' +skinName+ '" '; } if(useExitUrl){ if(p) htmlcode += ''; else htmlcode += ' exitUrl="' +exitUrl+ '" '; } if(useInfoUrlFrame){ if(p) htmlcode += ''; else htmlcode += ' infoUrlFrame="' +infoUrlFrame+ '" '; } if(useReporter){ if(p){ htmlcode += ''; htmlcode += ''; } else htmlcode += ' reporter="' +reporterClass+ '" reporterParams="' +reporterParams+ '" '; } if(useCookie){ if(p) htmlcode += ''; else htmlcode += ' cookie="' +cookie+ '" '; } if(useSystemSounds){ if(p) htmlcode += ''; else htmlcode += ' systemSounds="' +systemSounds+ '" '; } if(useCompressImages){ if(p) htmlcode += ''; else htmlcode += ' compressImages="' +compressImages+ '" '; } if(useTrace){ if(p) htmlcode += ''; else htmlcode += ' trace="' +trace+ '" '; } return htmlcode; } function getDownloadPageInfo(){ var htmlcode = ''; var pluginBase="http://clic.xtec.cat/"; var pluginCat=pluginBase+"ca/jclic/instjava.htm"; var pluginEsp=pluginBase+"es/jclic/instjava.htm"; var pluginEng=pluginBase+"en/jclic/instjava.htm"; htmlcode += ''+ 'Per utilitzar aquesta aplicació cal instal·lar un plug-in Java™ actualitzat
Feu clic aquí per descarregar-lo
 
'+ 'Para utilizar esta aplicación es necesario un plug-in Java™ actualizado
Haga clic aquí para descargarlo
 
'+ 'In order to run this program you need an updated Java™ plug-in
Click here to download it
'+ '
'; return htmlcode; } function getTable(w, h, nsw, nsh, s){ var htmlcode = ''; htmlcode += '"); } else { define('LINEFEED', "\n"); } /// Getting current dir $dir = dirname(__FILE__); /// Check if the dir seems to be moodle root (with some random shots) $is_moodle_root = false; if (file_exists($dir . '/lang/en') && file_exists($dir . '/lib/db') && file_exists($dir . '/install/lang/en')) { $is_moodle_root = true; } /// List of patterns to search $dml = array ( '(begin|commit|rollback)_sql', 'count_records(_select|_sql)?', 'delete_records(_select)?', 'get_field(set)?(_select|sql)?', 'get_record(s|set)?(_list|_menu|_select|_sql)?(_menu)?', 'insert_record', 'record_exists(_select|_sql)?', 'records_to_menu', 'recordset_to_(array|menu)', 'rs_(EOF|close|fetch_next_record|fetch_record|next_record)', 'set_field(_select)?', 'update_record', ); $helper = array ( 'db_(lowercase|uppercase)', 'sql_(as|bitand|bitnot|bitor|bitxor|cast_char2int|ceil|compare_text|concat|concat_join|empty|fullname|ilike|isempty|isnotempty|length|max|null_from_clause|order_by_text|paging_limit|position|substr)' ); $ddl = array ( 'add_(field|index|key)', 'change_field_(default|enum|notnull|precision|type|unsigned)', 'create_(table|temp_table)', 'drop_(field|index|key|table)', 'find_(check_constraint_name|index_name|key_name|sequence_name)', 'rename_(field|index|key|table)', '(check_constraint|field|index|table)_exists' ); $coreonly = array ( 'delete_tables_from_xmldb_file', 'drop_plugin_tables', 'get_db_directories', 'get_used_table_names', 'install_from_xmldb_file', ); $enum = array ( 'ENUM(VALUES)?=".*?" ', '>getEnum\(', 'new xmldb_field\((((\'[^\']*?\')|[^\',]+?|array\(.*)[,\)]\s?){9,20}', '>add_field\((((\'[^\']*?\')|[^\',]+?|array\(.*)[,\)]\s?){9,20}', '>set_attributes\((((\'[^\']*?\')|[^\',]+?|array\(.*)[,\)]\s?){8,20}', 'change_field_enum' ); $internal = array ( 'change_db_encoding', 'configure_dbconnection', 'db_(detect_lobs|update_lobs)', 'execute_sql(_arr)?', 'onespace2empty', 'oracle_dirty_hack', 'rcache_(get|getforfill|releaseforfill|set|unset|unset_table)', 'where_clause' ); $unsupported = array ( 'column_type', 'table_column', 'modify_database', '(Execute|Connect|PConnect|ErrorMsg)', '(MetaTables|MetaColumns|MetaColumnNames|MetaPrimaryKeys|MetaIndexes)' ); $other = array ( '\$db[,; -]', "[^\$_'\"\.-]dbfamily", "[^\$_'\"\.-]dblibrary", "[^\$_'\"\.-]dbtype[^s]", 'sql_substr\(\)', '\$CFG->prefix', 'NEWNAMEGOESHERE', 'new\s(XMLDBTable|XMLDBField|XMLDBIndex|XMLDBKey)', '>(addFieldInfo|addIndexInfo|addKeyInfo|setAttributes)', '>(begin|commit|rollback)_sql', '(if|while|for|return).*>get_recordset(_list|_select|_sql)?', 'SELECT DISTINCT.*\.\*', "get_in_or_equal\(.*SQL_PARAMS_NAMED\s*,\s*'.*\d'" ); /// List of reserved words /// 1. default (common) ones $reservedlist = array( 'user', 'group', 'order', 'select', 'from', 'where', 'role', 'null', 'start', 'end', 'date', 'match', 'mod', 'new', 'old'); /// 2. from sql_generators if possible if ($is_moodle_root) { define('MOODLE_INTERNAL', true); // cheat, so sql_generator think we are one standard moodle script global $CFG; // cheat, again, to define some stuff needed by generators $CFG = new stdclass(); $CFG->libdir = dirname(__FILE__) . '/lib'; require_once($CFG->libdir . '/ddl/sql_generator.php'); $reservedlist = array_keys(sql_generator::getAllReservedWords()); } foreach ($reservedlist as $key => $word) { $reservedlist[$key] = '(?: AS\s+|:)' . trim($word); } /// Define some known false positives to take them out from errors report (nested array of => file => regular expressions considered false positives) $fp = array ( 'install.php' => array( 'empty\(\$distro-\>dbtype\)', /// Allow $distro->dbtype stuff to work in install '= trim\(\$_POST\[\'dbtype\'\]', /// Allow $config->dbtype stuff to work in install 'get_driver_instance\(\$config-|>dbtype' /// Allow $config->dbtype stuff to work in install ), 'admin/blocks.php' => array( 'drop_plugin_tables.*\/blocks' /// Tables can be dropped from blocks admin interface ), 'admin/health.php' => array( '\. \$CFG-\>prefix \.' /// health script is allowed to use $CFG->prefix when building suggested SQLs to be shown ), 'admin/modules.php' => array( 'drop_plugin_tables.*\/mod' /// Tables can be dropped from modules admin interface ), 'admin/qtypes.php' => array( 'drop_plugin_tables.*\$QTYPES\[\$delete\]-\>' /// Tables can be dropped from qtype admin interface ), 'admin/xmldb/actions/check_bigints/check_bigints.class.php' => array( /// dbfamily uses in this script 'this->dbfamily' ), 'auth/cas/CAS/CAS/client.php' => array( /// cas setAttributes method 'this->setAttributes' ), 'backup/util/dbops/backup_structure_dbops.class.php' => array( /// 2-verified expressions returning recordsets 'element->get_source_.*convert_params_to_values' ), 'backup/util/helper/restore_decode_content.class.php' => array( /// 1-verified expression returning recordset 'return.*get_recordset_sql' ), 'blocks/html/backup/moodle2/restore_html_block_task.class.php' => array( /// 1-verified expression returning recordset 'return.*get_recordset_sql' ), 'lib/adminlib.php' => array( /// adminlib valid code 'drop_plugin_tables\(\$pluginname', 'used_tables = get_used_table_names', 'dbdirs = get_db_directories' ), 'lib/ddl/database_manager.php' => array( /// dbmanager 'dbdirs = get_db_directories' ), 'lib/ddl/simpletest/testddl.php' => array( /// ddl tests 'DB2 = moodle_database::get_driver_instance' ), 'lib/dml/moodle_database.php' => array( /// moodle_database valid code 'cfg-\>dbtype = \$this-\>get_dbtype', 'cfg-\>dblibrary = \$this-\>get_dblibrary', 'return \$this-\>get_recordset_select\(\$table, \$select, \$params', 'return \$this-\>get_recordset_sql\(\$sql, \$params, \$limitfrom' ), 'lib/dml/simpletest/testdml.php' => array( /// dml tests 'DB2 = moodle_database::get_driver_instance' ), 'lib/form/recaptcha.php' => array( /// recaptcha form has own setAttributes method 'this->setAttributes' ), 'mod/assignment/lib.php' => array( /// cas setAttributes method 'mform->setAttributes' ), 'mod/scorm/datamodels/scorm_13.js.php' => array( /// Various scorm 13 exceptions 'max.*delimiter.*(unique|duplicate).*(:true|:false)', 'cmi\.objectives\.n\..*defaultvalue.*:null' ), /// Some (properly closer by caller) returned rs in workshop module 'mod/workshop/form/accumulative/lib.php' => array( 'return \$DB-\>get_recordset_sql\(' ), 'mod/workshop/form/comments/lib.php' => array( 'return \$DB-\>get_recordset_sql\(' ), 'mod/workshop/form/numerrors/lib.php' => array( 'return \$DB-\>get_recordset_sql\(' ), 'mod/workshop/form/rubric/lib.php' => array( 'return \$DB-\>get_recordset_sql\(' ), /// various correct get_db_directories uses 'admin/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php' => array( 'dbdirs = get_db_directories' ), 'admin/xmldb/actions/get_db_directories/get_db_directories.class.php' => array( 'db_directories = get_db_directories' ) ); /// List of exceptions that aren't errors (function declarations, comments, adodb usage from adodb drivers and harcoded strings). Non reportable false positives $excludes = '/(function |^\s*\*|^\s*\/\/|\$this-\>adodb-\>(Execute|Connect|PConnect|ErrorMsg|MetaTables|MetaIndexes|MetaColumns|MetaColumnNames|MetaPrimaryKeys|)|protected \$[a-zA-Z]*db|Incorrect |check find_index_name|not available anymore|output|Replace it with the correct use of|where order of parameters is|_moodle_database|invaliddbtype|has been deprecated in Moodle 2\.0\. Will be out in Moodle 2\.1|Potential SQL injection detected|requires at least two parameters|hint_database = install_db_val|Current database \(|admin_setting_configselect|(if|while|for|return).*\>get_recordset(_list|_select|_sql)?.*\>valid\(\)|NEWNAMEGOESHERE.*XMLDB_LINEFEED|has_capability\(.*:view.*context)|die(.*result.*:null.*errstr)|CAST\(.+AS\s+(INT|FLOAT|DECIMAL|NUM|REAL)/'; /// Calculating megarules $dml_megarule = calculate_megarule($dml,array('[ =@.]'), array('( )?\('), 'i'); $helper_megarule = calculate_megarule($helper,array('[ =@.]'), array('( )?\('), 'i'); $ddl_megarule = calculate_megarule($ddl,array('[ =@.]'), array('( )?\('), 'i'); $coreonly_megarule = calculate_megarule($coreonly,array('[ =@.]'), array('( )?\('), 'i'); $enum_megarule = calculate_megarule($enum); $internal_megarule = calculate_megarule($internal,array('[ =@.]'), array('( )?\('), 'i'); $unsupported_megarule= calculate_megarule($unsupported,array('[ \>=@,.]'), array('( )?\(')); $other_megarule = calculate_megarule($other); $reserved_megarule = calculate_megarule($reservedlist, array("[ =('\"]"), array("[ ,)'\"]"), 'i'); /// All rules $all_megarules = array( 'DML'=>$dml_megarule, 'HELPER'=>$helper_megarule, 'DDL'=>$ddl_megarule, 'COREONLY'=>$coreonly_megarule, 'ENUM'=>$enum_megarule, 'INTERNAL'=>$internal_megarule, 'UNSUPPORTED'=>$unsupported_megarule, 'OTHER'=>$other_megarule, 'RESERVED_WORD'=>$reserved_megarule ); /// To store errors found $errors = array(); $counterrors = 0; /// To store known false positives $falsepositives = array(); $countfalsepositives = 0; /// Process starts here echo "Checking the $dir directory recursively" . LINEFEED; if ($is_moodle_root) { echo "(detected Moodle root directory - false positive detection enabled)" . LINEFEED; } else { echo "(executed from custom directory - false positive detection DISABLED!)" . LINEFEED; } $files = files_to_check($dir); foreach ($files as $file) { echo " - $file: "; /// Read the file, line by line, applying all the megarules $handle = @fopen($file, 'r'); if ($handle) { $line = 0; while (!feof($handle)) { $buffer = fgets($handle, 65535); /// Long lines supported on purpose $line++; /// Search for megarules foreach ($all_megarules as $name=>$megarule) { if (!empty($megarule) && preg_match($megarule, $buffer) && !preg_match($excludes, $buffer)) { /// Let's see if that's a well known false positive (only if executed from Moodle root) if ($is_moodle_root && is_known_false_positive($fp, $file, $buffer, $is_moodle_root)) { /// Known false positive found, annotate it if (!isset($falsepositives[$file])) { $falsepositives[$file] = array(); } $falsepositives[$file][] = "- NOTICE ( $name ) - line $line : " . trim($buffer); $countfalsepositives++; break; } else { /// Error found, add to errrors if (!isset($errors[$file])) { $errors[$file] = array(); echo LINEFEED . " * ERROR found!" . LINEFEED; } $errors[$file][] = "- ERROR ( $name ) - line $line : " . trim($buffer); echo " - ERROR ( $name ) - line $line : " . trim($buffer) . LINEFEED; $counterrors++; break; } } } } if (!isset($errors[$file])) { echo "... OK" . LINEFEED; } fclose($handle); } } echo LINEFEED . LINEFEED; echo " SUMMARY: " . count($errors) . " files with errors ($counterrors ocurrences)" . LINEFEED; foreach ($errors as $file=>$errarr) { echo LINEFEED . " * $file" . LINEFEED; foreach ($errarr as $err) { echo " $err" . LINEFEED; } } echo LINEFEED . LINEFEED; echo " Known false positive: " . count($falsepositives) . " files with $countfalsepositives ocurrences" . LINEFEED; echo " (you should ignore these, although reviewing them from time to time isn't a bad idea either)" . LINEFEED; foreach ($falsepositives as $file=>$fparr) { echo LINEFEED . " * $file" . LINEFEED; foreach ($fparr as $fp) { echo " $fp" . LINEFEED; } } /// INTERNAL FUNCIONS /** * Given an array of search patterns, create one "megarule", with the specified prefixes and suffixes */ function calculate_megarule($patterns, $prefixes=array(), $suffixes=array(), $modifiers='') { $megarule = ''; $totalrule = ''; if (empty($patterns)) { return false; } foreach ($patterns as $pattern) { $megarule .= '|(?:' . $pattern . ')'; } $megarule = trim($megarule, '|'); /// Add all the prefix/suffix combinations foreach ($prefixes as $prefix) { foreach ($suffixes as $suffix) { $totalrule .= '|(?:' . $prefix . '(?:' . $megarule . ')' . $suffix . ')'; } } $totalrule = trim($totalrule, '|'); return '/' . (empty($totalrule) ? $megarule : $totalrule) . '/' . $modifiers; } /** * Given one full path, return one array with all the files to check */ function files_to_check($path) { $results = array(); $pending = array(); $dir = opendir($path); while (false !== ($file=readdir($dir))) { $fullpath = $path . '/' . $file; if (substr($file, 0, 1)=='.' || $file=='CVS') { /// Exclude some dirs continue; } if (is_dir($fullpath)) { /// Process dirs later $pending[] = $fullpath; continue; } if (is_file($fullpath) && strpos($file, basename(__FILE__))!==false) { /// Exclude me continue; } if (is_file($fullpath) && (strpos($fullpath, 'lib/adodb')!==false || strpos($fullpath, 'lib/pear')!==false || strpos($fullpath, 'lib/simpletest')!==false || strpos($fullpath, 'lib/htmlpurifier')!==false || strpos($fullpath, 'lib/memcached.class.php')!==false || strpos($fullpath, 'lib/eaccelerator.class.php')!==false || strpos($fullpath, 'lib/phpmailer')!==false || strpos($fullpath, 'lib/simplepie/simplepie.class.php')!==false || strpos($fullpath, 'lib/soap')!==false || strpos($fullpath, 'lib/zend/Zend/Amf/Adobe/DbInspector.php')!==false || strpos($fullpath, 'search/Zend/Search')!==false || strpos($fullpath, 'lang/')!==false || strpos($fullpath, 'config.php')!==false || strpos($fullpath, 'config-dist.php')!=false)) { /// Exclude adodb, pear, simpletest, htmlpurifier, memcached, phpmailer, soap and lucene libs, lang and config files continue; } if (is_file($fullpath) && strpos($file, '.php')===false && strpos($file, '.html')===false && strpos($file,'.xml')===false) { /// Exclude some files continue; } if (!in_array($fullpath, $results)) { /// Add file if doesn't exists $results[$fullpath] = $fullpath; } } closedir($dir); foreach ($pending as $pend) { $results = array_merge($results, files_to_check($pend)); } return $results; } /// Function used to discard some well known false positives ($fp) when /// some $text in $file has been detected as error. Only processed if /// we detect the script is being executed from moodle root directory. /// Simply returns true/false function is_known_false_positive($fp, $file, $text, $is_moodle_root = false) { if (!$is_moodle_root) { return false; } /// Take out dirroot from $file $file = trim(str_replace(dirname(__FILE__), '', $file), '/'); /// Look for $file in array of known false positives if (array_key_exists($file, $fp)) { foreach ($fp[$file] as $fprule) { if (preg_match('/' . $fprule . '/i', $text)) { return true; } } } /// Arrived hed, no false positives found for that file/$text return false; } ?> jclicmoodle-0.2.3/version.php0000644000175000017500000000321612216575042016316 0ustar demarchidemarchi. /** * Defines the version of jclic * * This code fragment is called by moodle_needs_upgrading() and * /admin/index.php * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); //$module->version = 0; // If version == 0 then module will not be installed $module->version = 2013022200; // The current module version (Date: YYYYMMDDXX) $module->requires = 2011033009; // Requires this Moodle version (2.0) $module->cron = 0; // Period for cron to check this module (secs) $module->component = 'mod_jclic'; // To check on upgrade, that module sits in correct place $module->release = 'v0.2.3'; // Human-readable version name $module->maturity = MATURITY_STABLE; // How stable the plugin is jclicmoodle-0.2.3/pix/icon.svg0000644000175000017500000000760512216575042016377 0ustar demarchidemarchi image/svg+xml jclicmoodle-0.2.3/pix/icon.gif0000644000175000017500000000025012216575042016332 0ustar demarchidemarchiGIF89afML%ـrf3!,UI$8k}1Ha@0v , ! n7 F h8EsxIC e::8ZY;jclicmoodle-0.2.3/pix/icon.png0000644000175000017500000000210512216575042016352 0ustar demarchidemarchiPNG  IHDRw=sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDATHmhUɓIfK\[v*6Da7Ed!lB ւ~Tv~v k-tjC`7V~eӄqyii'Ͻ-:t+ZQgՋq4˳MUjK>[}13 q9/Zi? [*%3aiLJ/b̪^傩n@WX'w"4+^;P]py}<¢t۹P|@NF7Nqnǎ4u{Cr$bx*xxWvQ%ղA3)✤~pŷG?Y\]҈M: }ǩ>gHs5WH,J-KcǕ4LR[0N3"b|,|ik%H 3 s`:H\̨.Y>h% !VMi;2S$ ήZn7HgXA@FtLd4"=| tRK卍@# r'/ Ӥ 0#qZ~<@2 \SI B>FC( 4nQdL\Fd\(ĺ79ϑY#^{|n.i?"&1gH7,ke{q jPu_/0rXIENDB`jclicmoodle-0.2.3/index.php0000644000175000017500000000700112216575042015734 0ustar demarchidemarchi. /** * This is a one-line short description of the file * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/lib.php'); $id = required_param('id', PARAM_INT); // course if (! $course = $DB->get_record('course', array('id' => $id))) { error('Course ID is incorrect'); } require_course_login($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); add_to_log($course->id, 'jclic', 'view all', "index.php?id={$course->id}", ''); /// Print the header $PAGE->set_url('/mod/jclic/index.php', array('id' => $id)); $PAGE->set_title(format_string($course->fullname)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); // other things you may want to set - remove if not needed //$PAGE->set_cacheable(false); //$PAGE->set_focuscontrol('some-html-id'); //$PAGE->add_body_class('jclic-'.$somevar); // Output starts here echo $OUTPUT->header(); /// Get all the appropriate data if (! $jclics = get_all_instances_in_course('jclic', $course)) { echo $OUTPUT->heading(get_string('nojclics', 'jclic'), 2); echo $OUTPUT->continue_button("view.php?id=$course->id"); echo $OUTPUT->footer(); 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'); $table = new html_table(); 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 ($jclics as $jclic) { if (!$jclic->visible) { //Show dimmed if the mod is hidden $link = ''.format_string($jclic->name).''; } else { //Show normal if the mod is visible $link = ''.format_string($jclic->name).''; } if ($course->format == 'weeks' or $course->format == 'topics') { $table->data[] = array ($jclic->section, $link); } else { $table->data[] = array ($link); } } echo $OUTPUT->heading(get_string('modulenameplural', 'jclic'), 2); echo html_writer::table($table); /// Finish the page echo $OUTPUT->footer(); jclicmoodle-0.2.3/CHANGES.txt0000755000175000017500000001301112216575042015726 0ustar demarchidemarchiRelease notes for JClic Module for Moodle (https://projectes.lafarga.cat/projects/jclicmoodle) More information on each of the fixes can be found in the project development home at https://projectes.lafarga.cat/projects/jclicmoodle Changes in 0.2.3 - 2013022200 (2013/09/19) --------------------------------------------------------------------------------------- - Fixed bug when deleting jclic activities and enableajax is enabled - Fixed bug when upgrading empty maxgrade (reported by Ferran Recio - UPCnet) - Fixed bug when editing title from main course page (is still not working but solve some minor warnings) Changes in 0.2.3 RC - 2013022200 (2013/02/22) --------------------------------------------------------------------------------------- - Added Brazilian translation - Updated Euskara translation (downloaded from AMOS) - Reviewed English translation (thanks to German Valero!) - Reviewed some SQL to avoid Postgre problem with userid - Included SVG icons (thanks to Pau Ferrer!) - Fixed bug with users reporting (only first page was showed) Changes in 0.2.2 (2012/08/24) --------------------------------------------------------------------------------------- - Added Brazilian translation - Added Galician translation - Fixed some bugs related with importation from Moodle 1.9 - Solved some 'Strict standards' warnings - Adapted code for Moodle 2.3 (like addinstance capability) Changes in 0.2.1 (2012/06/05) --------------------------------------------------------------------------------------- - First version of the jclic module for Moodle 2. Changes in 0.1.0.11 (2011/05/25) --------------------------------------------------------------------------------------- - Added language parameter to the activity edition page to let specify the player language (http://projectes.lafarga.cat/projects/jclicmoodle/tracker/291/1641/detail) - Added exiturl parameter to the activity edition page to let specify exit URL (http://projectes.lafarga.cat/projects/jclicmoodle/tracker/291/1287/detail) - Revised information showed in summary - Solved problem when moodle is installed in the root (without path in the URL) - Added jclic_scale_used_anywhere function sended by David Monllao from URV to improve the performance of the module - Fixed warnings when restoring jclic activities (http://projectes.lafarga.cat/projects/jclicmoodle/tracker/288/1200/detail) - Fixed bug with single quote reported to Moodle tracker (http://tracker.moodle.org/browse/CONTRIB-2079?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acvs-tabpanel) - Fixed warning message when there were no users in the course (http://projectes.lafarga.cat/projects/jclicmoodle/tracker/288/1335/detail) - Added protocol parameter to TCPReporter jclic function to let it works with HTTPS connections (https://projectes.lafarga.cat/projects/jclicmoodle/tracker/288/1507/detail) - Solved error with maxattempts (http://projectes.lafarga.cat/projects/jclicmoodle/tracker/288/1775/detail) Changes in 0.1.0.9 (2009/10/27) --------------------------------------------------------------------------------------- - Added Hebrew translation (Nadav Kavalerchik - nadavkav@gmail.com) - Removed the pass-by-reference to the $grades parameter in jclic_user_grades function. - Assigned a default value to maxgrade parameter and removed restriction in jclic_grades function to solve the problem with the qualificator of Moodle if maxgrade isn't specified. - Added COPYING, CREDITS and INSTALL files - Added user picture to the teacher view - Commented if (function_exists('date_default_timezone_set')) date_default_timezone_set('UTC'); line in lib.php file to solve time problems (Jaume Rocarias from UAB) - Added IOC implementation for restarting courses with JClic activities (Albert Gasset Romo) - Solved some problems with Moodle 1.6 Changes in 0.1.0.8 (2008/12/10) --------------------------------------------------------------------------------------- - Solved include /gradelib.php bug Changes in 0.1.0.8 (2008/11/07) --------------------------------------------------------------------------------------- - Added Galician translation (Xosé Luis Barreiro Cebey - xoseluis@edu.xunta.es) - Added Greek translation (Yannis Kaskamanidis - ttnfy17@yahoo.gr) - Solved problems with Moodle 1.9 qualification - Added preview button from teachers view - Solved problems with white spaces in URL - Added @mini.xml skin Changes in 0.1.0.7 (2008/01/25) --------------------------------------------------------------------------------------- - Added compatibility with course groups - Solved problems with switch role button - Added file install.xml file (for compatibility with Oracle) - Moved lang directory inside jclic module. - Added Basque translation (Abel Camacho - didaktika@santurtzieus.com) Changes in 0.1.0.6 (2007/03/07) --------------------------------------------------------------------------------------- - Added compatibility with Moodle 1.7 and 1.8; therefore, the jclicmoodle module works correctly with Moodle 1.5 and superior. - Incorporated detailed information of the activities for each student's session. - Added button "Choose or upload a file..." to use your own JClic activities. - Inserted new configuration parameter (lap) which allows you configuring the time between JClic applet client and Moodle server transactions. - Students' view updated: sessions list replaced for a button (to open the results in a new window) Changes in 0.1.0.5 (2006/12/12) --------------------------------------------------------------------------------------- - Solved problems detected in the backup of Moodle courses containing JClic activities. jclicmoodle-0.2.3/jclic.js0000644000175000017500000000351712216575042015546 0ustar demarchidemarchi// This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . /** * Javascript helper function for Folder module * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ M.mod_jclic = {}; M.mod_jclic.init = function(Y, params) { setJarBase(params['jclic_jarbase']); setReporter('TCPReporter','path='+params['jclic_path']+';service='+params['jclic_service']+';user='+params['jclic_user']+';key='+params['id']+';lap='+params['jclic_lap']+';protocol='+params['jclic_protocol']); setSkin(params['skin']); setLanguage(params['lang']); setExitUrl(params['exiturl']); document.getElementById('jclic_applet').innerHTML = getPlugin(params['jclic_url'], params['width'], params['height']); }; function showSessionActivities(sessionid){ activities = document.getElementById('session_'+sessionid); if (activities.className == 'jclic-session-activities-visible') { activities.className='jclic-session-activities-hidden'; } else{ activities.className='jclic-session-activities-visible'; } }jclicmoodle-0.2.3/lang/es/jclic.php0000644000175000017500000001515512216575042017252 0ustar demarchidemarchi. /** * Spanish strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'Actividades realizadas'; $string['activitysolved'] = 'Activitades acertadas'; $string['attempts'] = 'Intentos'; $string['avaluation'] = 'Criterio de evaluación'; $string['avaluation_score'] = 'Alcanzar una puntuación media entre todas las actividades'; $string['avaluation_solved'] = 'Resolver correctamente un número de actividades diferentes'; $string['description'] = 'Descripción'; $string['height']='Altura'; $string['hideall']='Mostrar sólo los resúmenes'; $string['lastaccess']='último acceso'; $string['maxattempts'] = 'Número màximo de intentos'; $string['maxgrade'] = 'Puntuación/actividades a alcanzar'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'Ya has realizado esta actividad el número de veces màximo'; $string['score']='Puntuación'; $string['sessions']='Sesiones'; $string['size']='Medidas'; $string['showall']='Mostrar el detalle de las sesiones'; $string['starttime']= 'Fecha de inicio'; $string['skin'] = 'Entorno gràfico (skin)'; $string['totals']= 'Totales'; $string['totaltime']= 'Tiempo total'; $string['unlimited'] = 'Ilimitado'; $string['url'] = 'Enlace'; $string['width']='Anchura'; /* Revision 20070305 */ $string['actions']='Aciertos'; $string['activity']='Actividad'; $string['msg_nosessions']='Esta actividad JClic todavía no tiene ninguna sessión'; $string['solved']='Correcta'; $string['time']='Tiempo'; /* Revision 20071002 */ $string['header_jclic']='Ajustes de JClic'; $string['header_score']='Ajustes de evaluación'; /* Revision 20081107 */ $string['preview_jclic']='Mostrar la actividad JClic'; /* Revision 20091023 */ $string['deleteallsessions'] = 'Borrar todas las sesiones'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Idioma'; $string['exiturl']='Enlace de salida'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Disponible desde'; $string['closebeforeopen'] = 'No se pudo actualizar el JClic: la fecha de cierre es anterior a la de apertura.'; $string['duedate'] = 'Fecha de entrega'; $string['exiturl_help'] = 'Se trata del URL que se abrirá cuando el alumnado finalice la última actividad JClic. Para que esta redirección funcione es necesario que, en la pestaña "Secuencias", la última actividad del projecto JClic, tenga asociada, en la sección "Flecha adelante", la acción "Salir de JClic".'; $string['expired'] = 'Lo sentimos, esta actividad se cerró en {$a} y ya no está disponible'; $string['filetype'] = 'Tipo'; $string['filetype_help'] = 'Este parámetro determina cómo se incluye el paquete JClic en el curso. Hay 2 opciones: * Fichero JClic subido - Posibilita escoger un fichero ".jclic.zip" válido mediante el selector de archivos. * URL externo - Posibilita especificar el URL de un paquete JClic. NOTA: El URL debe empezar con https(s) o www y contener un fichero ".jclic.zip" válido'; $string['filetypeexternal'] = 'URL externo'; $string['filetypelocal'] = 'Fichero JClic subido'; $string['invalidjclicfile'] = 'Se ha especificado un fichero JClic no válido. El fichero debe tener la extensión ".jclic.zip".'; $string['invalidurl'] = 'Se ha especificado un URL no válido. El URL debe empezar con http(s) y enlazar a un fichero ".jclic.zip" válido.'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='URL base de los ficheros JAR'; $string['jclicjarbase_help']='Dirección web donde localizar todos los ficheros jar de JClic.'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'Este parámetro habilita un URL para especificar el paquete JClic en lugar de seleccionarlo a través del selector de archivos.'; $string['jclicfile'] = 'Fichero JClic'; $string['jclicfile_help'] = 'El fichero ".jclic.zip" que contiene el paquete JClic.'; $string['lap']='Tiempo entre vueltas'; $string['lap_help']='Tiempo que se deja entre las transacciones cliente-servidor (expresado en segundos)'; $string['modulename_help'] = 'JClic es un proyecto del Departament de Ensenyament de la Generalitat de Cataluña que está formado por un conjunto de aplicaciones de software libre que permiten crear diversos tipos de actividades educativas multimedia: puzzles, asociaciones, ejercicios de texto, crucigramas, sopas de letras y otros. Además, la zonaClic dispone de una biblioteca de actividades que cuenta con unos 1000 proyectos que han creado profesores y personas de otros colectivos que han querido compartir solidariamente su trabajo. Este módulo permite al profesorado añadir a un curso cualquier actividad de tipo JClic y recopilar los resultados obtenidos (tiempo utilizado para cada actividad, intentos, aciertos, etc.) para cada alumno/a.'; $string['notopenyet'] = 'Esta actividad no estará disponible hasta {$a}'; $string['pluginadministration'] = 'Administración de JClic'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='Previsualizar la actividad JClic'; $string['return_results']='Volver a los resultados'; $string['show_my_results']='Mostrar mis resultados'; $string['solveddone'] = 'Actividades acertadas / realizadas'; $string['urledit'] = 'Fichero JClic'; $string['urledit_help'] = 'El fichero "jclic.zip" que contiene la actividad JClic.'; $string['jclic:view'] = 'Ver JClic'; $string['jclic:submit'] = 'Enviar JClic'; $string['jclic:grade'] = 'Evaluar JClic'; /* Revision Moodle 2.3 */ $string['jclic:addinstance'] = 'Añadir un JClic';jclicmoodle-0.2.3/lang/el/jclic.php0000644000175000017500000002043512216575042017240 0ustar demarchidemarchi. /** * Greek strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Yannis Kaskamanidis (kiolalis@gmail.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'Οι δραστηριότητες ολοκληρώθηκαν'; $string['activitysolved'] = 'Οι δραστηριότητες ολοκληρώθηκαν με επιτυχία'; $string['attempts'] = 'Προσπάθειες'; $string['avaluation'] = 'Κριτήρια αξιολόγησης'; $string['avaluation_score'] = 'Επίτευξη συνολικής βαθμολογίας'; $string['avaluation_solved'] = 'Επίλυση αυτού του αριθμού διαφορετικών δραστηριοτήτων'; $string['description'] = 'Περιγραφή'; $string['height']='Ύψος'; $string['hideall']='Προβολή μόνο των περιλήψεων'; $string['lastaccess']='Τελευταία επίσκεψη'; $string['maxattempts'] = 'Μέγιστος αριθμός δοκιμών'; $string['maxgrade'] = 'Βαθμολογία/Δραστηριότητες που πρέπει να επιτευχθούν'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'Έχετε επιχειρήσει να ολοκληρώσετε αυτή τη δραστηριότητα με τον μέγιστο αριθμό προσπαθειών'; $string['score']='Βαθμολογία'; $string['sessions']='Συνεδρίες'; $string['showall']='Προβολή λεπτομερειών όλων των συνεδριών'; $string['size']='Μέγεθος'; $string['starttime']= 'Ημερομηνία έναρξης'; $string['skin'] = 'Θέμα'; $string['totals']= 'Σύνολα'; $string['totaltime']= 'Συνολικός χρόνος'; $string['unlimited'] = 'Απεριόριστο'; $string['url'] = 'URL'; $string['width']='Πλάτος'; /* Revision 20070305 */ $string['actions']='Ενέργειες'; $string['activity']='Δραστηριότητα'; $string['msg_nosessions']='Αυτή η δραστηριότητα του JClic δεν διαθέτει ακόμη καμία συνεδρία'; $string['solved']='Σωστό'; $string['time']='Χρόνος'; /* Revision 20071002 */ $string['header_jclic']='Ρυθμίσεις JClic'; $string['header_score']='Ρυθμίσεις Αξιολόγησης'; /* Revision 20091023 */ $string['deleteallsessions'] = 'Διαγραφή όλων των συνεδριών'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Γλώσσα'; $string['exiturl']='Έξοδος από το URL'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Διαθέσιμο από'; $string['closebeforeopen'] = 'Αδυναμία ενημέρωσης του JClic. Έχετε ορίσει ημερομηνία λήξης προγενέστερη της ημερομηνίας διαθεσιμότητας.'; $string['duedate'] = 'Ημερομηνία λήξης'; $string['exiturl_help'] = 'Αυτό είναι το URL που εμφανίζεται όταν οι μαθητές ολοκληρώνουν την τελευταία δραστηριότητα του JClic. To make work this redirection it\'s necessary to associate to the last activity in the Sequences tab the action "Exit JClic" in the Forward arrow section.'; $string['expired'] = 'Συγνώμη, αλλά αυτή η δραστηριότητα έκλεισε στις {$a} και δεν είναι πλέον διαθέσιμη'; $string['filetype'] = 'Είδος'; $string['filetype_help'] = 'Αυτή η ρύθμιση καθορίζει τον τρόπο συμπερίληψης αυτής της δραστηριότητας του JClic στο μάθημα. Υπάρχουν δύο επιλογές: * Uploaded JClic - Enables a valid ".jclic.zip" package to be chosen by the file picker. * External URL - Enables a URL to be specified. Note: The URL must start with http(s) or www and contain a valid "jclic.zip" file.'; $string['filetypeexternal'] = 'Εξωτερικό URL'; $string['filetypelocal'] = 'Φορτωμένο JClic'; $string['invalidjclicfile'] = 'Προσδιορίστηκε ένα μη έγκυρο αρχείο JClic. Θα πρέπει να έχει κατάληξη ".jclic.zip".'; $string['invalidurl'] = 'Προσδιορίστηκε ένα μη έγκυρο URL. Θα πρέπει να αρχίζει με http(s) και να παραπέμπει σε ένα έγκυρο αρχείο ".jclic.zip".'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='Με βάση Jar'; $string['jclicjarbase_help']='Διεύθυνση Ιστού όπου βρίσκονται όλα τα αρχεία jar του JClic'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'Αυτή η ρύθμιση ενεργοποιεί ένα URL για τον προσδιορισμό ενός αρχείου JClic, καλύτερα απ\' ότι με επιλογή του αρχείου μέσω ενός επιλογέα.'; $string['jclicfile'] = 'Αρχείο JClic'; $string['jclicfile_help'] = 'Το αρχείο ".jclic.zip" που περιέχει τα αρχεία του JClic.'; $string['lap']='Απαιτούμενος χρόνος'; $string['lap_help']='Χρόνος συναλλαγών μεταξύ πελατών και διακομιστή (σε δευτερόλεπτα)'; $string['modulename_help'] = 'Το JClic είναι ένα έργο του Υπουργείου Παιδείας της Καταλωνίας. Αποτελείται από εφαρμογές ανοιχτού λογισμού που επιτρέπουν τη δημιουργία αρκετών τύπων πολυμεσικών εκπαιδευτικών δραστηριοτήτων: παζλ, παιχνίδια αντιστοίχισης, δραστηριότητες κειμένου, σταυρόλεξα, αναζήτηση λέξεων και άλλα. Επιπροσθέτως, το ClicZone προσφέρει ένα αποθετήριο όπου θα βρείτε περισσότερες από χίλιες έτοιμες δραστηριότητες, οι οποίες δημιουργήθηκαν από εκπαιδευτικούς και άλλους επαγγελματίες της εκπαίδευσης, οι οποίοι επιθυμούν τον διαμοιρασμό της δουλειάς τους. This module allows teachers to add JClick activities to any course and to track pupils\' results (time spent on each of the activities, number of tries, score...).'; $string['notopenyet'] = 'Συγνώμη, αλλά αυτή η δραστηριότητα δεν είναι διαθέσιμη μέχρι τις {$a}'; $string['pluginadministration'] = 'Διαχείριση JClic'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='Εμφάνιση δραστηριότητας του JClic'; // Preview JClic activity $string['return_results']='Επιστροφή στα αποτελέσματα'; $string['show_my_results']='Προβολή αποτελεσμάτων'; // Show my results $string['solveddone'] = 'Ολοκληρωμένες δραστηριότητες'; $string['urledit'] = 'Αρχείο δραστηριότητας JClic'; $string['urledit_help'] = 'Το αρχείο "jclic.zip" όπου θα βρείτε το πακέτο δραστηριοτήτων του JClic.'; jclicmoodle-0.2.3/lang/ca/jclic.php0000644000175000017500000001500612216575042017221 0ustar demarchidemarchi. /** * Catalan strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'Activitats fetes'; $string['activitysolved'] = 'Activitats encertades'; $string['attempts'] = 'Intents'; $string['avaluation'] = 'Criteri d\'avaluació'; $string['avaluation_score'] = 'Assolir aquesta puntuació mitja entre totes les activitats'; $string['avaluation_solved'] = 'Resoldre correctament aquest nombre d\'activitats diferents'; $string['description'] = 'Descripció'; $string['height']='Alçada'; $string['hideall']='Mostra només els resums'; $string['lastaccess']='Últim accés'; $string['maxattempts'] = 'Nombre màxim d\'intents'; $string['maxgrade'] = 'Puntuació/activitats que cal assolir'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'Ja has fet aquesta activitat el nombre màxim de vegades permès.'; $string['score']='Puntuació'; $string['sessions']='Sessions'; $string['showall']='Mostra el detall de les sessions'; $string['size']='Mides'; $string['starttime']= 'Data d\'inici'; $string['skin'] = 'Aparença (skin)'; $string['totals']= 'Totals'; $string['totaltime']= 'Temps total'; $string['unlimited'] = 'Il·limitat'; $string['url'] = 'Enllaç'; $string['width']='Amplada'; /* Revision 20070305 */ $string['actions']='Encerts'; $string['activity']='Activitat'; $string['msg_nosessions']='Aquesta activitat JClic encara no té cap sessió'; $string['solved']='Correcta'; $string['time']='Temps'; /* Revision 20071002 */ $string['header_jclic']='Paràmetres JClic'; $string['header_score']='Paràmetres d\'avaluació'; /* Revision 20091023 */ $string['deleteallsessions'] = 'Suprimeix totes les sessions'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Idioma'; $string['exiturl']='Enllaç de sortida'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Disponible des de'; $string['closebeforeopen'] = 'No s\'ha pogut actualitzar el JClic. Heu especificat una data de finalització anterior a la data d\'inici.'; $string['duedate'] = 'Data de venciment'; $string['exiturl_help'] = 'Es tracta del URL que s\'obrirà quan l\'alumnat finalitzi la darrera activitat JClic. Per tal que aquesta redirecció funcioni cal que, a la pestanya seqüències, la darrera activitat del projecte JClic, a la "Fletxa endavant", tingui associada l\'acció "Sortir del JClic".'; $string['expired'] = 'Ho sentim, aquesta activitat es va tancar el {$a} i ja no està disponible'; $string['filetype'] = 'Tipus'; $string['filetype_help'] = 'Aquest paràmetre determina com s\'insereix l\'activitat JClic en el curs. Tenim 2 opcions: * Fitxer JClic pujat - Permet escollir un fitxer ".jclic.zip" vàlid mitjançant el selector d\'arxius. * URL extern - Permet especificar el URL d\'un paquet JClic. Nota: El URL ha de començar amb http(s) o www i contenir un fitxer "jclic.zip" vàlid.'; $string['filetypeexternal'] = 'URL extern'; $string['filetypelocal'] = 'Fitxer JClic pujat'; $string['invalidjclicfile'] = 'S\'ha especificat un fitxer JClic no vàlid. El fitxer ha de tenir l\'extensió ".jclic.zip".'; $string['invalidurl'] = 'S\'ha especificat un URL no vàlid. El URL ha de començar amb http(s) i ha d\'enllaçar a un fitxer ".jclic.zip" vàlid.'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='URL base dels fitxers JAR'; $string['jclicjarbase_help']='Adreça web on localitzar tots els fitxers jar de JClic.'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'Aquest paràmetre permet especificar el URL del paquet JClic enlloc de seleccionar-ho mitjançant el selector d\'arxius.'; $string['jclicfile'] = 'Fitxer JClic'; $string['jclicfile_help'] = 'El fitxer ".jclic.zip" que conté el paquet JClic.'; $string['lap']='Temps entre voltes'; $string['lap_help']='Temps que es deixa entre les transaccions client-servidor (expressat en segons)'; $string['modulename_help'] = 'El JClic és un projecte del Departament d\'Ensenyament de la Generalitat de Catalunya que està format per un conjunt d\'aplicacions de programari lliure que permeten crear diversos tipus d\'activitats educatives multimèdia: puzles, associacions, exercicis de text, mots encreuats, sopes de lletres i altres. A més, la zonaClic disposa d\'una biblioteca d\'activitats que compta amb uns mil projectes que han creat professors i persones d\'altres col·lectius que han volgut compartir solidàriament el seu treball. Aquest mòdul permet al professorat afegir a un curs qualsevol activitat de tipus JClic i recopilar els resultats obtinguts (temps utilitzat a cada activitat, intents, encerts...) per cada alumne/a.'; $string['notopenyet'] = 'Ho sentim, aquesta activitat no estarà disponible fins {$a}'; $string['pluginadministration'] = 'Administració de JClic'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='Previsualitza l\'activitat JClic'; $string['return_results']='Torna als resultats'; $string['show_my_results']='Mostra els meus resultats'; $string['solveddone'] = 'Activitats encertades / fetes'; $string['urledit'] = 'Fitxer JClic'; $string['urledit_help'] = 'El fitxer ".jclic.zip" que conté l\'activitat JClic.'; $string['jclic:view'] = 'Visualitza JClic'; $string['jclic:submit'] = 'Envia JClic'; $string['jclic:grade'] = 'Avalua JClic'; /* Revision Moodle 2.3 */ $string['jclic:addinstance'] = 'Afegeix una activitat JClic'; jclicmoodle-0.2.3/lang/pt_br/jclic.php0000644000175000017500000001435512216575042017752 0ustar demarchidemarchi. /** * [EN] Brazilian portuguese strings for jclic * [BR] Textos em português do Brasil para jclic * * @package mod * @copyright 2012 4Linux Free Software Solutions * @author Kleber Calegario Batista * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['actions'] = 'Ações'; $string['activity'] = 'Atividade'; $string['activitydone'] = 'Atividades prontas'; $string['activitysolved'] = 'Atividades completadas com sucesso'; $string['attempts'] = 'Tentativas'; $string['avaluation'] = 'Critério de avaliação'; $string['avaluation_score'] = 'Atingindo esta nota global'; $string['avaluation_solved'] = 'Resolvendo este número de diferentes atividades'; $string['description'] = 'Descrição'; $string['height'] = 'Altura'; $string['hideall'] = 'Mostrar apenas sumários'; $string['lastaccess'] = 'Última visita'; $string['maxattempts'] = 'Número máximo de tentativas'; $string['maxgrade'] = 'Pontuação/atividades que devem ser atingidas'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts'] = 'Você excedeu o número máximo de tentativas para esta atividade'; $string['msg_nosessions'] = 'Esta atividade JClic ainda não tem uma sessão'; $string['score'] = 'Pontuação'; $string['sessions'] = 'Sessões'; $string['showall'] = 'Mostrar detalhes de todas as sessões'; $string['size'] = 'Tamanho'; $string['starttime'] = 'Data de início'; $string['skin'] = 'Tema'; $string['solved'] = 'Correto'; $string['time'] = 'Tempo'; $string['totals'] = 'Totais'; $string['totaltime'] = 'Tempo total'; $string['unlimited'] = 'Ilimitado'; $string['url'] = 'URL'; $string['width'] = 'Largura'; /* Revision 20071002 */ $string['header_jclic'] = 'Configurações JClic'; $string['header_score'] = 'Configurações da Avaliação'; /* Revision 20091023 */ $string['deleteallsessions'] = 'Apagar todas as sessões'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang'] = 'Idioma'; $string['exiturl'] = 'URL de saída'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Disponível em'; $string['closebeforeopen'] = 'Não foi possível atualizar o jclic. Você especificou uma data de vencimento anterior à data disponível.'; $string['duedate'] = 'Data de vencimento'; $string['exiturl_help'] = 'Esta é a URL que aparece quando um aluno termina a última atividade JClic. Para fazer este redirecionamento funcionar, é preciso associar a última atividade da aba de Sequências à ação "Saída JClic" na seção da seta Próximo'; $string['expired'] = 'Desculpe, esta atividade foi fechada em {$a} e não está mais disponível'; $string['filetype'] = 'Tipo'; $string['filetype_help'] = 'Esta configuração determina como a atividade JClic é incluída no curso. Existem 2 opções disponíveis: * Upload de arquivo JClic - Habilita um pacote ".jclic.zip" válido para ser escolhido pelo file picker. * URL Externa - Habilita uma URL a ser especificada. Nota: A URL deve começar com http(s) ou www, além de conter um arquivo "jclic.zip" válido.'; $string['filetypeexternal'] = 'URL externa'; $string['filetypelocal'] = 'Upload de arquivo JClic'; $string['invalidjclicfile'] = 'Foi informado um JClic inválido. O arquivo deve ter uma extensão ".jclic.zip".'; $string['invalidurl'] = 'Foi informada uma URL inválida. A URL deve começar com http(s) ou www, além de conter um arquivo "jclic.zip" válido.'; $string['jclic'] = 'JClic'; $string['jclicjarbase'] = 'Base Jar'; $string['jclicjarbase_help'] = 'Endereço Web onde estão localizados todos os arquivos JClic jar'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'Esta configuração habilita a especifiação de uma URL para ser usada pelo pacote JClic, ao invés da escolha de um arquivo através do file picker.'; $string['jclicfile'] = 'Arquivo JClic'; $string['jclicfile_help'] = 'O arquivo ".jclic.zip" contendo os arquivos JClic.'; $string['lap'] = 'Volta'; $string['lap_help'] = 'Tempo entre as transações cliente-servidor (em segundos)'; $string['modulename_help'] = 'JClic é um projeto do Ministério da Educação da Catalunha. Ele consiste em um conjunto de aplicações de código-aberto que permitem a criação de diversos tipos de atividades educacionais multimídia: quebra-cabeças, jogos associativos, atividades de texto, palavras cruzadas, caça-palavras, entre outras. Além disso, a ClicZone oferece um repositório onde mais de mil atividades estão disponíveis. Ela foi criada por professores e outros profissionais que querem compartilhar seu trabalho com outras pessoas. Este módulo possibilita aos professores adicionar atividades JClick a qualquer curso e acompanhar os resultados de seus pupilos (tempo gasto em cada atividade, número de tentativas, nota...).'; $string['notopenyet'] = 'Desculpe, esta atividade não estará disponível até {$a}'; $string['pluginadministration'] = 'Administração do JClic'; $string['pluginname'] = 'JClic'; $string['preview_jclic'] = 'Visualizar atividade JClic'; $string['return_results'] = 'Retornar aos resultados'; $string['show_my_results'] = 'Mostrar resultados'; $string['solveddone'] = 'Atividades resolvidas / concluídas'; $string['urledit'] = 'Arquivos de atividade JClic'; $string['urledit_help'] = 'O arquivo "jclic.zip" onde você vai encontraro pacote da atividade JClic.'; $string['jclic:view'] = 'Visualizar JClic'; $string['jclic:submit'] = 'Enviar JClic'; $string['jclic:grade'] = 'Avaliar JClic';jclicmoodle-0.2.3/lang/he/jclic.php0000644000175000017500000001430012216575042017226 0ustar demarchidemarchi. /** * Hebrew strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Nadav Kavalerchik (nadavkav@gmail.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'פעילויות אשר הסתיימו'; $string['activitysolved'] = 'פעילויות אשר הסתיימו בהצלחה'; $string['attempts'] = 'נסיונות'; $string['avaluation'] = 'סוג ציון'; $string['avaluation_score'] = 'סיכום כל הפעילויות לציון סופי כללי'; $string['avaluation_solved'] = 'סיכום מספר ההצלחות בפתרון פעילויות שונות'; $string['description'] = 'תאור'; $string['height']='גובה'; $string['hideall']='הצגת סיכום בלבד'; $string['lastaccess']='ביקרו לאחרונה'; $string['maxattempts'] = 'מספר נסיונות מירבי'; $string['maxgrade'] = 'ציון/פעילויות אשר יש לסיים'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'התנסתם במספר המירבי של האפשרויות לפתור פעילות זו'; $string['score']='ציון'; $string['sessions']='ניסיונות'; $string['showall']='הציגו תוצאות של כל הניסיונות '; $string['size']='גודל'; $string['starttime']= 'תאריך תחילה'; $string['skin'] = 'תצורת ממשק'; $string['totals']= 'סך הכל'; $string['totaltime']= 'זמן כולל'; $string['unlimited'] = 'ללא הגבלה'; $string['url'] = 'URL'; $string['width']='רוחב'; /* Revision 20070305 */ $string['actions']='פעילויות'; $string['activity']='פעילות'; $string['msg_nosessions']='עליכם להתחבר בשם משתמש אמיתי
כדי לשמור את תוצאות הפעילות כציון בתיק המשתמש'; $string['solved']='נכון'; $string['time']='זמן'; /* Revision 20071002 */ $string['header_jclic']='JClic מאפיינים'; $string['header_score']='מאפייני הערכה'; /* Revision 20091023 */ $string['deleteallsessions'] = 'מחיקת כל הפעילויות'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Language'; $string['exiturl']='Exit URL'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Available from'; $string['closebeforeopen'] = 'Could not update the jclic. You have specified a due date before the available date.'; $string['duedate'] = 'Due date'; $string['exiturl_help'] = 'This is the URL that appears when students finish the last JClic activity. To make work this redirection it\'s necessary to associate to the last activity in the Sequences tab the action "Exit JClic" in the Forward arrow section.'; $string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available'; $string['filetype'] = 'Type'; $string['filetype_help'] = 'This setting determines how the JClic activity is included in the course. There are up to 2 options: * Uploaded JClic - Enables a valid ".jclic.zip" package to be chosen by the file picker. * External URL - Enables a URL to be specified. Note: The URL must start with http(s) or www and contain a valid "jclic.zip" file.'; $string['filetypeexternal'] = 'External URL'; $string['filetypelocal'] = 'Uploaded JClic'; $string['invalidjclicfile'] = 'Invalid JClic specified. It must have the ".jclic.zip" extension.'; $string['invalidurl'] = 'Invalid URL specified. It must start with http(s) and has to be a valid ".jclic.zip" file.'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='Jar base'; $string['jclicjarbase_help']='Web address where to locate all the JClic jar files'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'This setting enables a URL for the JClic package to be specified, rather than choosing a file via the file picker.'; $string['jclicfile'] = 'JClic file'; $string['jclicfile_help'] = 'The .jclic.zip file containing the JClic files.'; $string['lap']='Lap'; $string['lap_help']='זמן התקשורת בין השרת-למחשב שלכם (בשניות)'; $string['modulename_help'] = 'JClic is a project of the Catalan Ministry of Education. It consists of a set of open source software applications that allow the creation of several types of multimedia educational activities: puzzles, association games, text activities, crosswords, wordsearch games and more. Besides, the ClicZone offers a repository where more than a thousand activities are displayed. It has been created by teachers and other professionals who want to share their work with others. This module allows teachers to add JClick activities to any course and to track pupils\' results (time spent on each of the activities, number of tries, score...).'; $string['notopenyet'] = 'Sorry, this activity is not available until {$a}'; $string['pluginadministration'] = 'JClic administration'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='תצוגת פעילות JClic   '; // Preview JClic activity $string['return_results']='Return to results'; $string['show_my_results']='תצוגת תוצאות'; // Show my results $string['solveddone'] = 'Activities solved / done'; $string['urledit'] = 'JClic activity file'; $string['urledit_help'] = 'The "jclic.zip" file where you will find the JClic activity package.'; jclicmoodle-0.2.3/lang/gl/jclic.php0000644000175000017500000001510012216575042017233 0ustar demarchidemarchi. /** * English strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Xosé Luis Barreiro Cebey (xoseluis@edu.xunta.es) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'Actividades realizadas'; $string['activitysolved'] = 'Actividades acertadas'; $string['attempts'] = 'Intentos'; $string['avaluation'] = 'Criterio de avaliación'; $string['avaluation_score'] = 'Acadar unha puntuación media entre todas as actividades'; $string['avaluation_solved'] = 'Resolver correctamente un número de actividades diferentes'; $string['description'] = 'Descrición'; $string['height']='Altura'; $string['hideall']='Amosar só os resumos'; $string['lastaccess']='último acceso'; $string['maxattempts'] = 'Número máximo de intentos'; $string['maxgrade'] = 'Puntuación/actividades a acadar'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'Xa realizaches esta actividade o número de veces máximo'; $string['score']='Puntuación'; $string['sessions']='Sesións'; $string['size']='Medidas'; $string['showall']='Amosar o detalle das sesións'; $string['starttime']= 'Data de inicio'; $string['skin'] = 'Entorno gráfico (skin)'; $string['totals']= 'Totais'; $string['totaltime']= 'Tempo total'; $string['unlimited'] = 'Ilimitado'; $string['url'] = 'Enlace'; $string['width']='Anchura'; /* Revision 20070305 */ $string['actions']='Acertos'; $string['activity']='Actividade'; $string['msg_nosessions']='Esta actividade JClic aínda non ten ningunha sesión'; $string['solved']='Correcta'; $string['time']='Tempo'; /* Revision 20071002 */ $string['header_jclic']='Axustes de JClic'; $string['header_score']='Axustes de avaliación'; /* Revision 20091026 */ $string['deleteallsessions'] = 'Borrar tódalas sesións'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Idioma'; $string['exiturl']='Enlace de saída'; /* Revision Moodle 2.X 20110725 */ $string['availabledate'] = 'Dispoñible desde'; $string['closebeforeopen'] = 'No se puido actualizar o JClic: a data de peche é anterior á de apertura.'; $string['duedate'] = 'Data de entrega'; $string['exiturl_help'] = 'Trátase da URL que se abrirá cando o alumnado remate a derradeira actividade JClic. Para que esta redirección funcione é necesario que, na pestana "Secuencias", a derradeira actividade do proxecto JClic, teña asociada, na selección "Data adiante", a acción "Saír de JClic".'; $string['expired'] = 'Sentímolo, esta actividade pechouse en {$a} e xa non está dispoñible'; $string['filetype'] = 'Tipo'; $string['filetype_help'] = 'Este parámetro determina como se inclúe no paquete JClic no curso. Hai 2 opcións: * Ficheiro JClic subido - Posibilita escoller un ficheiro ".jclic.zip" válido mediante o selector de arquivos. * URL externa - Posibilita especificar a URL dun paquete JClic. NOTA: A URL debe comezar con https(s) ou www e conter un ficheiro ".jclic.zip" válido'; $string['filetypeexternal'] = 'URL externa'; $string['filetypelocal'] = 'Ficheiro JClic subido'; $string['invalidjclicfile'] = 'Especificouse un ficheiro JClic non válido. O ficheiro debe ter a extensión ".jclic.zip".'; $string['invalidurl'] = 'Especificouse unha URL non válido. A URL debe comezar con http(s) e enlazar a un ficheiro ".jclic.zip" válido.'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='URL base dos ficheiros JAR'; $string['jclicjarbase_help']='Dirección web onde localizar tódolos ficheiros jar de JClic.'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'Este parámetro habilita unha URL para especificar o paquete JClic en lugar de seleccionalo a través do selector de arquivos.'; $string['jclicfile'] = 'Ficheiro JClic'; $string['jclicfile_help'] = 'O ficheiro ".jclic.zip" que contén o paquete JClic.'; $string['lap']='Tempo entre voltas'; $string['lap_help']='Tempo que se deixa entre as transaccións cliente-servidor (expresado en segundos)'; $string['modulename_help'] = 'JClic é un proxecto do Departament de Ensenyament da Generalitat de Cataluña que está formado por un conxunto de aplicacións de software libre que permiten crear diversos tipos de actividades educativas multimedia: quebracabezas, asociacións, exercicios de texto, encrucillados, sopas de letras y outros. Ademais, a zonaClic dispón dunha biblioteca de actividades que conta cuns 1000 proxectos que crearon mestres e persoas doutros colectivos que quixeron compartir solidariamente o seu traballo. Este módulo permite ao profesorado engadir a un curso calquera actividade de tipo JClic e recopilar os resultados obtidos (tempo empregado para cada actividade, intentos, acertos, etc.) para cada alumno/a.'; $string['notopenyet'] = 'Esta actividade non estará dispoñible ata {$a}'; $string['pluginadministration'] = 'Administración de JClic'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='Amosar a actividade JClic'; // Previsualizar la actividad JClic $string['return_results']='Volver aos resultados'; $string['show_my_results']='Amosar os resultados'; // Mostrar mis resultados $string['solveddone'] = 'Actividades acertadas / realizadas'; $string['urledit'] = 'Ficheiro JClic'; $string['urledit_help'] = 'O ficheiro "jclic.zip" que contén a actividade JClic.'; jclicmoodle-0.2.3/lang/eu/jclic.php0000644000175000017500000001405212216575042017247 0ustar demarchidemarchi. /** * Strings for component 'jclic', language 'eu', branch 'MOODLE_23_STABLE' * * @package jclic * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @author Abel Camacho (didaktika@santurtzieus.com) & Pedro Lonbide (zuzen@santurtzieus.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['actions'] = 'Ekintzak'; $string['activity'] = 'Jarduera'; $string['activitydone'] = 'Amaitutako jarduerak'; $string['activitysolved'] = 'Ondo ebatzitako jarduerak'; $string['attempts'] = 'Saiakerak'; $string['availabledate'] = 'Noiztik eskuragarri:'; $string['avaluation'] = 'Ebaluazio-irizpideak'; $string['avaluation_score'] = 'Jarduera guztien arteko batez bestekoa egin'; $string['avaluation_solved'] = 'Jarduera ezberdinen kopuru bat ongi ebatzi'; $string['closebeforeopen'] = 'Ezin izan da JClic eguneratu. Ixteko data zabaltzeko data baina lehenagokoa da.'; $string['deleteallsessions'] = 'Ezabatu saio guztiak'; $string['description'] = 'Deskribapena'; $string['duedate'] = 'Entregatze-data'; $string['exiturl'] = 'Irteera-esteka'; $string['exiturl_help'] = 'Hau da ikasleak JClic jarduera amaitzen duenean zabalduko den URLa. Berbidalketa honek funtziona dezan, "Sekuentziak" fitxako JClic proiektuko azken jarduerak, "Aurrerako gezia" atalean, lotuta izan behar du "JClic-etik irten" ekintza.'; $string['expired'] = 'Barkatu, jarduera hau {$a} datan itxi zen eta dagoeneko ez dago eskura'; $string['filetype'] = 'Mota'; $string['filetypeexternal'] = 'Kanpoko URLa'; $string['filetype_help'] = 'Ezarpen honek zehazten du nola txertatuko den ikastaroan JClic paketea. Bi aukera dago: * Igotako JClic fitxategia - Fitxategi-hautatzailearen bitartez ".jclic.zip" fitxategi baliagarria aukera daiteke * Kanpoko URLa - JClic pakete baten URLa zehazteko aukera ematen du. OHARRA: URL-ak https(s) edo www hasiera izan behar du eta ".jclic.zip" fitxategi baliagarria izan behar du barnean.'; $string['filetypelocal'] = 'Igotako JClic fitxategia'; $string['header_jclic'] = 'JClic-en ezarpenak'; $string['header_score'] = 'Ebaluazio-ezarpenak'; $string['height'] = 'Altuera'; $string['hideall'] = 'Laburpenak baino ez erakutsi'; $string['invalidjclicfile'] = 'Balio ez duen JClic fitxategia ezarri da. Fitxategiak ".jclic.zip" luzapena izan behar du.'; $string['invalidurl'] = 'Balio ez duen URLa ezarri da. URLak http(s) hasiera izan behar du eta ".jclic.zip" fitxategi baliagarri bat izan behar du.'; $string['jclic'] = 'JClic'; $string['jclicfile'] = 'JClic fitxategia'; $string['jclicfile_help'] = 'JClic paketea duen .jclic.zip fitxategia.'; $string['jclic:grade'] = 'JClic-en kalifikazioa'; $string['jclicjarbase'] = 'JAR fitxategien oinarrizko URLa'; $string['jclicjarbase_help'] = 'JClic-en JAR fitxategi guztiak izateko web-helbidea'; $string['jclic:submit'] = 'Bidali JClic'; $string['jclicurl'] = 'URLa'; $string['jclicurl_help'] = 'Ezarpen honek URL bat sortzen du JClic paketea aukeratzeko, fitxategi-hautatzailearen bidez aukeratu beharrik gabe.'; $string['jclic:view'] = 'Ikusi JClic'; $string['lang'] = 'Hizkuntza'; $string['lap'] = 'Itzulien arteko denbora-tartea'; $string['lap_help'] = 'Bezeroaren eta zerbitzariaren arteko transakzioetarako uzten den denbora (segundutan)'; $string['lastaccess'] = 'Azken sarrera'; $string['maxattempts'] = 'Gehienezko saiakera-kopurua'; $string['maxgrade'] = 'Lortu beharreko jarduera/puntuazioa'; $string['modulename'] = 'JClic'; $string['modulename_help'] = 'JClic Kataluniako Generalitateko Hezkuntza Sailaren proiektua da. Software askeko hainbat aplikatibok osatzen dute eta hainbat hezkuntza-jarduera multimedia sortzeko aukera ematen dute: puzzleak, loturak, testu-ariketak, gurutzegramak, letra-zopak eta bestelakoak. Gainera, zonaClic-ak jarduera-biltegi bat du eta bertan bere lana elkarbanatu nahi izan duten irakasle eta beste talde batzuetako hainbat lagunek sortutako 1000 proiektutik gora daude Modulu honen bitartez irakasleek JClic motako edozein jarduera gehi dezakete ikastaro batean eta baita ikasle bakoitzak lortutako emaitzak eskuratu ere (jardueran emandako denbora, saiakerak, asmatutakoak, e.a.).'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts'] = 'Jarduera hau ahal zen aldi guztietan egin duzu'; $string['msg_nosessions'] = 'Jarduera honetarako gehienezko saiakera-kopurua gainditu duzu'; $string['notopenyet'] = 'Barkatu, jarduera hau ez da {$a} datara arte eskuragarri egongo'; $string['pluginadministration'] = 'JClic-en kudeaketa'; $string['pluginname'] = 'JClic'; $string['preview_jclic'] = 'Aurreikusi JClic jarduera'; $string['return_results'] = 'Itzuli emaitzetara'; $string['score'] = 'Puntuazioa'; $string['sessions'] = 'Saioak'; $string['showall'] = 'Erakutsi saio guztietako xehetasunak'; $string['show_my_results'] = 'Erakutsi nire emaitzak'; $string['size'] = 'Tamaina'; $string['skin'] = 'Itxura'; $string['solved'] = 'Zuzena'; $string['solveddone'] = 'Zuzen egindako / burututako jarduerak'; $string['starttime'] = 'Hasiera-data'; $string['time'] = 'Denbora'; $string['totals'] = 'Guztira'; $string['totaltime'] = 'Guztirako denbora'; $string['unlimited'] = 'Mugagabea'; $string['url'] = 'URLa'; $string['urledit'] = 'JClic jardueraren fitxategia'; $string['urledit_help'] = 'JClic jarduera-paketea duen "jclic.zip" fitxategia'; $string['width'] = 'Zabalera'; jclicmoodle-0.2.3/lang/en/jclic.php0000644000175000017500000001357312216575042017247 0ustar demarchidemarchi. /** * English strings for jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $string['activitydone'] = 'Activities done'; $string['activitysolved'] = 'Activities completed successfully'; $string['attempts'] = 'Attempts'; $string['avaluation'] = 'Evaluation criteria'; $string['avaluation_score'] = 'Achieving this global score'; $string['avaluation_solved'] = 'Solving this number of different activities'; $string['description'] = 'Description'; $string['height']='Height'; $string['hideall']='Show only summaries'; $string['lastaccess']='Last visited'; $string['maxattempts'] = 'Maximum number of trials'; $string['maxgrade'] = 'Score/activities that must be achieved'; $string['modulename'] = 'JClic'; $string['modulenameplural'] = 'JClic'; $string['msg_noattempts']= 'You have tried this activity the maximum number of times'; $string['score']='Score'; $string['sessions']='Sessions'; $string['showall']='Show the details of all the sessions'; $string['size']='Size'; $string['starttime']= 'Date started'; $string['skin'] = 'Skin'; $string['totals']= 'Totals'; $string['totaltime']= 'Total time'; $string['unlimited'] = 'Unlimited'; $string['url'] = 'URL'; $string['width']='Width'; /* Revision 20070305 */ $string['actions']='Actions'; $string['activity']='Activity'; $string['msg_nosessions']='This JClic activity hasn\'t yet any session'; $string['solved']='Correct'; $string['time']='Time'; /* Revision 20071002 */ $string['header_jclic']='JClic Settings'; $string['header_score']='Avaluation Settings'; /* Revision 20091023 */ $string['deleteallsessions'] = 'Delete all sessions'; /* Revision 20110119 - version 0.1.0.11 */ $string['lang']='Language'; $string['exiturl']='Exit URL'; /* Revision Moodle 2.X */ $string['availabledate'] = 'Available from'; $string['closebeforeopen'] = 'Could not update the jclic. You have specified a due date before the available date.'; $string['duedate'] = 'Due date'; $string['exiturl_help'] = 'This is the URL that appears when students finish the last JClic activity. To make work this redirection it\'s necessary to associate to the last activity in the Sequences tab the action "Exit JClic" in the Forward arrow section.'; $string['expired'] = 'Sorry, this activity closed on {$a} and is no longer available'; $string['filetype'] = 'Type'; $string['filetype_help'] = 'This setting determines how the JClic activity is included in the course. There are up to 2 options: * Uploaded JClic - Enables a valid ".jclic.zip" package to be chosen by the file picker. * External URL - Enables a URL to be specified. Note: The URL must start with http(s) or www and contain a valid "jclic.zip" file.'; $string['filetypeexternal'] = 'External URL'; $string['filetypelocal'] = 'Uploaded JClic'; $string['invalidjclicfile'] = 'Invalid JClic specified. It must have the ".jclic.zip" extension.'; $string['invalidurl'] = 'Invalid URL specified. It must start with http(s) and has to be a valid ".jclic.zip" file.'; $string['jclic'] = 'JClic'; $string['jclicjarbase']='Jar base'; $string['jclicjarbase_help']='Web address where to locate all the JClic jar files'; $string['jclicurl'] = 'URL'; $string['jclicurl_help'] = 'This setting enables a URL for the JClic package to be specified, rather than choosing a file via the file picker.'; $string['jclicfile'] = 'JClic file'; $string['jclicfile_help'] = 'The .jclic.zip file containing the JClic files.'; $string['lap']='Lap'; $string['lap_help']='Time between client-server transactions (in seconds)'; $string['modulename_help'] = 'JClic is a project of the Catalan Ministry of Education. It consists of a set of open source software applications that allow the creation of several types of multimedia educational activities: puzzles, association games, text activities, crosswords, wordsearch games and more. Besides, the ClicZone offers a repository where more than a thousand activities are displayed. It has been created by teachers and other professionals who want to share their work with others. This module allows teachers to add JClick activities to any course and to track pupils\' results (time spent on each of the activities, number of tries, score...).'; $string['notopenyet'] = 'Sorry, this activity is not available until {$a}'; $string['pluginadministration'] = 'JClic administration'; $string['pluginname'] = 'JClic'; $string['preview_jclic']='Preview JClic activity'; $string['return_results']='Return to results'; $string['show_my_results']='Show my results'; $string['solveddone'] = 'Activities solved / done'; $string['urledit'] = 'JClic activity file'; $string['urledit_help'] = 'The "jclic.zip" file where you will find the JClic activity package.'; $string['jclic:view'] = 'View JClic'; $string['jclic:submit'] = 'Submit JClic'; $string['jclic:grade'] = 'Grade JClic'; /* Revision Moodle 2.3 */ $string['jclic:addinstance'] = 'Add JClic'; jclicmoodle-0.2.3/action/beans.php0000644000175000017500000002252012216575042017175 0ustar demarchidemarchi. /** * File called from JClic player to save students' results * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ header('Content-type: text/xml'); ///////////////////////////////////////////////////////////////////////////////// /// JClic Services to save activities /// Author: Sara Arjona Tellez (sara.arjona@gmail.com) ///////////////////////////////////////////////////////////////////////////////// if($GLOBALS["HTTP_RAW_POST_DATA"]){ $my_xml = $GLOBALS["HTTP_RAW_POST_DATA"]; } else { $my_xml = $HTTP_RAW_POST_DATA; } require_once("../../../config.php"); require_once("../lib.php"); require_once("../locallib.php"); $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes $elements=array(); $oldElements=array(); $thisElement=""; $beans=array(); $currentBean=-1; $params=array(); function startElement($parser, $name, $attribs ) { global $beans, $currentBean, $params, $thisElement, $oldElements, $elements; array_push( $oldElements, $thisElement); $thisElement=$name; if ($name=='BEAN'){ $currentBean++; $bean=array(); $bean['ID']=$attribs['ID']; $bean['PARAMS']=""; $beans[$currentBean]=$bean; $params=array(); }else if ($name=='PARAM'){ $params[$attribs['NAME']]=$attribs['VALUE']; }else if ($name=='ACTIVITY'){ $beans[$currentBean]['ACTIVITY']=array('name'=>$attribs['NAME'],'start'=>$attribs['START'],'time'=>$attribs['TIME'],'solved'=>$attribs['SOLVED'],'score'=>$attribs['SCORE'],'minActions'=>$attribs['MINACTIONS'],'actions'=>$attribs['ACTIONS']); } $elements[ $thisElement ] = $attribs; } function endElement($parser, $name) { global $beans, $currentBean, $params, $thisElement, $oldElements; $thisElement= array_pop( $oldElements); $beans[$currentBean]['PARAMS']=$params; } function characterData($parser, $text) { global $beans, $currentBean, $params, $thisElement, $elements; $elements[ $thisElement ] .= $text; } $xml_parser = xml_parser_create(''); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_parse($xml_parser, $my_xml); xml_parser_free($xml_parser); /*$jclic_log->bean=$beans[0]['ID']; $jclic_log->xml=$my_xml; $jclic_log->time=time(); insert_record("jclic_log", $jclic_log);*/ //error_log($beans[0]['ID'].': '.$my_xml); //addEntry($beans[0]['ID'], $my_xml); switch($beans[0]['ID']){ case "get_properties": echo ''; echo ''; $settings = $DB->get_records('jclic_settings'); foreach($settings as $setting){ echo ' '; } echo ''; break; case "add session": $jclic_session = new stdClass(); $jclic_session->jclicid=$beans[0]['PARAMS']['key']; $jclic_session->user_id=$beans[0]['PARAMS']['user']; $jclic_session->session_datetime = date('Y-m-d h:i:s', round($beans[0]['PARAMS']['time']/1000)); $jclic_session->session_id='X'; // @TODO: Review // $jclic_session->session_id=$beans[0]['PARAMS']['user'].'_'.$beans[0]['PARAMS']['time']; $jclic_session->project_name=$beans[0]['PARAMS']['project']; try{ // ALTER TABLE m2jclic_sessions MODIFY (SESSION_DATETIME DATE null); // $params = array('jclicid'=>$jclic_session->jclicid, 'user_id'=>$jclic_session->user_id, // 'session_datetime'=>$jclic_session->session_datetime,'session_id'=>$jclic_session->session_id, // 'project_name'=>$jclic_session->project_name); // $sql = 'INSERT INTO {jclic_sessions} (jclicid, user_id, session_datetime, session_id, project_name) // VALUES (:jclicid,:user_id,:session_datetime,:session_id,:project_name)'; // $sql = 'INSERT INTO {jclic_sessions} (jclicid, user_id, session_datetime, session_id, project_name) // VALUES ('.$jclic_session->jclicid.','.$jclic_session->user_id.',\'2008-11-03 11:49:30\',\''.$jclic_session->session_id.'\',\''.$jclic_session->project_name.'\')'; jclic_normalize_date(); $sessionid = $DB->insert_record("jclic_sessions", $jclic_session); $jclic_session->id = $sessionid; $jclic_session->session_id = $sessionid; $DB->update_record("jclic_sessions", $jclic_session); }catch (Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; print_r($e); } if (!$DB->get_record('jclic_users', array('user_id' => $beans[0]['PARAMS']['user'].'') )){ if ($user = $DB->get_record('user', array('id' => $beans[0]['PARAMS']['user'].''))){ $jclic_user = new stdClass(); $jclic_user->user_id = $beans[0]['PARAMS']['user']; $jclic_user->group_id = '1'; $jclic_user->user_name = $user->firstname.' '.$user->lastname; $DB->insert_record("jclic_users", $jclic_user); } } echo ''; echo ''; echo ' '; echo ''; break; case "multiple": $jclic_activity = null; foreach ($beans as $bean){ if ($bean['ID']=='add activity'){ $jclic_activity = new stdClass(); $jclic_activity->session_id=$bean['PARAMS']['session']; $jclic_activity->activity_id=$bean['PARAMS']['num']; $jclic_activity->activity_name=substr($bean['ACTIVITY']['name'], 0, 50); $jclic_activity->num_actions=$bean['ACTIVITY']['actions']; $jclic_activity->activity_solved=$bean['ACTIVITY']['solved']=='true'?1:0; $jclic_activity->score=$bean['ACTIVITY']['score']; $jclic_activity->grade=$jclic_activity->score; $jclic_activity->qualification=round(getPrecision($bean['ACTIVITY']['minActions'], $bean['ACTIVITY']['actions'], ''.$bean['ACTIVITY']['solved'], $bean['ACTIVITY']['score'])); $jclic_activity->total_time=$bean['ACTIVITY']['time']; $DB->insert_record("jclic_activities", $jclic_activity); } } if (isset($jclic_activity) && $jclic_session = $DB->get_record('jclic_sessions', array('session_id' => $jclic_activity->session_id))){ $jclic = $DB->get_record('jclic', array('id' => $jclic_session->jclicid) ); $cm = get_coursemodule_from_instance('jclic', $jclic->id, $jclic->course, false, MUST_EXIST); $jclic->cmidnumber = $cm->idnumber; jclic_update_grades($jclic, $jclic_session->user_id); } echo ''; echo ''; echo ' '; echo ''; break; default: echo ''; echo ''; echo ' '; echo ''; } function getPrecision($minActions, $numActions, $solved, $score){ $precision = 0; if ($minActions>0 && $numActions>0){ if ($solved=='true'){ if ($numActions<$minActions) $precision=100; else $precision=($minActions*100)/$numActions; }else{ $precision=100*($score*$score)/($minActions*$numActions); } } return $precision; } // // // ?> jclicmoodle-0.2.3/action/student_results.php0000644000175000017500000001044512216575042021357 0ustar demarchidemarchi. /** * Prints results from a specific session * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(dirname(dirname(__FILE__))).'/../config.php'); require_once(dirname(__FILE__).'/../locallib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or if ($id) { $cm = get_coursemodule_from_id('jclic', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $jclic = $DB->get_record('jclic', array('id' => $cm->instance), '*', MUST_EXIST); } else { error('You must specify a course_module ID or an instance ID'); } require_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/jclic:view', $context); $strjclics = get_string("modulenameplural", "jclic"); $strstarttime = get_string("starttime", "jclic"); $strscore = get_string("score", "jclic"); $strtotaltime = get_string("totaltime", "jclic"); $strtotals = get_string("totals", "jclic"); $strdone = get_string("activitydone", "jclic"); $stractivitysolved = get_string("activitysolved", "jclic"); $strattempts = get_string("attempts", "jclic"); $strlastaccess = get_string("lastaccess", "jclic"); $strmsgnosessions = get_string("msg_nosessions", "jclic"); $stractivity = get_string("activity", "jclic"); $strsolved = get_string("solved", "jclic"); $stractions = get_string("actions", "jclic"); $strtime = get_string("time", "jclic"); $stryes = get_string("yes"); $strno = get_string("no"); $PAGE->set_url('/mod/jclic/action/student_results.php', array('id' => $cm->id)); $PAGE->set_title(format_string($course->fullname.' - '.$jclic->name)); //$PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); echo $OUTPUT->header(); $sessions = jclic_get_sessions($jclic->id, $USER->id); if (sizeof($sessions)>0){ $PAGE->requires->js('/mod/jclic/jclic.js'); $table = new html_table(); $table->head = array($strstarttime, $strscore, $strtotaltime, get_string('solveddone', 'jclic'), $strattempts); // Print session data foreach($sessions as $session){ $starttime=''.date('d/m/Y H:i', strtotime($session->starttime)).''; $table->data[] = array($starttime, $session->score.'%', $session->totaltime, $session->solved.' / '.$session->done,$session->attempts.($jclic->maxattempts>0?'/'.$jclic->maxattempts:'')); // Print activities for each session $session_activities_html= jclic_get_session_activities_html($session->session_id); $cell = new html_table_cell(); $cell->text = $session_activities_html; $cell->colspan = 5; $row = new html_table_row(); $row->id = 'session_'.$session->session_id; $row->attributes = array('class' => 'jclic-session-activities-hidden') ; $row->cells[] = $cell; $table->data[] = $row; } if (sizeof($sessions)>1){ $sessions_summary = jclic_get_sessions_summary($jclic->id,$USER->id); $table->data[] = array(''.$strtotals.'', ''.$sessions_summary->score.'%', ''.$sessions_summary->totaltime.'',''.$sessions_summary->solved.' / '.$sessions_summary->done.'',''.$sessions_summary->attempts.''); } echo html_writer::table($table); } else{ echo '
'.$strmsgnosessions.'
'; } echo $OUTPUT->footer(); jclicmoodle-0.2.3/action/test_beans.php0000644000175000017500000000502312216575042020233 0ustar demarchidemarchi Ajax + XML
  • Service:
  • Bean:
  • Request:
  • Execute
  • Response:
jclicmoodle-0.2.3/db/install.xml0000644000175000017500000002307412216575042016701 0ustar demarchidemarchi
jclicmoodle-0.2.3/db/upgrade.php0000644000175000017500000001370412216575042016650 0ustar demarchidemarchi. /** * This file keeps track of upgrades to the jclic module * * Sometimes, changes between versions involve alterations to database * structures and other major things that may break installations. The upgrade * function in this file will attempt to perform all the necessary actions to * upgrade your older installation to the current version. If there's something * it cannot do itself, it will tell you what you need to do. The commands in * here will all be database-neutral, using the functions defined in DLL libraries. * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Execute jclic upgrade from the given old version * * @param int $oldversion * @return bool */ function xmldb_jclic_upgrade($oldversion) { global $CFG, $DB; $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes if ($oldversion < 2011011900) { $table = new xmldb_table('jclic'); /// Define lang field format to be added to jclic $field = new xmldb_field('lang'); $field->set_attributes(XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, 'ca', 'url'); $result = $result && $dbman->add_field($table, $field); /// Define exiturl field format to be added to jclic $field = new xmldb_field('exiturl'); $field->set_attributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'url'); $result = $result && $dbman->add_field($table, $field); } if ($oldversion < 2011122902) { /// Define field introformat to be added to jclic $table = new xmldb_table('jclic'); $field = new xmldb_field('description', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'name'); if ($dbman->field_exists($table, $field)) { $dbman->rename_field($table, $field, 'intro'); } $field = new xmldb_field('introformat'); $field->set_attributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro'); /// Launch add field introformat if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } // conditionally migrate to html format in intro if ($CFG->texteditors !== 'textarea') { $rs = $DB->get_recordset('jclic', array('introformat'=>FORMAT_MOODLE), '', 'id,intro,introformat'); foreach ($rs as $f) { $f->intro = text_to_html($f->intro, false, false, true); $f->introformat = FORMAT_HTML; $DB->update_record('jclic', $f); upgrade_set_timeout(); } $rs->close(); } /// jclic savepoint reached upgrade_mod_savepoint(true, 2011122902, 'jclic'); } //===== 1.9.0 upgrade line ======// if ($oldversion < 2012042700) { require_once("$CFG->dirroot/mod/jclic/db/upgradelib.php"); // Add upgrading code from 1.9 (+ new file storage system) // @TODO: test it!!!! jclic_migrate_files(); // Add fields grade, timeavailable and timedue on table jclic $table = new xmldb_table('jclic'); $field = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'maxgrade'); $dbman->add_field($table, $field); // Update jclic.grade with the jclic.max_grade value if ($jclics = $DB->get_records('jclic')){ foreach($jclics as $jclic){ if (empty($jclic->maxgrade)) $jclic->maxgrade = 10; $jclic->grade= $jclic->maxgrade; $DB->update_record("jclic", $jclic); } } $field = new xmldb_field('timeavailable', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'exiturl'); $dbman->add_field($table, $field); $field = new xmldb_field('timedue', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0', 'timeavailable'); $dbman->add_field($table, $field); // jclic savepoint reached upgrade_mod_savepoint(true, 2012042700, 'jclic'); } if ($oldversion < 2012050703) { // Remove unique restriction for jclic_sessions.session_id field $table = new xmldb_table('jclic_sessions'); $key = new xmldb_index('session_id', XMLDB_INDEX_UNIQUE, array('session_id')); $dbman->drop_index($table, $key); // Copy jclic_sessions.id to jclic_sessions.session_id and update jclic_activities.session_id if ($sessions = $DB->get_records('jclic_sessions')){ foreach($sessions as $session){ $sql = 'UPDATE {jclic_activities} SET session_id=? WHERE session_id=? '; $params = array($session->id, $session->session_id); $DB->execute($sql, $params); $session->session_id = $session->id; $DB->update_record("jclic_sessions", $session); } } // jclic savepoint reached upgrade_mod_savepoint(true, 2012050703, 'jclic'); } // Final return of upgrade result (true, all went good) to Moodle. return true; } jclicmoodle-0.2.3/db/upgradelib.php0000644000175000017500000000607312216575042017340 0ustar demarchidemarchi. /** * Resource module upgrade related helper functions * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot . '/mod/jclic/locallib.php'); /** * Migrate jclic package to new area if found * * @return */ function jclic_migrate_files() { global $CFG, $DB; $fs = get_file_storage(); $sqlfrom = "FROM {jclic} j JOIN {modules} m ON m.name = 'jclic' JOIN {course_modules} cm ON (cm.module = m.id AND cm.instance = j.id)"; $count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom"); $rs = $DB->get_recordset_sql("SELECT j.id, j.url, j.course, cm.id AS cmid $sqlfrom ORDER BY j.course, j.id"); if ($rs->valid()) { $pbar = new progress_bar('migratejclicfiles', 500, true); $i = 0; foreach ($rs as $jclic) { $i++; upgrade_set_timeout(180); // set up timeout, may also abort execution $pbar->update($i, $count, "Migrating jclic files - $i/$count."); $context = get_context_instance(CONTEXT_MODULE, $jclic->cmid); $coursecontext = get_context_instance(CONTEXT_COURSE, $jclic->course); if (!jclic_is_valid_external_url($jclic->url)) { // first copy local files if found - do not delete in case they are shared ;-) $jclicfile = clean_param($jclic->url, PARAM_PATH); $pathnamehash = sha1("/$coursecontext->id/course/legacy/0/$jclicfile"); if ($file = $fs->get_file_by_hash($pathnamehash)) { $file_record = array('contextid'=>$context->id, 'component'=>'mod_jclic', 'filearea'=>'content', 'itemid'=>0, 'filepath'=>'/'); try { $fs->create_file_from_storedfile($file_record, $file); } catch (Exception $x) { // ignore any errors, we can not do much anyway } $jclic->url = $pathnamehash; } else { $jclic->url = ''; } $DB->update_record('jclic', $jclic); } } } $rs->close(); }jclicmoodle-0.2.3/db/access.php0000644000175000017500000000612612216575042016462 0ustar demarchidemarchi. /** * Capability definitions for the jclic module * * The capabilities are loaded into the database table when the module is * installed or updated. Whenever the capability definitions are updated, * the module version number should be bumped up. * * The system has four possible values for a capability: * CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set). * * It is important that capability names are unique. The naming convention * for capabilities that are specific to modules and blocks is as follows: * [mod/block]/: * * component_name should be the same as the directory name of the mod or block. * * Core moodle capabilities are defined thus: * moodle/: * * Examples: mod/forum:viewpost * block/recent_activity:view * moodle/site:deleteuser * * The variable name for the capability definitions array is $capabilities * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'mod/jclic:view' => array( 'captype' => 'read', 'contextlevel' => CONTEXT_MODULE, 'legacy' => array( 'guest' => CAP_ALLOW, 'student' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ) ), 'mod/jclic:submit' => array( 'riskbitmask' => RISK_SPAM, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'legacy' => array( 'student' => CAP_ALLOW ) ), 'mod/jclic:grade' => array( 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ) ), 'mod/jclic:addinstance' => array( 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/course:manageactivities' ), ); jclicmoodle-0.2.3/db/log.php0000644000175000017500000000273012216575042015777 0ustar demarchidemarchi. /** * Definition of log events * * NOTE: this is an example how to insert log event during installation/update. * It is not really essential to know about it, but these logs were created as example * in the previous 1.9 jclic. * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $DB; $logs = array( array('module'=>'jclic', 'action'=>'add', 'mtable'=>'jclic', 'field'=>'name'), array('module'=>'jclic', 'action'=>'view', 'mtable'=>'jclic', 'field'=>'name'), array('module'=>'jclic', 'action'=>'update', 'mtable'=>'jclic', 'field'=>'name'), ); jclicmoodle-0.2.3/db/uninstall.php0000644000175000017500000000205612216575042017230 0ustar demarchidemarchi. /** * @see uninstall_plugin() * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Custom uninstallation procedure */ function xmldb_jclic_uninstall() { return true; } jclicmoodle-0.2.3/db/install.php0000644000175000017500000000604712216575042016671 0ustar demarchidemarchi. /** * This file replaces the legacy STATEMENTS section in db/install.xml, * lib.php/modulename_install() post installation hook and partially defaults.php * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Post installation procedure * * @see upgrade_plugins_modules() */ function xmldb_jclic_install() { global $DB; $records = array( array_combine(array('setting_key', 'setting_value'), array('ALLOW_CREATE_GROUPS', 'false')), array_combine(array('setting_key', 'setting_value'), array('ALLOW_CREATE_USERS', 'false')), array_combine(array('setting_key', 'setting_value'), array('SHOW_GROUP_LIST', 'false')), array_combine(array('setting_key', 'setting_value'), array('SHOW_USER_LIST', 'false')), array_combine(array('setting_key', 'setting_value'), array('USER_TABLES', 'true')), array_combine(array('setting_key', 'setting_value'), array('TIME_LAP', '10')) ); foreach ($records as $record) { $DB->insert_record('jclic_settings', $record, false); } /* $record = new stdClass(); $record->setting_key = 'ALLOW_CREATE_GROUPS'; $record->setting_value = 'false'; $DB->insert_record('jclic_settings', $record); $record = new stdClass(); $record->setting_key = 'ALLOW_CREATE_USERS'; $record->setting_value = 'false'; $DB->insert_record('jclic_settings', $record); $record = new stdClass(); $record->setting_key = 'SHOW_GROUP_LIST'; $record->setting_value = 'false'; $DB->insert_record('jclic_settings', $record); $record = new stdClass(); $record->setting_key = 'SHOW_USER_LIST'; $record->setting_value = 'false'; $DB->insert_record('jclic_settings', $record); $record = new stdClass(); $record->setting_key = 'USER_TABLES'; $record->setting_value = 'true'; $DB->insert_record('jclic_settings', $record); $record = new stdClass(); $record->setting_key = 'TIME_LAP'; $record->setting_value = '10'; $DB->insert_record('jclic_settings', $record); */ } /** * Post installation recovery procedure * * @see upgrade_plugins_modules() */ function xmldb_jclic_install_recovery() { } jclicmoodle-0.2.3/mod_form.php0000644000175000017500000002137612216575042016442 0ustar demarchidemarchi. /** * The main jclic configuration form * * It uses the standard core Moodle formslib. For more info about them, please * visit: http://docs.moodle.org/en/Development:lib/formslib.php * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot.'/course/moodleform_mod.php'); require_once('locallib.php'); /** * Module instance settings form */ class mod_jclic_mod_form extends moodleform_mod { /** * Defines forms elements */ public function definition() { global $CFG; $mform = $this->_form; //------------------------------------------------------------------------------- // Adding the "general" fieldset, where all the common settings are showed $mform->addElement('header', 'general', get_string('general', 'form')); // Adding the standard "name" field $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEAN); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); //$mform->addHelpButton('name', 'name', 'jclic'); // Adding the standard "intro" and "introformat" fields $this->add_intro_editor(); $mform->addElement('date_time_selector', 'timeavailable', get_string('availabledate', 'jclic'), array('optional'=>true)); $mform->addElement('date_time_selector', 'timedue', get_string('duedate', 'jclic'), array('optional'=>true)); //------------------------------------------------------------------------------- // Adding the rest of jclic settings, spreeading all them into this fieldset $mform->addElement('header', 'header_jclic', get_string('header_jclic', 'jclic')); $mform->addElement('select', 'filetype', get_string('filetype', 'jclic'), jclic_get_file_types()); $mform->addHelpButton('filetype', 'filetype', 'jclic'); $mform->addElement('text', 'jclicurl', get_string('jclicurl', 'jclic'), array('size'=>60)); $mform->setType('jclicurl', PARAM_RAW); $mform->addHelpButton('jclicurl', 'jclicurl', 'jclic'); $mform->disabledIf('jclicurl', 'filetype', 'eq', JCLIC_FILE_TYPE_LOCAL); $mform->addElement('filemanager', 'jclicfile', get_string('jclicfile', 'jclic'), array('optional'=>false), jclic_get_filemanager_options()); $mform->addHelpButton('jclicfile', 'urledit', 'jclic'); $mform->disabledIf('jclicfile', 'filetype', 'noteq', JCLIC_FILE_TYPE_LOCAL); $mform->addElement('text', 'exiturl', get_string('exiturl', 'jclic'), array('size'=>75)); $mform->addHelpButton('exiturl', 'exiturl', 'jclic'); //$mform->setHelpButton('exiturl', array('exiturl',get_string('exiturl', 'jclic'), 'jclic'), false, 'helpbutton'); $mform->setDefault('exiturl', ''); $mform->setType('exiturl', PARAM_RAW); $options = jclic_get_languages(); $mform->addElement('select', 'lang', get_string('lang', 'jclic'), $options); $mform->setDefault('lang', substr($CFG->lang, 0, -5)); $options = jclic_get_skins(); $mform->addElement('select', 'skin', get_string('skin', 'jclic'), $options); $mform->addElement('text', 'width', get_string('width', 'jclic'), array('size'=>'5')); $mform->setDefault('width', '800'); $mform->addElement('text', 'height', get_string('height', 'jclic'), array('size'=>'5')); $mform->setDefault('height', '600'); //------------------------------------------------------------------------------- $mform->addElement('header', 'header_score', get_string('header_score', 'jclic')); /*$mform->addElement('modgrade', 'maxxgrade', get_string('grade')); $mform->setDefault('grade', 100); $mform->addElement('date_time_selector', 'timeavailable', get_string('availabledate', 'jclic'), array('optional'=>true)); $mform->setDefault('timeavailable', time()); $mform->addElement('date_time_selector', 'timedue', get_string('duedate', 'jclic'), array('optional'=>true)); $mform->setDefault('timedue', time()+7*24*3600);*/ $options = array(-1 => get_string('unlimited','jclic'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10); $mform->addElement('select', 'maxattempts', get_string('maxattempts', 'jclic'), $options); $mform->setDefault('maxattempts', '-1'); $options = array('score' => get_string('avaluation_score','jclic'),'solved' => get_string('avaluation_solved','jclic')); $mform->addElement('select', 'avaluation', get_string('avaluation', 'jclic'), $options); $mform->setDefault('avaluation', '-1'); //------------------------------------------------------------------------------- $this->standard_grading_coursemodule_elements(); // add standard elements, common to all modules $this->standard_coursemodule_elements(); //------------------------------------------------------------------------------- // add standard buttons, common to all modules $this->add_action_buttons(); } function data_preprocessing(&$default_values) { if ($this->current->instance) { $draftitemid = file_get_submitted_draft_itemid('jclicfile'); file_prepare_draft_area($draftitemid, $this->context->id, 'mod_jclic', 'content', 0, jclic_get_filemanager_options()); $default_values['jclicfile'] = $draftitemid; } } public function validation($data, $files) { global $USER; $errors = parent::validation($data, $files); // Check open and close times are consistent. if ($data['timeavailable'] != 0 && $data['timedue'] != 0 && $data['timedue'] < $data['timeavailable']) { $errors['timedue'] = get_string('closebeforeopen', 'jclic'); } $type = $data['filetype']; if ($type === JCLIC_FILE_TYPE_LOCAL) { $usercontext = get_context_instance(CONTEXT_USER, $USER->id); $fs = get_file_storage(); if (!$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data['jclicfile'], 'sortorder, id', false)) { $errors['jclicfile'] = get_string('required'); } else{ $file = reset($files); $filename = $file->get_filename(); if (!jclic_is_valid_file($filename)){ $errors['jclicfile'] = get_string('invalidjclicfile', 'jclic'); } } } else if ($type === JCLIC_FILE_TYPE_EXTERNAL) { $reference = $data['jclicurl']; if (!jclic_is_valid_external_url($reference)) { $errors['jclicurl'] = get_string('invalidurl', 'jclic'); } } return $errors; } // Need to translate the "url" field function set_data($default_values) { $default_values = (array)$default_values; if (isset($default_values['url'])) { if (jclic_is_valid_external_url($default_values['url'])) { $default_values['filetype'] = JCLIC_FILE_TYPE_EXTERNAL; $default_values['jclicurl'] = $default_values['url']; } else{ $default_values['filetype'] = JCLIC_FILE_TYPE_LOCAL; $default_values['jclicfile'] = $default_values['url']; } } unset($default_values['url']); $this->data_preprocessing($default_values); parent::set_data($default_values); } function completion_rule_enabled($data) { return !empty($data['completionsubmit']); } } jclicmoodle-0.2.3/styles.css0000644000175000017500000000141412216575042016153 0ustar demarchidemarchi.jclic-activity-solved td {background-color:#DFFFDF!important;} .jclic-activity-unsolved td {background-color:#FFDFDF!important;} .jclic-activities-table{margin:20px!important; width:95%;} #page-mod-jclic-action-student_results #region-main-box{left:0px!important;} #dates .title-time{width:150px;float:left;clear:both;} #dates .data-time{float:left;} #dates.generalbox{height:30px;} .jclicdates{margin: 10px;} #jclic-summary-all-link {float:left; margin-top:20px;} #jclic-preview-link {float:right; margin-top:20px;} .summary-row{font-weight: bold;} .jclic-session-activities-visible{visibility: visible; ;} .jclic-session-activities-hidden{visibility: hidden; display: none;} .firstinitial{clear:both; margin-top:30px;} .initialbar {text-align: center;}jclicmoodle-0.2.3/view.php0000644000175000017500000000640112216575042015602 0ustar demarchidemarchi. /** * Prints a particular instance of jclic * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or $n = optional_param('n', 0, PARAM_INT); // jclic instance ID - it should be named as the first character of the module if ($id) { $cm = get_coursemodule_from_id('jclic', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $jclic = $DB->get_record('jclic', array('id' => $cm->instance), '*', MUST_EXIST); } elseif ($n) { $jclic = $DB->get_record('jclic', array('id' => $n), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $jclic->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('jclic', $jclic->id, $course->id, false, MUST_EXIST); } else { error('You must specify a course_module ID or an instance ID'); } require_login($course, true, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/jclic:view', $context); add_to_log($course->id, 'jclic', 'view', "view.php?id={$cm->id}", $jclic->name, $cm->id); /// Print the page header $PAGE->set_url('/mod/jclic/view.php', array('id' => $cm->id)); $PAGE->set_title(format_string($jclic->name)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_context($context); // Mark viewed if required $completion = new completion_info($course); $completion->set_module_viewed($cm); // other things you may want to set - remove if not needed //$PAGE->set_cacheable(false); //$PAGE->set_focuscontrol('some-html-id'); //$PAGE->add_body_class('jclic-'.$somevar); jclic_view_header($jclic, $cm, $course); jclic_view_intro($jclic, $cm); $action = optional_param('action', '', PARAM_TEXT); if (has_capability('mod/jclic:grade', $context, $USER->id, false)){ if ($action == 'preview'){ jclic_view_applet($jclic, $context, true); } else{ jclic_view_dates($jclic, $cm); jclic_print_results_table($jclic, $context, $cm, $course, $action); } } else{ jclic_view_applet($jclic, $context); } jclic_view_footer(); jclicmoodle-0.2.3/locallib.php0000644000175000017500000007543112216575042016422 0ustar demarchidemarchi. /** * Internal library of functions for module jclic * * All the jclic specific functions, needed to implement the module * logic, should go here. Never include this file from your lib.php! * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once("$CFG->libdir/filelib.php"); /** * Get an array with the languages * * @return array The array with each language. */ function jclic_get_languages(){ $tmplanglist = get_string_manager()->get_list_of_translations(); $langlist = array(); foreach ($tmplanglist as $lang=>$langname) { if (substr($lang, -5) == '_utf8') { //Remove the _utf8 suffix from the lang to show $lang = substr($lang, 0, -5); } $langlist[$lang]=$langname; } return $langlist; } /** * Get an array with the skins * * @return array The array with each skin. */ function jclic_get_skins(){ return array('@default.xml' => 'default','@blue.xml' => 'blue','@orange.xml' => 'orange','@green.xml' => 'green','@simple.xml' => 'simple', '@mini.xml' => 'mini'); } /** * Get an array with the file types * * @return array The array with each file type */ function jclic_get_file_types(){ $filetypes = array(JCLIC_FILE_TYPE_LOCAL => get_string('filetypelocal', 'jclic')); $filetypes[JCLIC_FILE_TYPE_EXTERNAL] = get_string('filetypeexternal', 'jclic'); return $filetypes; } /** * Display the header and top of a page * * This is used by the view() method to print the header of view.php but * it can be used on other pages in which case the string to denote the * page in the navigation trail should be passed as an argument * * @global object * @param string $subpage Description of subpage to be used in navigation trail */ function jclic_view_header($jclic, $cm, $course, $subpage='') { global $CFG, $PAGE, $OUTPUT; if ($subpage) { $PAGE->navbar->add($subpage); } //$PAGE->set_title($jclic->name); //$PAGE->set_heading($course->fullname); echo $OUTPUT->header(); groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/jclic/view.php?id=' . $cm->id); echo ''; echo '
'; } /** * Display the jclic intro * */ function jclic_view_intro($jclic, $cm) { global $OUTPUT; echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro'); echo format_module_intro('jclic', $jclic, $cm->id); echo $OUTPUT->box_end(); } /** * Display the jclic dates * * Prints the jclic start and end dates in a box. */ function jclic_view_dates($jclic, $cm, $timenow=null) { global $OUTPUT; if (!$jclic->timeavailable && !$jclic->timedue) { return; } if (is_null($timenow)) $timenow = time(); echo $OUTPUT->box_start('generalbox boxaligncenter jclicdates', 'dates'); if ($jclic->timeavailable) { echo '
'.get_string('availabledate','assignment').':
'; echo '
'.userdate($jclic->timeavailable).'
'; } if ($jclic->timedue) { echo '
'.get_string('duedate','assignment').':
'; echo '
'.userdate($jclic->timedue).'
'; } echo $OUTPUT->box_end(); } /** * Display the jclic applet * */ function jclic_view_applet($jclic, $context, $ispreview=false, $timenow=null) { global $OUTPUT, $PAGE, $CFG, $USER; if (is_null($timenow)) $timenow = time(); $isopen = (empty($jclic->timeavailable) || $jclic->timeavailable < $timenow); $isclosed = (!empty($jclic->timedue) && $jclic->timedue < $timenow); $sessions = jclic_get_sessions($jclic->id,$USER->id); $attempts=sizeof($sessions); if ($ispreview) { $url = new moodle_url('/mod/jclic/view.php', array('id' => $context->instanceid)); echo '
'.get_string('return_results', 'jclic').''; } else if ( $attempts > 0 || $isopen ) { echo '
'.get_string('show_my_results', 'jclic').''; } if (!$ispreview && !$isopen){ echo $OUTPUT->box(get_string('notopenyet', 'jclic', userdate($jclic->timeavailable)), 'generalbox boxaligncenter jclicdates'); } else if (!$ispreview && $isclosed ) { echo $OUTPUT->box(get_string('expired', 'jclic', userdate($jclic->timedue)), 'generalbox boxaligncenter jclicdates'); } else { if ($jclic->maxattempts<0 || $attempts < $jclic->maxattempts){ echo '
'; echo '
'; $PAGE->requires->js('/mod/jclic/jclicplugin.js'); $PAGE->requires->js('/mod/jclic/jclic.js'); $params = get_object_vars($jclic); $params['jclic_url'] = jclic_get_url($jclic, $context); $params['jclic_path'] = jclic_get_server(); $params['jclic_service'] = jclic_get_path().'/mod/jclic/action/beans.php'; $params['jclic_user'] = $USER->id; $params['jclic_jarbase'] = $CFG->jclic_jarbase; $params['jclic_lap'] = $CFG->jclic_lap; $params['jclic_protocol'] = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; $PAGE->requires->js_init_call('M.mod_jclic.init', array($params)); }else{ echo $OUTPUT->box(get_string('msg_noattempts', 'jclic'), 'generalbox boxaligncenter'); } jclic_view_dates($jclic, $context, $timenow); } } function jclic_get_url($jclic, $context){ global $CFG; $url = ''; if (jclic_is_valid_external_url($jclic->url)) { $url = $jclic->url; } else { $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'mod_jclic', 'content', 0, 'sortorder DESC, id ASC', false); if (count($files) < 1) { //resource_print_filenotfound($resource, $cm, $course); die; } else { $file = reset($files); unset($files); } $path = '/'.$context->id.'/mod_jclic/content/0'.$file->get_filepath().$file->get_filename(); $url = file_encode_url($CFG->wwwroot.'/pluginfile.php', $path, false); } return $url; } /** * Display the bottom and footer of a page * * This default method just prints the footer. * This will be suitable for most assignment types */ function jclic_view_footer() { global $OUTPUT; echo $OUTPUT->footer(); } /** * Returns a link with info about the state of the jclic attempts * * This is used by view_header to put this link at the top right of the page. * For teachers it gives the number of attempted jclics with a link * For students it gives the time of their last attempt. * * @global object * @global object * @param bool $allgroup print all groups info if user can access all groups, suitable for index.php * @return string */ function jclic_submittedlink($allgroups=false) { global $USER; global $CFG; $submitted = ''; $urlbase = "{$CFG->wwwroot}/mod/jclic/"; /* $context = get_context_instance(CONTEXT_MODULE,$this->cm->id); if (has_capability('mod/jclic:grade', $context)) { if ($allgroups and has_capability('moodle/site:accessallgroups', $context)) { $group = 0; } else { $group = groups_get_activity_group($this->cm); } $submitted = 'teacher'; } else { if (isloggedin()) { $submitted = 'student'; } } */ return $submitted; } /** * Get moodle server * * @return string myserver.com:port */ function jclic_get_server() { global $CFG; if (!empty($CFG->wwwroot)) { $url = parse_url($CFG->wwwroot); } if (!empty($url['host'])) { $hostname = $url['host']; } else if (!empty($_SERVER['SERVER_NAME'])) { $hostname = $_SERVER['SERVER_NAME']; } else if (!empty($_ENV['SERVER_NAME'])) { $hostname = $_ENV['SERVER_NAME']; } else if (!empty($_SERVER['HTTP_HOST'])) { $hostname = $_SERVER['HTTP_HOST']; } else if (!empty($_ENV['HTTP_HOST'])) { $hostname = $_ENV['HTTP_HOST']; } else { notify('Warning: could not find the name of this server!'); return false; } if (!empty($url['port'])) { $hostname .= ':'.$url['port']; } else if (!empty($_SERVER['SERVER_PORT'])) { if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { $hostname .= ':'.$_SERVER['SERVER_PORT']; } } return $hostname; } /** * Get moodle path * * @return string /path_to_moodle */ function jclic_get_path() { global $CFG; $path = '/'; if (!empty($CFG->wwwroot)) { $url = parse_url($CFG->wwwroot); if (array_key_exists('path', $url)){ $path = $url['path']; } } return $path; } function jclic_get_filemanager_options(){ $filemanager_options = array(); $filemanager_options['return_types'] = 3; // 3 == FILE_EXTERNAL & FILE_INTERNAL. These two constant names are defined in repository/lib.php $filemanager_options['accepted_types'] = 'archive'; $filemanager_options['maxbytes'] = 0; $filemanager_options['subdirs'] = 0; $filemanager_options['maxfiles'] = 1; return $filemanager_options; } function jclic_set_mainfile($data) { $filename = null; $fs = get_file_storage(); $cmid = $data->coursemodule; $draftitemid = $data->url; $context = get_context_instance(CONTEXT_MODULE, $cmid); if ($draftitemid) { file_save_draft_area_files($draftitemid, $context->id, 'mod_jclic', 'content', 0, jclic_get_filemanager_options()); } $files = $fs->get_area_files($context->id, 'mod_jclic', 'content', 0, 'sortorder', false); if (count($files) == 1) { // only one file attached, set it as main file automatically $file = reset($files); file_set_sortorder($context->id, 'mod_jclic', 'content', 0, $file->get_filepath(), $file->get_filename(), 1); $filename = $file->get_filename(); } return $filename; } function jclic_is_valid_external_url($url){ return preg_match('/(http:\/\/|https:\/\/|www).*\/*.jclic.zip(\?[a-z+&\$_.-][a-z0-9;:@&%=+\/\$_.-]*)?$/i', $url); } function jclic_is_valid_file($filename){ return preg_match('/.jclic.zip$/i', $filename); } //////////////////////////////////////////////////////////////////////////////// // Activity sessions // //////////////////////////////////////////////////////////////////////////////// /** * Get user sessions * * @return array [0=>session1,1=>session2...] where session1 is an array with keys: id,score,totaltime,starttime,done,solved,attempts. First sessions are newest. * @param object $jclicid The jclic to get sessions * @param object $userid The user id to get sessions */ function jclic_get_sessions($jclicid, $userid) { global $CFG, $DB; $sessions=array(); jclic_normalize_date(); $sql = "SELECT js.* FROM {jclic} j, {jclic_sessions} js WHERE j.id=js.jclicid AND js.jclicid=? AND js.user_id=? ORDER BY js.session_datetime"; $params = array($jclicid, $userid); if($rs = $DB->get_records_sql($sql, $params)){ $i = 0; foreach($rs as $session){ $activity = jclic_get_activity($session); $activity->attempts=$i+1; $sessions[$i++]=$activity; } } return $sessions; } /** * Get session activities * * @return array [0=>act0,1=>act1...] where act0 is an array with keys: activity_id,activity_name,num_actions,score,activity_solved,qualification, total_time. First activity are oldest. * @param string $session_id The session id to get actitivies */ function jclic_get_activities($session_id) { global $CFG, $DB; $activities = array(); if($rs = $DB->get_records('jclic_activities', array('session_id'=>$session_id), 'activity_id')){ $i=0; foreach($rs as $activity){ $activities[$i++]=$activity; } } return $activities; } /** * Get information about activities of specified session * * @return array Array has these keys id,score,totaltime,starttime,done,solved,attempts * @param object $session The session object */ function jclic_get_activity($session) { global $CFG, $DB; $activity = new stdClass(); $activity->starttime=$session->session_datetime; $activity->session_id=$session->session_id; if($rs = $DB->get_record_sql("SELECT AVG(ja.qualification) as qualification, SUM(ja.total_time) as totaltime FROM {jclic_activities} ja WHERE ja.session_id='$session->session_id'")){ $activity->score = round($rs->qualification,0); $activity->totaltime = jclic_format_time($rs->totaltime); } if ($rs = $DB->get_record_sql("SELECT COUNT(*) as done FROM (SELECT DISTINCT ja.activity_name FROM {jclic_activities} ja WHERE ja.session_id='$session->session_id') t")){ $activity->done=$rs->done; } if ($rs = $DB->get_record_sql("SELECT COUNT(*) as solved FROM (SELECT DISTINCT ja.activity_name FROM {jclic_activities} ja WHERE ja.session_id='$session->session_id' AND ja.activity_solved=1) t")){ $activity->solved=$rs->solved; } return $activity; } /** * Print a table data with all session activities * * @param string $session_id The session identifier */ function jclic_get_session_activities_html($session_id){ $table_html=''; // Import language strings $stractivity = get_string("activity", "jclic"); $strsolved = get_string("solved", "jclic"); $stractions = get_string("actions", "jclic"); $strtime = get_string("time", "jclic"); $strscore = get_string("score", "jclic"); $stryes = get_string("yes"); $strno = get_string("no"); // Print activities for each session $activities = jclic_get_activities($session_id); if (sizeof($activities)>0){ $table = new html_table(); $table->attributes = array('class'=>'jclic-activities-table'); $table->head = array($stractivity, $strsolved, $stractions, $strtime, $strscore); foreach($activities as $activity){ $act_percent=$activity->num_actions>0?round(($activity->score/$activity->num_actions)*100,0):0; $row = new html_table_row(); $row->attributes = array('class' => ($activity->activity_solved?'jclic-activity-solved':'jclic-activity-unsolved') ) ; $row->cells = array($activity->activity_name, ($activity->activity_solved?$stryes:$strno), $activity->score.'/'.$activity->num_actions.' ('.$act_percent.'%)', jclic_time2str($activity->total_time), $activity->qualification.'%'); $table->data[] = $row; } $table_html = html_writer::table($table); } return $table_html; } /** * Convert specified time (in milliseconds) to XX' YY'' format * * @param type $time time (in milliseconds) to format */ function jclic_format_time($time){ return floor($time/60000)."' ".round(fmod($time,60000)/1000,0)."''"; } /** * Get user activity summary * * @return object session object with score, totaltime, activities done and solved and attempts information */ function jclic_get_sessions_summary($jclicid, $userid) { global $CFG, $DB; jclic_normalize_date(); $sessions_summary = new stdClass(); $sessions_summary->attempts = ''; $sessions_summary->score = ''; $sessions_summary->totaltime = ''; $sessions_summary->starttime = ''; $sessions_summary->done = ''; $sessions_summary->solved = ''; if ($rs = $DB->get_record_sql("SELECT COUNT(*) AS attempts, AVG(t.qualification) AS qualification, SUM(t.totaltime) AS totaltime, MAX(t.starttime) AS starttime FROM (SELECT AVG(ja.qualification) AS qualification, SUM(ja.total_time) AS totaltime, MAX(js.session_datetime) AS starttime FROM {jclic} j, {jclic_sessions} js, {jclic_activities} ja WHERE j.id=js.jclicid AND js.user_id='$userid' AND js.jclicid=$jclicid AND ja.session_id=js.session_id GROUP BY js.session_id) t")){ $sessions_summary->attempts=$rs->attempts; $sessions_summary->score=round($rs->qualification,0); $sessions_summary->totaltime= jclic_format_time($rs->totaltime); $sessions_summary->starttime=$rs->starttime; } if ($rs = $DB->get_record_sql("SELECT COUNT(*) as done FROM (SELECT DISTINCT ja.activity_name FROM {jclic} j, {jclic_sessions} js, {jclic_activities} ja WHERE j.id=js.jclicid AND js.user_id='$userid' AND js.jclicid=$jclicid AND js.session_id=ja.session_id) t")){ $sessions_summary->done=$rs->done; } if ($rs = $DB->get_record_sql("SELECT COUNT(*) as solved FROM (SELECT DISTINCT ja.activity_name FROM {jclic} j, {jclic_sessions} js, {jclic_activities} ja WHERE j.id=js.jclicid AND js.user_id='$userid' AND js.jclicid=$jclicid AND js.session_id=ja.session_id AND ja.activity_solved=1) t")){ $sessions_summary->solved=$rs->solved; } return $sessions_summary; } /** * Format time from milliseconds to string * * @return string Formated string [x' y''], where x are the minutes and y are the seconds. * @param int $time The time (in ms) */ function jclic_time2str($time){ return round($time/60000,0)."' ".round(fmod($time,60000)/1000,0)."''"; } function jclic_print_results_table($jclic, $context, $cm, $course, $action){ global $CFG, $DB, $OUTPUT, $PAGE; $PAGE->requires->js('/mod/jclic/jclic.js'); // View all/summary sessions link if (isset($action) && $action != 'showall'){ $url = new moodle_url('/mod/jclic/view.php', array('id' => $context->instanceid, 'action' => 'showall')); $text = get_string('showall', 'jclic'); } else{ $url = new moodle_url('/mod/jclic/view.php', array('id' => $context->instanceid)); $text = get_string('hideall', 'jclic'); } echo ''; // Preview link to JClic activity $url = new moodle_url('/mod/jclic/view.php', array('id' => $context->instanceid, 'action' => 'preview')); echo ''; // Show students list with their results require_once($CFG->libdir.'/gradelib.php'); $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = ($perpage <= 0) ? 10 : $perpage ; $page = optional_param('page', 0, PARAM_INT); /// find out current groups mode $groupmode = groups_get_activity_groupmode($cm); $currentgroup = groups_get_activity_group($cm, true); /// Get all ppl that are allowed to submit jclic list($esql, $params) = get_enrolled_sql($context, 'mod/jclic:submit', $currentgroup); $sql = "SELECT u.id FROM {user} u ". "LEFT JOIN ($esql) eu ON eu.id=u.id ". "WHERE u.deleted = 0 AND eu.id=u.id "; $users = $DB->get_records_sql($sql, $params); if (!empty($users)) { $users = array_keys($users); } // if groupmembersonly used, remove users who are not in any group if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) { if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) { $users = array_intersect($users, array_keys($groupingusers)); } } // Create results table if (function_exists('get_extra_user_fields') ) { $extrafields = get_extra_user_fields($context); } else{ $extrafields = array(); } $tablecolumns = array_merge(array('picture', 'fullname'), $extrafields, array('starttime', 'attempts', 'solveddone', 'totaltime', 'grade')); $extrafieldnames = array(); foreach ($extrafields as $field) { $extrafieldnames[] = get_user_field_name($field); } $strstarttime = ($action=='showall')?get_string('starttime', 'jclic'):get_string('lastaccess', 'jclic'); $tableheaders = array_merge( array('', get_string('fullnameuser')), $extrafieldnames, array( $strstarttime, get_string('attempts', 'jclic'), get_string('solveddone', 'jclic'), get_string('totaltime', 'jclic'), get_string('grade'), )); require_once($CFG->libdir.'/tablelib.php'); $table = new flexible_table('mod-jclic-results'); $table->define_columns($tablecolumns); $table->define_headers($tableheaders); $table->define_baseurl($CFG->wwwroot.'/mod/jclic/view.php?id='.$cm->id.'&currentgroup='.$currentgroup.'&action='.$action); $table->sortable(true, 'lastname'); //sorted by lastname by default $table->collapsible(true); $table->initialbars(true); $table->column_suppress('picture'); $table->column_suppress('fullname'); $table->column_class('picture', 'picture'); $table->column_class('fullname', 'fullname'); foreach ($extrafields as $field) { $table->column_class($field, $field); } $table->set_attribute('cellspacing', '0'); $table->set_attribute('id', 'attempts'); $table->set_attribute('class', 'results generaltable generalbox'); $table->set_attribute('width', '100%'); $table->no_sorting('starttime'); $table->no_sorting('solveddone'); $table->no_sorting('totaltime'); $table->no_sorting('attempts'); $table->no_sorting('grade'); // Start working -- this is necessary as soon as the niceties are over $table->setup(); /// Construct the SQL list($where, $params) = $table->get_sql_where(); if ($where) { $where .= ' AND '; } if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY '.$sort; } $ufields = user_picture::fields('u', $extrafields); if (!empty($users)) { $select = "SELECT $ufields "; $sql = 'FROM {user} u '. 'WHERE '.$where.'u.id IN ('.implode(',',$users).') '; $ausers = $DB->get_records_sql($select.$sql.$sort, $params, $table->get_page_start(), $table->get_page_size()); $table->pagesize($perpage, count($users)); $offset = $page * $perpage; //offset used to calculate index of student in that particular query, needed for the pop up to know who's next if ($ausers !== false) { //$grading_info = grade_get_grades($course->id, 'mod', 'jclic', $jclic->id, array_keys($ausers)); $endposition = $offset + $perpage; $currentposition = $offset; $ausersObj = new ArrayObject($ausers); $iterator = $ausersObj->getIterator(); $iterator->seek($currentposition); while ($iterator->valid() && $currentposition < $endposition ) { $auser = $iterator->current(); $picture = $OUTPUT->user_picture($auser); $userlink = '' . fullname($auser, has_capability('moodle/site:viewfullnames', $context)) . ''; $extradata = array(); foreach ($extrafields as $field) { $extradata[] = $auser->{$field}; } $sessions = array(); if ($action == 'showall'){ // Print sessions for each student $sessions=jclic_get_sessions($jclic->id, $auser->id); if (sizeof($sessions)>0){ $first_session=true; foreach($sessions as $session){ // Print session information $rowclass = null; $starttime=''.date('d/m/Y H:i',strtotime($session->starttime)).''; $solveddone = $session->solved. ' / '. $session->done; $grade = $session->score; $totaltime = $session->totaltime; $attempts = $session->attempts; $row = array_merge(array($picture, $userlink), $extradata, array($starttime, $attempts, $solveddone, $totaltime, $grade)); $table->add_data($row, $rowclass); // Print activities for each session $html=''; $html.=''; $html.= ''; $html.= jclic_get_session_activities_html($session->session_id); $html.= ''; echo $html; // Remove user information (only showed in the first row) if ($first_session){ $first_session = false; $picture = null; $userlink = null; // Remove extradata fields to show them only once foreach ($extradata as $key=>$value){ $extradata[$key] = ''; } } } } } // Sessions summary $sessions_summary = jclic_get_sessions_summary($jclic->id, $auser->id); $starttime = (sizeof($sessions)>0)?get_string('totals', 'jclic'):(isset($sessions_summary->starttime)?date('d/m/Y H:i',strtotime($sessions_summary->starttime)):'-'); $solveddone = $sessions_summary->solved. ' / '. $sessions_summary->done; $grade = $sessions_summary->score; $totaltime = $sessions_summary->totaltime; $attempts = $sessions_summary->attempts; $row = array_merge(array($picture, $userlink), $extradata, array($starttime, $attempts, $solveddone, $totaltime, $grade)); $rowclass = (sizeof($sessions)>0)?'summary-row':''; $table->add_data($row, $rowclass); // Forward iterator $currentposition++; $iterator->next(); } $table->print_html(); /// Print the whole table } } } /** * Workaround to fix an Oracle's bug when inserting a row with date */ function jclic_normalize_date () { global $CFG, $DB; if ($CFG->dbtype == 'oci'){ $sql = "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"; $DB->execute($sql); } } jclicmoodle-0.2.3/lib.php0000644000175000017500000006542612216575042015412 0ustar demarchidemarchi. /** * Library of interface functions and constants for module jclic * * All the core Moodle functions, neeeded to allow the module to work * integrated in Moodle should be placed here. * All the jclic specific functions, needed to implement all the module * logic, should go to locallib.php. This will help to save some memory when * Moodle is performing actions across all modules. * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); define('JCLIC_DEFAULT_JARBASE', 'http://clic.xtec.cat/dist/jclic'); define('JCLIC_DEFAULT_LAP', 5); if (!isset($CFG->jclic_jarbase)) { set_config('jclic_jarbase', JCLIC_DEFAULT_JARBASE); } if (!isset($CFG->jclic_lap)) { set_config("jclic_lap", "5"); } // JClic file types define('JCLIC_FILE_TYPE_LOCAL', 'local'); define('JCLIC_FILE_TYPE_EXTERNAL', 'external'); /** Include eventslib.php */ require_once($CFG->libdir.'/eventslib.php'); /** Include formslib.php */ require_once($CFG->libdir.'/formslib.php'); /** Include calendar/lib.php */ require_once($CFG->dirroot.'/calendar/lib.php'); //////////////////////////////////////////////////////////////////////////////// // Moodle core API // //////////////////////////////////////////////////////////////////////////////// /** * Returns the information on whether the module supports a feature * * @todo: review features before publishing the module * * @see plugin_supports() in lib/moodlelib.php * @param string $feature FEATURE_xx constant for requested feature * @return mixed true if the feature is supported, null if unknown */ function jclic_supports($feature) { switch($feature) { case FEATURE_GROUPS: return true; // case FEATURE_GROUPINGS: return true; // case FEATURE_GROUPMEMBERSONLY: return true; case FEATURE_MOD_INTRO: return true; 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 true; case FEATURE_BACKUP_MOODLE2: return true; // case FEATURE_SHOW_DESCRIPTION: return true; // case FEATURE_ADVANCED_GRADING: return true; default: if (defined('FEATURE_SHOW_DESCRIPTION') && $feature==FEATURE_SHOW_DESCRIPTION) return true; else return null; } } /** * Saves a new instance of the jclic into the database * * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will create a new instance and return the id number * of the new instance. * * @todo: create event (when timedue added) * * @param object $jclic An object from the form in mod_form.php * @param mod_jclic_mod_form $mform * @return int The id of the newly inserted jclic record */ function jclic_add_instance(stdClass $jclic, mod_jclic_mod_form $mform = null) { global $DB; $cmid = $jclic->coursemodule; $jclic->timecreated = time(); if ($jclic->skin=='') $jclic->skin = "default"; if ($mform->get_data()->filetype === JCLIC_FILE_TYPE_LOCAL) { $jclic->url = $mform->get_data()->jclicfile; } else{ $jclic->url = $jclic->jclicurl; } if ($jclic->grade >=0 ) { $jclic->maxgrade = $jclic->grade; } $jclic->id = $DB->insert_record('jclic', $jclic); // we need to use context now, so we need to make sure all needed info is already in db $DB->set_field('course_modules', 'instance', $jclic->id, array('id'=>$cmid)); // Store the JClic and verify if ($mform->get_data()->filetype === JCLIC_FILE_TYPE_LOCAL) { $filename = jclic_set_mainfile($jclic); $jclic->url = $filename; $DB->update_record('jclic', $jclic); } if ($jclic->timedue) { $event = new stdClass(); $event->name = $jclic->name; $event->description = format_module_intro('jclic', $jclic, $jclic->coursemodule); $event->courseid = $jclic->course; $event->groupid = 0; $event->userid = 0; $event->modulename = 'jclic'; $event->instance = $jclic->id; $event->eventtype = 'due'; $event->timestart = $jclic->timedue; $event->timeduration = 0; calendar_event::create($event); } jclic_grade_item_update($jclic); return $jclic->id; } /** * Updates an instance of the jclic in the database * * Given an object containing all the necessary data, * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * * @param object $jclic An object from the form in mod_form.php * @param mod_jclic_mod_form $mform * @return boolean Success/Fail */ function jclic_update_instance(stdClass $jclic, mod_jclic_mod_form $mform = null) { global $DB; $jclic->timemodified = time(); $jclic->id = $jclic->instance; if ($mform->get_data()->filetype === JCLIC_FILE_TYPE_LOCAL) { $jclic->url = $mform->get_data()->jclicfile; } else{ $jclic->url = $jclic->jclicurl; } if ($jclic->grade >=0 ) { $jclic->maxgrade = $jclic->grade; } $result = $DB->update_record('jclic', $jclic); if ($result && $mform->get_data()->filetype === JCLIC_FILE_TYPE_LOCAL) { $filename = jclic_set_mainfile($jclic); $jclic->url = $filename; $result = $DB->update_record('jclic', $jclic); } if ($result && $jclic->timedue) { $event = new stdClass(); if ($event->id = $DB->get_field('event', 'id', array('modulename'=>'jclic', 'instance'=>$jclic->id))) { $event->name = $jclic->name; $event->description = format_module_intro('jclic', $jclic, $jclic->coursemodule); $event->timestart = $jclic->timedue; $calendarevent = calendar_event::load($event->id); $calendarevent->update($event); } else { $event = new stdClass(); $event->name = $jclic->name; $event->description = format_module_intro('jclic', $jclic, $jclic->coursemodule); $event->courseid = $jclic->course; $event->groupid = 0; $event->userid = 0; $event->modulename = 'jclic'; $event->instance = $jclic->id; $event->eventtype = 'due'; $event->timestart = $jclic->timedue; $event->timeduration = 0; calendar_event::create($event); } } else { $DB->delete_records('event', array('modulename'=>'jclic', 'instance'=>$jclic->id)); } if ($result){ // get existing grade item $result = jclic_grade_item_update($jclic); } return $result; } /** * Removes an instance of the jclic from the database * * Given an ID of an instance of this module, * this function will permanently delete the instance * and any data that depends on it. * * @todo: delete event records (after adding this feature to the module) * * @param int $id Id of the module instance * @return boolean Success/Failure */ function jclic_delete_instance($id) { global $DB; if (!$jclic = $DB->get_record('jclic', array('id'=>$id))) { return false; } $result = true; // Delete any dependent records $rs = $DB->get_records('jclic_sessions', array('jclicid' => $id)); foreach($rs as $session){ $DB->delete_records('jclic_activities', array('session_id' => $session->session_id)); } $DB->delete_records('jclic_sessions', array('jclicid' => $id)); // delete items from the gradebook if(!jclic_grade_item_delete($jclic)){ $result = false; } /** TODO: // delete files associated with this jclic $fs = get_file_storage(); if (! $fs->delete_area_files($context->id) ) { $result = false; } **/ // delete events related with this instance $DB->delete_records('event', array('modulename'=>'jclic', 'instance'=>$id)); // delete the instance $DB->delete_records('jclic', array('id' => $id)); return $result; } /** * Returns 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 * * @param object $course * @param object $user * @param object $mod * @param object $jclic * @return stdClass|null */ function jclic_user_outline($course, $user, $mod, $jclic) { global $CFG; require_once("$CFG->libdir/gradelib.php"); $result = null; $grades = grade_get_grades($course->id, 'mod', 'jclic', $jclic->id, $user->id); if (!empty($grades->items[0]->grades)) { $grade = reset($grades->items[0]->grades); $result = new stdClass(); $result->info = get_string('grade') . ': ' . $grade->str_long_grade; //if grade was last modified by the user themselves use date graded. Otherwise use date submitted if ($grade->usermodified == $user->id || empty($grade->datesubmitted)) { $result->time = $grade->dategraded; } else { $result->time = $grade->datesubmitted; } } return $result; } /** * Prints a detailed representation of what a user has done with * a given particular instance of this module, for user activity reports. * * @todo: implement * * @return string HTML */ function jclic_user_complete($course, $user, $mod, $jclic) { $outline = jclic_user_outline($course, $user, $mod, $jclic); print_r($outline->info); return true; } /** * Given a course and a time, this module should find recent activity * that has occurred in jclic activities and print it out. * Return true if there was output, or false is there was none. * * @todo: implement * * @return boolean */ function jclic_print_recent_activity($course, $viewfullnames, $timestart) { return false; // True if anything was printed, otherwise false } /** * Returns all activity in jclics since a given time * * @todo: implement * * @param array $activities sequentially indexed array of objects * @param int $index * @param int $timestart * @param int $courseid * @param int $cmid * @param int $userid defaults to 0 * @param int $groupid defaults to 0 * @return void adds items into $activities and increases $index */ function jclic_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) { } /** * Prints single activity item prepared by {@see jclic_get_recent_mod_activity()} * * @todo: implement * * @return void */ function jclic_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) { } /** * 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 ... * * @return boolean * @todo Finish documenting this function **/ function jclic_cron () { return true; } /** * Returns an array of users who are participanting in this jclic * * Must return an array of users who are participants for a given instance * of jclic. Must include every user involved in the instance, * independient of his role (student, teacher, admin...). The returned * objects must contain at least id property. * See other modules as example. * * @param int $jclicid ID of an instance of this module * @return boolean|array false if no participants, array of objects otherwise */ function jclic_get_participants($jclicid) { global $CFG, $DB; //Get students $students = $DB->get_records_sql("SELECT DISTINCT u.id, u.id as userid FROM {user} u, {jclic_sessions} js WHERE js.jclicid = ? and u.id = js.user_id", array($jclicid)); //Get teachers $teachers = $DB->get_records_sql("SELECT DISTINCT u.id, u.id as userid FROM {user} u, {jclic_sessions} js WHERE js.jclicid = ? and u.id = js.user_id", array($jclicid)); //Add teachers to students if ($teachers) { foreach ($teachers as $teacher) { $students[$teacher->id] = $teacher; } } //Return students array (it contains an array of unique users) return ($students); } /** * Returns all other caps used in the module * * @example return array('moodle/site:accessallgroups'); * @return array */ function jclic_get_extra_capabilities() { return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames', 'moodle/grade:managegradingforms'); } //////////////////////////////////////////////////////////////////////////////// // Gradebook API // //////////////////////////////////////////////////////////////////////////////// /** * Is a given scale used by the instance of jclic? * * This function returns if a scale is being used by one jclic * if it has support for grading and scales. Commented code should be * modified if necessary. See forum, glossary or journal modules * as reference. * * @param int $jclicid ID of an instance of this module * @return bool true if the scale is used by the given jclic instance */ function jclic_scale_used($jclicid, $scaleid) { global $DB; $return = false; $rec = $DB->get_record('jclic', array('id'=>$jclicid,'grade'=>-$scaleid)); if (!empty($rec) && !empty($scaleid)) { $return = true; } return $return; } /** * Checks if scale is being used by any instance of jclic. * * This is used to find out if scale used anywhere. * * @param $scaleid int * @return boolean true if the scale is used by any jclic instance */ function jclic_scale_used_anywhere($scaleid) { global $DB; if ($scaleid and $DB->record_exists('jclic', array('grade'=>-$scaleid))) { return true; } else { return false; } } /** * Creates or updates grade item for the give jclic instance * * Needed by grade_update_mod_grades() in lib/gradelib.php * * @uses GRADE_TYPE_NONE * @uses GRADE_TYPE_VALUE * @uses GRADE_TYPE_SCALE * @param stdClass $jclic instance object with extra cmidnumber and modname property * @param mixed $grades optional array/object of grade(s); 'reset' means reset grades in gradebook * @return int 0 if ok */ function jclic_grade_item_update(stdClass $jclic, $grades=NULL) { global $CFG; require_once($CFG->libdir.'/gradelib.php'); if (!isset($jclic->courseid)) { $jclic->courseid = $jclic->course; } $params = array(); $params['itemname'] = clean_param($jclic->name, PARAM_NOTAGS); $params['idnumber'] = $jclic->cmidnumber; if ($jclic->grade > 0) { $params['gradetype'] = GRADE_TYPE_VALUE; $params['grademax'] = $jclic->grade; $params['grademin'] = 0; } else if ($jclic->grade < 0) { $params['gradetype'] = GRADE_TYPE_SCALE; $params['scaleid'] = -$jclic->grade; } else { $params['gradetype'] = GRADE_TYPE_NONE; // allow text comments only } if ($grades === 'reset') { $params['reset'] = true; $grades = NULL; } grade_update('mod/jclic', $jclic->courseid, 'mod', 'jclic', $jclic->id, 0, $grades, $params); return true; } /** * Delete grade item for given jclic * * @global object * @param object $jclic object * @return object grade_item */ function jclic_grade_item_delete($jclic) { global $CFG; require_once($CFG->libdir.'/gradelib.php'); return grade_update('mod/jclic', $jclic->course, 'mod', 'jclic', $jclic->id, 0, NULL, array('deleted'=>1)) == GRADE_UPDATE_OK; } /** * Return grade for given user or all users. * * @todo: implement userid=0 (all users) * @todo: optimize this function (to avoid call jclic_get_sessions_summary or update only mandatory info) * * @param object $jclic object * @param int $userid optional user id, 0 means all users * @return array array of grades, false if none */ function jclic_get_user_grades($jclic, $userid=0) { global $CFG; require_once($CFG->dirroot.'/mod/jclic/locallib.php'); // sanity check on $jclic->id if (! isset($jclic->id)) { return; } $grades[$userid] = new stdClass(); $sessions_summary = jclic_get_sessions_summary($jclic->id, $userid); $grades[$userid]->userid = $userid; $grades[$userid]->attempts = $sessions_summary->attempts; $grades[$userid]->totaltime = $sessions_summary->totaltime; $grades[$userid]->starttime = $sessions_summary->starttime; $grades[$userid]->done = $sessions_summary->done; $grades[$userid]->rawgrade = 0; if ($jclic->avaluation=='score'){ $grades[$userid]->rawgrade = $sessions_summary->score; }else{ $grades[$userid]->rawgrade = $sessions_summary->solved; } return $grades; } /** * Update jclic grades in the gradebook * * Needed by grade_update_mod_grades() in lib/gradelib.php * * @todo: Fix some problems (this function is not working when is called from beans.php) * * @param stdClass $jclic instance object with extra cmidnumber and modname property * @param int $userid update grade of specific user only, 0 means all participants * @param boolean $nullifnone return null if grade does not exist * @return void */ function jclic_update_grades(stdClass $jclic, $userid = 0, $nullifnone=true) { global $CFG; require_once($CFG->libdir.'/gradelib.php'); if ($jclic->grade == 0) { jclic_grade_item_update($jclic); } else if ($grades = jclic_get_user_grades($jclic, $userid)) { foreach($grades as $k=>$v) { if ($v->rawgrade == -1) { $grades[$k]->rawgrade = null; } } jclic_grade_item_update($jclic, $grades); } else if ($userid and $nullifnone) { $grade = new stdClass(); $grade->userid = $userid; $grade->rawgrade = NULL; jclic_grade_item_update($jclic, $grade); } else { jclic_grade_item_update($jclic); } } //////////////////////////////////////////////////////////////////////////////// // File API // //////////////////////////////////////////////////////////////////////////////// /** * Returns the lists of all browsable file areas within the given module context * * The file area 'intro' for the activity introduction field is added automatically * by {@link file_browser::get_file_info_context_module()} * * @param stdClass $course * @param stdClass $cm * @param stdClass $context * @return array of [(string)filearea] => (string)description */ function jclic_get_file_areas($course, $cm, $context) { return array( 'content' => get_string('urledit', 'jclic') ); } /** * File browsing support for jclic module content area. * @param object $browser * @param object $areas * @param object $course * @param object $cm * @param object $context * @param string $filearea * @param int $itemid * @param string $filepath * @param string $filename * @return object file_info instance or null if not found */ function jclic_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG; if (!has_capability('moodle/course:managefiles', $context)) { // students can not peak here! return null; } $fs = get_file_storage(); if ($filearea === 'content') { $filepath = is_null($filepath) ? '/' : $filepath; $filename = is_null($filename) ? '.' : $filename; $urlbase = $CFG->wwwroot.'/pluginfile.php'; if (!$storedfile = $fs->get_file($context->id, 'mod_jclic', 'content', 0, $filepath, $filename)) { if ($filepath === '/' and $filename === '.') { $storedfile = new virtual_root_file($context->id, 'mod_jclic', 'content', 0); } else { // not found return null; } } return new file_info_stored($browser, $context, $storedfile, $urlbase, $areas[$filearea], false, true, false, false); } // note: jclic_intro handled in file_browser automatically return null; } /** * Serves the files from the jclic file areas * * @param stdClass $course * @param stdClass $cm * @param stdClass $context * @param string $filearea * @param array $args * @param bool $forcedownload * @return void this should never return to the caller */ function jclic_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload) { global $DB, $CFG; if ($context->contextlevel != CONTEXT_MODULE) { send_file_not_found(); } require_login($course, true, $cm); if (!has_capability('mod/jclic:view', $context)) { return false; } if ($filearea !== 'content') { // intro is handled automatically in pluginfile.php return false; } array_shift($args); // ignore revision - designed to prevent caching problems only $fs = get_file_storage(); $relativepath = implode('/', $args); $fullpath = rtrim("/$context->id/mod_jclic/$filearea/0/$relativepath", '/'); do { if ($file = $fs->get_file_by_hash(sha1($fullpath))) { break; } /* $jclic = $DB->get_record('jclic', array('id'=>$cm->instance), 'id, legacyfiles', MUST_EXIST); if (!$file = jcliclib_try_file_migration('/'.$relativepath, $cm->id, $cm->course, 'mod_jclic', 'content', 0)) { return false; } // file migrate - update flag $resource->legacyfileslast = time(); $DB->update_record('resource', $resource); */ } while (false); // finally send the file send_stored_file($file, 86400, 0, $forcedownload); } //////////////////////////////////////////////////////////////////////////////// // Navigation API // //////////////////////////////////////////////////////////////////////////////// /** * Extends the global navigation tree by adding jclic nodes if there is a relevant content * * This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly. * * @param navigation_node $navref An object representing the navigation tree node of the jclic module instance * @param stdClass $course * @param stdClass $module * @param cm_info $cm */ function jclic_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, cm_info $cm) { } /** * Extends the settings navigation with the jclic settings * * This function is called when the context for the page is a jclic module. This is not called by AJAX * so it is safe to rely on the $PAGE. * * @param settings_navigation $settingsnav {@link settings_navigation} * @param navigation_node $jclicnode {@link navigation_node} */ function jclic_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $jclicnode=null) { } //////////////////////////////////////////////////////////////////////////////// // Reset // //////////////////////////////////////////////////////////////////////////////// /** * Removes all grades from gradebook * @param int $courseid * @param string optional type */ function jclic_reset_gradebook($courseid) { global $CFG, $DB; $params = array('courseid'=>$courseid); $sql = "SELECT j.*, cm.idnumber as cmidnumber, j.course as courseid FROM {jclic} j, {course_modules} cm, {modules} m WHERE m.name='jclic' AND m.id=cm.module AND cm.instance=j.id AND j.course=:courseid "; if ($jclics = $DB->get_records_sql($sql, $params)) { foreach ($jclics as $jclic) { jclic_grade_item_update($jclic, 'reset'); } } } /** * This function is used by the reset_course_userdata function in moodlelib. * This function will remove all posts from the specified jclic * and clean up any related data. * @param $data the data submitted from the reset course. * @return array status array */ function jclic_reset_userdata($data) { global $CFG, $DB; $componentstr = get_string('modulenameplural', 'choice'); $status = array(); if (!empty($data->reset_jclic_deleteallsessions)) { $params = array('courseid' => $data->courseid); $select = 'session_id IN' . " (SELECT s.session_id FROM {jclic_sessions} s" . " INNER JOIN {jclic} j ON s.jclicid = j.id" . " WHERE j.course = :courseid)"; $DB->delete_records_select('jclic_activities', $select, $params); $select = 'jclicid IN' . " (SELECT j.id FROM {jclic} j" . " WHERE j.course = :courseid)"; $DB->delete_records_select('jclic_sessions', $select, $params); // remove all grades from gradebook if (empty($data->reset_gradebook_grades)) { jclic_reset_gradebook($data->courseid); } $status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallsessions', 'jclic'), 'error'=>false); } return $status; } /** * Implementation of the function for printing the form elements that control * whether the course reset functionality affects the jclic. * @param $mform form passed by reference */ function jclic_reset_course_form_definition(&$mform) { $mform->addElement('header', 'jclicheader', get_string('modulenameplural', 'jclic')); $mform->addElement('checkbox', 'reset_jclic_deleteallsessions', get_string('deleteallsessions', 'jclic')); } /** * Course reset form defaults. */ function jclic_reset_course_form_defaults($course) { return array('reset_jclic_deleteallsessions' => 1); } jclicmoodle-0.2.3/README.txt0000644000175000017500000000526112216575042015620 0ustar demarchidemarchi## # JClic module for Moodle # # @package mod # @subpackage jclic # @copyright 2008 Departament d'Ensenyament de la Generalitat de Catalunya # @source https://github.com/projectestac/moodle-mod_jclic/ # @license http://www.gnu.org/licenses/gpl-2.0.txt ## Clic [1] is a set of free software for the development of multimedia educational activities. This module allows the incorporation of JClic activities in Moodle. Its main features are: - Allows embedding easily JClic activities in some Moodle course. - Facilitates students tracing because it stores the score, date and duration of each of the attempts made ​​by the users. ----------------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (in a file called COPYING); if not, go to http://www.gnu.org/copyleft/gpl.html or write to Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- REQUIREMENTS Compatible with Moodle 2.X releases ----------------------------------------------------------------------------- INSTALL Follow the usual installation instructions ----------------------------------------------------------------------------- CREDITS Developers: Sara Arjona Tellez (sarjona@xtec.cat) With the support of: Education Government of Catalonia [2] Francesc Busquets Burguera (fbusquet@xtec.cat) JClic community support: Monica Grau Translations: Basque: Abel Camacho - didaktika@santurtzieus.com Pedro Lonbide - zuzen@santurtzieus.com Brazilian Kleber Calegario Batista - klebercal@gmail.com Greek: Yannis Kaskamanidis - kiolalis@gmail.com Galician: Xosé Luis Barreiro Cebey - xoseluis@edu.xunta.es Hebrew: Nadav Kavalerchik - nadavkav@gmail.com Special Thanks: Sandra Fernandez Birgit Ferran Pau Ferrer Ocana Silvia Garcia Yague Albert Gasset Romo Eva Gea Toni Ginard David Monllao Jaume Rocarias ----------------------------------------------------------------------------- [1] http://clic.xtec.cat/ [2] http://www.gencat.cat/ensenyament jclicmoodle-0.2.3/test/test_jclic_backup.php0000644000175000017500000000116612216575042021262 0ustar demarchidemarchidirroot . '/backup/util/includes/backup_includes.php'); // It's necessary to add $CFG->keeptempdirectoriesonbackup = true; to config.php $course_module_to_backup = 86; // Set this to one existing choice cmid in your dev site home=86; work=39 $user_doing_the_backup = 2; // Set this to the id of your admin accouun $bc = new backup_controller(backup::TYPE_1ACTIVITY, $course_module_to_backup, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_GENERAL, $user_doing_the_backup); $bc->execute_plan(); jclicmoodle-0.2.3/test/test_jclic_convert.php0000644000175000017500000000031512216575042021470 0ustar demarchidemarchidirroot.'/backup/util/helper/convert_helper.class.php'); convert_helper::to_moodle2_format('refcourse', 'moodle1'); jclicmoodle-0.2.3/test/test_jclic_restore.php0000644000175000017500000000151512216575042021476 0ustar demarchidemarchidirroot . '/backup/util/includes/restore_includes.php'); $folder = '06199f4ab82d075d19672f3bb42a285a'; // home=06199f4ab82d075d19672f3bb42a285a :: work=b5dbb55e2e834b3132e915395ed6917f $userid = 2; $fullname = 'JClic restore'; $shortname = 'jclic_restore'; $categoryid = 1; $courseid = 100; // Transaction $transaction = $DB->start_delegated_transaction(); // Create new course $courseid = restore_dbops::create_new_course($fullname, $shortname, $categoryid); // Restore backup into course $controller = new restore_controller($folder, $courseid, backup::INTERACTIVE_NO, backup::MODE_SAMESITE, $userid, backup::TARGET_NEW_COURSE); $controller->execute_precheck(); $controller->execute_plan(); // Commit $transaction->allow_commit(); jclicmoodle-0.2.3/settings.php0000644000175000017500000000265312216575042016475 0ustar demarchidemarchi. /** * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { require_once($CFG->dirroot.'/mod/jclic/lib.php'); $settings->add(new admin_setting_configtext('jclic_jarbase', get_string('jclicjarbase', 'jclic'), get_string('jclicjarbase_help', 'jclic'), JCLIC_DEFAULT_JARBASE, PARAM_URL, 60)); $settings->add(new admin_setting_configtext('jclic_lap', get_string('lap', 'jclic'), get_string('lap_help', 'jclic'), JCLIC_DEFAULT_LAP, PARAM_INT)); } jclicmoodle-0.2.3/backup/moodle1/lib.php0000644000175000017500000001247612216575042020214 0ustar demarchidemarchi. /** * Provides support for the conversion of moodle1 backup to the moodle2 format * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/mod/jclic/locallib.php'); /** * JClic conversion handler */ class moodle1_mod_jclic_handler extends moodle1_mod_handler { /** * Declare the paths in moodle.xml we are able to convert * * The method returns list of {@link convert_path} instances. For each path returned, * at least one of on_xxx_start(), process_xxx() and on_xxx_end() methods must be * defined. The method process_xxx() is not executed if the associated path element is * empty (i.e. it contains none elements or sub-paths only). * * Note that the path /MOODLE_BACKUP/COURSE/MODULES/MOD/JCLIC does not * actually exist in the file. The last element with the module name was * appended by the moodle1_converter class. * * @return array of {@link convert_path} instances */ public function get_paths() { return array( new convert_path( 'jclic', '/MOODLE_BACKUP/COURSE/MODULES/MOD/JCLIC', array( 'renamefields' => array( 'description' => 'intro', 'format' => 'introformat', ), 'newfields' => array( 'introformat' => 0, 'grade' => 0, 'timeavailable' => 0, 'timedue' => 0, ), ) ), ); } /** * This is executed every time we have one /MOODLE_BACKUP/COURSE/MODULES/MOD/JCLIC * data available */ public function process_jclic($data) { // get the course module id and context id $instanceid = $data['id']; $cminfo = $this->get_cminfo($instanceid); $this->moduleid = $cminfo['id']; $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid); // get a fresh new file manager for this instance $this->fileman = $this->converter->get_file_manager($contextid, 'mod_jclic'); // convert course files embedded into the intro $this->fileman->filearea = 'intro'; $this->fileman->itemid = 0; $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman); // migrate jclic package file $this->fileman->filearea = 'content'; $this->fileman->itemid = 0; if (!jclic_is_valid_external_url($data['url']) ) { // Migrate file try{ $this->fileman->migrate_file('course_files/'.$data['url']); } catch (Exception $e){ echo 'Caught exception: ', $e->getMessage(), ' File: \'',$data['url'], '\' on JClic activity \''.$data['name'].'\'
'; } } // To avoid problems if maxgrade is null if ($data['maxgrade'] === NULL) $data['maxgrade'] = 100; // get grade value from maxgrade $data['grade'] = $data['maxgrade']; // start writing jclic.xml $this->open_xml_writer("activities/jclic_{$this->moduleid}/jclic.xml"); $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'jclic', 'contextid' => $contextid)); $this->xmlwriter->begin_tag('jclic', array('id' => $instanceid)); foreach ($data as $field => $value) { if ($field <> 'id') { $this->xmlwriter->full_tag($field, $value); } } return $data; } /** * This is executed when we reach the closing tag of our 'jclic' path */ public function on_jclic_end() { // finalize jclic.xml $this->xmlwriter->end_tag('jclic'); $this->xmlwriter->end_tag('activity'); $this->close_xml_writer(); // write inforef.xml $this->open_xml_writer("activities/jclic_{$this->moduleid}/inforef.xml"); $this->xmlwriter->begin_tag('inforef'); $this->xmlwriter->begin_tag('fileref'); foreach ($this->fileman->get_fileids() as $fileid) { $this->write_xml('file', array('id' => $fileid)); } $this->xmlwriter->end_tag('fileref'); $this->xmlwriter->end_tag('inforef'); $this->close_xml_writer(); } }jclicmoodle-0.2.3/backup/moodle2/restore_jclic_stepslib.php0000644000175000017500000000726312216575042024201 0ustar demarchidemarchi. /** * * Define all the restore steps that will be used by the restore_jclic_activity_task * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Structure step to restore one jclic activity */ class restore_jclic_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('jclic', '/activity/jclic'); if ($userinfo) { $paths[] = new restore_path_element('jclic_session', '/activity/jclic/sessions/session'); $paths[] = new restore_path_element('jclic_session_activity', '/activity/jclic/sessions/session/sessionactivities/sessionactivity'); } // Return the paths wrapped into standard activity structure return $this->prepare_activity_structure($paths); } protected function process_jclic($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->course = $this->get_courseid(); $data->timeavailable = $this->apply_date_offset($data->timeavailable); $data->timedue = $this->apply_date_offset($data->timedue); // insert the jclic record $newitemid = $DB->insert_record('jclic', $data); // immediately after inserting "activity" record, call this $this->apply_activity_instance($newitemid); } protected function process_jclic_session($data) { global $DB; $data = (object)$data; $oldid = $data->id; $data->jclicid = $this->get_new_parentid('jclic'); $data->user_id = $this->get_mappingid('user', $data->user_id); $data->session_datetime = date('Y-m-d h:i:s', $this->apply_date_offset(strtotime($data->session_datetime))); $data->session_id = time(); $newitemid = $DB->insert_record('jclic_sessions', $data); $data->id = $newitemid; $data->session_id = $newitemid; $DB->update_record('jclic_sessions', $data); $this->set_mapping('jclic_session', $oldid, $newitemid); } protected function process_jclic_session_activity($data) { global $DB; $data = (object)$data; $oldid = $data->id; $oldsessionid = $data->session_id; $data->session_id = $this->get_mappingid('jclic_session', $oldsessionid); $newitemid = $DB->insert_record('jclic_activities', $data); // No need to save this mapping as far as nothing depend on it // (child paths, file areas nor links decoder) } protected function after_execute() { // Add jclic related files, no need to match by itemname (just internally handled context) $this->add_related_files('mod_jclic', 'intro', null); $this->add_related_files('mod_jclic', 'content', null); } }jclicmoodle-0.2.3/backup/moodle2/backup_jclic_stepslib.php0000644000175000017500000000654512216575042023765 0ustar demarchidemarchi. /** * * Define all the backup steps that will be used by the backup_jclic_activity_task * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Define the complete jclic structure for backup, with file and id annotations */ class backup_jclic_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 $jclic = new backup_nested_element('jclic', array('id'), array( 'name', 'intro', 'introformat', 'url', 'skin', 'maxattempts', 'width', 'height', 'avaluation', 'maxgrade', 'grade', 'lang', 'exiturl', 'timeavailable', 'timedue')); $sessions = new backup_nested_element('sessions'); $session = new backup_nested_element('session', array('id'), array( 'session_id', 'user_id', 'session_datetime', 'project_name', 'session_key', 'session_code', 'session_context')); $activities = new backup_nested_element('sessionactivities'); $activity = new backup_nested_element('sessionactivity', array('id'), array( 'session_id', 'activity_id', 'activity_name', 'num_actions', 'score', 'activity_solved', 'qualification', 'total_time', 'activity_code')); // Build the tree $jclic->add_child($sessions); $sessions->add_child($session); $session->add_child($activities); $activities->add_child($activity); // Define sources $jclic->set_source_table('jclic', array('id' => backup::VAR_ACTIVITYID)); // All the rest of elements only happen if we are including user info if ($userinfo) { $session->set_source_table('jclic_sessions', array('jclicid' => backup::VAR_PARENTID)); $activity->set_source_table('jclic_activities', array('session_id' => '../../session_id')); } // Define id annotations $jclic->annotate_ids('scale', 'grade'); $session->annotate_ids('user', 'user_id'); // Define file annotations $jclic->annotate_files('mod_jclic', 'intro', null); // This file area hasn't itemid $jclic->annotate_files('mod_jclic', 'content', null); // This file area hasn't itemid // Return the root element (jclic), wrapped into standard activity structure return $this->prepare_activity_structure($jclic); } }jclicmoodle-0.2.3/backup/moodle2/backup_jclic_activity_task.class.php0000644000175000017500000000461512216575042026116 0ustar demarchidemarchi. /** * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->dirroot . '/mod/jclic/locallib.php'); // Because it exists (must) require_once($CFG->dirroot . '/mod/jclic/backup/moodle2/backup_jclic_stepslib.php'); // Because it exists (must) /** * jclic backup task that provides all the settings and steps to perform one * complete backup of the activity */ class backup_jclic_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() { jclic_normalize_date(); $this->add_step(new backup_jclic_activity_structure_step('jclic_structure', 'jclic.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 jclics $search="/(".$base."\/mod\/jclic\/index.php\?id\=)([0-9]+)/"; $content= preg_replace($search, '$@JCLICINDEX*$2@$', $content); // Link to jclic view by moduleid $search="/(".$base."\/mod\/jclic\/view.php\?id\=)([0-9]+)/"; $content= preg_replace($search, '$@JCLICVIEWBYID*$2@$', $content); return $content; } }jclicmoodle-0.2.3/backup/moodle2/restore_jclic_activity_task.class.php0000644000175000017500000001002612216575042026325 0ustar demarchidemarchi. /** * * @package mod * @subpackage jclic * @copyright 2011 Departament d'Ensenyament de la Generalitat de Catalunya * @author Sara Arjona Téllez * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/mod/jclic/locallib.php'); // Because it exists (must) require_once($CFG->dirroot . '/mod/jclic/backup/moodle2/restore_jclic_stepslib.php'); // Because it exists (must) /** * jclic restore task that provides all the settings and steps to perform one * complete restore of the activity */ class restore_jclic_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() { jclic_normalize_date(); // JClic only has one structure step $this->add_step(new restore_jclic_activity_structure_step('jclic_structure', 'jclic.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('jclic', array('intro'), 'jclic'); 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(); $rules[] = new restore_decode_rule('JCLICVIEWBYID', '/mod/jclic/view.php?id=$1', 'course_module'); $rules[] = new restore_decode_rule('JCLICINDEX', '/mod/jclic/index.php?id=$1', 'course'); return $rules; } /** * Define the restore log rules that will be applied * by the {@link restore_logs_processor} when restoring * jclic 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('jclic', 'add', 'view.php?id={course_module}', '{jclic}'); $rules[] = new restore_log_rule('jclic', 'update', 'view.php?id={course_module}', '{jclic}'); $rules[] = new restore_log_rule('jclic', 'view', 'view.php?id={course_module}', '{jclic}'); 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('jclic', 'view all', 'index?id={course}', null, null, null, 'index.php?id={course}'); $rules[] = new restore_log_rule('jclic', 'view all', 'index.php?id={course}', null); return $rules; } }