Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions components/ILIAS/Search/classes/class.ilUserSearch.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/

declare(strict_types=1);
/*
+-----------------------------------------------------------------------------+
| ILIAS open source |
+-----------------------------------------------------------------------------+
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
+-----------------------------------------------------------------------------+
*/

/**
* Class ilUserSearch
Expand All @@ -37,6 +32,7 @@ class ilUserSearch extends ilAbstractSearch
{
private bool $active_check = false;
private bool $inactive_check = false;
private bool $time_limited_check = false;

public function enableActiveCheck(bool $a_enabled): void
{
Expand All @@ -48,6 +44,11 @@ public function enableInactiveCheck(bool $a_enabled): void
$this->inactive_check = $a_enabled;
}

public function enableTimeLimitedCheck(bool $a_enabled): void
{
$this->time_limited_check = $a_enabled;
}

public function performSearch(): ilSearchResult
{
$where = $this->__createWhereCondition();
Expand All @@ -63,6 +64,15 @@ public function performSearch(): ilSearchResult
$query .= 'AND active = 0 ';
}

if ($this->time_limited_check) {
$query .= "AND " . sprintf(
'(usr_data.time_limit_unlimited = %s OR (time_limit_from < %s AND time_limit_until > %s))',
$this->db->quote(1, ilDBConstants::T_INTEGER),
$this->db->quote(time(), ilDBConstants::T_INTEGER),
$this->db->quote(time(), ilDBConstants::T_INTEGER)
) . " ";
}


$res = $this->db->query($query);
while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
Expand Down