Пример #1
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;
     }
 }
Пример #2
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;
 }
Пример #3
0
 protected function doRead()
 {
     global $ilDB;
     $set = $ilDB->query("SELECT * FROM il_poll" . " WHERE id = " . $ilDB->quote($this->getId(), "integer"));
     $row = $ilDB->fetchAssoc($set);
     $this->setQuestion($row["question"]);
     $this->setImage($row["image"]);
     $this->setOnline($row["online_status"]);
     $this->setViewResults($row["view_results"]);
     $this->setVotingPeriod($row["period"]);
     $this->setVotingPeriodBegin($row["period_begin"]);
     $this->setVotingPeriodEnd($row["period_end"]);
     $this->setMaxNumberOfAnswers($row["max_answers"]);
     $this->setSortResultByVotes($row["result_sort"]);
     $this->setNonAnonymous($row["non_anon"]);
     $this->setShowResultsAs($row["show_results_as"]);
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     $this->setShowComments(ilNote::commentsActivated($this->getId(), 0, $this->getType()));
     if ($this->ref_id) {
         $activation = ilObjectActivation::getItem($this->ref_id);
         $this->setAccessType($activation["timing_type"]);
         $this->setAccessBegin($activation["timing_start"]);
         $this->setAccessEnd($activation["timing_end"]);
         $this->setAccessVisibility($activation["visible"]);
     }
 }
Пример #4
0
 /**
  * read content object properties
  */
 function readProperties()
 {
     global $ilDB;
     $q = "SELECT * FROM content_object WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $lm_set = $ilDB->query($q);
     $lm_rec = $ilDB->fetchAssoc($lm_set);
     $this->setLayout($lm_rec["default_layout"]);
     $this->setStyleSheetId((int) $lm_rec["stylesheet"]);
     $this->setPageHeader($lm_rec["page_header"]);
     $this->setTOCMode($lm_rec["toc_mode"]);
     $this->setOnline(ilUtil::yn2tf($lm_rec["is_online"]));
     $this->setActiveTOC(ilUtil::yn2tf($lm_rec["toc_active"]));
     $this->setActiveNumbering(ilUtil::yn2tf($lm_rec["numbering"]));
     $this->setActivePrintView(ilUtil::yn2tf($lm_rec["print_view_active"]));
     $this->setActivePreventGlossaryAppendix(ilUtil::yn2tf($lm_rec["no_glo_appendix"]));
     $this->setHideHeaderFooterPrint($lm_rec["hide_head_foot_print"]);
     $this->setActiveDownloads(ilUtil::yn2tf($lm_rec["downloads_active"]));
     $this->setActiveDownloadsPublic(ilUtil::yn2tf($lm_rec["downloads_public_active"]));
     $this->setActiveLMMenu(ilUtil::yn2tf($lm_rec["lm_menu_active"]));
     $this->setCleanFrames(ilUtil::yn2tf($lm_rec["clean_frames"]));
     $this->setHeaderPage((int) $lm_rec["header_page"]);
     $this->setFooterPage((int) $lm_rec["footer_page"]);
     $this->setHistoryUserComments(ilUtil::yn2tf($lm_rec["hist_user_comments"]));
     $this->setPublicAccessMode($lm_rec["public_access_mode"]);
     $this->setPublicExportFile("xml", $lm_rec["public_xml_file"]);
     $this->setPublicExportFile("html", $lm_rec["public_html_file"]);
     $this->setPublicExportFile("scorm", $lm_rec["public_scorm_file"]);
     $this->setLayoutPerPage($lm_rec["layout_per_page"]);
     $this->setRating($lm_rec["rating"]);
     $this->setRatingPages($lm_rec["rating_pages"]);
     $this->setDisableDefaultFeedback($lm_rec["disable_def_feedback"]);
     $this->setProgressIcons($lm_rec["progr_icons"]);
     $this->setStoreTries($lm_rec["store_tries"]);
     $this->setRestrictForwardNavigation($lm_rec["restrict_forw_nav"]);
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     $this->setPublicNotes(ilNote::commentsActivated($this->getId(), 0, $this->getType()));
 }
Пример #5
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;
 }
