Proyectos de Subversion Moodle

Rev

Rev 52 | Rev 54 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 52 Rev 53
Línea 120... Línea 120...
120
    $coreCourseList = new core_course_list_element($course);
120
    $coreCourseList = new core_course_list_element($course);
121
} else {
121
} else {
122
    $coreCourseList = [];
122
    $coreCourseList = [];
123
}
123
}
Línea 124... Línea 124...
124
        
124
        
125
$image = ''; // $url_noimage;
125
$courseimage = null;
126
foreach ($coreCourseList->get_course_overviewfiles() as $file)
126
foreach ($coreCourseList->get_course_overviewfiles() as $file)
127
{
127
{
128
    $isimage = $file->is_valid_image();
128
    $isimage = $file->is_valid_image();
129
    if($isimage) {
-
 
130
       // $image = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
-
 
131
        //if (!$isimage) {
-
 
132
        //    $image = $url_noimage;
-
 
133
        //}
-
 
134
        
-
 
135
       // echo "file \r\n";
-
 
136
       // print_r($file);
129
    if($isimage) {
137
        
-
 
138
      //  echo "\r\n\r\n";
-
 
139
       // echo "context \r\n";
-
 
140
        
-
 
141
        $course_context = \context_course::instance($course->id);
-
 
142
   
-
 
143
        $fs = get_file_storage();
-
 
144
       // $file = $fs->get_file($file->get_contextid(), $file->get_component(), $file->get_filearea(), $course->id, $file->get_filepath(), $file->get_filename());
-
 
145
        
-
 
146
        
-
 
147
       // $file = $fs->get_file($course_context->id, 'course', $file->get_filearea(), 0, $file->get_filepath(), $file->get_filename());
-
 
148
        
130
 
149
        if($file) {
131
        if($file) {
150
            echo 'file';
-
 
151
           
-
 
152
            print_r(get_class_methods($file));
132
            $courseimage = [
153
            print_r($file->get_filename());
133
                'filename'  => $file->get_filename(),
154
            print_r($file->get_filesize());
134
                'filesize'  => $file->get_filesize(),
155
            print_r($file->get_content());
-
 
156
            //$stored_file = new  stored_file($fs, $file);
135
                'content'   => base64_encode($file->get_content()),
-
 
136
            ];
157
            //print_r($stored_file);
137
 
Línea 158... Línea 138...
158
        }
138
        }
Línea 159... Línea 139...
159
        
139
        
160
      
-
 
Línea 161... Línea -...
161
        
-
 
162
        
-
 
163
    }
-
 
164
    
-
 
165
    
-
 
166
}
-
 
167
exit;
-
 
168
 
-
 
169
//ttps:\/\/moodle4-dev.leaderslinked.com\/pluginfile.php\/22898\/course\/overviewfiles\/HOME_APLICACIONES_-17.png
-
 
170
    
-
 
171
/*
-
 
172
$course_context = context_course::instance($course->id);
-
 
Línea 173... Línea 140...
173
    
140
      
174
$fs = get_file_storage();
141
        
175
$file = $fs->get_file($course_context ->id, 'mod_course', $filearea, $course->id, $filepath, $filename);
142
        
176
if (!$file) {
143
    }
177
    // The file does not exist.
144
    
178
    return false;
145
    
179
}*/
146
}
180
     
147
 
181
 
148
 
182
echo json_encode([
149
echo json_encode([
183
    'success' => true, 
150
    'success' => true,