|
@@ -4,6 +4,9 @@
|
|
|
* This class provides all the functionality for an ia (interactive activities).
|
|
|
*
|
|
|
* Release Notes:
|
|
|
+ * - v 4.9.3 2020/01/16
|
|
|
+ * + Several fixes to allow to move activities in a block and improvements in repository
|
|
|
+ *
|
|
|
* - v 4.9.2 2019/03/13
|
|
|
* + Several fixes to allow iLM under HTML stack
|
|
|
*
|
|
@@ -313,7 +316,8 @@ class iassign {
|
|
|
else {
|
|
|
|
|
|
|
|
|
- eval($action_iassign[$this->action]);
|
|
|
+ if (isset($action_iassign[$this->action]))
|
|
|
+ eval($action_iassign[$this->action]);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -6186,7 +6190,7 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
$fs = get_file_storage();
|
|
|
- $dir_base = $this->get_dir_ilm('dir_base');
|
|
|
+ $dir_base = $this->get_dir_ilm('dir_base');
|
|
|
$files_course = $fs->get_directory_files($contextid, 'mod_iassign', 'activity', 0, $dir_base, false, true, 'filename');
|
|
|
$countf = 0;
|
|
|
$array_files_id = array();
|
|
@@ -6204,13 +6208,15 @@ class ilm_manager {
|
|
|
$countf++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return $countf;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- function view_files_ilm ($iassign_ilm_class, $extension) {
|
|
|
+ function view_files_ilm ($iassign_ilm_class, $extension, $start = 0) {
|
|
|
+
|
|
|
global $CFG, $DB, $USER, $OUTPUT;
|
|
|
$fs = get_file_storage();
|
|
|
$context = context_course::instance($this->id);
|
|
@@ -6227,29 +6233,44 @@ class ilm_manager {
|
|
|
|
|
|
|
|
|
|
|
|
- if (!has_capability("moodle/site:config", $context, $USER->id, true))
|
|
|
- $array_query = array('component' => 'mod_iassign');
|
|
|
- else
|
|
|
- $array_query = array('component' => 'mod_iassign', 'userid' => $USER->id);
|
|
|
-
|
|
|
- $files_iassign = $DB->get_records('files', $array_query);
|
|
|
+
|
|
|
+
|
|
|
+ $hascapability = has_capability("moodle/site:config", $context, $USER->id);
|
|
|
+ if ($hascapability==1) {
|
|
|
+
|
|
|
+ $query_sql = "SELECT * FROM {files} WHERE component='mod_iassign' AND filearea='activity'";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+ $query_sql = "SELECT * FROM {files} WHERE component='mod_iassign' AND filearea='activity' AND " .
|
|
|
+ " (license<>'allrightsreserved' OR contextid=" . $context->id . " OR userid=" . $USER->id . ")";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ $files_iassign = $DB->get_records_sql($query_sql);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
$count_all_files = 0;
|
|
|
$count_files_with_ext = 0;
|
|
|
$count_thisauthor_contextid = 0;
|
|
|
$count_otherauthors_contextid = 0;
|
|
|
+
|
|
|
+
|
|
|
+ if (is_array($files_iassign))
|
|
|
foreach ($files_iassign as $item_files_iassign) {
|
|
|
$extensionF = explode(".", $item_files_iassign->filename);
|
|
|
$lastitem = sizeof($extensionF);
|
|
|
if ($lastitem>0) $lastitem--;
|
|
|
- else
|
|
|
- continue;
|
|
|
+ else { echo ".";
|
|
|
+ continue;}
|
|
|
$str_extension = $extensionF[$lastitem];
|
|
|
$count_files_with_ext++;
|
|
|
if ($extension == $str_extension) {
|
|
|
$contextid = $item_files_iassign->contextid;
|
|
|
if (!in_array($contextid, $array_contextid_files_aux)) {
|
|
|
|
|
|
+ $array_contextid_files_aux[] = $contextid;
|
|
|
$total_in_context = $this->get_files_in_context($array_all_files, $contextid, $extension, $USER->id);
|
|
|
|
|
|
$count_all_files += $total_in_context;
|
|
@@ -6257,10 +6278,17 @@ class ilm_manager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
$array_files_course = array();
|
|
|
+ $dirs_array = '';
|
|
|
+ $files_array = '';
|
|
|
+ $files_array = "''";
|
|
|
+ $error_files_exists = "''";
|
|
|
for ($ii=$count_all_files-1; $ii>0; $ii--) {
|
|
|
|
|
|
|