public function preload()
 {
     global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem;
     if (!$this->obj_ids) {
         return;
     }
     $this->obj_ids = array_unique($this->obj_ids);
     $this->types = array_unique($this->types);
     if ($this->ref_ids) {
         $this->ref_ids = array_unique($this->ref_ids);
     }
     // type specific preloads
     include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
     foreach ($this->types as $type) {
         $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
         if (is_array($this->ref_ids_by_type[$type])) {
             $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
         }
         if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
             ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]);
         }
         $class = $objDefinition->getClassName($type);
         $location = $objDefinition->getLocation($type);
         if ($class && $location) {
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             if (class_exists($full_class)) {
                 call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]);
             }
         }
     }
     if ($this->ref_ids) {
         $tree->preloadDeleted($this->ref_ids);
         $tree->preloadDepthParent($this->ref_ids);
         $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
         $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
         if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) {
             ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
         }
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($this->ref_ids);
     }
     include_once "./Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
         include_once "./Services/Rating/classes/class.ilRating.php";
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         ilRating::preloadListGUIData($this->obj_ids);
         include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
         ilAdvancedMDValues::preloadByObjIds($this->obj_ids);
     }
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         ilLPStatus::preloadListGUIData($this->obj_ids);
     }
 }
 protected function getItems()
 {
     $data = array();
     foreach ($this->peer_data as $idx => $item) {
         $row = array();
         $row["seq"] = $idx + 1;
         $row["giver_id"] = $item["giver_id"];
         $row["peer_id"] = $item["peer_id"];
         $row["submission"] = "";
         $row["mark"] = (int) round(ilRating::getRatingForUserAndObject($this->ass->getId(), "ass", $item["peer_id"], "peer", $item["giver_id"]));
         $row["comment"] = $item["pcomment"];
         $row["tstamp"] = $item["tstamp"];
         $data[] = $row;
     }
     $this->setData($data);
 }
Пример #3
0
 function updatePeerReviewCommentsObject()
 {
     global $ilCtrl, $ilUser, $tpl;
     if (!$this->ass || !$this->ass->getPeerReview() || !$this->ass->getDeadline() || $this->ass->getDeadline() - time() > 0 || !sizeof($_POST["pc"]) || !$ilCtrl->isAsynch()) {
         exit;
     }
     $rating_peer_id = $_POST["rating_peer_id"];
     $giver_id = $ilUser->getId();
     // save rating
     include_once './Services/Rating/classes/class.ilRating.php';
     ilRating::writeRatingForUserAndObject($this->ass->getId(), "ass", $rating_peer_id, "peer", $giver_id, $_POST["rating"]);
     // save comments
     foreach ($_POST["pc"] as $peer_id => $value) {
         if ($peer_id) {
             $this->ass->updatePeerReviewComment($peer_id, $value);
         }
     }
     // render current rating
     $ilCtrl->setParameter($this->parent_obj, "peer_id", $rating_peer_id);
     include_once './Services/Rating/classes/class.ilRatingGUI.php';
     $rating = new ilRatingGUI();
     $rating->setObject($this->ass->getId(), "ass", $rating_peer_id, "peer");
     $rating->setUserId($giver_id);
     if (!$_REQUEST["ssrtg"]) {
         echo $rating->getHTML(false, true, "il.ExcPeerReview.saveComments(" . $rating_peer_id . ", %rating%)");
     } else {
         echo '<div id="rtr_widget">' . $rating->getHTML(false, true, "il.ExcPeerReview.saveSingleRating(" . $rating_peer_id . ", %rating%)") . '</div>';
     }
     echo $tpl->getOnLoadCodeForAsynch();
     exit;
 }
Пример #4
0
 public static function countGivenFeedback($a_ass_id)
 {
     global $ilDB, $ilUser;
     $cnt = 0;
     include_once './Services/Rating/classes/class.ilRating.php';
     $set = $ilDB->query("SELECT *" . " FROM exc_assignment_peer" . " WHERE ass_id = " . $ilDB->quote($a_ass_id, "integer") . " AND giver_id = " . $ilDB->quote($ilUser->getId(), "integer"));
     while ($row = $ilDB->fetchAssoc($set)) {
         if (trim($row["pcomment"])) {
             $cnt++;
         } else {
             $mark = (int) round(ilRating::getRatingForUserAndObject($a_ass_id, "ass", $row["peer_id"], "peer", $row["giver_id"]));
             if ($mark) {
                 $cnt++;
             }
         }
     }
     return $cnt;
 }
