コード例 #1
0
 /**
  * Fill data section
  */
 function fillDataSection()
 {
     global $ilUser;
     include_once "Services/Notes/classes/class.ilNote.php";
     $this->notes = ilNote::_getLastNotesOfUser();
     if ($this->getCurrentDetailLevel() > 1 && count($this->notes) > 0) {
         $this->setRowTemplate("tpl.pd_notes_overview.html", "Services/Notes");
         $this->getListRowData();
         //$this->setColSpan(2);
         parent::fillDataSection();
     } else {
         $this->setEnableNumInfo(false);
         if (count($this->notes) == 0) {
             $this->setEnableDetailRow(false);
         }
         $this->setDataSection($this->getOverview());
     }
 }
コード例 #2
0
ファイル: class.ilObjPoll.php プロジェクト: arlendotcn/ilias
 protected function doUpdate()
 {
     global $ilDB;
     if ($this->getId()) {
         $fields = $this->propertiesToDB();
         $ilDB->update("il_poll", $fields, array("id" => array("integer", $this->getId())));
         // #14661
         include_once "./Services/Notes/classes/class.ilNote.php";
         ilNote::activateComments($this->getId(), 0, $this->getType(), $this->getShowComments());
         if ($this->ref_id) {
             $activation = new ilObjectActivation();
             $activation->setTimingType($this->getAccessType());
             $activation->setTimingStart($this->getAccessBegin());
             $activation->setTimingEnd($this->getAccessEnd());
             $activation->toggleVisible($this->getAccessVisibility());
             $activation->update($this->ref_id);
         }
     }
 }
コード例 #3
0
 function view()
 {
     global $ilUser, $lng;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         foreach ($rel_objs as $obj) {
             $this->tpl->setCurrentBlock("related_option");
             $this->tpl->setVariable("VAL_RELATED", $obj["rep_obj_id"]);
             //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $this->tpl->setVariable("TXT_RELATED", $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]));
             } else {
                 $this->tpl->setVariable("TXT_RELATED", $lng->txt("personal_desktop"));
             }
             if ($obj["rep_obj_id"] == $this->current_rel_obj) {
                 $this->tpl->setVariable("SEL", 'selected="selected"');
             }
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("related_selection");
         $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
         $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
         $this->tpl->setVariable("TXT_FILTER", $lng->txt("filter"));
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("adm_content");
     // output notes
     $this->tpl->setVariable("NOTES", $html);
     $this->tpl->parseCurrentBlock();
 }
コード例 #4
0
 /**
  * Get xml record
  *
  * @param
  * @return
  */
 function getXmlRecord($a_entity, $a_version, $a_set)
 {
     if ($a_entity == "poll") {
         include_once "./Modules/Poll/classes/class.ilObjPoll.php";
         $dir = ilObjPoll::initStorage($a_set["Id"]);
         $a_set["Dir"] = $dir;
         include_once "./Services/Notes/classes/class.ilNote.php";
         $a_set["ShowComments"] = ilNote::commentsActivated($a_set["Id"], 0, "poll");
     }
     return $a_set;
 }
コード例 #5
0
 /**
  * Get comment count
  *
  * @param int $ref_id
  * @return int
  */
 public function getNumberOfComments($ref_id)
 {
     include_once "./Services/Notes/classes/class.ilNote.php";
     $obj_id = ilObject2::_lookupObjectId($ref_id);
     $number = ilNote::_countNotesAndComments($obj_id);
     if (count($number) == 0) {
         return 0;
     }
     return $number[$obj_id][IL_NOTE_PUBLIC];
 }
コード例 #6
0
 /**
  * Get xml record
  *
  * @param
  * @return
  */
 function getXmlRecord($a_entity, $a_version, $a_set)
 {
     if ($a_entity == "blog") {
         include_once "./Modules/Blog/classes/class.ilObjBlog.php";
         $dir = ilObjBlog::initStorage($a_set["Id"]);
         $a_set["Dir"] = $dir;
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         $a_set["Style"] = ilObjStyleSheet::lookupObjectStyle($a_set["Id"]);
         // #14734
         include_once "./Services/Notes/classes/class.ilNote.php";
         $a_set["Notes"] = ilNote::commentsActivated($a_set["Id"], 0, "blog");
     }
     return $a_set;
 }
