コード例 #1
0
ファイル: conference.php プロジェクト: abhinay100/forma_app
function conference_startnewconf($url)
{
    checkPerm('view');
    $mod_perm = checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    if (isset($_POST['create_conf'])) {
        $conference = new Conference_Manager();
        $start_date = Format::dateDb($_POST['start_date'], 'date');
        $start_date = substr($start_date, 0, 10);
        $start_time = (strlen($_POST['start_time']['hour']) == 1 ? '0' : '') . $_POST['start_time']['hour'] . ':' . (strlen($_POST['start_time']['minute']) == 1 ? '0' : '') . $_POST['start_time']['minute'] . ':00';
        $start_timestamp = fromDatetimeToTimestamp($start_date . ' ' . $start_time);
        $conference_name = trim($_POST["conference_name"]) ? trim($_POST["conference_name"]) : $lang->def('_VIDEOCONFERENCE');
        $meetinghours = (int) $_POST["meetinghours"];
        $end_timestamp = $start_timestamp + $meetinghours * 3600;
        $maxparticipants = (int) $_POST["maxparticipants"];
        $idCourse = $_SESSION['idCourse'];
        $room_type = $_POST["room_type"];
        if ($conference->can_create_room_limit(getLogUserId(), $idCourse, $room_type, $start_timestamp, $end_timestamp) && $conference->can_create_user_limit(getLogUserId(), $idCourse, $start_timestamp)) {
            $conference->insert_room($idCourse, getLogUserId(), $conference_name, $room_type, $start_timestamp, $end_timestamp, $meetinghours, $maxparticipants, isset($_POST['bookable']) ? 1 : 0, $start_date, (int) $_POST['start_time']['hour'], (int) $_POST['start_time']['minute']);
            Util::jump_to('index.php?modname=conference&op=list');
        } else {
            $title_page = array('index.php?modname=conference&op=list' => $lang->def('_VIDEOCONFERENCE'), $lang->def('_CREATE'));
            $GLOBALS['page']->add(getTitleArea($title_page, 'conference', $lang->def('_VIDEOCONFERENCE')) . '<div class="std_block">' . '<span><strong>' . $lang->def('_NO_MORE_ROOM') . '</strong></span>' . '</div>', 'content');
            return false;
        }
    }
    $start_time['hour'] = date('H');
    $start_time['minute'] = date('i');
    $start_date = importVar('start_date', false, date("Y-m-d H:i:s"));
    $conf_system = array();
    //$conf_system[""]="";
    $default = "";
    $default_maxp = 30;
    if (Get::sett('code_teleskill')) {
        $conf_system["teleskill"] = "teleskill";
    }
    if (Get::sett('dimdim_server') and Get::sett('dimdim_user') and Get::sett('dimdim_password')) {
        $conf_system["dimdim"] = "dimdim";
    }
    if (Get::sett('bbb_server') and Get::sett('bbb_user') and Get::sett('bbb_salt') and Get::sett('bbb_password_moderator') and Get::sett('bbb_password_viewer')) {
        $conf_system["bbb"] = "Big Blue Button";
        $default = "bbb";
        $default_maxp = Get::sett('bbb_max_participant');
    }
    YuiLib::load();
    //addJs($GLOBALS['where_lms_relative'].'/modules/conference/', 'ajax_conference.js');
    $GLOBALS['page']->add(getTitleArea($lang->def('_VIDEOCONFERENCE'), 'conference') . '<div class="std_block">', 'content');
    $GLOBALS['page']->add(Form::openForm('create_conference', $url->getUrl('op=startnewconf')) . Form::openElementSpace() . Form::getTextfield($lang->def('_VIDEOCONFERENCE'), 'conference_name', 'conference_name', 255, importVar('conference_name')) . Form::getLineBox($lang->def('_CONFERENCE_SYSTEM'), Form::getInputDropdown('', 'room_type', 'room_type', $conf_system, $default, '')) . Form::getDatefield($lang->def('_START_DATE'), 'start_date', 'start_date', Format::date($start_date, 'date')) . Form::getLineBox($lang->def('_AT_HOUR'), Form::getInputDropdown('', 'start_time_hour', 'start_time[hour]', range(0, 23), importVar('start_time_hour', false, date("H")), '') . ' : ' . Form::getInputDropdown('', 'start_time_minute', 'start_time[minute]', range(0, 59), importVar('start_time_hour', false, date("i")), '')) . Form::getLineBox($lang->def('_MEETING_HOURS'), Form::getInputDropdown('', 'meetinghours', 'meetinghours', range(0, 5), importVar('meetinghours', false, 2), '')) . Form::getTextfield($lang->def('_MAX_PARTICIPANTS'), 'maxparticipants', 'maxparticipants', 6, importVar('maxparticipants', true, $default_maxp)), 'content');
    if (Get::sett('use_dimdim_api') === 'on') {
        $GLOBALS['page']->add('<div id="dimdim_conf" style="' . ($default === 'dimdim' ? 'display:block;' : 'display:none;') . '">' . Form::getOpenFieldset(Lang::t('_DIMDIM_FEATURES', 'conference'), 'dimdim_features') . Form::getCheckbox(Lang::t('_SHOW_WAITING_AREA', 'conference'), 'lobbyEnabled', 'lobbyEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PRIVATE_CHAT', 'conference'), 'privateChatEnabled', 'privateChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PUBLIC_CHAT', 'conference'), 'publicChatEnabled', 'publicChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DESKTOP_SHARING', 'conference'), 'screenShareEnabled', 'screenShareEnabled', '1') . Form::getCheckbox(Lang::t('_ASSIGN_MIC_TO_ATTENDEES', 'conference'), 'autoAssignMikeOnJoin', 'autoAssignMikeOnJoin', '1') . Form::getCheckbox(Lang::t('_ENABLE_WHITEBOARD', 'conference'), 'whiteboardEnabled', 'whiteboardEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DOCUMENTS_SHARING', 'conference'), 'documentSharingEnabled', 'documentSharingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_RECORDING', 'conference'), 'recordingEnabled', 'recordingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_HANDS_FREE', 'conference'), 'autoHandsFreeOnAVLoad', 'autoHandsFreeOnAVLoad', '1') . Form::getCheckbox(Lang::t('_START_MAIL', 'conference'), 'joinEmailRequired', 'joinEmailRequired', '1') . '<script type="text/javascript">' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' YAHOO.util.Event.addListener(room_type, \'change\', dimdimEvent);' . ' function dimdimEvent(e)' . ' {' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' var dimdim_conf = YAHOO.util.Dom.get(\'dimdim_conf\');' . ' if(room_type.value == "dimdim")' . ' dimdim_conf.style.display = "block";' . ' else' . ' dimdim_conf.style.display = "none";' . ' }' . '</script>' . Form::getCloseFieldset() . '</div>', 'content');
    }
    $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('create_conf', 'create_conf', $lang->def('_CREATE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}