예제 #1
0
 function LCUser($props, $prefix)
 {
     $prefixUtil = new PrefixUtil();
     $userID = $prefixUtil->trimPrefix($props[ATTRIB_USER_ID], $prefix);
     $this->userId = $userID;
     $this->setFirstName($props[ATTRIB_FIRST_NAME]);
     $this->setLastName($props[ATTRIB_LAST_NAME]);
 }
예제 #2
0
/**
 * Validate the data in passed in the configuration page
 * 
 * @param  $config - the information from the form mod.html
 * @return nothing , but returns an error if the configuration is wrong
 */
function liveclassroom_process_options(&$config)
{
    global $CFG, $USER;
    /*******
       we do the following verfication before submitting the configuration
       -The parameters sent can not be empty
       -The url of the server can not finish with a /
       -The url must start with http:// 
       -The api account has to valid
       ********/
    $config->servername = trim($config->servername);
    $config->adminusername = trim($config->adminusername);
    $config->adminpassword = trim($config->adminpassword);
    if (!isadmin($USER->id)) {
        wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom'));
        error(get_string('errormustbeadmin', 'liveclassroom'));
    }
    if (empty($config->servername)) {
        wimba_add_log(WIMBA_ERROR, WC, get_string('wrongconfigurationURLunavailable', 'liveclassroom'));
        error(get_string('wrongconfigurationURLunavailable', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
    } else {
        if (empty($config->adminusername)) {
            wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminUsername', 'liveclassroom'));
            error(get_string('emptyAdminUsername', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
        } else {
            if (empty($config->adminpassword)) {
                wimba_add_log(WIMBA_ERROR, WC, get_string('emptyAdminPassword', 'liveclassroom'));
                error(get_string('emptyAdminPassword', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
            }
        }
    }
    $length = strlen($config->servername);
    if ($config->servername[$length - 1] == '/') {
        wimba_add_log(WIMBA_ERROR, WC, get_String('trailingSlash', 'liveclassroom'));
        error(get_String('trailingSlash', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
    }
    if (!preg_match('/^http:\\/\\//', $config->servername)) {
        wimba_add_log(WIMBA_ERROR, WC, get_String('trailingHttp', 'liveclassroom'));
        error(get_String('trailingHttp', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
    }
    $prefixUtil = new PrefixUtil();
    $prefix = $prefixUtil->getPrefix($config->adminusername);
    $api = new LCApi($config->servername, $config->adminusername, $config->adminpassword, $prefix);
    if (!$api->lcapi_authenticate()) {
        wimba_add_log(WIMBA_ERROR, WC, get_string('wrongadminpass', 'liveclassroom'));
        error(get_string('wrongadminpass', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
    }
    $domxml = false;
    $php_extension = get_loaded_extensions();
    for ($i = 0; $i < count($php_extension); $i++) {
        if ($php_extension[$i] == "libxml" || $php_extension[$i] == "domxml") {
            $domxml = true;
        }
    }
    if ($domxml === false) {
        wimba_add_log(WIMBA_ERROR, WC, get_string('domxml', 'liveclassroom'));
        error(get_string('domxml', 'liveclassroom'), $_SERVER["HTTP_REFERER"]);
    }
    return;
}
예제 #3
0
 function setByRecord($currentRecord, $prefix)
 {
     // room attributes
     $prefixUtil = new PrefixUtil();
     $rid = $prefixUtil->trimPrefix($this->getKeyValue($currentRecord, ATTRIB_ROOM_ID), $prefix);
     $this->setRoomId($rid);
     $this->setDescription($this->getKeyValue($currentRecord, ATTRIB_ROOM_DESCRIPTION));
     $this->setLongname($this->getKeyValue($currentRecord, ATTRIB_ROOM_LONG_NAME));
     $this->setContactEmail($this->getKeyValue($currentRecord, ATTRIB_ROOM_CONTACT_EMAIL));
     $this->setArchive($this->getKeyValue($currentRecord, ATTRIB_ROOM_ARCHIVE));
     $this->setPreview($this->getKeyValue($currentRecord, ATTRIB_ROOM_PREVIEW));
     $this->setBORAutoMoveInstructors($this->getKeyValue($currentRecord, ATTRIB_BOR_AUTO_MOVE_INSTRUCTORS));
     $this->setBORAutoMoveSelf($this->getKeyValue($currentRecord, ATTRIB_BOR_AUTO_MOVE_SELF));
     $this->setBORCarouselsPublic($this->getKeyValue($currentRecord, ATTRIB_BOR_CAROUSELS_PUBLIC));
     $this->setBOREnabled($this->getKeyValue($currentRecord, ATTRIB_BOR_ENABLED));
     $this->setBORInitialNumber($this->getKeyValue($currentRecord, ATTRIB_BOR_INITIAL_NUMBER));
     $this->setBORShowRoomCarousels($this->getKeyValue($currentRecord, ATTRIB_BOR_SHOW_ROOM_CAROUSELS));
     $this->setUserstatusEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_USERSTATUS_ENABLED));
     $this->setSendUserstatusUpdates($this->getKeyValue($currentRecord, ATTRIB_ROOM_SEND_USERSTATUS_UPDATES));
     // Media Settings
     // Compatible with LC 5.X
     $this->setHmsSimulcast($this->getKeyValue($currentRecord, ATTRIB_ROOM_HMS_SIMULCAST));
     $this->setHmsSimulcastRestricted($this->getKeyValue($currentRecord, ATTRIB_ROOM_HMS_SIMULCAST_RESTRICTED));
     $this->setHmsTwoWayEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_HMS_TWO_WAY_ENABLED));
     $this->setMediaFormat($this->getKeyValue($currentRecord, ATTRIB_ROOM_MEDIA_FORMAT));
     $this->setMediaType($this->getKeyValue($currentRecord, ATTRIB_ROOM_MEDIA_TYPE));
     $this->setVideoFrameWidth($this->getKeyValue($currentRecord, ATTRIB_ROOM_VF_WIDTH));
     $this->setVideoFrameHeight($this->getKeyValue($currentRecord, ATTRIB_ROOM_VF_HEIGHT));
     $this->setVideoFrameLocation($this->getKeyValue($currentRecord, ATTRIB_ROOM_VF_LOCATION));
     $this->setVideoFrameSet($this->getKeyValue($currentRecord, ATTRIB_ROOM_VIDEOFRAMESET));
     $this->setStudentVideoOnStartupEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_ENABLE_STUDENT_VIDEO_ON_STARTUP));
     // setVideoWindowSizeOnStartup((String)currentRecord[ATTRIB_ROOM_HMS_VIDEO_WINDOW_SIZE_ON_STARTUP));
     // setVideoWindowEncodingSize((String)currentRecord[ATTRIB_ROOM_HMS_VIDEO_WINDOW_ENCODING_SIZE));
     // setVideoDefaultBitRate((String)currentRecord[ATTRIB_ROOM_HMS_VIDEO_DEFAULT_BIT_RATE));
     // setVideoBitRateCeiling((String)currentRecord[ATTRIB_ROOM_HMS_VIDEO_BIT_RATE_CEILING));
     $this->setVideoBandwidth($this->getKeyValue($currentRecord, ATTRIB_ROOM_HMS_VIDEO_BANDWIDTH));
     // Advanced settings
     $this->setArchiveEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_ARCHIVE));
     $this->setEboardEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_EBOARD));
     $this->setLiveShareEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_LIVESHARE));
     $this->setLogChatEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_LOGCHAT));
     $this->setMoveStudentEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_MOVE_STUDENT));
     $this->setPptImportEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_PPT_IMPORT));
     $this->setShowWebEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_SHOW_WEB));
     $this->setChatEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CHATENABLE));
     $this->setPrivateChatEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_PRIVATECHATENABLE));
     $this->setStudentWhiteboardEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_STUDENT_WB_ENABLED));
     $this->setStudentLiveAppEnabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_STUDENT_WB_LIVEAPP));
     // Access
     $this->setUserLimit($this->getKeyValue($currentRecord, ATTRIB_ROOM_USERLIMIT));
     // PINs are compatible with LC 4.3.0+
     $this->setParticipantPin($this->getKeyValue($currentRecord, ATTRIB_ROOM_PARTICIPANT_PIN));
     $this->setPresenterPin($this->getKeyValue($currentRecord, ATTRIB_ROOM_PRESENTER_PIN));
     $this->setArchiveVersion($this->getKeyValue($currentRecord, ATTRIB_ARCHIVE_VERSION));
     //Mp4
     $this->setMp4EncodingType($this->getKeyValue($currentRecord, ATTRIB_ROOM_MP4_ENCODING_TYPE));
     $this->setMp4MediaPriority($this->getKeyValue($currentRecord, ATTRIB_ROOM_MP4_MEDIA_PRIORITY));
     $this->setDownloadMP3Enabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_DOWNLOAD_MP3));
     $this->setDownloadMP4Enabled($this->getKeyValue($currentRecord, ATTRIB_ROOM_CAN_DOWNLOAD_MP4));
     $this->setAutoOpenArchive($this->getKeyValue($currentRecord, ATTRIB_ROOM_AUTO_OPEN_NEW_ARCHIVES));
 }