private function showCreationForm(ilPropertyFormGUI $form) { global $tpl; require_once dirname(__FILE__) . '/class.ilObjAdobeConnect.php'; require_once dirname(__FILE__) . '/class.ilAdobeConnectServer.php'; $num_max_ac_obj = ilAdobeConnectServer::getSetting('ac_interface_objects'); if ((int) $num_max_ac_obj <= 0) { $tpl->setContent($form->getHtml()); return 0; } $fromtime = strtotime(date('Y-m-d H:00', time())); $totime = strtotime(date('Y-m-d', time() + 60 * 60 * 24 * 15)) - 1; $meetings = ilObjAdobeConnect::getMeetingsInRange($fromtime, $totime); $meetingsByDay = $this->getFreeMeetingSlotTable($meetings); $ranges = array(); $t0 = $fromtime; $t1 = $fromtime; /* * 2 * 30 minutes for starting and ending buffer * 10 minutes as minimum meeting length */ $bufferingTime = 30 * 60 * 2 + 10 * 60; $prev_dayinmonth = date('d', $t1); for (; $t1 < $totime; $t1 += 60 * 15) { $day = date('Y-m-d', $t1); $hour = date('H', $t1) * 60 + floor(date('i', $t1) / 15) * 15; $dayinmonth = date('d', $t1); if ($meetingsByDay[$day] && $meetingsByDay[$day][$hour] && $meetingsByDay[$day][$hour] >= $num_max_ac_obj || $dayinmonth != $prev_dayinmonth) { if ($t0 != $t1 && $t1 - $t0 > $bufferingTime) { $ranges[] = array($t0, $t1 - 1, $t1 - $t0); } if ($dayinmonth != $prev_dayinmonth) { $prev_dayinmonth = $dayinmonth; $t0 = $t1; } else { $t0 = $t1 + 60 * 15; } } } if ($t0 != $t1) { $ranges[] = array($t0, $t1 - 1, $t1 - $t0); } $data = array(); foreach ($ranges as $r) { $size_hours = floor($r[2] / 60 / 60); $size_minutes = ($r[2] - $size_hours * 60 * 60) / 60; $data[] = array('sched_from' => ilDatePresentation::formatDate(new ilDateTime($r[0], IL_CAL_UNIX)), 'sched_to' => ilDatePresentation::formatDate(new ilDateTime($r[1], IL_CAL_UNIX)), 'sched_size' => str_pad($size_hours, 2, '0', STR_PAD_LEFT) . ':' . str_pad($size_minutes, 2, '0', STR_PAD_LEFT)); } require_once 'Services/Table/classes/class.ilTable2GUI.php'; $tgui = new ilTable2GUI($this); $tgui->addColumn($this->txt('sched_from')); $tgui->addColumn($this->txt('sched_to')); $tgui->addColumn($this->txt('sched_size')); $tgui->setExternalSegmentation(true); $tgui->enabled['footer'] = false; // $tgui->setRowTemplate('tpl.schedule_row.html', 'Customizing/global/plugins/Services/Repository/RepositoryObject/AdobeConnect'); $tgui->setRowTemplate('tpl.schedule_row.html', $this->pluginObj->getDirectory()); $tgui->setData($data); $tgui->setTitle(sprintf($this->txt('schedule_free_slots'), date('z', $totime - $fromtime))); $tpl->setContent($form->getHtml() . '<br />' . $tgui->getHTML()); }