Ejemplo n.º 1
0
function delete_wiki($groupId)
{
    $tblList = claro_sql_get_course_tbl();
    $config = array();
    $config["tbl_wiki_properties"] = $tblList["wiki_properties"];
    $config["tbl_wiki_pages"] = $tblList["wiki_pages"];
    $config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
    $config["tbl_wiki_acls"] = $tblList["wiki_acls"];
    $con = Claroline::getDatabase();
    $store = new WikiStore($con, $config);
    if (strtoupper($groupId) == 'ALL') {
        $wikiList = $store->getGroupWikiList();
    } else {
        $wikiList = $store->getWikiListByGroup($groupId);
    }
    if (count($wikiList) > 0) {
        foreach ($wikiList as $wiki) {
            $store->deleteWiki($wiki['id']);
        }
    }
}
Ejemplo n.º 2
0
            if (is_object($result)) {
                $group_name = $result->name;
                $navigation[] = array('url' => '../group/index.php?course=' . $course_code, 'name' => $langGroups);
                $navigation[] = array('url' => '../group/group_space.php?course=' . $course_code, 'name' => $group_name);
            }
        } else {
            //redirect user to course wiki
            header("Location: index.php?course={$course_code}");
            exit;
        }
    }
} else {
    $groupId = 0;
}
// Objects instantiation
$wikiStore = new WikiStore();
if (!$wikiStore->wikiIdExists($wikiId)) {
    die($langWikiInvalidWikiId);
    draw($tool_content, 2, null, $head_content);
}
$wiki = $wikiStore->loadWiki($wikiId);
$wikiPage = new WikiPage($wikiId);
$wikiRenderer = new Wiki2xhtmlRenderer($wiki);
$accessControlList = $wiki->getACL();
// --------------- Start of access rights management --------------
// Wiki access levels
$is_allowedToEdit = false;
$is_allowedToRead = false;
$is_allowedToCreate = false;
// set user access rights using user status and wiki access control list
if ($groupId != 0 && $is_groupAllowed) {
Ejemplo n.º 3
0
    }
}
// Database nitialisation
$tblList = claro_sql_get_course_tbl();
$config = array();
$config['tbl_wiki_properties'] = $tblList['wiki_properties'];
$config['tbl_wiki_pages'] = $tblList['wiki_pages'];
$config['tbl_wiki_pages_content'] = $tblList['wiki_pages_content'];
$config['tbl_wiki_acls'] = $tblList['wiki_acls'];
$con = Claroline::getDatabase();
// DEVEL_MODE database initialisation
if (defined('DEVEL_MODE') && DEVEL_MODE == true) {
    init_wiki_tables($con, false);
}
// Objects instantiation
$wikiStore = new WikiStore($con, $config);
$wikiList = array();
// --------- Start of command processing ----------------
switch ($action) {
    case 'exExport':
        require_once "lib/class.wiki2xhtmlexport.php";
        if (!$wikiStore->wikiIdExists($wikiId)) {
            // die( get_lang("Invalid Wiki Id") );
            $message = get_lang("Invalid Wiki Id");
            $dialogBox->error($message);
            $action = 'error';
        } else {
            $wiki = $wikiStore->loadWiki($wikiId);
            $wikiTitle = $wiki->getTitle();
            $renderer = new WikiToSingleHTMLExporter($wiki);
            $contents = $renderer->export();
Ejemplo n.º 4
0
            Indexer::queueAsync(Indexer::REQUEST_REMOVEBYFORUM, Indexer::RESOURCE_FORUMTOPIC, $forum_id);
            Database::get()->query("DELETE FROM forum_notify WHERE forum_id = ?d AND course_id = ?d", $forum_id, $course_id);
            Database::get()->query("DELETE FROM forum WHERE id = ?d AND course_id = ?d", $forum_id, $course_id);
            Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_FORUM, $forum_id);
        }
        /*         * *********************************** */

        Database::get()->query("DELETE FROM document WHERE course_id = ?d AND subsystem = 1 AND subsystem_id = ?d", $course_id, $id);
        Database::get()->query("DELETE FROM group_members WHERE group_id = ?d", $id);
		Database::get()->query("DELETE FROM group_properties WHERE group_id = ?d", $id);
        Database::get()->query("DELETE FROM `group` WHERE id = ?d", $id);

        /*         * ********Delete Group Wiki*********** */
        $result = Database::get()->querySingle("SELECT id FROM wiki_properties WHERE group_id = ?d", $id);
        if ($result) {
            $wikiStore = new WikiStore();
            $wikiStore->deleteWiki($result->id);
        }
        /*         * *********************************** */

        Log::record($course_id, MODULE_ID_GROUPS, LOG_DELETE, array('gid' => $id,
            'name' => $myDir? $myDir->name:"[no name]"));

        $message = $langGroupDel;
    } elseif (isset($_REQUEST['empty'])) {
        Database::get()->query("DELETE FROM group_members
                                   WHERE group_id IN
                                   (SELECT id FROM `group` WHERE course_id = ?d)", $course_id);
        $message = $langGroupsEmptied;
    } elseif (isset($_REQUEST['fill'])) {
        $resGroups = Database::get()->queryArray("SELECT id, max_members -
Ejemplo n.º 5
0
    $valid_actions = array('list', 'rqEdit', 'exEdit', 'exDelete', 'exExport');
} else {
    $valid_actions = array('list');
}

$_CLEAN = filter_by_key('action', $valid_actions, 'R', false);

$action = ( isset($_CLEAN['action']) ) ? $_CLEAN['action'] : 'list';

$wikiId = (isset($_REQUEST['wikiId'])) ? intval($_REQUEST['wikiId']) : 0;

$creatorId = $uid;

// Objects instantiation

$wikiStore = new WikiStore();
$wikiList = array();

// --------- Start of command processing ----------------

switch ($action) {
	case 'exExport':
    {
        require_once "lib/class.wiki2xhtmlexport.php";

        if (!$wikiStore->wikiIdExists($wikiId)){
            $message = $langWikiInvalidWikiId;
            $action = "error";
            $style = "caution";
        }
        else{
Ejemplo n.º 6
0
// set request variables
$wikiId = isset($_REQUEST['wikiId']) ? (int) $_REQUEST['wikiId'] : 0;
// Database nitialisation
$tblList = claro_sql_get_course_tbl();
$config = array();
$config["tbl_wiki_properties"] = $tblList["wiki_properties"];
$config["tbl_wiki_pages"] = $tblList["wiki_pages"];
$config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
$config["tbl_wiki_acls"] = $tblList["wiki_acls"];
$con = Claroline::getDatabase();
// auto create wiki in devel mode
if (defined("DEVEL_MODE") && DEVEL_MODE == true) {
    init_wiki_tables($con, false);
}
// Objects instantiation
$wikiStore = new WikiStore($con, $config);
if (!$wikiStore->wikiIdExists($wikiId)) {
    die(get_lang("Invalid Wiki Id"));
}
$wiki = $wikiStore->loadWiki($wikiId);
$wikiPage = new WikiPage($con, $config, $wikiId);
$wikiRenderer = new Wiki2xhtmlRenderer($wiki);
$accessControlList = $wiki->getACL();
// --------------- Start of access rights management --------------
// Wiki access levels
$is_allowedToEdit = false;
$is_allowedToRead = false;
$is_allowedToCreate = false;
// set user access rights using user status and wiki access control list
if (claro_is_in_a_group() && claro_is_group_allowed()) {
    // group_context
Ejemplo n.º 7
0
    }
    if ($wikiACL['other_read'] == false and $wikiACL['other_edit'] == true) {
        $wikiACL['other_edit'] = false;
    }
    if ($wikiACL['course_edit'] == false and $wikiACL['course_create'] == true) {
        $wikiACL['course_create'] = false;
    }
    if ($wikiACL['group_edit'] == false and $wikiACL['group_create'] == true) {
        $wikiACL['group_create'] = false;
    }
    if ($wikiACL['other_edit'] == false and $wikiACL['other_create'] == true) {
        $wikiACL['other_create'] = false;
    }
}
// Objects instantiation
$wikiStore = new WikiStore();
$wikiList = array();
// --------- Start of command processing ----------------
switch ($action) {
    case 'exExport':
        require_once "lib/class.wiki2xhtmlexport.php";
        if (!$wikiStore->wikiIdExists($wikiId)) {
            $message = $langWikiInvalidWikiId;
            $action = "error";
            $style = "caution";
        } else {
            $wiki = $wikiStore->loadWiki($wikiId);
            $wikiTitle = $wiki->getTitle();
            $renderer = new WikiToSingleHTMLExporter($wiki);
            $contents = $renderer->export();
            header('Content-Description: File Transfer');