8 include_once
"./Services/Object/classes/class.ilObject.php";
9 include_once (
"./Modules/Wiki/classes/class.ilWikiUtil.php");
30 function ilObjWiki($a_id = 0,$a_call_by_reference =
true)
33 $this->
ilObject($a_id,$a_call_by_reference);
43 $this->online = $a_online;
63 $this->rating_overall = (bool)$a_rating;
73 return $this->rating_overall;
83 $this->rating = (bool)$a_rating;
103 $this->rating_block = (bool)$a_rating;
113 return $this->rating_block;
123 $this->rating_new_pages = (bool)$a_rating;
133 return $this->rating_new_pages;
143 $this->rating_categories = (bool)$a_rating;
153 return $this->rating_categories;
161 $this->public_notes = $a_val;
179 $this->imp_pages = $a_val;
189 return $this->imp_pages;
209 return $this->startpage;
219 $this->shorttitle = $a_shorttitle;
229 return $this->shorttitle;
239 $this->introduction = $a_introduction;
249 return $this->introduction;
257 return $this->style_id;
265 $this->style_id = $a_style_id;
275 $this->page_toc = $a_val;
285 return $this->page_toc;
295 if ($a_ref_id > 0 && $a_ref_id == OH_REF_ID)
305 function create($a_prevent_start_page_creation =
false)
311 $ilDB->insert(
"il_wiki_data", array(
312 "id" => array(
"integer", $this->
getId()),
313 "is_online" => array(
"integer", (
int) $this->
getOnline()),
316 "rating" => array(
"integer", (
int) $this->
getRating()),
317 "public_notes" => array(
"integer", (
int) $this->
getPublicNotes()),
322 if ($this->
getStartPage() !=
"" && !$a_prevent_start_page_creation)
324 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
326 $start_page->setWikiId($this->
getId());
328 $start_page->create();
333 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
344 function update($a_prevent_start_page_creation =
false)
348 if (!parent::update())
353 $ilDB->update(
"il_wiki_data", array(
354 "is_online" => array(
"integer", $this->
getOnline()),
358 "rating" => array(
"integer", $this->
getRating()),
365 "page_toc" => array(
"integer", $this->
getPageToc())
367 "id" => array(
"integer", $this->
getId())
371 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
373 && !$a_prevent_start_page_creation)
376 $start_page->setWikiId($this->
getId());
378 $start_page->create();
381 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
396 $query =
"SELECT * FROM il_wiki_data WHERE id = ".
397 $ilDB->quote($this->
getId(),
"integer");
398 $set = $ilDB->query(
$query);
399 $rec = $ilDB->fetchAssoc($set);
414 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
431 if (!parent::delete())
437 $query =
"DELETE FROM il_wiki_data".
438 " WHERE id = ".$ilDB->quote($this->
getId(),
"integer");
439 $ilDB->manipulate(
$query);
442 include_once
"./Services/Notification/classes/class.ilNotification.php";
445 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
458 $res = $ilDB->queryF(
"SELECT id FROM il_wiki_data WHERE short = %s",
459 array(
"text"), array($a_short_title));
460 if ($ilDB->fetchAssoc(
$res))
491 return $roles ? $roles : array();
507 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
547 if ($a_node_id==
$_GET[
"ref_id"])
549 $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
550 $parent_type = $parent_obj->getType();
551 if($parent_type == $this->
getType())
553 $a_node_id = (int) $tree->getParentId($a_node_id);
557 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
628 private static function _lookup($a_wiki_id, $a_field)
632 $query =
"SELECT $a_field FROM il_wiki_data WHERE id = ".
633 $ilDB->quote($a_wiki_id,
"integer");
634 $set = $ilDB->query(
$query);
635 $rec = $ilDB->fetchAssoc($set);
636 return $rec[$a_field];
658 include_once(
"./Modules/Wiki/classes/class.ilWikiUtil.php");
659 $ilDB->manipulate(
"UPDATE il_wiki_data SET ".
661 " WHERE id = ".$ilDB->quote($a_id,
"integer")
671 include_once
'Services/Search/classes/class.ilQueryParser.php';
674 $query_parser->setCombination(
"or");
675 $query_parser->parse();
677 include_once
'Services/Search/classes/class.ilSearchResult.php';
679 if($query_parser->validate())
682 include_once
'Services/Search/classes/class.ilObjectSearchFactory.php';
684 $wiki_search->setFilter(array(
'wpg'));
685 $search_result->mergeEntries($wiki_search->performSearch());
688 $entries = $search_result->getEntries();
690 $found_pages = array();
691 foreach($entries as $entry)
693 if ($entry[
"obj_id"] == $a_wiki_id && is_array($entry[
"child"]))
695 foreach($entry[
"child"] as $child)
697 $found_pages[] = array(
"page_id" => $child);
731 $set = $ilDB->query(
"SELECT * FROM il_wiki_imp_pages WHERE ".
732 " wiki_id = ".$ilDB->quote($a_wiki_id,
"integer").
" ORDER BY ord ASC " 735 $imp_pages = array();
737 while ($rec = $ilDB->fetchAssoc($set))
754 $set = $ilDB->query(
"SELECT MAX(ord) as m FROM il_wiki_imp_pages WHERE ".
755 " wiki_id = ".$ilDB->quote($a_wiki_id,
"integer")
758 $rec = $ilDB->fetchAssoc($set);
759 return (
int) $rec[
"m"];
779 $ilDB->manipulate(
"INSERT INTO il_wiki_imp_pages ".
780 "(wiki_id, ord, indent, page_id) VALUES (".
781 $ilDB->quote($this->getId(),
"integer").
",".
782 $ilDB->quote($a_nr,
"integer").
",".
783 $ilDB->quote($a_indent,
"integer").
",".
784 $ilDB->quote($a_page_id,
"integer").
799 $set = $ilDB->query(
"SELECT * FROM il_wiki_imp_pages WHERE ".
800 " wiki_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
801 " page_id = ".$ilDB->quote($a_page_id,
"integer")
803 if ($rec = $ilDB->fetchAssoc($set))
819 $ilDB->manipulate(
"DELETE FROM il_wiki_imp_pages WHERE " 820 .
" wiki_id = ".$ilDB->quote($this->getId(),
"integer")
821 .
" AND page_id = ".$ilDB->quote($a_id,
"integer")
839 foreach ($ipages as $k => $v)
841 if (isset($a_ord[$v[
"page_id"]]))
843 $ipages[$k][
"ord"] = (int) $a_ord[$v[
"page_id"]];
845 if (isset($a_indent[$v[
"page_id"]]))
847 $ipages[$k][
"indent"] = (int) $a_indent[$v[
"page_id"]];
855 foreach ($ipages as $k => $v)
857 if ($ipages[$k][
"indent"] == 2 && $c_indent == 0)
859 $ipages[$k][
"indent"] = 1;
862 $c_indent = $ipages[$k][
"indent"];
867 foreach ($ipages as $k => $v)
869 $ilDB->manipulate($q =
"UPDATE il_wiki_imp_pages SET ".
870 " ord = ".$ilDB->quote($ord,
"integer").
",".
871 " indent = ".$ilDB->quote($v[
"indent"],
"integer").
872 " WHERE wiki_id = ".$ilDB->quote($v[
"wiki_id"],
"integer").
873 " AND page_id = ".$ilDB->quote($v[
"page_id"],
"integer")
893 foreach ($ipages as $k => $v)
895 if ($ipages[$k][
"indent"] == 2 && $c_indent == 0)
897 $ipages[$k][
"indent"] = 1;
900 $c_indent = $ipages[$k][
"indent"];
904 foreach ($ipages as $k => $v)
906 $ilDB->manipulate($q =
"UPDATE il_wiki_imp_pages SET ".
907 " ord = ".$ilDB->quote($ord,
"integer").
908 ", indent = ".$ilDB->quote($v[
"indent"],
"integer").
909 " WHERE wiki_id = ".$ilDB->quote($v[
"wiki_id"],
"integer").
910 " AND page_id = ".$ilDB->quote($v[
"page_id"],
"integer")
943 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
945 $new_obj->setTitle($this->
getTitle());
960 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
964 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
965 $new_id = $style_obj->ilClone();
966 $new_obj->setStyleSheetId($new_id);
971 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
973 if (count($pages) > 0)
978 $start_page->delete();
981 foreach ($pages as $p)
985 $new_page->setTitle($page->getTitle());
986 $new_page->setWikiId($new_obj->getId());
987 $new_page->setTitle($page->getTitle());
988 $new_page->setBlocked($page->getBlocked());
989 $new_page->setRating($page->getRating());
992 $page->copy($new_page->getId(),
"", 0,
true);
996 $map[$p[
"id"]] = $new_page->getId();
1002 $new_obj->addImportantPage($map[$ip[
"page_id"]], $ip[
"ord"], $ip[
"indent"]);
1006 include_once(
"./Services/Rating/classes/class.ilRatingCategory.php");
1010 $new_rc->setParentId($new_obj->getId());
1011 $new_rc->setTitle($rc[
"title"]);
1012 $new_rc->setDescription($rc[
"description"]);
static _getWikiContentSearchInstance($query_parser)
get reference of ilFulltextWikiContentSearch
static removeForObject($type, $id)
Remove all notifications for given object.
static _lookupRatingOverall($a_wiki_id)
Lookup whether rating is activated for whole object.
saveOrderingAndIndentation($a_ord, $a_indent)
Save ordering and indentation.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
setImportantPages($a_val)
Set important pages.
getRatingOverall()
Get Enable Rating For Object.
update($a_prevent_start_page_creation=false)
update object data
setOnline($a_online)
Set Online.
getStartPage()
Get Start Page.
setIntroduction($a_introduction)
Set Introduction.
static checkShortTitleAvailability($a_short_title)
Check availability of short title.
getShortTitle()
Get ShortTitle.
setPublicNotes($a_val)
Set public notes.
Class ilObject Basic functions for all objects.
static _lookupStartPage($a_wiki_id)
Lookup start page.
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
getPublicNotes()
Get public notes.
getRatingForNewPages()
Get Enable Rating For New Pages.
static _lookupRatingCategories($a_wiki_id)
Lookup whether rating categories are activated.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getRatingCategories()
Get Enable Rating Categories.
static getAllForObject($a_parent_obj_id)
Get all categories for object.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static getPageIdForTitle($a_wiki_id, $a_title)
Get wiki page object for id and title.
setRatingCategories($a_rating)
Set Enable Rating Categories.
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
ilObject($a_id=0, $a_reference=true)
Constructor public.
isImportantPage($a_page_id)
Is page an important page?
addImportantPage($a_page_id, $a_nr=0, $a_indent=0)
Add important page.
static _lookupRating($a_wiki_id)
Lookup whether rating is activated.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getPageToc()
Get page toc.
setRatingAsBlock($a_rating)
Set Enable Rating Side Block.
static _performSearch($a_wiki_id, $a_searchterm)
Search in Wiki.
fixImportantPagesNumbering()
Fix important pages numbering.
initDefaultRoles()
init default roles settings
getId()
get object id public
getRatingAsBlock()
Get Enable Rating Side Block.
cloneObject($a_target_id, $a_copy_id=0)
Clone wiki.
static _lookupRatingAsBlock($a_wiki_id)
Lookup whether rating side block is activated.
getTitle()
get object title public
static _lookupMaxOrdNrImportantPages($a_wiki_id)
Get important pages list.
getStyleSheetId()
get ID of assigned style sheet object
redirection script todo: (a better solution should control the processing via a xml file) ...
setShortTitle($a_shorttitle)
Set ShortTitle.
ilObjWiki($a_id=0, $a_call_by_reference=true)
Constructor public.
static _lookupPageToc($a_wiki_id)
Lookup whether important pages are activated.
getType()
get object type public
static makeDbTitle($a_par)
Handle page GET parameter.
setStartPage($a_startpage)
Set Start Page.
setRating($a_rating)
Set Enable Rating.
static _lookup($a_wiki_id, $a_field)
Lookup a data field.
_lookupStandard($a_id)
Lookup standard flag.
static exists($a_wiki_id, $a_title)
Checks whether a page with given title exists.
getIntroduction()
Get Introduction.
setRatingForNewPages($a_rating)
Set Enable Rating For New Pages.
static isOnlineHelpWiki($a_ref_id)
Is wiki an online help wiki?
getImportantPages()
Get important pages.
setRatingOverall($a_rating)
Set Enable Rating For Object.
create($a_prevent_start_page_creation=false)
Create new wiki.
static deleteAllPagesOfWiki($a_wiki_id)
delete wiki page and al related data
getRating()
Get Enable Rating.
static getAllPages($a_wiki_id)
Get all pages of wiki.
static _lookupImportantPages($a_wiki_id)
Lookup whether important pages are activated.
static _lookupPublicNotes($a_wiki_id)
Lookup whether public notes are activated.
setPageToc($a_val)
Set page toc.
static writeStartPage($a_id, $a_name)
Write start page.
removeImportantPage($a_id)
Remove important page.