/**
  * Create plugin specific data
  * @access    public
  */
 public function doCreate()
 {
     /**
      * @var $ilCtrl ilCtrl
      */
     global $ilCtrl;
     $cmdClass = $ilCtrl->getCmdClass();
     if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) {
         $tpl_id = (int) $_POST['tpl_id'];
     } else {
         throw new ilException('no_template_id_given');
     }
     include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
     $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc");
     foreach ($templates as $template) {
         if ((int) $template['id'] == $tpl_id) {
             $template_settings = array();
             if ($template['id']) {
                 $objTemplate = new ilSettingsTemplate($template['id']);
                 $template_settings = $objTemplate->getSettings();
             }
         }
     }
     // reuse existing ac-room
     if (isset($_POST['creation_type']) && $_POST['creation_type'] == 'existing_vc' && $template_settings['reuse_existing_rooms']['hide'] == '0') {
         // 1. the sco-id will be assigned to this new ilias object
         $sco_id = (int) $_POST['available_rooms'];
         try {
             $this->useExistingVC($this->getId(), $sco_id);
         } catch (ilException $e) {
             $this->creationRollback();
             throw new ilException($this->txt($e->getMessage()));
         }
         return;
     }
     if (strlen($_POST['instructions']) > 0) {
         $post_instructions = (string) $_POST['instructions'];
     } else {
         if (strlen($_POST['instructions_2']) > 0) {
             $post_instructions = (string) $_POST['instructions_2'];
         } else {
             if (strlen($_POST['instructions_3']) > 0) {
                 $post_instructions = (string) $_POST['instructions_3'];
             }
         }
     }
     if (strlen($_POST['contact_info']) > 0) {
         $post_contact = (string) $_POST['contact_info'];
     } else {
         if (strlen($_POST['contact_info_2']) > 0) {
             $post_contact = (string) $_POST['contact_info_2'];
         } else {
             if (strlen($_POST['contact_info_3']) > 0) {
                 $post_contact = (string) $_POST['contact_info_3'];
             }
         }
     }
     $this->setInstructions($post_instructions);
     $this->setContactInfo($post_contact);
     if (isset($_POST['time_type_selection']) && $_POST['time_type_selection'] == 'permanent_room') {
         $this->setPermanentRoom(1);
     } else {
         if (!isset($_POST['time_type_selection']) && ilAdobeConnectServer::getSetting('default_perm_room') == 1) {
             $this->setPermanentRoom(1);
         } else {
             $this->setPermanentRoom(0);
         }
     }
     if (isset($_POST['access_level'])) {
         $this->setPermission($_POST['access_level']);
     } else {
         $this->setPermission(ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED);
     }
     $this->pluginObj->includeClass('class.ilXAVCPermissions.php');
     $this->setReadContents(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_CONTENTS, 'view'));
     $this->setReadRecords(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_RECORDS, 'view'));
     $this->externalLogin = $this->checkExternalUser();
     $folder_id = $this->getFolderIdByLogin($this->externalLogin);
     $this->setFolderId($folder_id);
     if ($cmdClass == 'ilobjectcopygui') {
         $now = new ilDateTime(time(), IL_CAL_UNIX);
         $this->start_date = new ilDateTime($now->getUnixTime() - 7200, IL_CAL_UNIX);
         $this->duration = array('hours' => 1, 'minutes' => 0);
         $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId());
         return;
     }
     try {
         if (isset($_POST['start_date']) && $template_settings['start_date']['hide'] == '0') {
             //start_date
             $this->start_date = new ilDateTime($_POST['start_date']['date'] . ' ' . $_POST['start_date']['time'], IL_CAL_DATETIME);
         } else {
             $this->start_date = new ilDateTime(time() + 120, IL_CAL_UNIX);
         }
         // duration
         if (isset($_POST['duration']['hh']) && isset($_POST['duration']['mm']) && ($_POST['duration']['hh'] > 0 || $_POST['duration']['mm'] > 0) && $template_settings['duration']['hide'] == '0') {
             $this->duration = array('hours' => $_POST['duration']['hh'], 'minutes' => $_POST['duration']['mm']);
         } else {
             $this->duration = array('hours' => (int) $template_settings['duration']['value'], 'minutes' => 0);
         }
         //end_date
         $this->end_date = $this->getEnddate();
         $concurrent_vc = count($this->checkConcurrentMeetingDates());
         $max_rep_obj_vc = ilAdobeConnectServer::getSetting('ac_interface_objects');
         if ((int) $max_rep_obj_vc > 0 && $concurrent_vc >= $max_rep_obj_vc) {
             throw new ilException('xavc_reached_number_of_connections');
         }
         $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId());
     } catch (ilException $e) {
         $this->creationRollback();
         throw new ilException($this->txt($e->getMessage()));
     }
 }