Пример #1
0
function liveclassroom_backup_one_mod($bf, $preferences, $liveclassroom)
{
    global $CFG;
    if (is_numeric($liveclassroom)) {
        $liveclassroom = get_record('liveclassroom', 'id', $liveclassroom);
    }
    $status = true;
    $lcAction = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, null, $liveclassroom->course);
    $roomPreview = $lcAction->getRoomPreview($liveclassroom->type);
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print liveclassroom data
    fwrite($bf, full_tag("ID", 4, false, $liveclassroom->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "liveclassroom"));
    fwrite($bf, full_tag("COURSE", 4, false, $liveclassroom->course));
    fwrite($bf, full_tag("NAME", 4, false, $liveclassroom->name));
    if ($lcAction->isStudentAdmin($liveclassroom->course, $liveclassroom->course . '_S') == "true") {
        fwrite($bf, full_tag("ISSTUDENTADMIN", 4, false, "true"));
    } else {
        fwrite($bf, full_tag("ISSTUDENTADMIN", 4, false, "false"));
    }
    fwrite($bf, full_tag("PREVIEW", 4, false, $roomPreview));
    fwrite($bf, full_tag("TYPE", 4, false, $liveclassroom->type));
    fwrite($bf, full_tag("SECTION", 4, false, $liveclassroom->section));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $liveclassroom->timemodified));
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
    }
}
global $error;
$params = array();
foreach (getKeysOfGeneralParameters() as $param) {
    $value = optional_param($param["value"], $param["default_value"], $param["type"]);
    if ($value != null) {
        $params[$param["value"]] = $value;
    }
}
require_login($params["enc_course_id"]);
set_error_handler("manage_error");
$action = optional_param('action', PARAM_ALPHA);
$currentIdtab = optional_param('idtab', null, PARAM_CLEAN);
$session = new WimbaMoodleSession($params);
$api = new LCAction($session, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
$uiManager = new WimbaUI($params, $api, $currentIdtab);
if ($uiManager->getSessionError() === false) {
    if ($action == 'update') {
        $roomId = required_param('resource_id', PARAM_SAFEDIR);
        $room_info = $api->getRoom($roomId);
        if ($room_info) {
            $uiManager->setCurrentProduct("liveclassroom", $room_info);
        } else {
            //problem to get the lc resource
            $uiManager->setError(get_string('error_connection_lc', 'liveclassroom'));
        }
    } else {
        $uiManager->setCurrentProduct("liveclassroom");
    }
    $uiManager->getLCSettingsView($action);
Пример #3
0
 *      51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA                *
 *                                                                            *
 * Author: Hazan Samy                                                         *
 *                                                                            *
 * Date: November 2006                                                        *
 *                                                                            *
 ******************************************************************************/
/* $Id: reports.php 76025 2009-08-26 11:39:42Z trollinger $ */
/// This page is to displayed the reports of a room
require_once "../../config.php";
require_once "lib.php";
require_once "lib/php/lc/lcapi.php";
require_once "lib/php/lc/LCAction.php";
$roomId = required_param('id', PARAM_SAFEDIR);
$token = required_param('hzA', PARAM_RAW);
$api = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
$room_info = $api->getRoom($roomId);
?>
<html>
<head>
<link rel="STYLESHEET" href="css/StyleSheet.css" type="text/css" />
<script type="text/javascript" src='<?php 
echo $CFG->liveclassroom_servername;
?>
/js/launch.js'></script>
</head>
<body>
    <table border="0" width="96%" cellpadding="0" cellspacing="0">
      <tr class="divider">
        <td colspan=2 class="page_title"><img src="icon.gif" alt="Live Classroom" title="Live Classroom" border="0"/>View Reports</td>
      </tr>
Пример #4
0
/**
* Actual implementation of the rest coures functionality, delete all the
* chat messages for course $data->courseid.
* @param $data the data submitted from the reset course.
* @return array status array
*/
function liveclassroom_reset_userdata($data, $showfeedback = true)
{
    global $CFG, $COURSE;
    $componentstr = get_string('modulenameplural', 'liveclassroom');
    $status = array();
    if (!empty($data->reset_content_liveclassroom_all)) {
        $api = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
        $rooms = $api->getRooms($data->id . "_T");
        foreach ($rooms as $room) {
            if ($room->isArchive() == 0) {
                $isAdmin = $api->isStudentAdmin($room->getRoomId(), $data->id . "_S");
                $api->cloneRoom($data->id, $room->getRoomId(), "0", $isAdmin, $room->isPreview());
                if ($isAdmin == "true") {
                    $api->removeRole($room->getRoomId(), $data->id . "_S", "Student");
                    $api->removeRole($room->getRoomId(), $data->id . "_T", "ClassAdmin");
                } else {
                    $api->removeRole($room->getRoomId(), $data->id . "_S", "Instructor");
                    $api->removeRole($room->getRoomId(), $data->id . "_T", "ClassAdmin");
                }
            } else {
                $api->deleteRoom($room->getRoomId());
            }
            $activities = get_records("liveclassroom", "id", $room->getRoomId());
            foreach (array_keys($activities) as $id) {
                $activities[$id]->rid = new_rid;
                update_record("liveclassroom", $activities[$id]);
            }
        }
        $typesstr = "Delete all the archives and content";
        $status[] = array('component' => $componentstr, 'item' => $typesstr, 'error' => false);
    } else {
        if (!empty($data->reset_content_liveclassroom_archives)) {
            $api = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
            $rooms = $api->getRooms($data->id . "_T");
            foreach ($rooms as $room) {
                if ($room->isArchive() == 1) {
                    $api->deleteRoom($room->getRoomId());
                }
            }
            $typesstr = "Delete only the archives";
            $status[] = array('component' => $componentstr, 'item' => $typesstr, 'error' => false);
        }
    }
    return $status;
}
Пример #5
0
function liveclassroom_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    $userdata = restore_userdata_selected($restore, "liveclassroom", $mod->id);
    $lcAction = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot, $restore->course_id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //add logs
        //Now, build the liveclassroom record structure
        $copy_content = 0;
        if ($userdata) {
            $copy_content = 1;
        }
        $sameResource = get_record("liveclassroom", "fromid", $info['MOD']['#']['TYPE']['0']['#'], "course", $restore->course_id, "copy_content", $copy_content);
        $resource = get_record("liveclassroom", "fromid", $info['MOD']['#']['TYPE']['0']['#'], "course", $restore->course_id, "copy_content", $copy_content == 1 ? 0 : 1);
        if (empty($sameResource)) {
            if (!($new_lc_id = $lcAction->cloneRoom($restore->course_id, $info['MOD']['#']['TYPE']['0']['#'], $userdata, $info['MOD']['#']['ISSTUDENTADMIN']['0']['#'], $info['MOD']['#']['PREVIEW']['0']['#']))) {
                return false;
                //there is a problem during the copy of the room
            }
            if (!empty($resource)) {
                if ($userdata) {
                    $room = $lcAction->getRoom($new_lc_id);
                    $room->setLongname($room->getLongname() . " with user data");
                    $lcAction->api->lcapi_modify_room($new_lc_id, $room->getAttributes());
                } else {
                    $room = $lcAction->getRoom($resource->type);
                    $room->setLongname($room->getLongname() . " with user data");
                    $lcAction->api->lcapi_modify_room($resource->type, $room->getAttributes());
                }
            }
        } else {
            $new_lc_id = $resource->type;
        }
        $liveclassroom->course = backup_todb($restore->course_id);
        $liveclassroom->type = backup_todb($new_lc_id);
        $liveclassroom->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $liveclassroom->section = backup_todb($info['MOD']['#']['SECTION']['0']['#']);
        $liveclassroom->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        $liveclassroom->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        $liveclassroom->fromid = $info['MOD']['#']['TYPE']['0']['#'];
        $liveclassroom->copy_content = $copy_content;
        $liveclassroom->isfirst = 1;
        //The structure is equal to the db, so insert the liveclassroom
        $newid = insert_record("liveclassroom", $liveclassroom);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "liveclassroom") . " \"" . format_string(stripslashes($liveclassroom->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
    }
}
$keys = array_merge(getKeysOfGeneralParameters(), getKeyWimbaClassroomForm());
$params = array();
foreach ($keys as $param) {
    $value = optional_param($param["value"], $param["default_value"], $param["type"]);
    $params[$param["value"]] = $value;
}
require_login($params["enc_course_id"]);
$action = $params["action"];
$roomId = $params["resource_id"];
$rid_audio = $params["rid_audio"];
$session = new WimbaMoodleSession($params);
$xml = new WimbaXml();
if ($session->error === false && $session != NULL) {
    $api = new LCAction($session, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
    $prefix = $api->getPrefix();
    switch ($action) {
        case "launch":
            $roomId = required_param('resource_id', PARAM_SAFEDIR);
            if ($params["studentView"] == "true") {
                $authToken = $api->getAuthokenNormal($session->getCourseId() . "_S", $session->getFirstname(), $session->getLastname());
            } else {
                $authToken = $api->getAuthoken();
            }
            redirection($CFG->liveclassroom_servername . '/main/horizon_ui.pl.epl?' . 'channel=' . $api->getPrefix() . $roomId . '&hzA=' . $authToken);
            break;
        case "create":
            $id = $api->createRoom($roomId, "false");
            $messageAction = "created";
            $messageProduct = "room";
Пример #7
0
    }
    if (!($course = get_record("course", "id", $liveclassroom->course))) {
        error("Course is misconfigured");
    }
    if (!($cm = get_coursemodule_from_instance("liveclassroom", $liveclassroom->id, $course->id))) {
        error("Course Module ID was incorrect");
    }
}
require_login($course->id);
if ($liveclassroom->isfirst == 0) {
    $liveclassroom->isfirst = 1;
    $liveclassroom->name = addslashes($liveclassroom->name);
    update_record("liveclassroom", $liveclassroom);
    redirection("{$CFG->wwwroot}/course/view.php?id={$course->id}");
}
$api = new LCAction(null, $CFG->liveclassroom_servername, $CFG->liveclassroom_adminusername, $CFG->liveclassroom_adminpassword, $CFG->dataroot);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
#if(getRoleForWimbaTools($course->id, $USER->id)=="Instructor")
if (liveclassroom_getRole($context) == "Instructor") {
    $authToken = $api->getAuthokenNormal($course->id . "_T", $USER->firstname, $USER->lastname);
} else {
    $authToken = $api->getAuthokenNormal($course->id . "_S", $USER->firstname, $USER->lastname);
}
$classid = $liveclassroom->type;
//get the room
$room = $api->getRoom($classid);
$strliveclassrooms = get_string("modulenameplural", "liveclassroom");
$strliveclassroom = get_string("modulename", "liveclassroom");
if (function_exists("build_navigation")) {
    //moodle 1.9
    $cm->modname = "liveclassroom";