Beispiel #1
0
     $wiki = new Wiki($con, $config);
     $wiki->setTitle($wikiTitle);
     $wiki->setDescription($wikiDesc);
     $wiki->setACL($wikiACL);
     $wiki->setGroupId($groupId);
     $wikiId = $wiki->save();
     //notify wiki modification
     $eventNotifier->notifyCourseEvent('wiki_added', claro_get_current_course_id(), claro_get_current_tool_id(), $wikiId, claro_get_current_group_id(), '0');
     $mainPageContent = sprintf(get_lang("This is the main page of the Wiki %s. Click on '''Edit''' to modify the content."), $wikiTitle);
     $wikiPage = new WikiPage($con, $config, $wikiId);
     if ($wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true)) {
         $message = get_lang("Wiki creation succeed");
         $dialogBox->success($message);
     } else {
         $message = get_lang("Wiki creation failed");
         $dialogBox->error($message . ":" . $wikiPage->getError());
     }
 } elseif ($wikiStore->wikiIdExists($wikiId)) {
     $wiki = $wikiStore->loadWiki($wikiId);
     $wiki->setTitle($wikiTitle);
     $wiki->setDescription($wikiDesc);
     $wiki->setACL($wikiACL);
     $wiki->setGroupId($groupId);
     $wikiId = $wiki->save();
     //notify wiki creation
     $eventNotifier->notifyCourseEvent('wiki_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $wikiId, claro_get_current_group_id(), '0');
     if ($wikiId) {
         $message = get_lang("Wiki edition succeed");
         $dialogBox->success($message);
     } else {
         $message = get_lang("Wiki edition failed");
Beispiel #2
0
     $content = $wikiPage->getContent();
     $changelog = $langWikiPageRevertedVersion;
     $versionId = 0;
 }
 if (isset($content)) {
     $time = date('Y-m-d H:i:s');
     if ($wikiPage->pageExists($wiki_title)) {
         $wikiPage->loadPage($wiki_title);
         if ($content == $wikiPage->getContent()) {
             $message = $langWikiIdenticalContent;
             $style = 'caution';
             $action = 'show';
         } else {
             $wikiPage->edit($creatorId, $content, $changelog, $time, true);
             if ($wikiPage->hasError()) {
                 $message = "Database error : " . $wikiPage->getError();
                 $style = "caution";
             } else {
                 $message = $langWikiPageSaved;
                 $style = "success";
             }
             $action = 'show';
         }
     } else {
         $wikiPage->create($creatorId, $wiki_title, $content, $changelog, $time, true);
         if ($wikiPage->hasError()) {
             $message = 'Database error : ' . $wikiPage->getError();
             $style = 'caution';
         } else {
             $message = $langWikiPageSaved;
             $style = 'success';
Beispiel #3
0
 $time = date("Y-m-d H:i:s");
 if ($wikiPage->pageExists($title)) {
     $wikiPage->loadPage($title);
     if ($content == $wikiPage->getContent()) {
         unset($_SESSION['wikiLastVersion']);
         $message = get_lang("Identical content<br />no modification saved");
         $dialogBox->info($message);
         $action = 'show';
     } else {
         if (isset($_SESSION['wikiLastVersion']) && $wikiPage->getLastVersionId() != $_SESSION['wikiLastVersion']) {
             $action = 'conflict';
         } else {
             $wikiPage->edit($creatorId, $content, $time, true);
             unset($_SESSION['wikiLastVersion']);
             if ($wikiPage->hasError()) {
                 $message = get_lang("Database error : ") . $wikiPage->getError();
                 $dialogBox->error($message);
             } else {
                 $message = get_lang("Page saved");
                 $dialogBox->success($message);
             }
             $action = 'show';
         }
     }
     //notify modification of the page
     $eventNotifier->notifyCourseEvent('wiki_page_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $wikiId, claro_get_current_group_id(), '0');
 } else {
     $wikiPage->create($creatorId, $title, $content, $time, true);
     if ($wikiPage->hasError()) {
         $message = get_lang("Database error : ") . $wikiPage->getError();
         $dialogBox->error($message);