refactor(ccdaservice): extract and test safeTrim function (#6788)
[openemr.git] / library / group.inc.php
blobbf41906eaec70744d8f5f067e6d7d7a069694652
1 <?php
3 /**
4 * interface/therapy_groups/index.php routing for therapy groups
6 * group.inc.php includes methods for groups
8 * Copyright (C) 2016 Shachar Zilbershlag <shaharzi@matrix.co.il>
9 * Copyright (C) 2016 Amiel Elboim <amielel@matrix.co.il>
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Shachar Zilbershlag <shaharzi@matrix.co.il>
24 * @author Amiel Elboim <amielel@matrix.co.il>
25 * @link http://www.open-emr.org
28 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_models/therapy_groups_model.php");
29 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_models/group_statuses_model.php");
30 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_models/therapy_groups_counselors_model.php");
31 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_models/users_model.php");
32 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_models/therapy_groups_participants_model.php");
33 require_once(dirname(__FILE__) . "/../interface/therapy_groups/therapy_groups_controllers/therapy_groups_controller.php");
35 use OpenEMR\Common\Session\SessionUtil;
37 //Fetches groups data by given search parameter (used in popup search when in add_edit_event for groups)
38 function getGroup($gid)
40 $model = new Therapy_Groups();
41 $result = $model->getGroup($gid);
42 return $result;
45 //Fetches groups data by given search parameter (used in popup search when in add_edit_event for groups)
46 function getGroupData($search_params, $result_columns, $column)
48 $model = new Therapy_Groups();
49 $result = $model->getGroupData($search_params, $result_columns, $column);
50 return $result;
53 //Fetches group statuses from 'groupstat' list
54 function getGroupStatuses()
56 $model = new Group_Statuses();
57 $result = $model->getGroupStatuses();
58 return $result;
61 //Fetches group attendance statuses from 'attendstat' list
62 function getGroupAttendanceStatuses()
64 $model = new Group_Statuses();
65 $result = $model->getGroupAttendanceStatuses();
66 return $result;
69 //Fetches counselors for specific group
70 function getCounselors($gid)
72 $model = new Therapy_Groups_Counselors();
73 $result = $model->getCounselors($gid);
74 return $result;
77 //Fetches participants of group
78 function getParticipants($gid, $onlyActive = false)
80 $model = new Therapy_groups_participants();
81 $result = $model->getParticipants($gid, $onlyActive);
82 return $result;
85 //Fetches group status name by status key
86 function getTypeName($key)
88 $types_array = TherapyGroupsController::prepareGroupTypesList();
89 $types_name = $types_array[$key];
90 return $types_name;
93 //Fetches providers for a specific group event
94 function getProvidersOfEvent($eid)
96 $model = new Users();
97 $result = $model->getProvidersOfEvent($eid);
98 return $result;
101 //Fetches name of user by his id
102 function getUserNameById($uid)
104 $model = new Users();
105 $result = $model->getUserNameById($uid);
106 return $result;
109 function getGroupCounselorsNames($gid)
112 $model = new Therapy_Groups_Counselors();
113 $result = $model->getAllCounselorsNames($gid);
114 return $result;
117 function unsetGroup()
119 SessionUtil::unsetSession('therapy_group');