Taskcenter refactored and prepared for new workflow module
[Packages/TYPO3.CMS.git] / typo3 / sysext / taskcenter / task / class.mod_user_task.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Module class for task module
29 *
30 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
31 */
32
33 require_once(PATH_t3lib."class.t3lib_extobjbase.php");
34
35 class mod_user_task extends t3lib_extobjbase {
36 var $getUserNamesFields = "username,usergroup,usergroup_cached_list,uid,realName,email";
37 var $userGroupArray=array();
38 var $perms_clause="";
39
40 var $backPath;
41 var $BE_USER;
42
43 function JScode() {
44
45 }
46 function sendEmail($email,$subject,$message) {
47 $sender = $this->BE_USER->user["realName"]." <".$this->BE_USER->user["email"].">";
48 $message.='
49
50 --------
51 '.sprintf($GLOBALS["LANG"]->getLL("messages_emailFooter"),$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["sitename"],t3lib_div::getIndpEnv("HTTP_HOST"));
52 mail($email,$GLOBALS["TYPO3_CONF_VARS"]["BE"]["notificationPrefix"]." ".$subject,$message,"From: ".$sender);
53
54 // debug($email);
55 // debug($message);
56 }
57 function mod_user_task_init($BE_USER) {
58 $this->BE_USER = $BE_USER;
59 $this->perms_clause = $this->BE_USER->getPagePermsClause(1);
60 }
61 function helpBubble() {
62 return '<img src="'.$this->backPath.'gfx/helpbubble.gif" width="14" height="14" hspace=2 align=top'.$GLOBALS["SOBE"]->doc->helpStyle().'>';
63 }
64 function loadLeftFrameJS() {
65 $str = '<script language="javascript" type="text/javascript">if (parent.nav_frame) parent.nav_frame.document.location="overview.php";</script>';
66 return $str;
67 }
68 function headLink($key,$dontLink=0,$params="") {
69 $str = $GLOBALS["SOBE"]->MOD_MENU["function"][$key];
70 if (!$dontLink) $str = '<a href="index.php?SET[function]='.$key.$params.'" target="list_frame" onClick="this.blur();">'.htmlspecialchars($str).'</a>';
71 return $str;
72 }
73 function fixed_lgd($str,$len=0) {
74 return t3lib_div::fixed_lgd($str,$len?$len:$this->BE_USER->uc["titleLen"]);
75 }
76 function errorIcon() {
77 return '<img src="'.$this->backPath.'gfx/icon_fatalerror.gif" width="18" height="16" align=top>';
78 }
79 function getUserAndGroupArrays() {
80 // Get groupnames for todo-tasks
81 $be_group_Array=t3lib_BEfunc::getListGroupNames("title,uid");
82 $groupArray=array_keys($be_group_Array);
83 // Usernames
84 $be_user_Array = $be_user_Array_o = t3lib_BEfunc::getUserNames($this->getUserNamesFields);
85 if (!$GLOBALS["BE_USER"]->isAdmin()) $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array,$groupArray,1);
86
87 $this->userGroupArray = array($be_user_Array,$be_group_Array,$be_user_Array_o);
88 return $this->userGroupArray;
89 }
90 function dateTimeAge($tstamp,$prefix=1) {
91 return t3lib_BEfunc::dateTimeAge($tstamp,$prefix);
92 }
93 function accessMod($mod) {
94 return $this->BE_USER->modAccess(array("name"=>$mod,"access"=>"user,group"),0);
95 }
96 }
97
98 // Include extension?
99 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter/task/class.mod_user_task.php"]) {
100 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter/task/class.mod_user_task.php"]);
101 }
102
103
104 ?>