Пример #5
0
 /**
  * Preload rating data for list guis
  * 
  * @param array $a_obj_ids
  */
 public static function preloadListGUIData(array $a_obj_ids)
 {
     global $ilDB, $ilUser;
     $tmp = $res = $tmp_user = $res_user = array();
     // collapse by categories
     $q = "SELECT obj_id, obj_type, user_id, AVG(rating) av" . " FROM il_rating" . " WHERE " . $ilDB->in("obj_id", $a_obj_ids, "", "integer") . " AND sub_obj_id = " . $ilDB->quote(0, "integer") . " GROUP BY obj_id, obj_type, user_id";
     $set = $ilDB->query($q);
     while ($rec = $ilDB->fetchAssoc($set)) {
         $tmp[$rec["obj_type"] . "/" . $rec["obj_id"]][$rec["user_id"]] = (double) $rec["av"];
         if ($rec["user_id"] == $ilUser->getId()) {
             // add final average to user result (no sub-objects)
             $res_user[$rec["obj_type"] . "/" . $rec["obj_id"]] = (double) $rec["av"];
         }
     }
     // average for main objects without sub-objects
     foreach ($tmp as $obj_id => $votes) {
         $res[$obj_id] = array("avg" => array_sum($votes) / sizeof($votes), "cnt" => sizeof($votes));
     }
     // file/wiki/lm rating toggles
     $set = $ilDB->query("SELECT file_id, rating" . " FROM file_data" . " WHERE " . $ilDB->in("file_id", $a_obj_ids, "", integer));
     while ($row = $ilDB->fetchAssoc($set)) {
         $id = "file/" . $row["file_id"];
         if ($row["rating"] && !isset($res[$id])) {
             $res[$id] = array("avg" => 0, "cnt" => 0);
         } else {
             if (!$row["rating"] && isset($res[$id])) {
                 unset($res[$id]);
             }
         }
     }
     $set = $ilDB->query("SELECT id, rating_overall" . " FROM il_wiki_data" . " WHERE " . $ilDB->in("id", $a_obj_ids, "", integer));
     while ($row = $ilDB->fetchAssoc($set)) {
         $id = "wiki/" . $row["id"];
         if ($row["rating_overall"] && !isset($res[$id])) {
             $res[$id] = array("avg" => 0, "cnt" => 0);
         } else {
             if (!$row["rating_overall"] && isset($res[$id])) {
                 unset($res[$id]);
             }
         }
     }
     $set = $ilDB->query("SELECT id, rating" . " FROM content_object" . " WHERE " . $ilDB->in("id", $a_obj_ids, "", integer));
     while ($row = $ilDB->fetchAssoc($set)) {
         $id = "lm/" . $row["id"];
         if ($row["rating"] && !isset($res[$id])) {
             $res[$id] = array("avg" => 0, "cnt" => 0);
         } else {
             if (!$row["rating"] && isset($res[$id])) {
                 unset($res[$id]);
             }
         }
     }
     self::$list_data = array("all" => $res, "user" => $res_user);
 }
Пример #6
0
 function updatePageRating()
 {
     global $ilUser;
     $pg_id = $_GET["pgid"];
     if (!$this->ctrl->isAsynch() || !$pg_id) {
         exit;
     }
     include_once './Services/Rating/classes/class.ilRating.php';
     $rating = (int) $_POST["rating"];
     if ($rating) {
         ilRating::writeRatingForUserAndObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId(), $_POST["rating"]);
     } else {
         ilRating::resetRatingForUserAndObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
     }
     include_once './Services/Rating/classes/class.ilRatingGUI.php';
     $rating = new ilRatingGUI();
     $rating->setObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
     $rating->setYourRatingText($this->lng->txt("lm_rate_page"));
     echo $rating->getHtml(true, true, "il.LearningModule.saveRating(%rating%);");
     echo $this->tpl->getOnLoadCodeForAsynch();
     exit;
 }
 /**
  * Save Rating
  */
 function saveRating()
 {
     if (!is_array($_REQUEST["rating"])) {
         ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), ilUtil::stripSlashes($_GET["rating"]));
     } else {
         foreach ($_POST["rating"] as $cat_id => $rating) {
             ilRating::writeRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), $rating, $cat_id);
         }
     }
 }
