Beispiel #1
0
 /**
  * Get tool consumer.
  *
  * @return ToolConsumer Tool consumer object for this resource link.
  */
 public function getConsumer()
 {
     if (is_null($this->consumer)) {
         if (!is_null($this->context) || !is_null($this->contextId)) {
             $this->consumer = $this->getContext()->getConsumer();
         } else {
             $this->consumer = ToolConsumer::fromRecordId($this->consumerId, $this->getDataConnector());
         }
     }
     return $this->consumer;
 }
Beispiel #2
0
 /**
  * Get tool consumer.
  *
  * @return ToolConsumer Tool consumer object for this context.
  */
 public function getConsumer()
 {
     if (is_null($this->consumer)) {
         $this->consumer = ToolConsumer::fromRecordId($this->consumerId, $this->getDataConnector());
     }
     return $this->consumer;
 }
Beispiel #3
0
 /**
  * Fetches the list of ToolConsumer objects that are linked to a tool.
  *
  * @param int $toolid
  * @return ToolConsumer[]
  */
 public function get_consumers_mapped_to_tool($toolid)
 {
     global $DB;
     $consumers = [];
     $consumerrecords = $DB->get_records('enrol_lti_tool_consumer_map', ['toolid' => $toolid], '', 'consumerid');
     foreach ($consumerrecords as $record) {
         $consumers[] = ToolConsumer::fromRecordId($record->consumerid, $this);
     }
     return $consumers;
 }