public function getEventsFor($logLevels = null, $objectIDs = null, $objectTypes = null, $activityCodes = null, $limit = -1, $startTime = null, $endTime = null, $users = null) { $clauses = null; $usersFilter = null; if (!is_null($logLevels)) { $logLevels = (array) $logLevels; $logLevels = implode(",", $logLevels); $clauses[] = "log_level IN ({$logLevels})"; } if (!is_null($objectIDs) && !empty($objectIDs)) { $objectIDs = (array) $objectIDs; $objectIDs = implode(",", $objectIDs); $clauses[] = "object_id IN ({$objectIDs})"; } if (!is_null($objectTypes) && !empty($objectTypes)) { $objectTypes = (array) $objectTypes; $objectTypes = $this->db->prepare_string(implode("','", $objectTypes)); $clauses[] = "object_type IN ('{$objectTypes}')"; } if (!is_null($activityCodes)) { $activityCodes = (array) $activityCodes; $activityCodes = "('" . implode("','", $activityCodes) . "')"; $clauses[] = "activity IN {$activityCodes}"; } if (!is_null($startTime)) { $clauses[] = "fired_at >= {$startTime}"; } if (!is_null($endTime)) { $clauses[] = "fired_at <= {$endTime}"; } if (!is_null($users)) { $usersFilter = " JOIN {$this->tables['transactions']} T " . " ON T.id = E.transaction_id AND T.user_id IN ({$users}) "; } $query = "SELECT E.id FROM {$this->tables['events']} E {$usersFilter}"; if ($clauses) { $query .= " WHERE " . implode(" AND ", $clauses); } $query .= " ORDER BY transaction_id DESC,fired_at DESC"; return tlEvent::createObjectsFromDBbySQL($this->db, $query, 'id', "tlEvent", true, tlEvent::TLOBJ_O_GET_DETAIL_FULL, $limit); }
* This script is distributed under the GNU General Public License 2 or later. * * Filename $RCSfile: eventinfo.php,v $ * * @version $Revision: 1.12 $ * @modified $Date: 2010/05/18 05:07:52 $ by $Author: amkhullar $ **/ require_once "../../config.inc.php"; require_once "common.php"; testlinkInitPage($db, false, false, "checkRights"); $templateCfg = templateConfiguration(); $user = null; $event = null; $args = init_args(); if ($args->id) { $event = new tlEvent($args->id); if ($event->readFromDB($db, tlEvent::TLOBJ_O_GET_DETAIL_TRANSACTION) >= tl::OK) { $user = new tlUser($event->userID); if ($user->readFromDB($db) < tl::OK) { $user = null; } } else { $event = null; } } $smarty = new TLSmarty(); $smarty->assign("event", $event); $smarty->assign("user", $user); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /** *