Пример #8
0
 public function getAllPeerReviews($a_validate = true)
 {
     global $ilDB;
     $res = array();
     include_once './Services/Rating/classes/class.ilRating.php';
     $set = $ilDB->query("SELECT *" . " FROM exc_assignment_peer" . " WHERE ass_id = " . $ilDB->quote($this->getId(), "integer") . " ORDER BY peer_id");
     while ($row = $ilDB->fetchAssoc($set)) {
         $rating = round(ilRating::getRatingForUserAndObject($this->getId(), "ass", $row["peer_id"], "peer", $row["giver_id"]));
         if (!$a_validate || self::validatePeerReview($row, $rating)) {
             $res[$row["peer_id"]][$row["giver_id"]] = array($row["pcomment"], $rating);
         }
     }
     return $res;
 }
 public function getValue()
 {
     return ilRating::getOverallRatingForObject($this->getRecord()->getId(), "dcl_record", $this->getField()->getId(), "dcl_field");
 }
Пример #10
0
 public function executeCommand()
 {
     /**
      * @var $ilNavigationHistory ilNavigationHistory
      * @var $ilAccess ilAccessHandler
      * @var $ilCtrl ilCtrl
      * @var $ilTabs ilTabsGUI
      * @var $ilErr  ilErrorHandling
      * @var $ilUser ilObjUser
      */
     global $ilNavigationHistory, $ilAccess, $ilCtrl, $ilTabs, $ilErr, $ilUser;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $exclude_cmds = array('viewThread', 'markPostUnread', 'markPostRead', 'showThreadNotification', 'cancelPostActivation', 'cancelPostDeactivation', 'performPostActivation', 'performPostDeactivation', 'performPostAndChildPostsActivation', 'askForPostActivation', 'askForPostDeactivation', 'toggleThreadNotification', 'toggleThreadNotificationTab', 'toggleStickiness', 'cancelPost', 'savePost', 'quotePost', 'getQuotationHTMLAsynch', 'setTreeStateAsynch', 'fetchTreeChildrenAsync');
     if (!in_array($cmd, $exclude_cmds)) {
         $this->prepareOutput();
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
         $ilNavigationHistory->addItem($_GET['ref_id'], 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=showThreads&amp;ref_id=' . $_GET['ref_id'], 'frm');
     }
     switch ($next_class) {
         case 'ilpermissiongui':
             require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
             $perm_gui = new ilPermissionGUI($this);
             $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'ilforumexportgui':
             require_once 'Modules/Forum/classes/class.ilForumExportGUI.php';
             $fex_gui = new ilForumExportGUI($this);
             $this->ctrl->forwardCommand($fex_gui);
             exit;
             break;
         case 'ilforummoderatorsgui':
             require_once 'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
             $fm_gui = new ilForumModeratorsGUI($this);
             $this->ctrl->forwardCommand($fm_gui);
             break;
         case 'ilinfoscreengui':
             $this->infoScreen();
             break;
         case 'ilcolumngui':
             $this->showThreadsObject();
             break;
         case 'ilpublicuserprofilegui':
             include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
             $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
             $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
             $profile_gui->setAdditional($add);
             $ret = $this->ctrl->forwardCommand($profile_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilobjectcopygui':
             include_once 'Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('frm');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilexportgui':
             $ilTabs->setTabActive('export');
             include_once 'Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this);
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         case "ilratinggui":
             if (!$this->objProperties->isIsThreadRatingEnabled() || $ilUser->isAnonymous()) {
                 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
             }
             require_once 'Services/Rating/classes/class.ilRatingGUI.php';
             $rating_gui = new ilRatingGUI();
             $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 'thread');
             $ilCtrl->setParameter($this, 'thr_pk', (int) $_GET['thr_pk']);
             $this->ctrl->forwardCommand($rating_gui);
             $avg = ilRating::getOverallRatingForObject($this->object->getId(), $this->object->getType(), (int) $_GET['thr_pk'], 'thread');
             $this->objCurrentTopic->setAverageRating($avg['avg']);
             $this->objCurrentTopic->update();
             $ilCtrl->redirect($this, "showThreads");
             break;
         case 'ilcommonactiondispatchergui':
             include_once 'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         default:
             // alex, 11 Jan 2011:
             // I inserted this workaround due to bug report 6971.
             // In general the command handling is quite obscure here.
             // The form action of the table should be filled
             // with $ilCtrl->getFormAction(..) not with $ilCtrl->getLinkTarget(..)
             // Commands should be determined with $ilCtrl->getCmd() not
             // with accessing $_POST['selected_cmd'], since this is internal
             // of ilTable2GUI/ilCtrl and may change.
             if (isset($_POST['select_cmd2'])) {
                 $_POST['selected_cmd'] = $_POST["selected_cmd2"];
             }
             if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] != null) {
                 $member_cmd = array('enableAdminForceNoti', 'disableAdminForceNoti', 'enableHideUserToggleNoti', 'disableHideUserToggleNoti');
                 in_array($_POST['selected_cmd'], $member_cmd) ? $cmd = $_POST['selected_cmd'] : ($cmd = 'performThreadsAction');
             } else {
                 if (!$cmd && !$_POST['selected_cmd']) {
                     $cmd = 'showThreads';
                 }
             }
             $cmd .= 'Object';
             $this->{$cmd}();
             break;
     }
     // suppress for topic level
     if ($cmd != 'viewThreadObject' && $cmd != 'showUserObject') {
         $this->addHeaderAction();
     }
 }
