/**
  * Check in the certificate type if this setting is editable in the current context (crs, tst...)
  *
  * @return bool
  */
 public function isEditable()
 {
     /** @var srCertificateDefinition $definition */
     $definition = srCertificateDefinition::find($this->getDefinitionId());
     $type = $definition->getType();
     $setting = $type->getSettingByIdentifier($this->getIdentifier());
     $ref_id = $definition->getRefId();
     $object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     return in_array($object_type, $setting->getEditableIn());
 }
 /**
  * Get dropdown for choosing the certificate type
  *
  * @return ilSelectInputGUI
  */
 protected function getTypeInput()
 {
     $types = srcertificateType::get();
     $options = array();
     $object_type = $this->pl->isCourseTemplate((int) $_GET['ref_id']) ? 'crs-tpl' : ilObject::_lookupType((int) $_GET['ref_id'], true);
     /** @var $type srCertificateType */
     $invalid = array();
     foreach ($types as $type) {
         if (!srCertificateType::isSelectable($type, (int) $_GET['ref_id'])) {
             continue;
         }
         // Skip the type if it contains no valid template file!
         if (!is_file($type->getCertificateTemplatesPath(true))) {
             $invalid[] = $type->getTitle();
             continue;
         }
         $options[$type->getId()] = $type->getTitle();
     }
     if (count($invalid) && $this->isNew) {
         ilUtil::sendInfo(sprintf($this->pl->txt('msg_info_invalid_cert_types'), implode(', ', $invalid)));
     }
     $item = new ilSelectInputGUI($this->pl->txt('setting_id_type'), 'type_id');
     asort($options);
     $item->setOptions($options);
     $info = $this->isNew ? $this->pl->txt('setting_id_type_info_new') : $this->pl->txt('setting_id_type_info_change');
     $item->setInfo($info);
     $item->setValue($this->definition->getTypeId());
     $item->setRequired(true);
     return $item;
 }
 /**
  * Check in the value of the placeholder is editable in the current context (crs, crs-tpl, tst...)
  *
  * @return bool
  */
 public function isEditable()
 {
     $ref_id = $this->getDefinition()->getRefId();
     $object_type = $this->pl->isCourseTemplate($ref_id) ? 'crs-tpl' : ilObject::_lookupType($ref_id, true);
     return in_array($object_type, $this->getPlaceholder()->getEditableIn());
 }