Пример #1
0
 /**
  * Get values for properties form
  */
 protected function getEditFormCustomValues(array &$a_values)
 {
     global $ilUser;
     $a_values["desc"] = $this->object->getLongDescription();
     $a_values["show_submissions"] = $this->object->getShowSubmissions();
     $a_values["pass_mode"] = $this->object->getPassMode();
     if ($a_values["pass_mode"] == "nr") {
         $a_values["pass_nr"] = $this->object->getPassNr();
     }
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $a_values["notification"] = ilNotification::hasNotification(ilNotification::TYPE_EXERCISE_SUBMISSION, $ilUser->getId(), $this->object->getId());
     $a_values['completion_by_submission'] = (int) $this->object->isCompletionBySubmissionEnabled();
 }
Пример #2
0
 protected function initHeaderAction($sub_type = null, $sub_id = null, $a_is_preview = false)
 {
     global $ilUser, $ilCtrl;
     if (!$this->obj_id) {
         return false;
     }
     $sub_type = $sub_id = null;
     if ($_GET["blpg"]) {
         $sub_type = "blp";
         $sub_id = $_GET["blpg"];
     }
     $lg = parent::initHeaderAction($sub_type, $sub_id);
     if ($a_is_preview) {
         $lg->enableComments(false);
         $lg->enableNotes(false);
         $lg->enableTags(false);
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_BLOG, $ilUser->getId(), $this->obj_id)) {
             $ilCtrl->setParameter($this, "ntf", 1);
             $link = $ilCtrl->getLinkTarget($this, "setNotification");
             $ilCtrl->setParameter($this, "ntf", "");
             $lg->addCustomCommand($link, "blog_notification_toggle_off");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("blog_notification_activated"));
         } else {
             $ilCtrl->setParameter($this, "ntf", 2);
             $link = $ilCtrl->getLinkTarget($this, "setNotification");
             $ilCtrl->setParameter($this, "ntf", "");
             $lg->addCustomCommand($link, "blog_notification_toggle_on");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("blog_notification_deactivated"));
         }
         // #11758
         if ($this->mayContribute()) {
             $ilCtrl->setParameter($this, "prvm", "");
             $ilCtrl->setParameter($this, "bmn", "");
             $ilCtrl->setParameter($this, "blpg", "");
             $link = $ilCtrl->getLinkTarget($this, "");
             $ilCtrl->setParameter($this, "blpg", $sub_id);
             $ilCtrl->setParameter($this, "bmn", $this->month);
             $lg->addCustomCommand($link, "blog_edit");
             // #11868
             if ($sub_id && $this->mayContribute($sub_id)) {
                 $link = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit");
                 $lg->addCustomCommand($link, "blog_edit_posting");
             }
             $ilCtrl->setParameter($this, "prvm", "fsc");
         }
         $ilCtrl->setParameter($this, "ntf", "");
     }
     return $lg;
 }
 public function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess, $tpl, $lng, $ilCtrl;
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "dcl", $this->ref_id, $this->obj_id);
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     //$lg->enableNotes(true);
     //$lg->enableComments(ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), false);
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->object->getNotification() == 1) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_DATA_COLLECTION, $ilUser->getId(), $this->obj_id)) {
             //Command Activate Notification
             $ilCtrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_deactivate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $lng->txt("dcl_notification_activated"));
         } else {
             //Command Deactivate Notification
             $ilCtrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_activate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $lng->txt("dcl_notification_deactivated"));
         }
         $ilCtrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
     $tpl->setHeaderActionMenu($lg->getHeaderAction());
 }