Пример #11
0
 /**
  * Get average rating for wiki or wiki page
  * 
  * @param int $a_wiki_id
  * @param int $a_page_id
  * @return array
  */
 protected static function getAverageRating($a_wiki_id, $a_page_id = null)
 {
     include_once "Services/Rating/classes/class.ilRating.php";
     if (!$a_page_id) {
         return ilRating::getOverallRatingForObject($a_wiki_id, "wiki");
     } else {
         return ilRating::getOverallRatingForObject($a_wiki_id, "wiki", $a_page_id, "wpg");
     }
 }
Пример #12
0
 /**
  * Reset Rating
  */
 function resetUserRating()
 {
     ilRating::resetRatingForUserAndObject($this->obj_id, $this->obj_type, $this->sub_obj_id, $this->sub_obj_type, $this->getUserId());
 }
Пример #13
0
 /**
  * Get all item information (title, commands, description) in HTML
  *
  * @access	public
  * @param	int			$a_ref_id		item reference id
  * @param	int			$a_obj_id		item object id
  * @param	int			$a_title		item title
  * @param	int			$a_description	item description
  * @param	bool		$a_use_asynch
  * @param	bool		$a_get_asynch_commands
  * @param	string		$a_asynch_url
  * @param	bool		$a_context	    workspace/tree context
  * @return	string		html code
  */
 function getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch = false, $a_get_asynch_commands = false, $a_asynch_url = "", $a_context = self::CONTEXT_REPOSITORY)
 {
     global $ilAccess, $ilBench, $ilUser, $ilCtrl;
     // this variable stores wheter any admin commands
     // are included in the output
     $this->adm_commands_included = false;
     // only for permformance exploration
     $type = ilObject::_lookupType($a_obj_id);
     // initialization
     $ilBench->start("ilObjectListGUI", "1000_getListHTML_init{$type}");
     $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description, $a_context);
     $ilBench->stop("ilObjectListGUI", "1000_getListHTML_init{$type}");
     // prepare ajax calls
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     if ($a_context == self::CONTEXT_REPOSITORY) {
         $node_type = ilCommonActionDispatcherGUI::TYPE_REPOSITORY;
     } else {
         $node_type = ilCommonActionDispatcherGUI::TYPE_WORKSPACE;
     }
     $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id));
     if ($a_use_asynch && $a_get_asynch_commands) {
         return $this->insertCommands(true, true);
     }
     if ($this->rating_enabled) {
         if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) {
             $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type);
             $rating = new ilRatingGUI();
             $rating->setObject($this->obj_id, $this->type);
             /*				$this->addCustomProperty(
             					$this->lng->txt("rating_average_rating"),
             					$rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
             					false,
             					true
             				);*/
             $this->addCustomProperty("", $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), false, true);
         }
     }
     // read from cache
     include_once "Services/Object/classes/class.ilListItemAccessCache.php";
     $this->acache = new ilListItemAccessCache();
     $cres = $this->acache->getEntry($ilUser->getId() . ":" . $a_ref_id);
     if ($this->acache->getLastAccessStatus() == "hit") {
         $this->access_cache = unserialize($cres);
     } else {
         // write to cache
         $this->storeAccessCache();
     }
     // visible check
     if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id)) {
         $ilBench->stop("ilObjectListGUI", "2000_getListHTML_check_visible");
         $this->resetCustomData();
         return "";
     }
     // BEGIN WEBDAV
     if ($type == 'file' and ilObjFileAccess::_isFileHidden($a_title)) {
         $this->resetCustomData();
         return "";
     }
     // END WEBDAV
     $this->tpl = new ilTemplate("tpl.container_list_item.html", true, true, "Services/Container", "DEFAULT", false, true);
     if ($this->getCommandsStatus() || $this->payment_enabled && IS_PAYMENT_ENABLED) {
         if (!$this->getSeparateCommands()) {
             $this->tpl->setVariable("COMMAND_SELECTION_LIST", $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url));
         }
     }
     if ($this->getProgressInfoStatus()) {
         $this->insertProgressInfo();
     }
     // insert title and describtion
     $this->insertTitle();
     if (!$this->isMode(IL_LIST_AS_TRIGGER)) {
         if ($this->getDescriptionStatus()) {
             $this->insertDescription();
         }
     }
     if ($this->getSearchFragmentStatus()) {
         $this->insertSearchFragment();
     }
     if ($this->enabledRelevance()) {
         $this->insertRelevance();
     }
     // properties
     $ilBench->start("ilObjectListGUI", "6000_insert_properties{$type}");
     if ($this->getPropertiesStatus()) {
         $this->insertProperties();
     }
     $ilBench->stop("ilObjectListGUI", "6000_insert_properties{$type}");
     // notice properties
     $ilBench->start("ilObjectListGUI", "6500_insert_notice_properties{$type}");
     if ($this->getNoticePropertiesStatus()) {
         $this->insertNoticeProperties();
     }
     $ilBench->stop("ilObjectListGUI", "6500_insert_notice_properties{$type}");
     // preconditions
     $ilBench->start("ilObjectListGUI", "7000_insert_preconditions");
     if ($this->getPreconditionsStatus()) {
         $this->insertPreconditions();
     }
     $ilBench->stop("ilObjectListGUI", "7000_insert_preconditions");
     // path
     $ilBench->start("ilObjectListGUI", "8000_insert_path");
     $this->insertPath();
     $ilBench->stop("ilObjectListGUI", "8000_insert_path");
     $ilBench->start("ilObjectListGUI", "8500_item_detail_links");
     if ($this->getItemDetailLinkStatus()) {
         $this->insertItemDetailLinks();
     }
     $ilBench->stop("ilObjectListGUI", "8500_item_detail_links");
     // icons and checkboxes
     $this->insertIconsAndCheckboxes();
     // input field for position
     $this->insertPositionField();
     // subitems
     $this->insertSubItems();
     // file upload
     if ($this->isFileUploadAllowed()) {
         $this->insertFileUpload();
     }
     $this->resetCustomData();
     $this->tpl->setVariable("DIV_CLASS", 'ilContainerListItemOuter');
     $this->tpl->setVariable("DIV_ID", 'id = "' . $this->getUniqueItemId(true) . '"');
     $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation());
     // #11554 - make sure that internal ids are reset
     $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
     return $this->tpl->get();
 }
 private function buildData()
 {
     global $ilCtrl, $lng;
     $data = array();
     foreach ($this->object_data as $record) {
         $record_data = array();
         $record_data["_front"] = null;
         foreach ($this->table->getVisibleFields() as $field) {
             $title = $field->getTitle();
             //Check Options of Displaying
             $options = array();
             $arr_properties = $field->getProperties();
             if ($arr_properties[ilDataCollectionField::PROPERTYID_REFERENCE_LINK]) {
                 $options['link']['display'] = true;
             }
             if ($arr_properties[ilDataCollectionField::PROPERTYID_ILIAS_REFERENCE_LINK]) {
                 $options['link']['display'] = true;
             }
             if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_RATING) {
                 $val = ilRating::getOverallRatingForObject($record->getId(), "dcl_record", $field->getId(), "dcl_field");
                 $record_data[$title] = $val["avg"] . " (" . $val["cnt"] . ")";
             } else {
                 $record_data[$title] = $record->getRecordFieldHTML($field->getId(), $options) ? $record->getRecordFieldHTML($field->getId(), $options) : null;
             }
             if ($field->getLearningProgress()) {
                 $record_data["_status_" . $title] = $this->getStatus($record, $field);
             }
         }
         $ilCtrl->setParameterByClass("ildatacollectionfieldeditgui", "record_id", $record->getId());
         $ilCtrl->setParameterByClass("ildatacollectionrecordviewgui", "record_id", $record->getId());
         $ilCtrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", $record->getId());
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         if (ilDataCollectionRecordViewGUI::_getViewDefinitionId($record)) {
             $record_data["_front"] = $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord');
         }
         $alist = new ilAdvancedSelectionListGUI();
         $alist->setId($record->getId());
         $alist->setListTitle($lng->txt("actions"));
         if (ilDataCollectionRecordViewGUI::_getViewDefinitionId($record)) {
             $alist->addItem($lng->txt('view'), 'view', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord'));
         }
         if ($record->hasPermissionToEdit($this->parent_obj->parent_obj->ref_id)) {
             $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'edit'));
         }
         if ($record->hasPermissionToDelete($this->parent_obj->parent_obj->ref_id)) {
             $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'confirmDelete'));
         }
         $record_data["_actions"] = $alist->getHTML();
         $record_data["_record"] = $record;
         $data[] = $record_data;
     }
     $this->setData($data);
 }
