private function addMultiCommands()
 {
     global $ilUser, $lng;
     $this->parent_obj->pluginObj->includeClass('class.ilXAVCPermissions.php');
     if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->parent_obj->ref_id, AdobeConnectPermissions::PERM_CHANGE_ROLE)) {
         $this->addMultiCommand('updateParticipants', $lng->txt('update'));
     }
     if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->parent_obj->ref_id, AdobeConnectPermissions::PERM_ADD_PARTICIPANTS)) {
         $this->addMultiCommand('detachMember', $lng->txt('delete'));
     }
 }
 private function addMultiCommands()
 {
     global $ilUser, $lng, $rbacsystem, $tree;
     $this->parent_obj->pluginObj->includeClass('class.ilXAVCPermissions.php');
     $isadmin = $rbacsystem->checkAccessOfUser($ilUser->getId(), 'write', $this->parent_obj->ref_id);
     $this->parent_obj->pluginObj->includeClass('class.ilAdobeConnectServer.php');
     $settings = ilAdobeConnectServer::_getInstance();
     if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->parent_obj->ref_id, AdobeConnectPermissions::PERM_CHANGE_ROLE) || $isadmin && $settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI) {
         $this->addMultiCommand('updateParticipants', $lng->txt('update'));
         $this->addMultiCommand('makeHosts', $this->pluginObj->txt('make_hosts'));
         $this->addMultiCommand('makeModerators', $this->pluginObj->txt('make_moderators'));
         $this->addMultiCommand('makeParticipants', $this->pluginObj->txt('make_participants'));
         $this->addMultiCommand('makeBlocked', $this->pluginObj->txt('make_blocked'));
     }
     $this->parent_obj->pluginObj->includeClass('class.ilAdobeConnectServer.php');
     $settings = ilAdobeConnectServer::_getInstance();
     if ((ilXAVCPermissions::hasAccess($ilUser->getId(), $this->parent_obj->ref_id, AdobeConnectPermissions::PERM_ADD_PARTICIPANTS) || $isadmin && $settings->getAuthMode() == ilAdobeConnectServer::AUTH_MODE_SWITCHAAI) && !$settings->getSetting('allow_crs_grp_trigger')) {
         $this->addMultiCommand('detachMember', $lng->txt('delete'));
     }
 }
 /**
  * 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()));
     }
 }
 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 saveIliasSettings()
 {
     /**
      * @var $ilCtrl ilCtrl
      * @var $lng 	$lng
      * @var $tpl	$tpl
      */
     global $lng, $ilCtrl, $tpl;
     if (is_array($_POST['permissions']) || $_POST['permissions'] == NULL) {
         if ($_POST['permissions'] == NULL) {
             $permissions = array();
         } else {
             $permissions = $_POST['permissions'];
         }
         $objPerm = new ilXAVCPermissions();
         $objPerm->setPermissions($permissions);
     }
     $this->initIliasSettingsForm();
     if ($this->form->checkInput()) {
         ilAdobeConnectServer::setSetting('obj_creation_settings', serialize($this->form->getInput('obj_creation_settings')));
         ilAdobeConnectServer::setSetting('allow_crs_grp_trigger', (int) $this->form->getInput('allow_crs_grp_trigger'));
         ilAdobeConnectServer::setSetting('obj_title_suffix', (int) $this->form->getInput('obj_title_suffix'));
         ilAdobeConnectServer::setSetting('show_free_slots', (int) $this->form->getInput('show_free_slots'));
         $enable_perm_room = (int) $this->form->getInput('enable_perm_room');
         ilAdobeConnectServer::setSetting('enable_perm_room', (int) $this->form->getInput('enable_perm_room'));
         ilAdobeConnectServer::setSetting('default_perm_room', $enable_perm_room == 0 ? 0 : (int) $this->form->getInput('default_perm_room'));
         ilAdobeConnectServer::setSetting('add_to_desktop', (int) $this->form->getInput('add_to_desktop'));
         ilAdobeConnectServer::setSetting('content_file_types', (string) $this->form->getInput('content_file_types'));
         ilAdobeConnectServer::setSetting('use_user_folders', (int) $this->form->getInput('use_user_folders'));
         //			ilAdobeConnectServer::setSetting('crs_owner', $this->form->getInput('crs_owner'));
         ilAdobeConnectServer::setSetting('crs_admin', $this->form->getInput('crs_admin'));
         ilAdobeConnectServer::setSetting('crs_tutor', $this->form->getInput('crs_tutor'));
         ilAdobeConnectServer::setSetting('crs_member', $this->form->getInput('crs_member'));
         //			ilAdobeConnectServer::setSetting('grp_owner', $this->form->getInput('grp_owner'));
         ilAdobeConnectServer::setSetting('grp_admin', $this->form->getInput('grp_admin'));
         ilAdobeConnectServer::setSetting('grp_member', $this->form->getInput('grp_member'));
         ilUtil::sendSuccess($lng->txt('settings_saved'), true);
         $ilCtrl->redirect($this, 'editIliasSettings');
     } else {
         ilUtil::sendFailure($this->getPluginObject()->txt('check_input'));
         $this->form->setValuesByPost();
         return $tpl->setContent($this->form->getHTML());
     }
 }
 public function showContent()
 {
     /*
      * var $ilUser ilUser
      */
     global $ilUser, $tpl, $ilCtrl, $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();
     $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());
     if ($this->access->checkAccess("write", "", $this->object->getRefId()) || $is_member || $is_admin) {
         $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)) {
                 $this->pluginObj->includeClass('class.ilAdobeConnectRoles.php');
                 $xavcRoles = new ilAdobeConnectRoles($this->object->getRefId());
                 if (!$quota->mayStartScheduledMeeting($this->object->getScoId())) {
                     $href = $this->txt("meeting_not_available_no_slots");
                     $button_disabled = true;
                 } else {
                     if (!$xavcRoles->isAdministrator($this->user->getId()) && count($current_pax = $this->object->getCurrentPax()) > $this->object->getMaxPax() && !in_array($this->object->getPrincipalId($xavc_login), $current_pax)) {
                         $href = $this->txt("meeting_full");
                         $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') || ilXAVCPermissions::hasAccess($ilUser->getId(), $this->ref_id, AdobeConnectPermissions::PERM_UPLOAD_CONTENT) || $has_write_permission) {
                 $admins_only = '';
                 if (!$this->object->getReadContents('content')) {
                     $admins_only = $this->pluginObj->txt('admins_only');
                 }
                 $info->addSection($this->pluginObj->txt('file_uploads') . ' ' . $admins_only);
                 $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() || ilXAVCPermissions::hasAccess($ilUser->getId(), $this->ref_id, AdobeConnectPermissions::PERM_EDIT_RECORDS) || $has_write_permission) {
                 $has_access = false;
                 $admins_only = '';
                 if (ilXAVCPermissions::hasAccess($ilUser->getId(), $this->ref_id, AdobeConnectPermissions::PERM_EDIT_RECORDS) || $has_write_permission) {
                     $has_access = true;
                     if (!$this->object->getReadRecords()) {
                         $admins_only = $this->pluginObj->txt('admins_only');
                     }
                 }
                 $info->addSection($this->pluginObj->txt('records') . ' ' . $admins_only);
                 $info->addProperty('', $this->viewRecords($has_access, 'record'));
             }
         } else {
             ilUtil::sendFailure($this->txt('error_connect_ac_server'));
         }
     }
     $info->hideFurtherSections('', true);
     $tpl->setContent($info->getHTML() . $this->getPerformTriggerHtml());
     $tpl->setPermanentLink('xavc', $this->object->getRefId());
     $tpl->addILIASFooter();
 }