Пример #1
0
 /**
  * Returns info about the files at System context
  *
  * @param object $context context object
  * @param string $component component
  * @param string $filearea file area
  * @param int $itemid item ID
  * @param string $filepath file path
  * @param string $filename file name
  * @return file_info instance or null if not found or access not allowed
  */
 private function get_file_info_context_system($context, $component, $filearea, $itemid, $filepath, $filename)
 {
     $level = new file_info_context_system($this, $context);
     return $level->get_file_info($component, $filearea, $itemid, $filepath, $filename);
     // nothing supported at this context yet
 }
Пример #2
0
 public function test_get_children()
 {
     $context = get_context_instance(CONTEXT_SYSTEM);
     $fis = new file_info_context_system(new file_browser(), $context);
     $children = $fis->get_children();
     $found_coursecat = false;
     $context_coursecat = get_context_instance(CONTEXT_COURSECAT, $this->coursecat->id);
     $file_info_context_coursecat = new file_info_context_coursecat(new file_browser(), $context_coursecat, $this->coursecat);
     foreach ($children as $child) {
         if ($child == $file_info_context_coursecat) {
             $found_coursecat = true;
         }
     }
     $this->assertTrue($found_coursecat);
 }