コード例 #1
0
ファイル: text.php プロジェクト: unikent/moodle-tool_cat
 /**
  * Return the rendered text.
  *
  * @return string The data.
  */
 public function get_data()
 {
     $data = parent::get_data();
     $text = $data->text;
     // Check we aren't a template.
     if (isset($data->template) && $data->template) {
         $context = $this->get_context();
         if (empty($context)) {
             debugging("Cannot render a template string with a blank context! Make sure you call set_context first.");
             $context = new \stdClass();
         }
         // Render as a template.
         $text = $this->render_template($text, $context);
     }
     return $text;
 }
コード例 #2
0
ファイル: activity.php プロジェクト: unikent/moodle-tool_cat
 /**
  * Get data (CM).
  */
 public function get_data()
 {
     global $DB;
     $context = $this->get_context();
     if (!is_array($context) || !isset($context['course']) || !isset($context['section'])) {
         throw new \moodle_exception("Invalid activity datatype context!");
     }
     $data = parent::get_data();
     // Get the module.
     $module = $DB->get_record('modules', array('name' => $data->activity), '*', \MUST_EXIST);
     // Create our instance.
     $activity = \tool_cat\activity::create_activity($data->activity, serialize($data));
     $instance = $activity->get_instance($context['course']);
     // Create the cm.
     return $this->create_cm($context['course'], $context['section'], $module, $instance, $data);
 }
コード例 #3
0
ファイル: block.php プロジェクト: unikent/moodle-tool_cat
 /**
  * Return the block name.
  */
 public function get_data()
 {
     $data = parent::get_data();
     return $data->block;
 }