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

usr_pdesktop.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 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 
00035 require_once "./include/inc.header.php";
00036 require_once "classes/class.ilObjUser.php";
00037 require_once "classes/class.ilMail.php";
00038 
00039 //add template for content
00040 $tpl->addBlockFile("CONTENT", "content", "tpl.usr_pdesktop.html");
00041 
00042 
00043 // get skin = path to the specific template
00044 $template_path = $ilias->tplPath.$ilias->account->getPref("skin");
00045 
00046 //if the user visited lessons output the last visited lesson
00047 if ($_GET["cmd"] == "lvis_le")
00048 {
00049         // add template to greet the user
00050         $tpl->addBlockFile("USR_TEXT", "usr_text", "tpl.usr_text.html");
00051 
00052         //greetings
00053         $login_name = $ilias->account->login;
00054         $greeting = "";
00055         //check if morning, afternoon, evening or night
00056         if (date("H:i",time()) > "06:00:00" and date("H:i",time()) < "12:00:00")
00057                 {$greeting .= $lng->txt("ingmedia_good_morning");}
00058         elseif (date("H:i",time()) > "12:00:00" and date("H:i",time()) < "18:00:00")
00059                 {$greeting .= $lng->txt("ingmedia_good_afternoon");}
00060         elseif (date("H:i",time()) > "18:00:00" or date("H:i",time()) < "22:00:00")
00061                 {$greeting .= $lng->txt("ingmedia_good_evening");}
00062         elseif (date("H:i",time()) < "06:00:00" or date("H:i",time()) > "22:00:00")
00063                 {$greeting .= $lng->txt("ingmedia_good_night");}
00064         else
00065                 {$greeting .= $lng->txt("ingmedia_hello");};
00066         $greeting .= " ".$login_name;
00067         //write these lines on the top of the frame "bottom"
00068         $greeting .= $lng->txt("ingmedia_welcome");
00069 
00070         // get all lm visited
00071         $result = $ilias->account->getLastVisitedLessons();
00072         if (sizeof($result) > 0)
00073         {
00074                 $akt_date =  ilFormat::formatDate($result[0]["timestamp"],"date");
00075                 $info ="";
00076                 $info = $lng->txt("ingmedia_info_about_work1");
00077                 $info .= " ".$akt_date." ";
00078                 $info .= $lng->txt("ingmedia_info_about_work2");
00079                 $tpl->setCurrentBlock("link_button");
00080                 $tpl->setVariable("TXT_LINK", "content/lm_presentation.php?ref_id=".$result[0]["lm_id"]."&obj_id=".$result[0]["obj_id"]);
00081                 $tpl->setVariable("TXT_LINK_IMG", $template_path."/images/layout/open.gif");
00082                 $tpl->setVariable("TXT_LINK_TITLE", $result[0]["lm_title"]);
00083                 $tpl->parseCurrentBlock();
00084         }
00085         else
00086         {
00087                 // no last lo for this user found, so inform user and link back to desktop
00088                 $info ="";
00089         }
00090         $tpl->setCurrentBlock("using_info");
00091         $tpl->setVariable("TXT_TITLE",$greeting);
00092         $tpl->setVariable("TXT_NOTES",$info);
00093         $tpl->parseCurrentBlock();
00094 }
00095 
00096 
00097 //if the user visited lessons output the last visited lesson
00098 if ($_GET["cmd"] == "visited")
00099 {
00100         // add template to greet the user
00101         $tpl->addBlockFile("USR_TEXT", "usr_text", "tpl.usr_text.html");
00102 
00103         // get all lm visited
00104         $result = $ilias->account->getLastVisitedLessons();
00105         if (sizeof($result) > 0)
00106         {
00107                 for ($i=1;$i<=sizeof($result);$i++)
00108                 {
00109                         $tpl->setCurrentBlock("link_button");
00110                         $tpl->setVariable("TXT_LINK", "content/lm_presentation.php?ref_id=".$result[$i-1]["lm_id"]."&obj_id=".$result[$i-1]["obj_id"]);
00111                         $tpl->setVariable("TXT_LINK_TITLE", ilFormat::formatDate($result[$i-1]["timestamp"],"date")." - ".$result[$i-1]["lm_title"]);
00112                         $tpl->setVariable("TXT_LINK_IMG", $template_path."/images/layout/open.gif");
00113                         $tpl->parseCurrentBlock();
00114                 }
00115         }
00116         // TO DO: use my own profile
00117         $tpl->setCurrentBlock("using_info");
00118         $tpl->setVariable("TXT_TITLE",$lng->txt("ingmedia_visited_le"));
00119         $tpl->parseCurrentBlock();
00120 }
00121 
00122 
00123 
00124 // output all registered lessons of the user
00125 if ($_GET["cmd"] == "reg_le")
00126 {
00127         // add template 
00128         $tpl->addBlockFile("USR_TEXT", "usr_text", "tpl.usr_text.html");
00129 
00130         // learning modules
00131         $lo_items = $ilias->account->getDesktopItems("lm");
00132         $i = 0;
00133         foreach ($lo_items as $lo_item)
00134         {
00135                 $i++;
00136                 $tpl->setCurrentBlock("link_button");
00137                 $tpl->setVariable("TXT_LINK", "content/lm_presentation.php?ref_id=".$lo_item["id"].
00138                         "&obj_id=".$lo_item["parameters"]);
00139                 $tpl->setVariable("TXT_LINK_TITLE", $lo_item["title"]);
00140                 $tpl->setVariable("TXT_LINK_IMG", $template_path."/images/layout/open.gif");
00141                 $tpl->parseCurrentBlock();
00142         }
00143         if ($i == 0)
00144         {
00145                 $tpl->setCurrentBlock("link_button");
00146                 $tpl->setVariable("TXT_LINK_TITLE",$lng->txt("no_lo_in_personal_list"));
00147                 $tpl->parseCurrentBlock();
00148         }
00149         
00150         $tpl->setCurrentBlock("using_info");
00151         $tpl->setVariable("TXT_TITLE",$lng->txt("ingmedia_reg_le"));
00152         $tpl->parseCurrentBlock();
00153 }
00154 
00155 
00156 // out all registered forms the user has access to
00157 if ($_GET["cmd"] == "reg_fo")
00158 {
00159         //forums
00160         $frm_obj = ilUtil::getObjectsByOperations('frm','read');
00161         $frmNum = count($frm_obj);
00162         $lastLogin = $ilias->account->getLastLogin();
00163 
00164         // add template 
00165         $tpl->addBlockFile("USR_TEXT", "usr_text", "tpl.usr_text.html");
00166 
00167         $frm_items = $ilias->account->getDesktopItems("frm");
00168         $i = 0;
00169         foreach ($frm_items as $frm_item)
00170         {
00171                 $i++;
00172                 $tpl->setCurrentBlock("link_button");
00173                 $tpl->setVariable("TXT_LINK",'repository.php?ref_id='.$frm_item['id']);
00174                 $tpl->setVariable("TXT_LINK_TITLE", $frm_item["title"]);
00175                 $tpl->setVariable("TXT_LINK_IMG", $template_path."/images/layout/open.gif");
00176                 $tpl->parseCurrentBlock();
00177         }
00178         if ($i == 0)
00179         {
00180                 $tpl->setCurrentBlock("link_button");
00181                 $tpl->setVariable("TXT_LINK_TITLE", $lng->txt("no_frm_in_personal_list"));
00182                 $tpl->parseCurrentBlock();
00183         }
00184         
00185         $tpl->setCurrentBlock("using_info");
00186         $tpl->setVariable("TXT_TITLE",$lng->txt("ingmedia_reg_fo"));
00187         $tpl->parseCurrentBlock();
00188         
00189         $tpl->parseCurrentBlock();
00190 }
00191 
00192 
00193 // output
00194 $tpl->show();
00195 ?>

Generated on Fri Dec 13 2013 09:06:40 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1