コード例 #7
0
 /**
  * Check comments status against comments settings and context
  * 
  * @param string $a_type
  * @param int $a_ref_id
  * @param int $a_obj_id
  * @param bool $a_header_actions
  * @param bool $a_check_write_access
  * @return bool 
  */
 protected function isCommentsActivated($a_type, $a_ref_id, $a_obj_id, $a_header_actions, $a_check_write_access = true)
 {
     if ($this->comments_enabled) {
         if (!$this->comments_settings_enabled) {
             return true;
         }
         if ($a_check_write_access && $this->checkCommandAccess('write', '', $a_ref_id, $a_type)) {
             return true;
         }
         // fallback to single object check if no preloaded data
         // only the repository does preloadCommonProperties() yet
         if (!$a_header_actions && self::$preload_done) {
             if (self::$comments_activation[$a_obj_id][$a_type]) {
                 return true;
             }
         } else {
             include_once "./Services/Notes/classes/class.ilNote.php";
             if (ilNote::commentsActivated($a_obj_id, 0, $a_type)) {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #8
0
 /**
  * Build posting month list
  * 
  * @param array $items
  * @param string $a_month
  * @param string $a_cmd
  * @param bool $a_link_template
  * @param bool $a_show_inactive
  * @return string 
  */
 function renderList(array $items, $a_month, $a_cmd = "preview", $a_link_template = null, $a_show_inactive = false)
 {
     global $lng, $ilCtrl;
     include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
     $wtpl = new ilTemplate("tpl.blog_list.html", true, true, "Modules/Blog");
     // title according to current "filter"/navigation
     if ($this->keyword) {
         $title = $lng->txt("blog_keyword") . ": " . $this->keyword;
     } else {
         if ($this->author) {
             include_once "Services/User/classes/class.ilUserUtil.php";
             $title = $lng->txt("blog_author") . ": " . ilUserUtil::getNamePresentation($this->author);
         } else {
             include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
             $title = ilCalendarUtil::_numericMonthToString((int) substr($a_month, 5)) . " " . substr($a_month, 0, 4);
         }
     }
     $wtpl->setVariable("TXT_CURRENT_MONTH", $title);
     $can_approve = $this->object->hasApproval() && $this->checkPermissionBool("write");
     $can_deactivate = $this->checkPermissionBool("write");
     include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
     foreach ($items as $item) {
         // only published items
         $is_active = ilBlogPosting::_lookupActive($item["id"], "blp");
         if (!$is_active && !$a_show_inactive) {
             continue;
         }
         if (!$a_link_template) {
             $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month);
             $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $item["id"]);
             $preview = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_cmd);
         } else {
             $preview = $this->buildExportLink($a_link_template, "posting", $item["id"]);
         }
         // actions
         $item_contribute = $this->mayContribute($item["id"], $item["author"]);
         if (($item_contribute || $can_approve || $can_deactivate) && !$a_link_template && $a_cmd == "preview") {
             include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
             $alist = new ilAdvancedSelectionListGUI();
             $alist->setId($item["id"]);
             $alist->setListTitle($lng->txt("actions"));
             if ($is_active && $this->object->hasApproval() && !$item["approved"]) {
                 if ($can_approve) {
                     $ilCtrl->setParameter($this, "apid", $item["id"]);
                     $alist->addItem($lng->txt("blog_approve"), "approve", $ilCtrl->getLinkTarget($this, "approve"));
                     $ilCtrl->setParameter($this, "apid", "");
                 }
                 $wtpl->setVariable("APPROVAL", $lng->txt("blog_needs_approval"));
             }
             if ($item_contribute) {
                 $alist->addItem($lng->txt("edit_content"), "edit", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit"));
                 // #11858
                 if ($is_active) {
                     $alist->addItem($lng->txt("blog_toggle_draft"), "deactivate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deactivatePageToList"));
                 } else {
                     $alist->addItem($lng->txt("blog_toggle_final"), "activate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "activatePageToList"));
                 }
                 $alist->addItem($lng->txt("rename"), "rename", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edittitle"));
                 $alist->addItem($lng->txt("blog_edit_keywords"), "keywords", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords"));
                 $alist->addItem($lng->txt("blog_edit_date"), "editdate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editdate"));
                 $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen"));
             } else {
                 if ($can_deactivate) {
                     // #10513
                     if ($is_active) {
                         $ilCtrl->setParameter($this, "apid", $item["id"]);
                         $alist->addItem($lng->txt("blog_toggle_draft_admin"), "deactivate", $ilCtrl->getLinkTarget($this, "deactivateAdmin"));
                         $ilCtrl->setParameter($this, "apid", "");
                     }
                     $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen"));
                 }
             }
             $wtpl->setCurrentBlock("actions");
             $wtpl->setVariable("ACTION_SELECTOR", $alist->getHTML());
             $wtpl->parseCurrentBlock();
         }
         // comments
         if ($this->object->getNotesStatus() && !$a_link_template && !$this->disable_notes) {
             // count (public) notes
             include_once "Services/Notes/classes/class.ilNote.php";
             $count = sizeof(ilNote::_getNotesOfObject($this->obj_id, $item["id"], "blp", IL_NOTE_PUBLIC));
             if ($a_cmd != "preview") {
                 $wtpl->setCurrentBlock("comments");
                 $wtpl->setVariable("TEXT_COMMENTS", $lng->txt("blog_comments"));
                 $wtpl->setVariable("URL_COMMENTS", $preview);
                 $wtpl->setVariable("COUNT_COMMENTS", $count);
                 $wtpl->parseCurrentBlock();
             }
             /* we disabled comments in edit mode (should always be done via pagegui)
             			else
             			{
             				$hash = ilCommonActionDispatcherGUI::buildAjaxHash(ilCommonActionDispatcherGUI::TYPE_WORKSPACE, 
             					$this->node_id, "blog", $this->obj_id, "blp", $item["id"]);
             				$notes_link = "#\" onclick=\"".ilNoteGUI::getListCommentsJSCall($hash);
             			}
             			*/
         }
         // permanent link
         if ($a_cmd != "preview" && $a_cmd != "previewEmbedded") {
             if ($this->id_type == self::WORKSPACE_NODE_ID) {
                 $goto = $this->getAccessHandler()->getGotoLink($this->node_id, $this->obj_id, "_" . $item["id"]);
             } else {
                 include_once "Services/Link/classes/class.ilLink.php";
                 $goto = ilLink::_getStaticLink($this->node_id, $this->getType(), true, "_" . $item["id"]);
             }
             $wtpl->setCurrentBlock("permalink");
             $wtpl->setVariable("URL_PERMALINK", $goto);
             $wtpl->setVariable("TEXT_PERMALINK", $lng->txt("blog_permanent_link"));
             $wtpl->parseCurrentBlock();
         }
         $snippet = ilBlogPostingGUI::getSnippet($item["id"]);
         if ($snippet) {
             $wtpl->setCurrentBlock("more");
             $wtpl->setVariable("URL_MORE", $preview);
             $wtpl->setVariable("TEXT_MORE", $lng->txt("blog_list_more"));
             $wtpl->parseCurrentBlock();
         }
         $wtpl->setCurrentBlock("posting");
         if (!$is_active) {
             $wtpl->setVariable("DRAFT_CLASS", " ilBlogListItemDraft");
         }
         $author = "";
         if ($this->id_type == self::REPOSITORY_NODE_ID) {
             $author_id = $item["author"];
             if ($author_id) {
                 include_once "Services/User/classes/class.ilUserUtil.php";
                 $author = ilUserUtil::getNamePresentation($author_id) . " - ";
             }
         }
         // title
         $wtpl->setVariable("URL_TITLE", $preview);
         $wtpl->setVariable("TITLE", $item["title"]);
         $wtpl->setVariable("DATETIME", $author . ilDatePresentation::formatDate($item["created"], IL_CAL_DATE));
         // content
         $wtpl->setVariable("CONTENT", $snippet);
         $wtpl->parseCurrentBlock();
     }
     // notes
     /*
     if($a_cmd == "previewFullscreen" && $this->object->getNotesStatus())
     {
     	$wtpl->setVariable("NOTES", $this->getNotesHTML());
     }		 
     */
     // permalink
     if ($a_cmd == "previewFullscreen") {
         $wtpl->setVariable("PERMALINK", $this->getPermanentLinkWidget(null, true));
     }
     return $wtpl->get();
 }
コード例 #9
0
 function view()
 {
     global $ilUser, $lng, $ilSetting, $ilAccess, $ilToolbar;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
         // #13707
         if ($this->current_rel_obj > 0 && sizeof($current_ref_ids) && $ilSetting->get("comments_del_tutor", 1)) {
             foreach ($current_ref_ids as $ref_id) {
                 if ($ilAccess->checkAccess("write", "", $ref_id)) {
                     $notes_gui->enablePublicNotesDeletion(true);
                     break;
                 }
             }
         }
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
             $html = $notes_gui->getOnlyNotesHTML();
         } else {
             $html = $notes_gui->getOnlyCommentsHTML();
         }
     }
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         foreach ($rel_objs as $obj) {
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $caption = $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]);
             } else {
                 $caption = $lng->txt("personal_desktop");
             }
             $options[$obj["rep_obj_id"]] = $caption;
         }
         include_once "Services/Form/classes/class.ilSelectInputGUI.php";
         $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
         $rel->setOptions($options);
         $rel->setValue($this->current_rel_obj);
         $ilToolbar->addInputItem($rel);
         $ilToolbar->addFormButton($lng->txt("change"), "changeRelatedObject");
     }
     $this->tpl->setContent($html);
 }
