Changeset 376 for trunk/team.php
- Timestamp:
- Mar 11, 2010, 8:40:32 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/team.php
r365 r376 8 8 function ShowTeamList() 9 9 { 10 global $Config, $Database ;10 global $Config, $Database, $User; 11 11 12 12 echo('<h3>Seznam překladatelských týmů</h3>'); … … 26 26 array('Name' => 'TimeCreate', 'Title' => 'Datum založení'), 27 27 ); 28 if( Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Uživatelské akce');28 if($User->Licence(LICENCE_USER)) $TableColumns[] = array('Name' => '', 'Title' => 'Uživatelské akce'); 29 29 30 30 $Order = GetOrderTableHeader($TableColumns, 'NumberUser', 1); 31 31 echo($Order['Output']); 32 32 33 if(array_key_exists('search', $_GET)) 33 if(array_key_exists('search', $_GET)) $_SESSION['search'] = ' WHERE `Name` LIKE "%'.$_GET['search'].'%" OR `Description` LIKE "%'.$_GET['search'].'%"'; 34 34 else if(!array_key_exists('search', $_SESSION)) $_SESSION['search'] = ''; 35 35 if (array_key_exists('search', $_GET) and ($_GET['search'] == '')) $_SESSION['search'] = ''; 36 /*37 if(array_key_exists('team', $_GET))38 {39 $_SESSION['team'] = $_GET['team'];40 if($_GET['team'] == '') $_SESSION['team'] = '';41 } else if(!array_key_exists('team', $_SESSION)) $_SESSION['team'] = '';42 43 if(is_numeric($_SESSION['team'])) $Where = ' WHERE '.$_SESSION['team'];44 else $Where = '';45 46 if(!is_numeric($_SESSION['team'])) echo(' <a href="?Where">Zrušit filtr týmů</a><br />');47 */48 $DbResult = $Database->SQLCommand('SELECT `Team` FROM `User` WHERE `ID`='.$_SESSION['UserID']);49 $User = mysql_fetch_assoc($DbResult);50 36 51 37 $ID = $Database->SQLCommand('SELECT *, (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) AS `NumberUser`, (SELECT `Name` FROM `User` WHERE `User`.`ID`=`Team`.`Leader`) AS `LeaderName` FROM `Team` '.$_SESSION['search'].$Order['SQL'].$PageList['SQLLimit']); … … 58 44 '<td><a href="userlist.php?team='.$Team['Id'].'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a></td>'. 59 45 '<td>'.HumanDate($Team['TimeCreate']).'</td>'); 60 if( Licence(LICENCE_USER))61 { 62 if($Team['Leader'] == $ _SESSION['UserID']) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">Upravit</a>';46 if($User->Licence(LICENCE_USER)) 47 { 48 if($Team['Leader'] == $User->Id) $Action = ' <a href="?action=modify&id='.$Team['Id'].'">Upravit</a>'; 63 49 else $Action = ''; 64 if($Team['Id'] == $User ['Team']) $Action = ' <a href="?action=leave">Opustit</a>';50 if($Team['Id'] == $User->Team) $Action = ' <a href="?action=leave">Opustit</a>'; 65 51 echo('<td><a href="?action=gointeam&id='.$Team['Id'].'">Vstoupit</a>'.$Action.'</td>'); 66 52 } … … 70 56 echo($PageList['Output']); 71 57 72 if( Licence(LICENCE_USER)) echo('<br /><div style="text-align: center;"><a href="?action=create">Vytvořit překladatelský tým</a></div>');58 if($User->Licence(LICENCE_USER)) echo('<br /><div style="text-align: center;"><a href="?action=create">Vytvořit překladatelský tým</a></div>'); 73 59 } 74 60 75 61 function TeamJoin() 76 62 { 77 global $Database ;78 79 if( Licence(LICENCE_USER))63 global $Database, $User; 64 65 if($User->Licence(LICENCE_USER)) 80 66 { 81 67 if(array_key_exists('id', $_GET)) 82 68 { 83 $Database->SQLCommand('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$ _SESSION['UserID']);69 $Database->SQLCommand('UPDATE `User` SET `Team` = '.$_GET['id'].' WHERE `ID` = '.$User->Id); 84 70 echo('<strong>Vstoupil jsi do týmu</strong><br /><br />'); 85 71 WriteLog('Uživatel vstoupil do týmu '.$_GET['id'], LOG_TYPE_USER); … … 98 84 function TeamCreateFinish() 99 85 { 100 global $Database ;101 102 if( Licence(LICENCE_USER))86 global $Database, $User; 87 88 if($User->Licence(LICENCE_USER)) 103 89 { 104 90 if(array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST)) … … 109 95 if(($Count == 0) and ($_POST['Name'] != '')) 110 96 { 111 $Database->SQLCommand('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`,`Leader`) VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.$_POST['URL'].'", NOW(), '.$ _SESSION['UserID'].')');112 $Database->SQLCommand('UPDATE `User` SET `Team` = '.mysql_insert_id().' WHERE `ID` = '.$ _SESSION['UserID']);97 $Database->SQLCommand('INSERT INTO `Team` (`Name` ,`Description`, `URL`, `TimeCreate`,`Leader`) VALUES ("'.trim($_POST['Name']).'", "'.trim($_POST['Description']).'", "'.$_POST['URL'].'", NOW(), '.$User->Id.')'); 98 $Database->SQLCommand('UPDATE `User` SET `Team` = '.mysql_insert_id().' WHERE `ID` = '.$User->Id); 113 99 echo('<strong>Překladatelský tým vytvořen</strong><br /><br />'); 114 100 WriteLog('Překladatelský tým vytvořen '.$_POST['Name'], LOG_TYPE_USER); … … 124 110 function TeamModify() 125 111 { 126 global $Database ;127 128 if( Licence(LICENCE_USER))112 global $Database, $User; 113 114 if($User->Licence(LICENCE_USER)) 129 115 { 130 116 if(array_key_exists('id', $_GET)) 131 117 { 132 $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ _SESSION['UserID']);118 $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 133 119 if(mysql_num_rows($DbResult) > 0) 134 120 { … … 148 134 function TeamModifyFinish() 149 135 { 150 global $Database ;151 152 if( Licence(LICENCE_USER))136 global $Database, $User; 137 138 if($User->Licence(LICENCE_USER)) 153 139 { 154 140 if(array_key_exists('id', $_GET) and array_key_exists('Name', $_POST) and array_key_exists('Description', $_POST) and array_key_exists('URL', $_POST)) 155 141 { 156 $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$ _SESSION['UserID']);142 $DbResult = $Database->SQLCommand('SELECT * FROM `Team` WHERE `Id`='.$_GET['id'].' AND `Leader`='.$User->Id); 157 143 if(mysql_num_rows($DbResult) > 0) 158 144 { … … 175 161 function TeamCreate() 176 162 { 177 if(Licence(LICENCE_USER)) 163 global $User; 164 165 if($User->Licence(LICENCE_USER)) 178 166 { 179 167 echo('<form action="?action=finish_create" method="post">'. … … 189 177 function TeamShow() 190 178 { 191 global $Database, $TranslationTree ;179 global $Database, $TranslationTree, $User; 192 180 193 181 if(array_key_exists('id', $_GET)) … … 208 196 $Team['Description'].'<br /><br />'); 209 197 //echo('<a href="export/?team='.$Team['Id'].'">Exportovat překlad týmu</a> '); 210 if( Licence(LICENCE_USER)) echo('<a href="?action=gointeam&id='.$Team['Id'].'">Vstoupit do týmu</a><br /><br />');198 if($User->Licence(LICENCE_USER)) echo('<a href="?action=gointeam&id='.$Team['Id'].'">Vstoupit do týmu</a><br /><br />'); 211 199 echo('<fieldset><legend>Statistika</legend>'. 212 200 'Počet členů týmu: <a href="userlist.php?team='.$Team['Id'].'" title="Zobrazit členy týmu">'.$Team['NumberUser'].'</a><br />'. … … 223 211 function TeamLeave() 224 212 { 225 global $Database ;226 227 if( Licence(LICENCE_USER))228 { 229 $Database->SQLCommand('UPDATE `User` SET `Team` = 0 WHERE `ID` = '.$ _SESSION['UserID']);213 global $Database, $User; 214 215 if($User->Licence(LICENCE_USER)) 216 { 217 $Database->SQLCommand('UPDATE `User` SET `Team` = 0 WHERE `ID` = '.$User->Id); 230 218 echo('<strong>Nyní nejste členem žádného týmu</strong><br /><br />'); 231 219 WriteLog('Uživatel vystoupil z týmu', LOG_TYPE_USER);
Note:
See TracChangeset
for help on using the changeset viewer.