public function showContent()
 {
     /*
      * var $ilUser ilUser
      */
     global $ilUser, $tpl, $ilAccess;
     $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
     $this->pluginObj->includeClass('class.ilAdobeConnectServer.php');
     $has_write_permission = $ilAccess->checkAccess("write", "", $this->object->getRefId());
     $settings = ilAdobeConnectServer::_getInstance();
     if ($settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI and ilAdobeConnectServer::useSwitchaaiAuthMode($ilUser->getAuthMode(true))) {
         //Login User - this creates a user if he not exists.
         $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId());
         $ilAdobeConnectUser->loginUser();
         //Add the user as Participant @adobe switch
         $status = ilXAVCMembers::_lookupStatus($ilUser->getId(), $this->object->getRefId());
         $this->object->addSwitchParticipant($ilUser->getEmail(), $status);
     }
     $this->tabs->setTabActive('contents');
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->removeFormAction();
     $this->pluginObj->includeClass('class.ilAdobeConnectQuota.php');
     $this->pluginObj->includeClass("class.ilObjAdobeConnectAccess.php");
     $is_member = ilObjAdobeConnectAccess::_hasMemberRole($ilUser->getId(), $this->object->getRefId());
     $is_admin = ilObjAdobeConnectAccess::_hasAdminRole($ilUser->getId(), $this->object->getRefId());
     //SWITCHAAI: If the user has no SWITCHaai-Account, we show the room link without connecting to the adobe-connect server. This is used for guest logins.
     $show_only_roomlink = false;
     if ($settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI and !ilAdobeConnectServer::useSwitchaaiAuthMode($ilUser->getAuthMode(true))) {
         $show_only_roomlink = true;
         $presentation_url = $settings->getPresentationUrl();
         $button_txt = $this->pluginObj->txt('enter_vc');
         $button_target = $presentation_url . $this->object->getURL();
         $button_tpl = new ilTemplate($this->pluginObj->getDirectory() . "/templates/default/tpl.bigbutton.html", true, true);
         $button_tpl->setVariable('BUTTON_TARGET', $button_target);
         $button_tpl->setVariable('BUTTON_TEXT', $button_txt);
         $big_button = $button_tpl->get();
         $info->addSection('');
         $info->addProperty('', $big_button . "<br />");
     }
     if (($this->access->checkAccess("write", "", $this->object->getRefId()) || $is_member || $is_admin) && !$show_only_roomlink) {
         $presentation_url = $settings->getPresentationUrl();
         $form = new ilPropertyFormGUI();
         $form->setTitle($this->pluginObj->txt('access_meeting_title'));
         $this->object->doRead();
         if ($this->object->getStartDate() != NULL) {
             $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId());
             $ilAdobeConnectUser->ensureAccountExistance();
             $xavc_login = $ilAdobeConnectUser->getXAVCLogin();
             $quota = new ilAdobeConnectQuota();
             // show button
             if (($this->object->getPermanentRoom() == 1 || $this->doProvideAccessLink()) && $this->object->isParticipant($xavc_login)) {
                 if (!$quota->mayStartScheduledMeeting($this->object->getScoId())) {
                     $href = $this->txt("meeting_not_available_no_slots");
                     $button_disabled = true;
                 } else {
                     $href = '<a href="' . $this->ctrl->getLinkTarget($this, 'performSso') . '" target="_blank" >' . $presentation_url . $this->object->getURL() . '</a>';
                     $button_disabled = false;
                 }
             } else {
                 $href = $this->txt("meeting_not_available");
                 $button_disabled = true;
             }
             if ($button_disabled == true) {
                 $button_txt = $href;
             } else {
                 $button_txt = $this->pluginObj->txt('enter_vc');
             }
             $button_target = ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTarget($this, 'performSso', '', false, false);
             $button_tpl = new ilTemplate($this->pluginObj->getDirectory() . "/templates/default/tpl.bigbutton.html", true, true);
             $button_tpl->setVariable('BUTTON_TARGET', $button_target);
             $button_tpl->setVariable('BUTTON_TEXT', $button_txt);
             $big_button = $button_tpl->get();
             $info->addSection('');
             if ($button_disabled == true) {
                 $info->addProperty('', $href);
             } else {
                 $info->addProperty('', $big_button . "<br />");
             }
             // show instructions
             if (strlen($this->object->getInstructions()) > 1) {
                 $info->addSection($this->lng->txt('exc_instruction'));
                 $info->addProperty('', nl2br($this->object->getInstructions()));
             }
             // show contact info
             if (strlen($this->object->getContactInfo()) > 1) {
                 $info->addSection($this->pluginObj->txt('contact_information'));
                 $info->addProperty('', nl2br($this->object->getContactInfo()));
             }
             //show contents
             if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->object->getRefId(), AdobeConnectPermissions::PERM_READ_CONTENTS) && $this->object->getReadContents('content')) {
                 $info->addSection($this->pluginObj->txt('file_uploads'));
                 $info->setFormAction($this->ctrl->getFormAction($this, 'showContent'));
                 $has_access = false;
                 if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->ref_id, AdobeConnectPermissions::PERM_UPLOAD_CONTENT) || $has_write_permission) {
                     $has_access = true;
                     $tpl_sub_button = new ilTemplate("Services/InfoScreen/templates/default/tpl.submitbuttons.html", true, true);
                     $tpl_sub_button->setVariable('BTN_NAME', $this->txt("add_new_content"));
                     $tpl_sub_button->setVariable('BTN_COMMAND', 'showAddContent');
                     $info->addProperty('', $tpl_sub_button->get());
                 }
                 $info->addProperty('', $this->viewContents($has_access));
             }
             // show records
             if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->object->getRefId(), AdobeConnectPermissions::PERM_READ_RECORDS) && $this->object->getReadRecords()) {
                 $has_access = false;
                 if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->ref_id, AdobeConnectPermissions::PERM_EDIT_RECORDS) || $has_write_permission) {
                     $has_access = true;
                 }
                 $info->addSection($this->pluginObj->txt('records'));
                 $info->addProperty('', $this->viewRecords($has_access, 'record'));
             }
         } else {
             ilUtil::sendFailure($this->txt('error_connect_ac_server'));
         }
     }
     $info->hideFurtherSections();
     $tpl->setContent($info->getHTML() . $this->getPerformTriggerHtml());
     $tpl->setPermanentLink('xavc', $this->object->getRefId());
     $tpl->addILIASFooter();
 }
 public function initCreateForm($item)
 {
     global $ilUser;
     $settings = ilAdobeConnectServer::_getInstance();
     //Login User - this creates a user if he not exists.
     if ($settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI) {
         $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
         $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId());
         $ilAdobeConnectUser->loginUser();
     }
     $this->pluginObj->includeClass('class.ilObjAdobeConnect.php');
     if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) {
         $item['id'] = $_POST['tpl_id'];
     }
     $template_settings = array();
     if ($item['id']) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         $template = new ilSettingsTemplate($item['id']);
         $template_settings = $template->getSettings();
     }
     $form = new ilPropertyFormGUI();
     $form->setTitle($this->pluginObj->txt($item['title']));
     //        login to ac-server
     $this->pluginObj->includeClass('class.ilAdobeConnectServer.php');
     // title
     $title = new ilTextInputGUI($this->pluginObj->txt("title"), "title");
     $title->setRequired(true);
     // description
     $description = new ilTextAreaInputGUI($this->pluginObj->txt("description"), "desc");
     // contact_info_val
     $civ = array();
     if ($ilUser->getPref('public_profile') == "y") {
         if ($ilUser->getPref('public_title')) {
             $civ_title = $ilUser->getUTitle() . ' ';
         }
         $civ[] = $civ_title . $ilUser->getFirstname() . ' ' . $ilUser->getLastname();
         if ($ilUser->getPref('public_email')) {
             $civ[] = $ilUser->getEmail();
         }
         if ($ilUser->getPref('public_phone_office') && strlen($ilUser->getPhoneOffice()) > 1) {
             $civ[] = $this->pluginObj->txt('office') . ': ' . $ilUser->getPhoneOffice();
         }
         if ($ilUser->getPref('public_phone_mobile') && strlen($ilUser->getPhoneMobile()) > 1) {
             $civ[] = $this->pluginObj->txt('mobile') . ': ' . $ilUser->getPhoneMobile();
         }
     }
     $contact_info_value = implode(', ', $civ);
     // owner
     $owner = new ilTextInputGUI($this->lng->txt("owner"), "owner");
     $owner->setInfo($this->pluginObj->txt('owner_info'));
     $owner->setValue(ilObjUser::_lookupLogin($ilUser->getId()));
     $radio_time_type = new ilRadioGroupInputGUI($this->pluginObj->txt('time_type_selection'), 'time_type_selection');
     // option: permanent room
     $permanent_room = new ilRadioOption($this->pluginObj->txt('permanent_room'), 'permanent_room');
     $permanent_room_is_enabled = ilAdobeConnectServer::getSetting('default_perm_room');
     $permanent_room->setInfo($this->pluginObj->txt('permanent_room_info'));
     $radio_time_type->addOption($permanent_room);
     // option: date selection
     $opt_date = new ilRadioOption($this->pluginObj->txt('start_date'), 'date_selection');
     if ($template_settings['start_date']['hide'] == '0') {
         // start date
         $sd = new ilDateTimeInputGUI($this->pluginObj->txt("start_date"), "start_date");
         $serverConfig = ilAdobeConnectServer::_getInstance();
         $now = strtotime('+3 minutes');
         $minTime = new ilDateTime($now + $serverConfig->getScheduleLeadTime() * 60 * 60, IL_CAL_UNIX);
         $sd->setDate($minTime);
         $sd->setShowTime(true);
         $sd->setRequired(true);
         $opt_date->addSubItem($sd);
     }
     if ($template_settings['duration']['hide'] == '0') {
         $duration = new ilDurationInputGUI($this->pluginObj->txt("duration"), "duration");
         $duration->setRequired(true);
         $duration->setHours('2');
         $opt_date->addSubItem($duration);
     }
     $radio_time_type->addOption($opt_date);
     $radio_time_type->setRequired(true);
     $radio_time_type->setValue('permanent_room');
     // access-level of the meeting room
     $radio_access_level = new ilRadioGroupInputGUI($this->pluginObj->txt('access'), 'access_level');
     $opt_private = new ilRadioOption($this->pluginObj->txt('private_room'), ilObjAdobeConnect::ACCESS_LEVEL_PRIVATE);
     $opt_protected = new ilRadioOption($this->pluginObj->txt('protected_room'), ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED);
     $opt_public = new ilRadioOption($this->pluginObj->txt('public_room'), ilObjAdobeConnect::ACCESS_LEVEL_PUBLIC);
     $radio_access_level->addOption($opt_private);
     $radio_access_level->addOption($opt_protected);
     $radio_access_level->addOption($opt_public);
     $radio_access_level->setValue(ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED);
     $available_langs = $settings->getSetting('langs');
     if ($available_langs == '' || $available_langs == NULL) {
         $available_langs = 'en';
     }
     $available_langs = explode(",", $available_langs);
     $available_langs_prepared = array();
     foreach ($available_langs as $lang) {
         $lang = trim($lang);
         $available_langs_prepared[$lang] = $lang;
     }
     $meeting_lang = new ilSelectInputGUI($this->pluginObj->txt('meeting_lang'), 'meeting_lang');
     $meeting_lang->setOptions($available_langs_prepared);
     $meeting_lang->setRequired(true);
     $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php');
     $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId());
     $ilAdobeConnectUser->ensureAccountExistance();
     $xavc_login = $ilAdobeConnectUser->getXAVCLogin();
     $folder_id = $ilAdobeConnectUser->ensureUserFolderExistance($xavc_login);
     if ($template_settings['reuse_existing_rooms']['hide'] == '0') {
         $all_scos = (array) ilObjAdobeConnect::getScosByFolderId($folder_id);
         $local_scos = (array) ilObjAdobeConnect::getLocalScos();
         $free_scos = array();
         if ($all_scos) {
             foreach ($all_scos as $sco) {
                 $sco_ids[] = $sco['sco_id'];
             }
             $free_scos = array_diff($sco_ids, $local_scos);
         }
         if (!$free_scos) {
             $hidden_creation_type = new ilHiddenInputGUI('creation_type');
             $hidden_creation_type->setValue('new_vc');
             $form->addItem($hidden_creation_type);
             $advanced_form_item = $form;
             $afi_add_method = 'addItem';
         } else {
             $radio_grp = new ilRadioGroupInputGUI($this->pluginObj->txt('choose_creation_type'), 'creation_type');
             $radio_grp->setRequired(true);
             $radio_new = new ilRadioOption($this->pluginObj->txt('create_new'), 'new_vc');
             $radio_existing = new ilRadioOption($this->pluginObj->txt('select_existing'), 'existing_vc');
             $radio_grp->setValue('new_vc');
             $radio_grp->addOption($radio_new);
             $advanced_form_item = $radio_new;
             $afi_add_method = 'addSubItem';
         }
         $advanced_form_item->{$afi_add_method}($title);
         $advanced_form_item->{$afi_add_method}($description);
         $contact_info = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info");
         $contact_info->setRows(self::CREATION_FORM_TA_ROWS);
         $contact_info->setCols(self::CREATION_FORM_TA_COLS);
         $contact_info->setValue($contact_info_value);
         $advanced_form_item->{$afi_add_method}($contact_info);
         $instructions = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions');
         $instructions->setRows(self::CREATION_FORM_TA_ROWS);
         $instructions->setCols(self::CREATION_FORM_TA_COLS);
         $advanced_form_item->{$afi_add_method}($instructions);
         if ($template_settings['access_level']['hide'] == 0) {
             $advanced_form_item->{$afi_add_method}($radio_access_level);
         }
         $advanced_form_item->{$afi_add_method}($radio_time_type);
         $advanced_form_item->{$afi_add_method}($owner);
         $advanced_form_item->{$afi_add_method}($meeting_lang);
         if ($free_scos && $radio_existing) {
             $radio_existing = new ilRadioOption($this->pluginObj->txt('select_existing'), 'existing_vc');
             $radio_grp->addOption($radio_existing);
             $form->addItem($radio_grp);
             foreach ($free_scos as $fs) {
                 $options[$fs] = $all_scos[$fs]['sco_name'];
             }
             $available_rooms = new ilSelectInputGUI($this->pluginObj->txt('available_rooms'), 'available_rooms');
             $available_rooms->setOptions($options);
             $available_rooms->setInfo($this->pluginObj->txt('choose_existing_room'));
             $radio_existing->addSubItem($available_rooms);
             $instructions_3 = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions_3');
             $instructions_3->setRows(self::CREATION_FORM_TA_ROWS);
             $instructions_3->setCols(self::CREATION_FORM_TA_COLS);
             $radio_existing->addSubItem($instructions_3);
             $contact_info_3 = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info_3");
             $contact_info_3->setValue($contact_info_value);
             $contact_info_3->setRows(self::CREATION_FORM_TA_ROWS);
             $contact_info_3->setCols(self::CREATION_FORM_TA_COLS);
             $radio_existing->addSubItem($contact_info_3);
         } else {
             //$info = new ilNonEditableValueGUI($this->pluginObj->txt('no_available_rooms'));
             //$radio_existing->addSubItem($info);
         }
     } else {
         $form->addItem($title);
         $form->addItem($description);
         $contact_info_2 = new ilTextAreaInputGUI($this->pluginObj->txt("contact_information"), "contact_info_2");
         $contact_info_2->setRows(self::CREATION_FORM_TA_ROWS);
         $contact_info_2->setCols(self::CREATION_FORM_TA_COLS);
         $contact_info_2->setValue($contact_info_value);
         $form->addItem($contact_info_2);
         if ($template_settings['access_level']['hide'] == 0) {
             $form->addItem($radio_access_level);
         }
         $instructions_2 = new ilTextAreaInputGUI($this->lng->txt('exc_instruction'), 'instructions_2');
         $instructions_2->setRows(self::CREATION_FORM_TA_ROWS);
         $instructions_2->setCols(self::CREATION_FORM_TA_COLS);
         $form->addItem($instructions_2);
         if ($permanent_room_is_enabled) {
             $info_text = $this->pluginObj->txt('smpl_permanent_room_enabled');
         } else {
             $time = date('H:i', strtotime('+2 hours'));
             $info_text = sprintf($this->pluginObj->txt('smpl_permanent_room_disabled'), $time);
         }
         $info = new ilNonEditableValueGUI($this->lng->txt('info'), 'info_text');
         $info->setValue($info_text);
         $form->addItem($info);
     }
     $tpl_id = new ilHiddenInputGUI('tpl_id');
     $tpl_id->setValue($item['id']);
     $form->addItem($tpl_id);
     $form->addCommandButton("save", $this->pluginObj->txt($this->getType() . "_add"));
     $form->addCommandButton("cancelCreation", $this->lng->txt("cancel"));
     $form->setFormAction($this->ctrl->getFormAction($this));
     return $form;
 }