コード例 #10
0
 /**
  * Get all comments of this record
  *
  * @return array ilNote[]
  */
 public function getComments()
 {
     if ($this->comments === null) {
         $this->comments = ilNote::_getNotesOfObject($this->table->getCollectionObject()->getId(), $this->getId(), 'dcl', IL_NOTE_PUBLIC);
     }
     return $this->comments;
 }
コード例 #11
0
ファイル: class.ilNote.php プロジェクト: arlendotcn/ilias
 /**
  * get all related objects for user
  */
 function _getRelatedObjectsOfUser($a_mode)
 {
     global $ilDB, $ilUser, $tree;
     if ($a_mode == ilPDNotesGUI::PRIVATE_NOTES) {
         $q = "SELECT DISTINCT rep_obj_id FROM note WHERE " . " type = " . $ilDB->quote((int) IL_NOTE_PRIVATE, "integer") . " AND author = " . $ilDB->quote($ilUser->getId(), "integer") . " AND (no_repository IS NULL OR no_repository < " . $ilDB->quote(1, "integer") . ")" . " ORDER BY rep_obj_id";
         $ilDB->quote($q);
         $set = $ilDB->query($q);
         $reps = array();
         while ($rep_rec = $ilDB->fetchAssoc($set)) {
             // #9343: deleted objects
             if (ilObject::_lookupType($rep_rec["rep_obj_id"])) {
                 $reps[] = array("rep_obj_id" => $rep_rec["rep_obj_id"]);
             }
         }
     } else {
         // all objects where the user wrote at least one comment
         $q = "SELECT DISTINCT rep_obj_id FROM note WHERE " . " type = " . $ilDB->quote((int) IL_NOTE_PUBLIC, "integer") . " AND author = " . $ilDB->quote($ilUser->getId(), "integer") . " AND (no_repository IS NULL OR no_repository < " . $ilDB->quote(1, "integer") . ")" . " ORDER BY rep_obj_id";
         $set = $ilDB->query($q);
         $reps = array();
         while ($rep_rec = $ilDB->fetchAssoc($set)) {
             // #9343: deleted objects
             if ($type = ilObject::_lookupType($rep_rec["rep_obj_id"])) {
                 if (ilNote::commentsActivated($rep_rec["rep_obj_id"], "", $type)) {
                     $reps[] = array("rep_obj_id" => $rep_rec["rep_obj_id"]);
                 }
             }
         }
         // additionally all objects on the personal desktop of the user
         // that have at least on comment
         $dis = ilObjUser::_lookupDesktopItems($ilUser->getId());
         $obj_ids = array();
         foreach ($dis as $di) {
             $obj_ids[] = $di["obj_id"];
         }
         if (count($obj_ids) > 0) {
             $q = "SELECT DISTINCT rep_obj_id FROM note WHERE " . $ilDB->in("rep_obj_id", $obj_ids, false, "integer") . " AND (no_repository IS NULL OR no_repository < " . $ilDB->quote(1, "integer") . ")";
             $set = $ilDB->query($q);
             while ($rec = $ilDB->fetchAssoc($set)) {
                 $add = true;
                 reset($reps);
                 foreach ($reps as $r) {
                     if ($r["rep_obj_id"] == $rec["rep_obj_id"]) {
                         $add = false;
                     }
                 }
                 if ($add) {
                     $type = ilObject::_lookupType($rec["rep_obj_id"]);
                     if (ilNote::commentsActivated($rec["rep_obj_id"], "", $type)) {
                         $reps[] = array("rep_obj_id" => $rec["rep_obj_id"]);
                     }
                 }
             }
         }
     }
     if (sizeof($reps)) {
         // check if notes/comments belong to objects in trash
         // see ilNoteGUI::showTargets()
         foreach ($reps as $idx => $rep) {
             $has_active_ref = false;
             // repository?
             $ref_ids = ilObject::_getAllReferences($rep["rep_obj_id"]);
             if ($ref_ids) {
                 $reps[$idx]["ref_ids"] = array_values($ref_ids);
                 foreach ($ref_ids as $ref_id) {
                     if (!$tree->isDeleted($ref_id)) {
                         $has_active_ref = true;
                         break;
                     }
                 }
             } else {
                 // personal workspace?
                 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
                 $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                 $node_id = $wsp_tree->lookupNodeId($rep["rep_obj_id"]);
                 if ($node_id) {
                     $reps[$idx]["wsp_id"] = $node_id;
                     $has_active_ref = true;
                 }
             }
             if (!$has_active_ref) {
                 unset($reps[$idx]);
             }
         }
     }
     return $reps;
 }
