Care Coordination module
[openemr.git] / interface / modules / zend_modules / module / Carecoordination / Module.php
bloba3241a91c4a1af88a445552eae98504b23c0215f
1 <?php
2 namespace Carecoordination;
3 use Carecoordination\Model\CarecoordinationTable;
4 use Carecoordination\Model\SetupTable;
5 use Carecoordination\Model\EncounterccdadispatchTable;
6 use Carecoordination\Model\EncountermanagerTable;
7 use Zend\Db\ResultSet\ResultSet;
8 use Zend\Db\TableGateway\TableGateway;
9 use Zend\ModuleManager\ModuleManager;
10 use Zend\View\Helper\Openemr\Emr;
11 use Zend\View\Helper\Openemr\Menu;
12 use Carecoordination\Model\Progressnote;
13 use Carecoordination\Model\ProgressnoteTable;
14 use Carecoordination\Model\Continuitycaredocument;
15 use Carecoordination\Model\ContinuitycaredocumentTable;
16 use Carecoordination\Model\CcdTable;
18 class Module
20 public function getAutoloaderConfig()
22 return array(
23 'Zend\Loader\ClassMapAutoloader' => array(
24 __DIR__ . '/autoload_classmap.php',
26 'Zend\Loader\StandardAutoloader' => array(
27 'namespaces' => array(
28 __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
35 public function getConfig()
37 return include __DIR__ . '/config/module.config.php';
40 public function init(ModuleManager $moduleManager)
42 $sharedEvents = $moduleManager->getEventManager()->getSharedManager();
43 $sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) {
44 $controller = $e->getTarget();
45 $controller->layout('carecoordination/layout/layout');
46 $route = $controller->getEvent()->getRouteMatch();
47 $controller->getEvent()->getViewModel()->setVariables(array(
48 'current_controller' => $route->getParam('controller'),
49 'current_action' => $route->getParam('action'),
50 ));
51 }, 100);
54 public function getServiceConfig()
56 return array(
57 'factories' => array(
58 'Carecoordination\Model\CarecoordinationTable' => function($sm) {
59 $tableGateway = $sm->get('Zend\Db\Adapter\Adapter');
60 $table = new CarecoordinationTable($tableGateway);
61 return $table;
62 },
64 'Carecoordination\Model\EncounterccdadispatchTable' => function($sm) {
65 $tableGateway = $sm->get('Zend\Db\Adapter\Adapter');
66 $table = new EncounterccdadispatchTable($tableGateway);
67 return $table;
70 'Carecoordination\Model\EncountermanagerTable' => function($sm) {
71 $tableGateway = $sm->get('Zend\Db\Adapter\Adapter');
72 $table = new EncountermanagerTable($tableGateway);
73 return $table;
76 'Carecoordination\Model\SetupTable' => function($sm) {
77 $tableGateway = $sm->get('Zend\Db\Adapter\Adapter');
78 $table = new SetupTable($tableGateway);
79 return $table;
82 'Carecoordination\Model\CcdTable' => function($sm) {
83 $tableGateway = $sm->get('Zend\Db\Adapter\Adapter');
84 $table = new CcdTable($tableGateway);
85 return $table;
92 public function getViewHelperConfig()
94 return array(
95 'factories' => array(
96 // the array key here is the name you will call the view helper by in your view scripts
97 'emr_helper' => function($sm) {
98 $locator = $sm->getServiceLocator(); // $sm is the view helper manager, so we need to fetch the main service manager
99 return new Emr($locator->get('Request'));
101 'menu' => function($sm) {
102 $locator = $sm->getServiceLocator();
103 return new Menu();