ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilWikiContributor.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2009 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
34 {
35  const STATUS_NOT_GRADED = 0;
36  const STATUS_PASSED = 1;
37  const STATUS_FAILED = 2;
38 
46  public static function _lookupStatus($a_obj_id, $a_user_id)
47  {
48  global $DIC;
49 
50  $ilDB = $DIC->database();
51 
52  $set = $ilDB->queryF(
53  "SELECT status FROM il_wiki_contributor " .
54  "WHERE wiki_id = %s and user_id = %s",
55  array("integer", "integer"),
56  array($a_obj_id, $a_user_id)
57  );
58  if ($row = $ilDB->fetchAssoc($set)) {
59  return $row["status"];
60  }
61  return false;
62  }
63 
71  public static function _lookupStatusTime($a_obj_id, $a_user_id)
72  {
73  global $DIC;
74 
75  $ilDB = $DIC->database();
76 
77  $set = $ilDB->queryF(
78  "SELECT status_time FROM il_wiki_contributor " .
79  "WHERE wiki_id = %s and user_id = %s",
80  array("integer", "integer"),
81  array($a_obj_id, $a_user_id)
82  );
83  if ($row = $ilDB->fetchAssoc($set)) {
84  return $row["status_time"];
85  }
86  return false;
87  }
88 
98  public static function _writeStatus($a_obj_id, $a_user_id, $a_status)
99  {
100  global $DIC;
101 
102  $ilDB = $DIC->database();
103 
104  $ilDB->manipulate("DELETE FROM il_wiki_contributor WHERE " .
105  " wiki_id = " . $ilDB->quote($a_obj_id, "integer") .
106  " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
107 
108  $ilDB->manipulateF(
109  "INSERT INTO il_wiki_contributor (status, wiki_id, user_id, status_time) " .
110  "VALUES (%s,%s,%s,%s)",
111  array("integer", "integer", "integer", "timestamp"),
112  array($a_status, $a_obj_id, $a_user_id, ilUtil::now())
113  );
114  }
115 }
global $DIC
Definition: saml.php:7
static _writeStatus($a_obj_id, $a_user_id, $a_status)
Write success status.
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
static _lookupStatusTime($a_obj_id, $a_user_id)
Lookup last change in mark or success status.
Class ilWikiContributor.
Create styles array
The data for the language used.
global $ilDB