コード例 #12
0
ファイル: class.ilObjBlog.php プロジェクト: bheyser/qplskl
 protected function doUpdate()
 {
     global $ilDB;
     if ($this->id) {
         $ilDB->manipulate("UPDATE il_blog" . " SET ppic = " . $ilDB->quote($this->hasProfilePicture(), "integer") . ",bg_color = " . $ilDB->quote($this->getBackgroundColor(), "text") . ",font_color = " . $ilDB->quote($this->getFontcolor(), "text") . ",img = " . $ilDB->quote($this->getImage(), "text") . ",rss_active = " . $ilDB->quote($this->hasRSS(), "text") . ",approval = " . $ilDB->quote($this->hasApproval(), "integer") . ",abs_shorten = " . $ilDB->quote($this->hasAbstractShorten(), "integer") . ",abs_shorten_len = " . $ilDB->quote($this->getAbstractShortenLength(), "integer") . ",abs_image = " . $ilDB->quote($this->hasAbstractImage(), "integer") . ",abs_img_width = " . $ilDB->quote($this->getAbstractImageWidth(), "integer") . ",abs_img_height = " . $ilDB->quote($this->getAbstractImageHeight(), "integer") . ",keywords = " . $ilDB->quote($this->hasKeywords(), "integer") . ",authors = " . $ilDB->quote($this->hasAuthors(), "integer") . ",nav_mode = " . $ilDB->quote($this->getNavMode(), "integer") . ",nav_list_post = " . $ilDB->quote($this->getNavModeListPostings(), "integer") . ",nav_list_mon = " . $ilDB->quote($this->getNavModeListMonths(), "integer") . ",ov_post = " . $ilDB->quote($this->getOverviewPostings(), "integer") . ",nav_order = " . $ilDB->quote(implode(";", $this->getOrder()), "text") . " WHERE id = " . $ilDB->quote($this->id, "integer"));
         // #14661
         include_once "./Services/Notes/classes/class.ilNote.php";
         ilNote::activateComments($this->id, 0, "blog", $this->getNotesStatus());
         include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
         ilObjStyleSheet::writeStyleUsage($this->id, $this->getStyleSheetId());
     }
 }
