revert attr() in path that was breaking admin calendar
[openemr.git] / services / ChartTrackerService.php
blob45ae2d9ba91c733b5084cc595604f1fa8182f57e
1 <?php
2 /**
3 * Chart tracker service.
5 * Copyright (C) 2017 Victor Kofia <victor.kofia@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Victor Kofia <victor.kofia@gmail.com>
20 * @link http://www.open-emr.org
23 namespace OpenEMR\Services;
25 use OpenEMR\Common\Database\Connector;
26 use OpenEMR\Common\Logging\Logger;
28 class ChartTrackerService
31 /**
32 * Logger used primarily for logging events that are of interest to
33 * developers.
35 private $logger;
37 /**
38 * The chart tracker repository to be used for db CRUD operations.
40 private $repository;
42 /**
43 * Default constructor.
45 public function __construct()
47 $this->logger = new Logger("\OpenEMR\Services\ChartTrackerService");
48 $database = Connector::Instance();
49 $entityManager = $database->entityManager;
50 $this->repository = $entityManager->getRepository('\OpenEMR\Entities\ChartTracker');
53 /**
54 * Add chart tracker table entry.
56 * @param array (pid, date, userid, location).
57 * @return the pid.
59 public function trackPatientLocation($patientLocation)
61 $patientLocation->setPid(add_escape_custom($patientLocation->getPid()));
62 $patientLocation->setUserId(add_escape_custom($patientLocation->getUserId()));
63 $patientLocation->setLocation(add_escape_custom($patientLocation->getLocation()));
64 $this->logger->debug('Attempting to track patient location');
65 $this->repository->save($patientLocation);