ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWikiContributor.php
Go to the documentation of this file.
1<?php
2
23{
24 public const STATUS_NOT_GRADED = 0;
25 public const STATUS_PASSED = 1;
26 public const STATUS_FAILED = 2;
27
32 public static function _lookupStatus(
33 int $a_obj_id,
34 int $a_user_id
35 ): ?int {
36 global $DIC;
37
38 $ilDB = $DIC->database();
39
40 $set = $ilDB->queryF(
41 "SELECT status FROM il_wiki_contributor " .
42 "WHERE wiki_id = %s and user_id = %s",
43 array("integer", "integer"),
44 array($a_obj_id, $a_user_id)
45 );
46 if ($row = $ilDB->fetchAssoc($set)) {
47 return (int) $row["status"];
48 }
49 return null;
50 }
51
52 public static function _lookupStatusTime(
53 int $a_obj_id,
54 int $a_user_id
55 ): ?string {
56 global $DIC;
57
58 $ilDB = $DIC->database();
59
60 $set = $ilDB->queryF(
61 "SELECT status_time FROM il_wiki_contributor " .
62 "WHERE wiki_id = %s and user_id = %s",
63 array("integer", "integer"),
64 array($a_obj_id, $a_user_id)
65 );
66 if ($row = $ilDB->fetchAssoc($set)) {
67 return $row["status_time"];
68 }
69 return null;
70 }
71
75 public static function _writeStatus(
76 int $a_obj_id,
77 int $a_user_id,
78 int $a_status
79 ): void {
80 global $DIC;
81
82 $ilDB = $DIC->database();
83
84 $ilDB->manipulate("DELETE FROM il_wiki_contributor WHERE " .
85 " wiki_id = " . $ilDB->quote($a_obj_id, "integer") .
86 " AND user_id = " . $ilDB->quote($a_user_id, "integer"));
87
88 $ilDB->manipulateF(
89 "INSERT INTO il_wiki_contributor (status, wiki_id, user_id, status_time) " .
90 "VALUES (%s,%s,%s,%s)",
91 array("integer", "integer", "integer", "timestamp"),
92 array($a_status, $a_obj_id, $a_user_id, ilUtil::now())
93 );
94 }
95}
static now()
Return current timestamp in Y-m-d H:i:s format.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeStatus(int $a_obj_id, int $a_user_id, int $a_status)
static _lookupStatusTime(int $a_obj_id, int $a_user_id)
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)
global $DIC
Definition: shib_login.php:26