title: Understanding Moodle $context
body: <p>From <a href="https://moodle.org/mod/glossary/showentry.php?eid=9984&amp;displayformat=dictionary" rel="noreferrer">Moodle doc</a>: </p>
  
  <blockquote>
    <p>A context is a space in Moodle where roles can be assigned.</p>
  </blockquote>
  
  <p>I understand that a context is a logical space used to manage Moodle objects.</p>
  
  <p>I developed a custom block plugin with a file upload where I use <code>file_prepare_draft_area</code> and<code>file_save_draft_area_files</code> functions.There is a <code>$context</code> parameter that must be passed and I am don't really know what context should I pass ?
  This mean, I guess, in which logical space should I put my block plugin uploaded files ? 
  In my opinion, the most logical would be store the uploaded files in a context related to my block plugin.</p>
  
  <p>I tried to use context_block::instance($instanceid) but I don't know how to get $instanceid param.</p>
  
  <ul>
  <li>Which context should I use in this case?  </li>
  <li>How to get it?</li>
  </ul>