Пример #6
0
 function getNotesHTML($a_init_form = true)
 {
     global $ilUser, $lng, $ilCtrl, $ilSetting;
     $lng->loadLanguageModule("notes");
     $ntpl = new ilTemplate("tpl.notes_and_comments.html", true, true, "Services/Notes");
     // check, whether column is hidden due to processing in other column
     $hide_comments = $this->only == "notes";
     $hide_notes = $this->only == "comments";
     switch ($ilCtrl->getCmd()) {
         case "addNoteForm":
         case "editNoteForm":
         case "addNote":
         case "updateNote":
             if ($_GET["note_type"] == IL_NOTE_PRIVATE) {
                 $hide_comments = true;
             }
             if ($_GET["note_type"] == IL_NOTE_PUBLIC) {
                 $hide_notes = true;
             }
             break;
     }
     // temp workaround: only show comments (if both have been activated)
     if ($this->private_enabled && $this->public_enabled && $this->only != "notes") {
         $this->private_enabled = false;
     }
     $nodes_col = false;
     if ($this->private_enabled && $ilUser->getId() != ANONYMOUS_USER_ID && !$hide_notes) {
         $ntpl->setCurrentBlock("notes_col");
         $ntpl->setVariable("NOTES", $this->getNoteListHTML(IL_NOTE_PRIVATE, $a_init_form));
         $ntpl->parseCurrentBlock();
         $nodes_col = true;
     }
     // :TODO: public enabled vs. comments_settings needs to be discussed - see poll!
     $comments_col = false;
     if (($this->public_enabled || !$this->comments_settings) && (!$this->delete_note || $this->public_deletion_enabled || $ilSetting->get("comments_del_user", 0)) && !$hide_comments) {
         $ntpl->setVariable("COMMENTS", $this->getNoteListHTML(IL_NOTE_PUBLIC, $a_init_form));
         $comments_col = true;
     }
     // Comments Settings
     if ($this->comments_settings && !$hide_comments && !$this->delete_note && !$this->edit_note_form && !$this->add_note_form && $ilUser->getId() != ANONYMOUS_USER_ID) {
         $notes_settings = new ilSetting("notes");
         $id = $this->rep_obj_id . "_" . $this->obj_id . "_" . $this->obj_type;
         //$active = $notes_settings->get("activate_".$id);
         $active = ilNote::commentsActivated($this->rep_obj_id, $this->obj_id, $this->obj_type);
         if ($active) {
             $this->renderLink($ntpl, "comments_settings", $lng->txt("notes_deactivate_comments"), "deactivateComments", "notes_top");
             $ntpl->setCurrentBlock("comments_settings2");
         } else {
             $this->renderLink($ntpl, "comments_settings", $lng->txt("notes_activate_comments"), "activateComments", "notes_top");
             $ntpl->setCurrentBlock("comments_settings2");
             if ($this->ajax && !$comments_col) {
                 $ntpl->setVariable("COMMENTS_MESS", $ntpl->getMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info"));
             }
         }
         $ntpl->parseCurrentBlock();
         if (!$comments_col) {
             $ntpl->setVariable("COMMENTS", "");
         }
         $comments_col = true;
     }
     if ($comments_col) {
         $ntpl->setCurrentBlock("comments_col");
         if ($nodes_col) {
             //				$ntpl->touchBlock("comments_style");
         }
         $ntpl->parseCurrentBlock();
     }
     if ($this->ajax) {
         echo $ntpl->get();
         exit;
     }
     return $ntpl->get();
 }
Пример #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
 /**
  * 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;
 }
Пример #9
0
 protected function doRead()
 {
     global $ilDB;
     $set = $ilDB->query("SELECT * FROM il_blog" . " WHERE id = " . $ilDB->quote($this->id, "integer"));
     $row = $ilDB->fetchAssoc($set);
     $this->setProfilePicture((bool) $row["ppic"]);
     $this->setBackgroundColor($row["bg_color"]);
     $this->setFontColor($row["font_color"]);
     $this->setImage($row["img"]);
     $this->setRSS($row["rss_active"]);
     $this->setApproval($row["approval"]);
     $this->setAbstractShorten($row["abs_shorten"]);
     $this->setAbstractShortenLength($row["abs_shorten_len"]);
     $this->setAbstractImage($row["abs_image"]);
     $this->setAbstractImageWidth($row["abs_img_width"]);
     $this->setAbstractImageHeight($row["abs_img_height"]);
     $this->setKeywords($row["keywords"]);
     $this->setAuthors($row["authors"]);
     $this->setNavMode($row["nav_mode"]);
     $this->setNavModeListPostings($row["nav_list_post"]);
     $this->setNavModeListMonths($row["nav_list_mon"]);
     $this->setOverviewPostings($row["ov_post"]);
     if (trim($row["nav_order"])) {
         $this->setOrder(explode(";", $row["nav_order"]));
     }
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     $this->setNotesStatus(ilNote::commentsActivated($this->id, 0, "blog"));
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->setStyleSheetId(ilObjStyleSheet::lookupObjectStyle($this->id));
 }
Пример #10
0
 protected function doRead()
 {
     global $ilDB;
     $set = $ilDB->query("SELECT * FROM usr_portfolio" . " WHERE id = " . $ilDB->quote($this->id, "integer"));
     $row = $ilDB->fetchAssoc($set);
     $this->setOnline((bool) $row["is_online"]);
     $this->setProfilePicture((bool) $row["ppic"]);
     $this->setBackgroundColor($row["bg_color"]);
     $this->setFontColor($row["font_color"]);
     $this->setImage($row["img"]);
     // #14661
     include_once "./Services/Notes/classes/class.ilNote.php";
     $this->setPublicComments(ilNote::commentsActivated($this->id, 0, $this->getType()));
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->setStyleSheetId(ilObjStyleSheet::lookupObjectStyle($this->id));
     $this->doReadCustom($row);
 }