Пример #4
0
 function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess;
     $wiki_id = $this->getPageObject()->getParentId();
     $page_id = $this->getPageObject()->getId();
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "wiki", $_GET["ref_id"], $wiki_id);
     $dispatcher->setSubObject("wpg", $page_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();
     $lg->enableNotes(true);
     $lg->enableComments(ilObjWiki::_lookupPublicNotes($wiki_id), false);
     // rating
     if (ilObjWiki::_lookupRating($wiki_id) && $this->getPageObject()->getRating() && $this->getPageObject()->old_nr == 0) {
         $lg->enableRating(true, $this->lng->txt("wiki_rate_page"), ilObjWiki::_lookupRatingCategories($wiki_id), array("ilcommonactiondispatchergui", "ilratinggui"));
     }
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $wiki_id)) {
             $this->ctrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_wiki");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_notification_activated"));
         } else {
             $this->ctrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_wiki");
             if (ilNotification::hasNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $page_id)) {
                 $this->ctrl->setParameter($this, "ntf", 3);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_page_notification_activated"));
             } else {
                 $this->ctrl->setParameter($this, "ntf", 4);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("wiki_notification_deactivated"));
             }
         }
         $this->ctrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
 }
 /**
  * Get values for properties form
  */
 function getPropertiesFormValues()
 {
     global $ilUser;
     $values = array();
     $title = $this->object->getTitle();
     $description = $this->object->getDescription();
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $ot = ilObjectTranslation::getInstance($this->object->getId());
     if ($ot->getContentActivated()) {
         $title = $ot->getDefaultTitle();
         $description = $ot->getDefaultDescription();
     }
     $values["title"] = $title;
     $values["description"] = $description;
     if ($this->object->getOnline()) {
         $values["cobj_online"] = true;
     }
     $values["lm_layout"] = $this->object->getLayout();
     $values["lm_pg_header"] = $this->object->getPageHeader();
     if ($this->object->isActiveNumbering()) {
         $values["cobj_act_number"] = true;
     }
     $values["toc_mode"] = $this->object->getTOCMode();
     if ($this->object->publicNotes()) {
         $values["cobj_pub_notes"] = true;
     }
     if ($this->object->cleanFrames()) {
         $values["cobj_clean_frames"] = true;
     }
     if ($this->object->isActiveHistoryUserComments()) {
         $values["cobj_user_comments"] = true;
     }
     $values["layout_per_page"] = $this->object->getLayoutPerPage();
     $values["rating"] = $this->object->hasRating();
     $values["rating_pages"] = $this->object->hasRatingPages();
     $values["disable_def_feedback"] = $this->object->getDisableDefaultFeedback();
     $values["progr_icons"] = $this->object->getProgressIcons();
     $values["store_tries"] = $this->object->getStoreTries();
     $values["restrict_forw_nav"] = $this->object->getRestrictForwardNavigation();
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $values["notification_blocked_users"] = ilNotification::hasNotification(ilNotification::TYPE_LM_BLOCKED_USERS, $ilUser->getId(), $this->object->getId());
     $this->form->setValuesByArray($values);
 }
Пример #6
0
 /**
  * Get block HTML code.
  */
 function getHTML()
 {
     global $ilCtrl, $lng, $ilAccess, $ilUser;
     $this->poll_block->setRefId($this->getRefId());
     $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
     $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
     if (!$this->may_write && !$this->has_content) {
         return "";
     }
     $poll_obj = $this->poll_block->getPoll();
     $this->setTitle($poll_obj->getTitle());
     $this->setData(array($poll_obj));
     $ilCtrl->setParameterByClass($this->getRepositoryObjectGUIName(), "ref_id", $this->getRefId());
     if (!$this->poll_block->getMessage($ilUser->getId())) {
         // notification
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
             $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "unsubscribe"), $lng->txt("poll_notification_unsubscribe"));
         } else {
             $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "subscribe"), $lng->txt("poll_notification_subscribe"));
         }
     }
     if ($this->may_write) {
         // edit
         $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "render"), $lng->txt("edit_content"));
         $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "edit"), $lng->txt("settings"));
         /* delete (#10993 - see ilBlockGUI)
         			$parent_id = $tree->getParentId($this->getRefId());			
         			$type = ilObject::_lookupType($parent_id, true);
         			$class = $objDefinition->getClassName($type);
         			if($class)
         			{
         				$class = "ilobj".strtolower($class)."gui";
         				$ilCtrl->setParameterByClass($class, "ref_id", $parent_id);		
         				$ilCtrl->setParameterByClass($class, "item_ref_id", $this->getRefId());	
         				$this->addBlockCommand(
         					$ilCtrl->getLinkTargetByClass($class, "delete"),
         					$lng->txt("delete"));	
         			}			 
         			*/
     }
     $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
     return parent::getHTML();
 }