Ejemplo n.º 1
0
 /**
  * Preload common properties
  *
  * @param
  * @return
  */
 static function preloadCommonProperties($a_obj_ids, $a_context)
 {
     global $lng, $ilSetting, $ilUser;
     if ($a_context == self::CONTEXT_REPOSITORY) {
         $active_notes = !$ilSetting->get("disable_notes");
         $active_comments = !$ilSetting->get("disable_comments");
         if ($active_notes || $active_comments) {
             include_once "./Services/Notes/classes/class.ilNote.php";
         }
         if ($active_comments) {
             // needed for action
             self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
         }
         // properties are optional
         if ($ilSetting->get('comments_tagging_in_lists')) {
             if ($active_notes || $active_comments) {
                 self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
                 $lng->loadLanguageModule("notes");
             }
             $tags_set = new ilSetting("tags");
             if ($tags_set->get("enable")) {
                 $all_users = $tags_set->get("enable_all_users");
                 include_once "./Services/Tagging/classes/class.ilTagging.php";
                 if (!$ilSetting->get('comments_tagging_in_lists_tags')) {
                     self::$cnt_tags = ilTagging::_countTags($a_obj_ids, $all_users);
                 } else {
                     $tag_user_id = null;
                     if (!$all_users) {
                         $tag_user_id = $ilUser->getId();
                     }
                     self::$tags = ilTagging::_getListTagsForObjects($a_obj_ids, $tag_user_id);
                 }
                 $lng->loadLanguageModule("tagging");
             }
         }
         $lng->loadLanguageModule("rating");
     }
     self::$preload_done = true;
 }
Ejemplo n.º 2
0
 /**
  * Get HTML
  *
  * @param
  * @return
  */
 function getHTML()
 {
     global $lng, $ilCtrl;
     $lng->loadLanguageModule("tagging");
     $tpl = new ilTemplate("tpl.edit_tags.html", true, true, "Services/Tagging");
     $tpl->setVariable("TXT_TAGS", $lng->txt("tagging_tags"));
     switch ($_GET["mess"] != "" ? $_GET["mess"] : $this->mess) {
         case "mod":
             $mtype = "success";
             $mtxt = $lng->txt("msg_obj_modified");
             break;
     }
     if ($mtxt != "") {
         $tpl->setVariable("MESS", $tpl->getMessageHTML($mtxt, $mtype));
     } else {
         $tpl->setVariable("MESS", "");
     }
     $img = ilUtil::img(ilObject::_getIcon($this->obj_id, "tiny"));
     $tpl->setVariable("TXT_OBJ_TITLE", $img . " " . ilObject::_lookupTitle($this->obj_id));
     $tags = ilTagging::getTagsForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId());
     $tpl->setVariable("VAL_TAGS", ilUtil::prepareFormOutput(implode($tags, " ")));
     $tpl->setVariable("TXT_SAVE", $lng->txt("save"));
     $tpl->setVariable("CMD_SAVE", "saveJS");
     $os = "ilTagging.cmdAjaxForm(event, '" . $ilCtrl->getFormActionByClass("iltagginggui", "", "", true) . "');";
     $tpl->setVariable("ON_SUBMIT", $os);
     $tags_set = new ilSetting("tags");
     if ($tags_set->get("enable_all_users")) {
         $tpl->setVariable("TAGS_TITLE", $lng->txt("tagging_my_tags"));
         $all_obj_tags = ilTagging::_getListTagsForObjects(array($this->obj_id));
         $all_obj_tags = $all_obj_tags[$this->obj_id];
         if (is_array($all_obj_tags) && sizeof($all_obj_tags) != sizeof($tags)) {
             $tpl->setVariable("TITLE_OTHER", $lng->txt("tagging_other_users"));
             $tpl->setCurrentBlock("tag_other_bl");
             foreach ($all_obj_tags as $tag => $is_owner) {
                 if (!$is_owner) {
                     $tpl->setVariable("OTHER_TAG", $tag);
                     $tpl->parseCurrentBlock();
                 }
             }
         }
     }
     echo $tpl->get();
     exit;
 }