/**
  * @param $a_comp
  * @param $a_part
  * @param array $a_par
  */
 public function modifyGUI($a_comp, $a_part, $a_par = array())
 {
     /**
      * @var $ilTabsGUI ilTabsGUI
      */
     if ($a_part == 'tabs' && isset($_GET['ref_id']) && self::$ref_is_crs !== false) {
         // ATM only display certificate tab in courses
         if (self::$ref_is_crs === null && ilObject::_lookupType((int) $_GET['ref_id'], true) != 'crs' || $_GET['admin_mode']) {
             self::$ref_is_crs = false;
             return;
         }
         self::$ref_is_crs = true;
         // User needs write access to course to see the tab 'certificate'
         if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) {
             $ilTabsGUI = $a_par['tabs'];
             $this->ctrl->setParameterByClass('srCertificateDefinitionGUI', 'ref_id', $_GET['ref_id']);
             $link = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), 'srCertificateDefinitionGUI'));
             $ilTabsGUI->addTarget('certificate', $link, 'show', 'srCertificateDefinitionGUI');
         }
     }
 }
 public function executeCommand()
 {
     if (!$this->checkPermission()) {
         ilUtil::sendFailure($this->pl->txt('msg_no_permission'), true);
         $this->ctrl->redirectByClass('ilpersonaldesktopgui');
     }
     global $ilMainMenu;
     $ilMainMenu->setActive('none');
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     if (!in_array($cmd, array('addType', ''))) {
         $this->ctrl->saveParameter($this, 'type_id');
         $this->ctrl->saveParameter($this, 'signature_id');
     }
     // needed for ILIAS >= 4.5
     if (ilCertificatePlugin::getBaseClass() != 'ilRouterGUI') {
         $this->tpl->getStandardTemplate();
     }
     switch ($next_class) {
         case '':
             switch ($cmd) {
                 case 'showTypes':
                     $this->showTypes();
                     break;
                 case 'editType':
                     $this->editType();
                     $this->setTabs('general');
                     break;
                 case 'addType':
                     $this->addType();
                     $this->setTabs('general');
                     break;
                 case 'saveType':
                     $this->saveType();
                     $this->setTabs('general');
                     break;
                 case 'editTemplate':
                     $this->editTemplate();
                     $this->setTabs('template');
                     break;
                 case 'updateTemplate':
                     $this->updateTemplate();
                     $this->setTabs('template');
                     break;
                 case 'downloadDefaultTemplate':
                     $this->downloadDefaultTemplate();
                     $this->setTabs('template');
                     break;
                 case 'downloadTemplate':
                     $this->downloadTemplate();
                     $this->setTabs('template');
                     break;
                 case 'showSettings':
                     $this->showSettings();
                     $this->setTabs('settings');
                     break;
                 case 'editSetting':
                     $this->editSetting();
                     $this->setTabs('settings');
                     break;
                 case 'updateSetting':
                     $this->updateSetting();
                     $this->setTabs('settings');
                     break;
                 case 'addCustomSetting':
                     $this->addCustomSetting();
                     $this->setTabs('settings');
                     break;
                 case 'editCustomSetting':
                     $this->editCustomSetting();
                     $this->setTabs('settings');
                     break;
                 case 'confirmDeleteCustomSetting':
                     $this->confirmDeleteCustomSetting();
                     $this->setTabs('settings');
                     break;
                 case 'deleteCustomSetting':
                     $this->deleteCustomSetting();
                     break;
                 case 'saveCustomSetting':
                     $this->saveCustomSetting();
                     $this->setTabs('settings');
                     break;
                 case 'showPlaceholders':
                     $this->showPlaceholders();
                     $this->setTabs('placeholders');
                     break;
                 case 'addPlaceholder':
                     $this->addPlaceholder();
                     $this->setTabs('placeholders');
                     break;
                 case 'editPlaceholder':
                     $this->editPlaceholder();
                     $this->setTabs('placeholders');
                     break;
                 case 'updatePlaceholder':
                     $this->updatePlaceholder();
                     $this->setTabs('placeholders');
                     break;
                 case 'createPlaceholder':
                     $this->createPlaceholder();
                     $this->setTabs('placeholders');
                     break;
                 case 'deletePlaceholder':
                     $this->deletePlaceholder();
                     break;
                 case 'confirmDeletePlaceholder':
                     $this->confirmDeletePlaceholder();
                     $this->setTabs('placeholders');
                     break;
                 case 'showSignatures':
                     $this->showSignatures();
                     $this->setTabs('signatures');
                     break;
                 case 'addSignature':
                     $this->addSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'editSignature':
                     $this->editSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'createSignature':
                     $this->createSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'updateSignature':
                     $this->updateSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'confirmDeleteSignature':
                     $this->confirmDeleteSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'deleteSignature':
                     $this->deleteSignature();
                     $this->setTabs('signatures');
                     break;
                 case 'downloadSignature':
                     $this->downloadSignature();
                     $this->setTabs('signatures');
                     break;
                 case '':
                     $this->showTypes();
                     break;
             }
             break;
     }
     // needed for ILIAS >= 4.5
     if (ilCertificatePlugin::getBaseClass() != 'ilRouterGUI') {
         $this->tpl->show();
     }
 }
 /**
  * @param array $a_set
  */
 protected function fillRow(array $a_set)
 {
     // For checkboxes in first column
     if (count($this->getOption('actions_multi')) && $a_set['status'] == 3) {
         $this->tpl->setCurrentBlock('CHECKBOXES');
         $this->tpl->setVariable('VALUE', $a_set['id']);
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock('COL');
         $this->tpl->setVariable('VALUE', '');
         $this->tpl->parseCurrentBlock();
     }
     $utc = ilCertificateConfig::get('time_format_utc');
     $date_function = $utc ? 'gmdate' : 'date';
     foreach ($this->columns as $k => $column) {
         $value = is_null($a_set[$column]) ? '' : $a_set[$column];
         if ($this->isColumnSelected($column)) {
             // Format dates
             if (in_array($column, array('valid_from', 'valid_to')) && $value != '') {
                 $time = strtotime($value);
                 $time = $utc ? $time + srCertificate::TIME_ZONE_CORRECTION : $time;
                 switch ($this->user->getDateFormat()) {
                     case ilCalendarSettings::DATE_FORMAT_DMY:
                         $value = $date_function('d.m.Y', $time);
                         break;
                     case ilCalendarSettings::DATE_FORMAT_MDY:
                         $value = $date_function('m/d/Y', $time);
                         break;
                 }
             } elseif (in_array($column, array('valid_from', 'valid_to')) && $value == '') {
                 $value = $this->pl->txt('unlimited');
             }
             if ($column == 'status') {
                 $value = $this->pl->txt("cert_status_" . (int) $value);
             }
             // Set value
             $this->tpl->setCurrentBlock('COL');
             $this->tpl->setVariable('VALUE', $value);
             $this->tpl->parseCurrentBlock();
         }
     }
     // Actions
     if (count($this->getOption('actions'))) {
         if ($this->hasAction($a_set)) {
             $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'cert_id', $a_set['id']);
             $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'status', $a_set['status']);
             $async_url = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), get_class($this->parent_obj)), 'buildActions', '', true);
             $actions = new ilAdvancedSelectionListGUI();
             $actions->setId('action_list_' . $a_set['id']);
             $actions->setAsynchUrl($async_url);
             $actions->setAsynch(true);
             $actions->setListTitle($this->pl->txt('actions'));
         } else {
             $actions = ' ';
         }
         $this->tpl->setCurrentBlock('ACTIONS');
         $this->tpl->setVariable('ACTIONS', is_string($actions) ? $actions : $actions->getHTML());
         $this->tpl->parseCurrentBlock();
     }
 }
 public function executeCommand()
 {
     $this->checkPermission();
     $this->initHeader();
     $this->setSubTabs();
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     // needed for ILIAS >= 4.5
     if (ilCertificatePlugin::getBaseClass() != 'ilRouterGUI') {
         $this->tpl->getStandardTemplate();
     }
     switch ($next_class) {
         case '':
             switch ($cmd) {
                 case 'showDefinition':
                 case 'showPlaceholders':
                 case 'showCertificates':
                 case 'downloadCertificate':
                 case 'downloadCertificates':
                 case 'updateDefinition':
                 case 'confirmTypeChange':
                 case 'updateType':
                 case 'createDefinition':
                 case 'updatePlaceholders':
                 case 'previewCertificate':
                 case 'buildActions':
                     $this->{$cmd}();
                     break;
                 case 'updatePlaceholdersPreview':
                     $this->updatePlaceholders('previewCertificate');
                     break;
                 case 'callBack':
                 case 'undoCallBack':
                 case 'retryGeneration':
                     /** @var srCertificate $certificate */
                     $certificate = srCertificate::find((int) $_GET['cert_id']);
                     if ($certificate->getDefinitionId() == $this->definition->getId()) {
                         $this->{$cmd}($certificate);
                     }
                     break;
                 case '':
                     if ($this->definition) {
                         $this->showCertificates();
                     } else {
                         $this->showDefinition();
                     }
             }
             break;
     }
     // needed for ILIAS >= 4.5
     if (ilCertificatePlugin::getBaseClass() != 'ilRouterGUI') {
         $this->tpl->show();
     }
 }