• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/News/classes/class.ilPDNewsTableGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once("Services/Table/classes/class.ilTable2GUI.php");
00025 
00034 class ilPDNewsTableGUI extends ilTable2GUI
00035 {
00036 
00037         function ilPDNewsTableGUI($a_parent_obj, $a_parent_cmd = "")
00038         {
00039                 global $ilCtrl, $lng;
00040                 
00041                 parent::__construct($a_parent_obj, $a_parent_cmd);
00042                 
00043                 $this->addColumn("");
00044                 //$this->addColumn($lng->txt("date"), "creation_date", "1");
00045                 //$this->addColumn($lng->txt("news_news_item_content"), "");
00046                 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
00047                 $this->setRowTemplate("tpl.table_row_pd_news.html",
00048                         "Services/News");
00049                 $this->setDefaultOrderField("update_date");
00050                 $this->setDefaultOrderDirection("desc");
00051                 $this->setEnableTitle(false);
00052                 $this->setEnableHeader(false);
00053                 //$this->setCloseCommand($ilCtrl->getParentReturnByClass("ilpdnewsgui"));
00054         }
00055         
00060         protected function fillRow($a_set)
00061         {
00062                 global $lng, $ilCtrl;
00063                 
00064                 $news_set = new ilSetting("news");
00065                 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
00066 
00067                 // context
00068                 $obj_id = ilObject::_lookupObjId($a_set["ref_id"]);
00069                 $obj_type = ilObject::_lookupType($obj_id);
00070                 $obj_title = ilObject::_lookupTitle($obj_id);
00071                         
00072                 // user
00073                 if ($a_set["user_id"] > 0)
00074                 {
00075                         $this->tpl->setCurrentBlock("user_info");
00076                         if ($obj_type == "frm")
00077                         {
00078                                 include_once("./Modules/Forum/classes/class.ilForumProperties.php");
00079                                 if (ilForumProperties::_isAnonymized($a_set["context_obj_id"]))
00080                                 {
00081                                         if ($a_set["context_sub_obj_type"] == "pos" &&
00082                                                 $a_set["context_sub_obj_id"] > 0)
00083                                         {
00084                                                 include_once("./Modules/Forum/classes/class.ilForumPost.php");
00085                                                 $post = new ilForumPost($a_set["context_sub_obj_id"]);
00086                                                 if ($post->getUserAlias() != "") $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias()));
00087                                                 else $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
00088                                         }
00089                                         else
00090                                         {
00091                                                 $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
00092                                         }
00093                                 }
00094                                 else
00095                                 {
00096                                         if (ilObject::_exists($a_set["user_id"]))
00097                                         {
00098                                                 $user_obj = new ilObjUser($a_set["user_id"]);
00099                                                 $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
00100                                         }
00101                                 }
00102                         }
00103                         else
00104                         {
00105                                 if (ilObject::_exists($a_set["user_id"]))
00106                                 {
00107                                         $user_obj = new ilObjUser($a_set["user_id"]);
00108                                         $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
00109                                 }
00110                         }
00111                         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
00112                         $this->tpl->parseCurrentBlock();
00113                 }
00114                 
00115                 // media player
00116                 if ($a_set["content_type"] == NEWS_AUDIO &&
00117                         $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"]))
00118                 {
00119                         include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
00120                         include_once("./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
00121                         $mob = new ilObjMediaObject($a_set["mob_id"]);
00122                         $med = $mob->getMediaItem("Standard");
00123                         $mpl = new ilMediaPlayerGUI();
00124                         $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"])."/".
00125                                 $med->getLocation());
00126                         $this->tpl->setCurrentBlock("player");
00127                         $this->tpl->setVariable("PLAYER",
00128                                 $mpl->getMp3PlayerHtml());
00129                         $this->tpl->parseCurrentBlock();
00130                 }
00131                 
00132                 // access
00133                 if ($enable_internal_rss)
00134                 {
00135                         $this->tpl->setCurrentBlock("access");
00136                         include_once("./Services/Block/classes/class.ilBlockSetting.php");
00137                         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
00138                         if ($a_set["visibility"] == NEWS_PUBLIC ||
00139                                 ($a_set["priority"] == 0 &&
00140                                 ilBlockSetting::_lookup("news", "public_notifications",
00141                                 0, $obj_id)))
00142                         {
00143                                 $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
00144                         }
00145                         else
00146                         {
00147                                 $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
00148                         }
00149                         $this->tpl->parseCurrentBlock();
00150                 }
00151 
00152                 // content
00153                 if ($a_set["content"] != "")
00154                 {
00155                         $this->tpl->setCurrentBlock("content");
00156                         $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true));
00157                         $this->tpl->parseCurrentBlock();
00158                 }
00159                 if ($a_set["content_long"] != "")
00160                 {
00161                         $this->tpl->setCurrentBlock("long");
00162                         $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true));
00163                         $this->tpl->parseCurrentBlock();
00164                 }
00165                 if ($a_set["update_date"] != $a_set["creation_date"])   // update date
00166                 {
00167                         $this->tpl->setCurrentBlock("ni_update");
00168                         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
00169                         $this->tpl->setVariable("VAL_LAST_UPDATE",
00170                                 ilFormat::formatDate($a_set["update_date"], "datetime", true));
00171                         $this->tpl->parseCurrentBlock();
00172                 }
00173 
00174                 // forum hack, not nice
00175                 $add = "";
00176                 if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos"
00177                         && $a_set["context_sub_obj_id"] > 0)
00178                 {
00179                         include_once("./Modules/Forum/classes/class.ilObjForumAccess.php");
00180                         $pos = $a_set["context_sub_obj_id"];
00181                         $thread = ilObjForumAccess::_getThreadForPosting($pos);
00182                         if ($thread > 0)
00183                         {
00184                                 $add = "_".$thread."_".$pos;
00185                         }
00186                 }
00187                 $url_target = "./goto.php?client_id=".rawurlencode(CLIENT_ID)."&target=".
00188                         $obj_type."_".$a_set["ref_id"].$add;
00189                 $this->tpl->setCurrentBlock("context");
00190                 $cont_loc = new ilLocatorGUI();
00191                 $cont_loc->addContextItems($a_set["ref_id"], true);
00192                 $this->tpl->setVariable("CONTEXT_LOCATOR",
00193                         $cont_loc->getHTML());
00194                 $this->tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
00195                 $this->tpl->setVariable("CONTEXT_TITLE", $obj_title);
00196                 $this->tpl->setVariable("IMG_CONTEXT_TITLE",
00197                         ilUtil::getImagePath("icon_".$obj_type."_b.gif"));
00198                 $this->tpl->parseCurrentBlock();
00199 
00200                 $this->tpl->setVariable("HREF_TITLE", $url_target);
00201                 
00202                 // title
00203                 if ($a_set["content_is_lang_var"])
00204                 {
00205                         $this->tpl->setVariable("VAL_TITLE", $lng->txt($a_set["title"]));
00206                 }
00207                 else
00208                 {
00209                         $this->tpl->setVariable("VAL_TITLE", ilUtil::stripSlashes($a_set["title"]));                    // title
00210                 }
00211 
00212                 // creation date
00213                 $this->tpl->setVariable("VAL_CREATION_DATE",
00214                         ilFormat::formatDate($a_set["creation_date"], "datetime", true));
00215                 $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
00216                 
00217                 $this->tpl->parseCurrentBlock();
00218         }
00219 
00220 }
00221 ?>

Generated on Fri Dec 13 2013 17:57:00 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1