Class ilObjForumListGUI. More...
Public Member Functions | |
ilObjForumListGUI () | |
constructor | |
setChildId ($a_child_id) | |
getChildId () | |
init () | |
initialisation | |
initItem ($a_ref_id, $a_obj_id, $a_title="", $a_description="") | |
inititialize new item | |
getProperties () | |
Get item properties. | |
getCommandFrame ($a_cmd) | |
Get command target. | |
getCommandLink ($a_cmd) | |
Get command link url. |
Class ilObjForumListGUI.
Definition at line 37 of file class.ilObjForumListGUI.php.
ilObjForumListGUI::getChildId | ( | ) |
Definition at line 52 of file class.ilObjForumListGUI.php.
Referenced by getCommandLink().
{
return $this->child_id;
}
ilObjForumListGUI::getCommandFrame | ( | $ | a_cmd | ) |
Get command target.
int | $a_ref_id reference id | |
string | $a_cmd command |
Reimplemented from ilObjectListGUI.
Definition at line 210 of file class.ilObjForumListGUI.php.
References ilFrameTargetInfo::_getFrame().
{ // separate method for this line $target = ilFrameTargetInfo::_getFrame("MainContent"); return $target; }
ilObjForumListGUI::getCommandLink | ( | $ | a_cmd | ) |
Get command link url.
Overwrite this method, if link target is not build by ctrl class (e.g. "lm_presentation.php", "forum.php"). This is the case for all links now, but bringing everything to ilCtrl should be realised in the future.
string | $a_cmd command |
Reimplemented from ilObjectListGUI.
Definition at line 218 of file class.ilObjForumListGUI.php.
References getChildId().
{ switch($a_cmd) { case 'thread': return "forums_frameset.php?ref_id=".$this->ref_id. "&thr_pk=".$this->getChildId(); case 'posting': $thread_post = $this->getChildId(); return "forums_frameset.php?target=1&ref_id=".$this->ref_id. "&thr_pk=".$thread_post[0]. "&pos_pk=".$thread_post[1]."#".$thread_post[1]; default: return parent::getCommandLink($a_cmd); } }
ilObjForumListGUI::getProperties | ( | ) |
Get item properties.
Overwrite this method to add properties at the bottom of the item html
Definition at line 105 of file class.ilObjForumListGUI.php.
References $lng, ilObject::_exists(), ilObjForum::_getCountUnread(), ilFrameTargetInfo::_getFrame(), ilForum::_getModerators(), ilForum::_lookupForumData(), and ilObjUser::_lookupLogin().
{ global $lng, $ilUser,$ilAccess; $props = array(); // Return no properties if read access isn't granted (e.g. course visibility) if(!$ilAccess->checkAccess('read','',$this->ref_id)) { return array(); } include_once("classes/class.ilForum.php"); include_once("classes/class.ilObjForum.php"); $frm_data = ilForum::_lookupForumData($this->obj_id); include_once("classes/class.ilObjUser.php"); $MODS = ilForum::_getModerators($this->ref_id); $moderators = ""; for ($i = 0; $i < count($MODS); $i++) { if ($moderators != "") { $moderators .= ", "; } $moderators .= "<a class=\"il_ItemProperty\" target=\"". ilFrameTargetInfo::_getFrame("MainContent"). "\" href=\"forums_user_view.php?ref_id=".$this->ref_id."&user=". $MODS[$i]."&offset=".$Start."\">".ilObjUser::_lookupLogin($MODS[$i])."</a>"; } // Moderators $props[] = array("alert" => false, "property" => $lng->txt("forums_moderators"), "value" => $moderators); // Topics $props[] = array("alert" => false, "property" => $lng->txt("forums_threads"), "value" => $frm_data["top_num_threads"]); // Articles (Unread) $unread = ilObjForum::_getCountUnread($this->obj_id,$ilUser->getId()); $alert = ($unread > 0) ? true : false; $props[] = array("alert" => $alert, "property" => $lng->txt("forums_articles")." (".$lng->txt("unread").")", "value" => $frm_data['top_num_posts']." (".$unread.")"); // New Articles $new = $this->frm_obj->getCountNew($ilUser->getId()); $alert = ($new > 0) ? true : false; $props[] = array("alert" => $alert, "property" => $lng->txt("forums_new_articles"), "value" => $new); // Visits $props[] = array("alert" => false, "property" => $lng->txt("visits"), "value" => $frm_data["visits"]); // Last Article if ($frm_data["top_last_post"] != "") { $lastPost = $this->frm->getLastPost($frm_data["top_last_post"]); $lastPost["pos_message"] = $this->frm->prepareText($lastPost["pos_message"]); } if (is_array($lastPost)) { $last_user = $this->frm->getUserData($lastPost["pos_usr_id"],$lastPost["import_name"]); $lpCont = "<a class=\"il_ItemProperty\" target=\"". ilFrameTargetInfo::_getFrame("MainContent"). "\" href=\"forums_frameset.php?target=true&pos_pk=". $lastPost["pos_pk"]."&thr_pk=".$lastPost["pos_thr_fk"]."&ref_id=". $this->ref_id."#".$lastPost["pos_pk"]."\">".$lastPost["pos_message"]."</a> ". strtolower($lng->txt("from"))." "; if($lastPost["pos_usr_id"] && ilObject::_exists($lastPost["pos_usr_id"])) { $lpCont .= "<a class=\"il_ItemProperty\" target=\"". ilFrameTargetInfo::_getFrame("MainContent"). "\" href=\"forums_user_view.php?ref_id=".$this->ref_id."&user=". $last_user["usr_id"]."&offset=".$Start."\">".$last_user["login"]."</a>, "; $lpCont .= $lastPost["pos_date"]; } else { $lpCont .= $last_user["login"]; } } $props[] = array("alert" => false, "newline" => true, "property" => $lng->txt("forums_last_post"), "value" => $lpCont); return $props; }
ilObjForumListGUI::ilObjForumListGUI | ( | ) |
constructor
Definition at line 43 of file class.ilObjForumListGUI.php.
References ilObjectListGUI::ilObjectListGUI().
{ $this->ilObjectListGUI(); }
ilObjForumListGUI::init | ( | ) |
initialisation
Reimplemented from ilObjectListGUI.
Definition at line 61 of file class.ilObjForumListGUI.php.
References ilObjForumAccess::_getCommands().
{ $this->delete_enabled = true; $this->cut_enabled = true; $this->subscribe_enabled = true; $this->link_enabled = true; $this->payment_enabled = false; $this->type = "frm"; $this->gui_class_name = "ilobjforumgui"; // general commands array include_once('class.ilObjForumAccess.php'); $this->commands = ilObjForumAccess::_getCommands(); }
ilObjForumListGUI::initItem | ( | $ | a_ref_id, | |
$ | a_obj_id, | |||
$ | a_title = "" , |
|||
$ | a_description = "" | |||
) |
inititialize new item
int | $a_ref_id reference id | |
int | $a_obj_id object id | |
string | $a_title title | |
string | $a_description description |
Reimplemented from ilObjectListGUI.
Definition at line 84 of file class.ilObjForumListGUI.php.
References ilObjectFactory::getInstanceByRefId().
{ parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description); $this->frm_obj =& ilObjectFactory::getInstanceByRefId($this->ref_id); $this->frm =& new ilForum(); $this->frm->setForumRefId($a_ref_id); $this->frm->setWhereCondition("top_frm_fk = ".$a_obj_id); }
ilObjForumListGUI::setChildId | ( | $ | a_child_id | ) |
Definition at line 48 of file class.ilObjForumListGUI.php.
{ $this->child_id = $a_child_id; }