コード例 #13
0
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     switch ($a_entity) {
         case "user_notes":
             $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["Author"]);
             if ($usr_id > 0) {
                 include_once "./Services/Notes/classes/class.ilNote.php";
                 // only import real user (assigned to personal desktop) notes
                 // here.
                 if ((int) $a_rec["RepObjId"] == 0 && $a_rec["ObjId"] == $a_rec["Author"] && $a_rec["Type"] == IL_NOTE_PRIVATE && $a_rec["ObjType"] == "pd") {
                     $note = new ilNote();
                     $note->setObject("pd", 0, $usr_id);
                     $note->setType(IL_NOTE_PRIVATE);
                     $note->setAuthor($usr_id);
                     $note->setText($a_rec["NoteText"]);
                     $note->setSubject($a_rec["Subject"]);
                     $note->setCreationDate($a_rec["CreationDate"]);
                     $note->setLabel($a_rec["Label"]);
                     $note->create(true);
                 }
             }
             break;
     }
 }
コード例 #14
0
 /**
  * Delete blog posting confirmation screen
  */
 function deleteBlogPostingConfirmationScreen()
 {
     global $tpl, $ilCtrl, $lng;
     if ($this->checkAccess("write") || $this->checkAccess("contribute")) {
         include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
         $confirmation_gui = new ilConfirmationGUI();
         $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
         $confirmation_gui->setHeaderText($lng->txt("blog_posting_deletion_confirmation"));
         $confirmation_gui->setCancel($lng->txt("cancel"), "cancelBlogPostingDeletion");
         $confirmation_gui->setConfirm($lng->txt("delete"), "confirmBlogPostingDeletion");
         $dtpl = new ilTemplate("tpl.blog_posting_deletion_confirmation.html", true, true, "Modules/Blog");
         $dtpl->setVariable("PAGE_TITLE", $this->getBlogPosting()->getTitle());
         // notes/comments
         include_once "./Services/Notes/classes/class.ilNote.php";
         $cnt_note_users = ilNote::getUserCount($this->getBlogPosting()->getParentId(), $this->getBlogPosting()->getId(), "wpg");
         $dtpl->setVariable("TXT_NUMBER_USERS_NOTES_OR_COMMENTS", $lng->txt("blog_number_users_notes_or_comments"));
         $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
         $confirmation_gui->addItem("", "", $dtpl->get());
         $tpl->setContent($confirmation_gui->getHTML());
     }
 }