Пример #15
0
 /**
  * Preload common properties
  *
  * @param
  * @return
  */
 static function preloadCommonProperties($a_obj_ids)
 {
     global $lng;
     $lng->loadLanguageModule("notes");
     $lng->loadLanguageModule("tagging");
     $lng->loadLanguageModule("rating");
     include_once "./Services/Tagging/classes/class.ilTagging.php";
     self::$cnt_tags = ilTagging::_countTags($a_obj_ids);
     include_once "./Services/Notes/classes/class.ilNote.php";
     self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
     self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
     include_once "./Services/Tracking/classes/class.ilLPStatus.php";
     ilLPStatus::preloadListGUIData($a_obj_ids);
     include_once "./Services/Rating/classes/class.ilRating.php";
     include_once "./Services/Rating/classes/class.ilRatingGUI.php";
     ilRating::preloadListGUIData($a_obj_ids);
     self::$preload_done = true;
 }
 protected function getItems()
 {
     $data = array();
     $personal = $this->ass->hasPeerReviewPersonalized();
     if ($personal) {
         include_once "Services/User/classes/class.ilUserUtil.php";
     }
     foreach ($this->peer_data as $idx => $item) {
         $row = array();
         $row["giver_id"] = $item["giver_id"];
         $row["peer_id"] = $item["peer_id"];
         $row["submission"] = "";
         $row["mark"] = (int) round(ilRating::getRatingForUserAndObject($this->ass->getId(), "ass", $item["peer_id"], "peer", $item["giver_id"]));
         $row["comment"] = $item["pcomment"];
         $row["tstamp"] = $item["tstamp"];
         if (!$personal) {
             $row["seq"] = $idx + 1;
         } else {
             if (!$this->read_only) {
                 $row["name"] = ilUserUtil::getNamePresentation($item["peer_id"]);
             } else {
                 $row["name"] = ilUserUtil::getNamePresentation($item["giver_id"]);
             }
         }
         $data[] = $row;
     }
     $this->setData($data);
 }