diff --git a/functions/session.inc b/functions/session.inc index bee5b7181..4aea58c28 100644 --- a/functions/session.inc +++ b/functions/session.inc @@ -4,16 +4,6 @@ require_module 'standard'; .*/ -if (!in_array('concom', $DISABLEDMODULES)) { - if (is_dir($MODULESDIR.DIRECTORY_SEPARATOR.'concom')) { - $check = $MODULESDIR.DIRECTORY_SEPARATOR.'concom'; - $check .= DIRECTORY_SEPARATOR.'functions/concom.inc'; - if (is_file($check)) { - require_once($check); - } - } -} - function buildSessionData($accountId) { @@ -71,8 +61,8 @@ function buildSessionData($accountId) } // Current ConCom Positions and ConCom Years Served - if (class_exists('CONCOM') && method_exists('CONCOM', 'getConComPosition')) { - $_SESSION['customFields']['currConComPos'] = CONCOM::getConComPosition($accountId); + if (class_exists('\\concom\\POSITION') && method_exists('\\concom\\POSITION', 'getConComPosition')) { + $_SESSION['customFields']['currConComPos'] = concom\POSITION::getConComPosition($accountId); } // Current Hotel Lottery Status @@ -215,8 +205,8 @@ function loadAccount($accountId) } // Current ConCom Positions and ConCom Years Served - if (class_exists('CONCOM') && method_exists('CONCOM', 'getConComPosition')) { - $_SESSION['customFields']['currConComPos'] = CONCOM::getConComPosition($accountId); + if (class_exists('\\concom\\POSITION') && method_exists('\\concom\\POSITION', 'getConComPosition')) { + $_SESSION['customFields']['currConComPos'] = concom\POSITION::getConComPosition($accountId); } // Current Hotel Lottery Status @@ -227,8 +217,8 @@ function loadAccount($accountId) $_SESSION['customFields']['hotelRoomCheckOut'] = &$_SESSION['customFields'][search_definedFields('Check Out')]; // If the logged in user is in the volunteers, note it - if (class_exists('VOLUNTEERS') && method_exists('VOLUNTEERS', 'inVolunteers')) { - $_SESSION['IS_VOLUNTEERS'] = VOLUNTEERS::inVolunteers($accountId); + if (class_exists('\\concom\\VOLUNTEERS') && method_exists('\\concom\\VOLUNTEERS', 'inVolunteers')) { + $_SESSION['IS_VOLUNTEERS'] = concom\VOLUNTEERS::inVolunteers($accountId); } // If the logged in user is a System Admin (defined in the config file), note it diff --git a/functions/users.inc b/functions/users.inc index f17fe21d7..0bb711eb8 100644 --- a/functions/users.inc +++ b/functions/users.inc @@ -4,16 +4,6 @@ require_module 'standard'; .*/ -if (!in_array('concom', $DISABLEDMODULES)) { - if (is_dir($MODULESDIR.DIRECTORY_SEPARATOR.'concom')) { - $check = $MODULESDIR.DIRECTORY_SEPARATOR.'concom'; - $check .= DIRECTORY_SEPARATOR.'functions/concom.inc'; - if (is_file($check)) { - require_once($check); - } - } -} - function _parse_user($result, $additional_fields) { @@ -30,8 +20,8 @@ function _parse_user($result, $additional_fields) } else { $user['Last Name'] = $result['Last Name']; } - if (class_exists('CONCOM') && method_exists('CONCOM', 'getConComPosition')) { - $user['ConCom'] = CONCOM::getConComPosition($user['Id']); + if (class_exists('\\concom\\POSITION') && method_exists('\\concom\\POSITION', 'getConComPosition')) { + $user['ConCom'] = concom\POSITION::getConComPosition($user['Id']); } if (!empty($result['Email 1'])) { $user['Email'] = $result['Email 1']; diff --git a/modules/concom/functions/POSITION.inc b/modules/concom/functions/POSITION.inc new file mode 100644 index 000000000..5cf4faf7c --- /dev/null +++ b/modules/concom/functions/POSITION.inc @@ -0,0 +1,58 @@ +fetch(); + $retvalue = null; + while ($value !== false) { + if ($retvalue == null) { + $retvalue = array(); + } + $retvalue[] = ['position' => $value['Position'], + 'department' => $value['Department'], + 'departmentId' => $value['DepartmentID'], + 'note' => $value['Note']]; + $value = $result->fetch(); + } + return $retvalue; + + } + + + /* end POSITION */ +} diff --git a/modules/concom/functions/REGISTRATION.inc b/modules/concom/functions/REGISTRATION.inc new file mode 100644 index 000000000..b1187947e --- /dev/null +++ b/modules/concom/functions/REGISTRATION.inc @@ -0,0 +1,26 @@ +fetch(); + if ($value !== false && $value['count']) { + return true; + } else { + return false; + } + + } + + + /* end REGISTRATION */ +} diff --git a/modules/concom/functions/VOLUNTEERS.inc b/modules/concom/functions/VOLUNTEERS.inc new file mode 100644 index 000000000..ce4a59339 --- /dev/null +++ b/modules/concom/functions/VOLUNTEERS.inc @@ -0,0 +1,26 @@ +fetch(); + if ($value !== false && $value['count']) { + return true; + } else { + return false; + } + + } + + + /* end VOLUNTEERS */ +} diff --git a/modules/concom/functions/concom.inc b/modules/concom/functions/concom.inc index d3fecddfb..5447e73c9 100644 --- a/modules/concom/functions/concom.inc +++ b/modules/concom/functions/concom.inc @@ -3,99 +3,9 @@ require_once($FUNCTIONDIR.'/divisional.inc'); require_once($FUNCTIONDIR."/database.inc"); require_once($FUNCTIONDIR.'/users.inc'); - -class VOLUNTEERS { - - public static function inVolunteers($lookup) - { - $sql = "SELECT count(ListRecordID) as count From ConComList"; - $sql .= " WHERE AccountID = $lookup"; - $sql .=" AND DepartmentID = (SELECT DepartmentID FROM Departments WHERE Name = 'Volunteers');"; - $result = DB::run($sql); - $value = $result->fetch(); - if ($value !== false && $value['count']) { - return true; - } - else { - return false; - } - } - -} - - -class CONCOM { - - public static function getConComPosition($account, $event = null) - { - if ($event == null) { - $event = current_eventID(); - } - $sql = <<fetch(); - $retvalue = null; - while ($value !== false) { - if ($retvalue == null) { - $retvalue = array(); - } - $retvalue[] = ['position' => $value['Position'], - 'department' => $value['Department'], - 'departmentId' => $value['DepartmentID'], - 'note' => $value['Note']]; - $value = $result->fetch(); - } - return $retvalue; - } - -} - -class REGISTRATION -{ - - - public static function inRegistration($lookup) - { - $sql = "SELECT count(ListRecordID) as count From ConComList"; - $sql .= " WHERE AccountID = $lookup"; - $sql .= " AND DepartmentID = (SELECT DepartmentID FROM Departments WHERE Name = 'Registration');"; - $result = DB::run($sql); - $value = $result->fetch(); - if ($value !== false && $value['count']) { - return true; - } else { - return false; - } - - } - - - /* end REGISTRATION */ -} +require_once(__DIR__.'/VOLUNTEERS.inc'); +require_once(__DIR__.'/POSITION.inc'); +require_once(__DIR__.'/REGISTRATION.inc'); function getDivision($dep) diff --git a/modules/concom/init.inc b/modules/concom/init.inc new file mode 100644 index 000000000..662512aa3 --- /dev/null +++ b/modules/concom/init.inc @@ -0,0 +1,5 @@ +