コード例 #15
0
ファイル: class.ilNoteGUI.php プロジェクト: bheyser/qplskl
 /**
  * Notify observers on update/create
  * 
  * @param string $a_action
  * @param ilNote $a_note 
  */
 protected function notifyObserver($a_action, $a_note)
 {
     if (sizeof($this->observer)) {
         foreach ($this->observer as $item) {
             $param = $a_note->getObject();
             $param["action"] = $a_action;
             $param["note_id"] = $a_note->getId();
             call_user_func_array($item, $param);
         }
     }
 }
コード例 #16
0
 /**
  * Delete wiki page confirmation screen.
  */
 function deleteWikiPageConfirmationScreen()
 {
     global $ilAccess, $tpl, $ilCtrl, $lng;
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
         $confirmation_gui = new ilConfirmationGUI();
         $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
         $confirmation_gui->setHeaderText($lng->txt("wiki_page_deletion_confirmation"));
         $confirmation_gui->setCancel($lng->txt("cancel"), "cancelWikiPageDeletion");
         $confirmation_gui->setConfirm($lng->txt("delete"), "confirmWikiPageDeletion");
         $dtpl = new ilTemplate("tpl.wiki_page_deletion_confirmation.html", true, true, "Modules/Wiki");
         $dtpl->setVariable("PAGE_TITLE", $this->getWikiPage()->getTitle());
         // other pages that link to this page
         $dtpl->setVariable("TXT_OTHER_PAGES", $lng->txt("wiki_other_pages_linking"));
         $pages = ilWikiPage::getLinksToPage($this->getWikiPage()->getWikiId(), $this->getWikiPage()->getId());
         if (count($pages) > 0) {
             foreach ($pages as $page) {
                 $dtpl->setCurrentBlock("lpage");
                 $dtpl->setVariable("TXT_LINKING_PAGE", $page["title"]);
                 $dtpl->parseCurrentBlock();
             }
         } else {
             $dtpl->setCurrentBlock("lpage");
             $dtpl->setVariable("TXT_LINKING_PAGE", "-");
             $dtpl->parseCurrentBlock();
         }
         // contributors
         $dtpl->setVariable("TXT_CONTRIBUTORS", $lng->txt("wiki_contributors"));
         $contributors = ilWikiPage::getPageContributors($this->getWikiPage()->getId());
         foreach ($contributors as $contributor) {
             $dtpl->setCurrentBlock("contributor");
             $dtpl->setVariable("TXT_CONTRIBUTOR", $contributor["lastname"] . ", " . $contributor["firstname"]);
             $dtpl->parseCurrentBlock();
         }
         // notes/comments
         include_once "./Services/Notes/classes/class.ilNote.php";
         $cnt_note_users = ilNote::getUserCount($this->getPageObject()->getParentId(), $this->getPageObject()->getId(), "wpg");
         $dtpl->setVariable("TXT_NUMBER_USERS_NOTES_OR_COMMENTS", $lng->txt("wiki_number_users_notes_or_comments"));
         $dtpl->setVariable("TXT_NR_NOTES_COMMENTS", $cnt_note_users);
         $confirmation_gui->addItem("", "", $dtpl->get());
         $tpl->setContent($confirmation_gui->getHTML());
     }
 }
