Example #1
0
 /**
  * Configure course and account navigation placements
  *
  * @return Generator
  */
 public function getGenerator()
 {
     parent::getGenerator();
     $this->generator->setOptionProperty(Option::COURSE_NAVIGATION(), 'visibility', 'admins');
     $this->generator->setOptionProperty(Option::ACCOUNT_NAVIGATION(), 'visibility', 'admins');
     return $this->generator;
 }
 /**
  * Build a tool placement option element
  *
  * @param  DOMDocument $config
  * @param  Option $option
  * @param  string[] $properties
  * @return DOMElement
  */
 private function getOptionsElement(DOMDocument $config, $option, array $properties)
 {
     if (is_a($option, Option::class) || Option::isValid($option)) {
         $options = $config->createElementNS(self::LTICM, 'lticm:options');
         $options->setAttribute('name', $option);
         /* inherit link text and launch URL properties if not specified */
         if (!array_key_exists('text', $properties)) {
             $properties['text'] = $this->name;
         }
         if (!array_key_exists('url', $properties)) {
             $properties['url'] = $this->launchURL;
         }
         foreach ($properties as $name => $value) {
             $property = $config->createElementNS(self::LTICM, 'lticm:property', $value);
             $property->setAttribute('name', $name);
             $options->appendChild($property);
         }
         return $options;
     }
     return null;
 }