/**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 public function getProperties()
 {
     global $lng, $ilUser;
     $props = array();
     $props[] = array('alert' => false, 'property' => '', 'propertyNameVisible' => false, 'value' => ilViteroPlugin::getInstance()->txt('virtual_team_room'));
     return $props;
 }
 /**
  * Get singelton instance
  * @global ilPluginAdmin $ilPluginAdmin
  * @return ilViteroPlugin
  */
 public static function getInstance()
 {
     global $ilPluginAdmin;
     if (self::$instance) {
         return self::$instance;
     }
     include_once './Services/Component/classes/class.ilPluginAdmin.php';
     return self::$instance = ilPluginAdmin::getPluginObject(self::CTYPE, self::CNAME, self::SLOT_ID, self::PNAME);
 }
 /**
  * Handles all commmands, default is "configure"
  */
 public function performCommand($cmd)
 {
     global $ilTabs;
     $ilTabs->addTab('settings', ilViteroPlugin::getInstance()->txt('tab_settings'), $GLOBALS['ilCtrl']->getLinkTarget($this, 'configure'));
     if (ilViteroSettings::getInstance()->getCustomer()) {
         $ilTabs->addTab('appointments', ilViteroPlugin::getInstance()->txt('tab_appointments'), $GLOBALS['ilCtrl']->getLinkTarget($this, 'listAppointments'));
     }
     switch ($cmd) {
         case "configure":
         case "save":
         case 'listAppointments':
             $this->{$cmd}();
             break;
     }
 }
 /**
  * Get available room sizes
  *
  * @return array
  */
 public static function getRoomSizeList()
 {
     try {
         $licence_service = new ilViteroLicenceSoapConnector();
         $modules = $licence_service->getModulesForCustomer(ilViteroSettings::getInstance()->getCustomer());
     } catch (ilViteroConnectorException $e) {
         return array();
     }
     $available_rooms = array();
     foreach ((array) $modules->modules->module as $key => $mod) {
         if ($mod->type != 'ROOM') {
             continue;
         }
         $available_rooms[(int) $mod->roomsize] = (int) $mod->roomsize . ' ' . ilViteroPlugin::getInstance()->txt('participants');
     }
     return $available_rooms;
 }
 public function getViteroMessage()
 {
     return ilViteroPlugin::getInstance()->txt('err_soap_' . (int) $this->getCode());
 }
 protected function initUpdateBookingForm($booking)
 {
     global $lng;
     $lng->loadLanguageModule('dateplaner');
     $lng->loadLanguageModule('crs');
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'showContent'));
     $form->setTitle(ilViteroPlugin::getInstance()->txt('tbl_update_appointment'));
     $form->addCommandButton('updateBooking', $GLOBALS['lng']->txt('save'));
     $form->addCommandButton('showContent', $GLOBALS['lng']->txt('cancel'));
     // Show only start if type is "cafe"
     if ($booking->booking->cafe) {
         $start = new ilDateTimeInputGUI($lng->txt('event_start_date'), 'cstart');
         $start->setShowTime(false);
         $start->setDate(ilViteroUtils::parseSoapDate($booking->booking->start));
         $form->addItem($start);
     } else {
         include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
         $dt = new ilDateDurationInputGUI($lng->txt('cal_fullday'), 'roomduration');
         $dt->setMinuteStepSize(15);
         $dt->setStartText($lng->txt('event_start_date'));
         $dt->setEndText($lng->txt('event_end_date'));
         $dt->setShowTime(true);
         $dt->setStart(ilViteroUtils::parseSoapDate($booking->booking->start));
         $dt->setEnd(ilViteroUtils::parseSoapDate($booking->booking->end));
         $form->addItem($dt);
         $this->initFormTimeBuffer($form);
         $form->getItemByPostVar('buffer_before')->setValue($booking->booking->startbuffer);
         $form->getItemByPostVar('buffer_after')->setValue($booking->booking->endbuffer);
     }
     return $form;
 }
 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($a_set)
 {
     global $ilUser, $ilAccess;
     $this->tpl->setVariable('VAL_ID', $a_set['usr_id']);
     $this->tpl->setVariable('VAL_NAME', $a_set['lastname'] . ', ' . $a_set['firstname']);
     if (!$ilAccess->checkAccessOfUser($a_set['usr_id'], 'read', '', $this->getParentObject()->object->getRefId()) and is_array($info = $ilAccess->getInfo())) {
         $this->tpl->setCurrentBlock('access_warning');
         $this->tpl->setVariable('PARENT_ACCESS', $info[0]['text']);
         $this->tpl->parseCurrentBlock();
     }
     if (!ilObjUser::_lookupActive($a_set['usr_id'])) {
         $this->tpl->setCurrentBlock('access_warning');
         $this->tpl->setVariable('PARENT_ACCESS', $this->lng->txt('usr_account_inactive'));
         $this->tpl->parseCurrentBlock();
     }
     foreach ($this->getSelectedColumns() as $field) {
         switch ($field) {
             case 'gender':
                 $a_set['gender'] = $a_set['gender'] ? $this->lng->txt('gender_' . $a_set['gender']) : '';
                 $this->tpl->setCurrentBlock('custom_fields');
                 $this->tpl->setVariable('VAL_CUST', $a_set[$field]);
                 $this->tpl->parseCurrentBlock();
                 break;
             case 'birthday':
                 $a_set['birthday'] = $a_set['birthday'] ? ilDatePresentation::formatDate(new ilDate($a_set['birthday'], IL_CAL_DATE)) : $this->lng->txt('no_date');
                 $this->tpl->setCurrentBlock('custom_fields');
                 $this->tpl->setVariable('VAL_CUST', $a_set[$field]);
                 $this->tpl->parseCurrentBlock();
                 break;
             default:
                 $this->tpl->setCurrentBlock('custom_fields');
                 $this->tpl->setVariable('VAL_CUST', $a_set[$field] ? $a_set[$field] : '');
                 $this->tpl->parseCurrentBlock();
                 break;
         }
     }
     if ($a_set['locked']) {
         $this->tpl->setVariable('UNLOCKED_ALT', ilViteroPlugin::getInstance()->txt('locked_txt'));
         $this->tpl->setVariable('UNLOCKED_IMG', ilUtil::getImagePath('icon_not_ok.svg'));
     } else {
         $this->tpl->setVariable('UNLOCKED_ALT', ilViteroPlugin::getInstance()->txt('unlocked_txt'));
         $this->tpl->setVariable('UNLOCKED_IMG', ilUtil::getImagePath('icon_ok.svg'));
     }
     if ($this->type == ilObjVitero::ADMIN) {
         $this->tpl->setVariable('VAL_POSTNAME', 'admins');
     } else {
         $this->tpl->setVariable('VAL_POSTNAME', 'members');
     }
     $this->ctrl->setParameter($this->parent_obj, 'member_id', $a_set['usr_id']);
     $this->tpl->setVariable('LINK_NAME', $this->ctrl->getLinkTarget($this->parent_obj, 'editMember'));
     $this->tpl->setVariable('LINK_TXT', $this->lng->txt('edit'));
     $this->ctrl->clearParameters($this->parent_obj);
     $this->tpl->setVariable('VAL_LOGIN', $a_set['login']);
 }
 /**
  * Fill template row
  * @param <type> $a_set
  */
 public function fillRow($a_set)
 {
     $this->tpl->setVariable('TIME', $a_set['time']);
     $this->tpl->setVariable('DURATION', $a_set['duration']);
     $this->tpl->setVariable('REC', ilViteroUtils::recurrenceToString($a_set['rec']));
     if ($this->isAdminTable()) {
         include_once './Services/Tree/classes/class.ilPathGUI.php';
         $path = new ilPathGUI();
         $path->setUseImages(false);
         $path->enableTextOnly(false);
         $this->tpl->setVariable('OBJ_PATH', $path->getPath(ROOT_FOLDER_ID, end(ilObject::_getAllReferences($a_set['group']))));
     }
     if ($a_set['rec']) {
         $this->tpl->setVariable('ENDS', $a_set['ends']);
     } else {
         $this->tpl->setVariable('ENDS', '');
     }
     if (!$this->isEditable()) {
         return true;
     }
     include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
     $list = new ilAdvancedSelectionListGUI();
     $list->setId('booka_' . $a_set['start']->get(IL_CAL_UNIX) . '_' . $a_set['id']);
     $list->setListTitle($this->lng->txt('actions'));
     // no recurrence
     if ($a_set['rec'] == 0) {
         $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'bookid', $a_set['id']);
         $list->addItem(ilViteroPlugin::getInstance()->txt('edit_booking'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'editBooking'));
         // delete appointment
         $list->addItem(ilViteroPlugin::getInstance()->txt('delete_appointment'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'confirmDeleteAppointment'));
     }
     // A recurrence
     if ($a_set['rec'] > 0) {
         // Delete single appointment
         $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'atime', $a_set['start']->get(IL_CAL_UNIX));
         $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'bookid', $a_set['id']);
         $list->addItem(ilViteroPlugin::getInstance()->txt('edit_bookings'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'editBooking'));
         // not supported
         /*
         $list->addItem(
         	ilViteroPlugin::getInstance()->txt('delete_appointment'),
         	'',
         	$GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(),'confirmDeleteAppointmentInSeries')
         );
         */
         // Delete appointment series
         $list->addItem(ilViteroPlugin::getInstance()->txt('delete_reccurrence'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'confirmDeleteBooking'));
     }
     $this->tpl->setVariable('ACTION_PART', $list->getHTML());
 }
 /**
  * insert
  *
  * @access public
  * @param
  * @return
  */
 public function insert($a_tpl)
 {
     $tpl = ilViteroPlugin::getInstance()->getTemplate('tpl.recurrence_input.html', true, true);
     $options = array(ilViteroUtils::REC_ONCE => ilViteroUtils::recurrenceToString(ilViteroUtils::REC_ONCE), ilViteroUtils::REC_DAILY => ilViteroUtils::recurrenceToString(ilViteroUtils::REC_DAILY), ilViteroUtils::REC_WEEKLY => ilViteroUtils::recurrenceToString(ilViteroUtils::REC_WEEKLY), ilViteroUtils::REC_WEEKDAYS => ilViteroUtils::recurrenceToString(ilViteroUtils::REC_WEEKDAYS), ilViteroUtils::REC_WEEKENDS => ilViteroUtils::recurrenceToString(ilViteroUtils::REC_WEEKENDS));
     $tpl->setVariable('FREQUENCE', ilUtil::formSelect($this->getReccurrence(), 'frequence', $options, false, true, '', '', array('onchange' => 'ilHideFrequencies();', 'id' => 'il_recurrence_1')));
     $tpl->setVariable('TXT_EVERY', $this->lng->txt('cal_every'));
     // UNTIL
     $this->buildUntilSelection($tpl);
     $a_tpl->setCurrentBlock("prop_custom");
     $a_tpl->setVariable("CUSTOM_CONTENT", $tpl->get());
     $a_tpl->parseCurrentBlock();
 }
 /**
  * Get instance
  */
 public function __construct()
 {
     $this->plugin = ilViteroPlugin::getInstance();
     $this->settings = ilViteroSettings::getInstance();
 }