コード例 #17
0
 /**
  * create new properties record
  */
 function createProperties()
 {
     global $ilDB;
     $q = "INSERT INTO content_object (id) VALUES (" . $ilDB->quote($this->getId(), "integer") . ")";
     $ilDB->manipulate($q);
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     ilNote::activateComments($this->getId(), 0, $this->getType(), true);
     $this->readProperties();
     // to get db default values
 }
コード例 #18
0
 /**
  * Add header action menu
  * 
  * @param string $a_sub_type
  * @param int $a_sub_id
  * @return ilObjectListGUI
  */
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     global $ilAccess;
     if (!$this->creation_mode && $this->object) {
         include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
         $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, $this->object->getType(), $this->ref_id, $this->object->getId());
         $dispatcher->setSubObject($a_sub_type, $a_sub_id);
         include_once "Services/Object/classes/class.ilObjectListGUI.php";
         ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
         $lg = $dispatcher->initHeaderAction();
         if (is_object($lg)) {
             // to enable add to desktop / remove from desktop
             if ($this instanceof ilDesktopItemHandling) {
                 $lg->setContainerObject($this);
             }
             // enable multi download
             $lg->enableMultiDownload(true);
             // comments settings are always on (for the repository)
             // should only be shown if active or permission to toggle
             include_once "Services/Notes/classes/class.ilNote.php";
             if ($ilAccess->checkAccess("write", "", $this->ref_id) || $ilAccess->checkAccess("edit_permissions", "", $this->ref_id) || ilNote::commentsActivated($this->object->getId(), 0, $this->object->getType())) {
                 $lg->enableComments(true);
             }
             $lg->enableNotes(true);
             $lg->enableTags(true);
         }
         return $lg;
     }
 }
コード例 #19
0
 protected function doUpdate()
 {
     global $ilDB;
     $fields = array("is_online" => array("integer", $this->isOnline()), "ppic" => array("integer", $this->hasProfilePicture()), "bg_color" => array("text", $this->getBackgroundColor()), "font_color" => array("text", $this->getFontcolor()), "img" => array("text", $this->getImage()));
     $this->doUpdateCustom($fields);
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     ilNote::activateComments($this->id, 0, $this->getType(), $this->hasPublicComments());
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     ilObjStyleSheet::writeStyleUsage($this->id, $this->getStyleSheetId());
     $ilDB->update("usr_portfolio", $fields, array("id" => array("integer", $this->id)));
 }