public function newAction() { $colIndex = $this->_getParam('colIndex'); $sessionFilters = $this->_calendarSession->filter; if (!isset($sessionFilters->columns[$colIndex])) { $msg = __('Cannot generate column with that index, there is no filter defined for that column Index: ') . $colIndex; throw new Exception($msg); } $column = $sessionFilters->columns[$colIndex]; $providerId = (int) $column['providerId']; $this->view->providerId = $providerId; $headerText = ''; if ($providerId > 0) { $provider = new Provider(); $provider->setPersonId($providerId); $provider->populate(); $headerText = $provider->displayName; } $roomId = 0; if (isset($column['roomId'])) { $roomId = $column['roomId']; } $this->view->roomId = $roomId; if ($roomId > 0) { $room = new Room(); $room->id = $roomId; $room->populate(); $headerText .= ' -> ' . $room->name; } if (isset($column['dateFilter'])) { $headerText .= " ({$column['dateFilter']})"; } $this->view->headerText = $headerText; $templates = array('' => ''); $templates['tpl1'] = 'Provider 1 Template'; $templates['tpl2'] = 'Provider 2 Template'; $templates['tpl3'] = 'Provider 3 Template'; $this->view->templates = $templates; // $this->_calendarSession->filter; calendar filter $this->render('new'); }
public function listHistoryAction() { $personId = (int) $this->_getParam('personId'); $future = (int) $this->_getParam('future'); $rows = array(); $appointmentTemplate = new AppointmentTemplate(); $reasons = $appointmentTemplate->getAppointmentReasons(); $iterator = new AppointmentIterator(null, false); $filters = array('patientId' => $personId); if ($future) { $filters['start'] = date('Y-m-d'); } $iterator->setFilters($filters); foreach ($iterator as $app) { $personId = (int) $app->patientId; $appointmentId = (int) $app->appointmentId; $providerId = (int) $app->providerId; $roomId = (int) $app->roomId; list($dateStart, $timeStart) = explode(' ', $app->start); list($dateEnd, $timeEnd) = explode(' ', $app->end); $providerName = ''; if ($providerId > 0) { $provider = new Provider(); $provider->setPersonId($providerId); $provider->populate(); $providerName = $provider->displayName; } $roomName = ''; if ($roomId > 0) { $room = new Room(); $room->setRoomId($roomId); $room->populate(); $roomName = $room->displayName; } $routing = new Routing(); $routing->personId = $personId; $routing->appointmentId = $appointmentId; $routing->providerId = $providerId; $routing->roomId = $roomId; $routing->populateByAppointments(); $station = $routing->stationId; $reason = $app->reason; $appointmentReason = isset($reasons[$reason]) ? $reasons[$reason]['name'] : ''; $row = array(); $row['id'] = $appointmentId; $row['data'] = array(); $row['data'][] = $dateStart; $row['data'][] = $timeStart . ' - ' . $timeEnd; $row['data'][] = $providerName; $row['data'][] = $app->title; $row['data'][] = $roomName; $row['data'][] = $appointmentReason; $row['data'][] = $app->appointmentCode; $row['data'][] = $routing->stationId; $rows[] = $row; } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $rows)); }
public static function getBuildingDefaultLocation($personId, $defaultLocationId = null) { // get default building given user's person id, if $defaultLocationId is defined then room is returned $user = new User(); $user->personId = $personId; $user->populateWithPersonId(); $user->populate(); $building = null; $room = null; if (strlen($user->preferences) > 0) { $xmlPreferences = new SimpleXMLElement($user->preferences); $room = new Room(); $room->roomId = (int) $xmlPreferences->currentLocation; if ($room->populate()) { $building = $room->building; } } if ($defaultLocationId === null) { if ($building === null) { $building = new Building(); $building->buildingId = (int) $user->defaultBuildingId; $building->populate(); } return $building; } else { if ($room === null) { $room = new Room(); $room->roomId = (int) $defaultLocationId; $room->populate(); } return $room; } }
function radioRelay_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'radioRelay') { if ($myUser != false) { $radioRelayManager = new RadioRelay(); $radioRelays = $radioRelayManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); //Si on est en mode modification if (isset($_['id'])) { $id_mod = $_['id']; $selected = $radioRelayManager->getById($id_mod); $description = $selected->GetName(); $button = "Modifier"; } else { $description = "Ajout d'un relais"; $button = "Ajouter"; } ?> <div class="span9 userBloc"> <h1>Relais</h1> <p>Gestion des relais radio</p> <form action="action.php?action=radioRelay_add_radioRelay" method="POST"> <fieldset> <legend><?php echo $description; ?> </legend> <div class="left"> <label for="nameRadioRelay">Nom</label> <?php if (isset($selected)) { echo '<input type="hidden" name="id" value="' . $id_mod . '">'; } ?> <input type="text" id="nameRadioRelay" value="<?php if (isset($selected)) { echo $selected->getName(); } ?> " onkeyup="$('#vocalCommand').html($(this).val());" name="nameRadioRelay" placeholder="Lumiere Canapé…"/> <small>Commande vocale associée : "<?php echo $conf->get('VOCAL_ENTITY_NAME'); ?> , allume <span id="vocalCommand"></span>"</small> <label for="descriptionRadioRelay">Description</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getDescription(); } ?> " name="descriptionRadioRelay" id="descriptionRadioRelay" placeholder="Relais sous le canapé…" /> <label for="radioCodeRadioRelay">Code radio</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getRadioCode(); } ?> " name="radioCodeRadioRelay" id="radioCodeRadioRelay" placeholder="0,1,2…" /> <label for="roomRadioRelay">Pièce</label> <select name="roomRadioRelay" id="roomRadioRelay"> <?php foreach ($rooms as $room) { if (isset($selected)) { $selected_room = $selected->getRoom(); } else { if (isset($_['room'])) { $selected_room = $_['room']; } else { $selected_room = null; } } ?> <option <?php if ($selected_room == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> <label for="pulseRadioRelay">Mode impulsion (laisser à zéro pour désactiver le mode impulsion ou definir un temps d'impulsion en milli-seconde)</label> <input type="text" name="pulseRadioRelay" value="<?php if (isset($selected)) { echo $selected->getPulse(); } else { echo "0"; } ?> " id="pulseWireRelay" placeholder="0" /> </div> <div class="clear"></div> <br/><button type="submit" class="btn"><?php echo $button; ?> </button> </fieldset> <br/> </form> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th>Code radio</th> <th>Pièce</th> <th>Impulsion</th> <th></th> </tr> </thead> <?php foreach ($radioRelays as $radioRelay) { $room = $roomManager->load(array('id' => $radioRelay->getRoom())); ?> <tr> <td><?php echo $radioRelay->getName(); ?> </td> <td><?php echo $radioRelay->getDescription(); ?> </td> <td><?php echo $radioRelay->getRadioCode(); ?> </td> <td><?php echo $room->getName(); ?> </td> <td><?php echo $radioRelay->getPulse(); ?> </td> <td><a class="btn" href="action.php?action=radioRelay_delete_radioRelay&id=<?php echo $radioRelay->getId(); ?> "><i class="fa fa-times"></i></a> <a class="btn" href="setting.php?section=radioRelay&id=<?php echo $radioRelay->getId(); ?> "><i class="fa fa-pencil"></i></a></td> </tr> <?php } ?> </table> </div> <?php } else { ?> <div id="main" class="wrapper clearfix"> <article> <h3>Vous devez être connecté</h3> </article> </div> <?php } } }
public static function myPreferencesLocation() { static $room = null; if ($room !== null) { return $room; } $auth = Zend_Auth::getInstance(); $room = new Room(); if ((int) $auth->getIdentity()->personId > 0) { $user = new User(); $user->userId = (int) $auth->getIdentity()->personId; $user->populate(); $xmlPreferences = new SimpleXMLElement($user->preferences); $roomId = (string) $xmlPreferences->currentLocation; $room->roomId = (int) $roomId; $room->populate(); } return $room; }
$r1->setRead('1'); $r1->setDelete('1'); $r1->setCreate('1'); $r1->setUpdate('1'); $r1->setRank('1'); $r1->save(); $conf = new Configuration(); $conf->put('plugin_kodiCmd_api_url_kodi', 'http://192.168.1.107:85/jsonrpc'); $conf->put('plugin_kodiCmd_api_timeout_kodi', 5); $conf->put('plugin_kodiCmd_api_recognition_status', ''); $ro = new Room(); $ro->setName('KODI'); $ro->setDescription('De la bonne zic, un bon p\'tit film....'); $ro->save(); $roomManager = new Room(); $rooms = $roomManager->populate(); foreach ($rooms as $room) { if ($room->getName() == "KODI") { $kodiRoomId = $room->getId(); } } $id = 0; $kodi = new KodiCmd(); $kodi->setName('à droite'); $kodi->setDescription('se déplacer à droite'); $kodi->setJson('"method":"Input.Right","id":"1"'); $kodi->setConfidence('0.8'); $kodi->setRoom($kodiRoomId); $kodi->save(); $kodi = new KodiCmd(); $kodi->setName('à gauche');
protected function _generateEventColumnData(array $filters) { // filters assume to be sanitized $appointment = new Appointment(); $appointment->providerId = $filters['providerId']; $appointment->roomId = $filters['roomId']; $appointment->start = $filters['dateFilter'] . ' ' . self::FILTER_TIME_START; $appointment->end = $filters['dateFilter'] . ' ' . self::FILTER_TIME_END; $startTime = strtotime($appointment->start); $endTime = strtotime($appointment->end); // we need to get the length of time to create number of rows in the grid $timeLen = ($endTime - $startTime) / 60 / self::FILTER_MINUTES_INTERVAL; // NOTE: height is 22px for xp, default 20px // prepopulate return data $columnData = array(); //$maps = array(); $start = $startTime; $end = $endTime; $ctr = 0; while ($start <= $end) { $map = array(); $map['start'] = $start; $start = strtotime('+' . self::FILTER_MINUTES_INTERVAL . ' minutes', $start); $map['end'] = $start; //$maps[$ctr] = $map; $row = array(); // assign row id as rowNumber and columnIndex $columnData[$ctr] = array('id' => $ctr + 1, 'data' => array(''), 'map' => $map); $ctr++; } $columnDataCtr = count($columnData); $data = array('apps' => array(), 'events' => array()); $mapIndex = 0; $apps = array(); foreach ($appointment->getIter() as $app) { $start = strtotime($app->start); for ($i = $mapIndex; $i < $columnDataCtr; $i++) { $map = $columnData[$mapIndex]['map']; $mapIndex = $i; if ($start >= $map['start'] && $start <= $map['end']) { if (!isset($data['apps'][$i])) { $data['apps'][$i] = array(); } $data['apps'][$i][] = $app; break; } } } $mapIndex = 0; $events = array(); trigger_error('looping schedule event started'); $scheduleEvent = new ScheduleEvent(); $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from('scheduleEvents')->where('providerId = ?', $appointment->providerId)->where('roomId = ?', $appointment->roomId)->where('start >= ?', $appointment->start)->where('end <= ?', $appointment->end)->where('start <= end')->order('start ASC'); $stmt = $db->query($sqlSelect); $stmt->setFetchMode(Zend_Db::FETCH_ASSOC); while ($row = $stmt->fetch()) { $event = new ScheduleEvent(); $event->populateWithArray($row); $start = strtotime($event->start); for ($i = $mapIndex; $i < $columnDataCtr; $i++) { $map = $columnData[$i]['map']; $mapIndex = $i; if ($start >= $map['start'] && $start <= $map['end']) { if (!isset($data['events'][$i])) { $data['events'][$i] = array(); } $data['events'][$i] = $event; break; } } } trigger_error('looping schedule event ended'); $colMultiplier = 1; $zIndex = 0; foreach ($data['apps'] as $index => $apps) { $ctr = count($apps); $columnData[$index]['userdata']['ctr'] = $ctr; if ($ctr > $colMultiplier) { $colMultiplier = $ctr; } for ($i = 0; $i < $ctr; $i++) { $app = $apps[$i]; $this->_populateAppointmentRow($app, $columnData, $index, $i, $ctr); } } $header = "{$filters['dateFilter']}<br>"; $title = $filters['dateFilter']; // temporarily set the header as providerId $providerId = (int) $filters['providerId']; $roomId = (int) $filters['roomId']; if ($providerId > 0) { $provider = new Provider(); $provider->setPersonId($providerId); $provider->populate(); $name = $provider->optionName; // we simply replace the comma with its html equivalent (,) because this may cause not to render the header $header .= str_replace(',', ',', $name); $title .= ' -> ' . $name; } if ($roomId > 0) { $room = new Room(); $room->id = $roomId; $room->populate(); if ($providerId > 0) { $header .= '<br>'; } $header .= $room->name; $title .= ' -> ' . $room->name; } $buildings = array(); foreach ($data['events'] as $index => $event) { $this->_populateScheduleEventRow($event, $columnData, $index); $buildingId = (int) $event->buildingId; $building = new Building(); $building->buildingId = $buildingId; $building->populate(); $buildings[$buildingId] = $building->displayName; } $eventBuilding = implode(', ', $buildings); $header .= '<br>(' . $eventBuilding . ')'; $title .= ' -> (' . $eventBuilding . ')'; $header = '<label title="' . $title . '">' . $header . '</label>'; for ($i = 0; $i < $columnDataCtr; $i++) { unset($columnData[$i]['map']); } $columnData[0]['userdata']['colMultiplier'] = $colMultiplier; $columnData[0]['userdata']['providerId'] = $appointment->providerId; $columnData[0]['userdata']['roomId'] = $appointment->roomId; $columnData[0]['userdata']['date'] = $filters['dateFilter']; return array('header' => $header, 'events' => array('rows' => $columnData)); }
public function getFacility() { $ret = ''; $roomId = (int) $this->roomId; if ($roomId > 0) { $room = new Room(); $room->roomId = $roomId; $room->populate(); $ret = $room->building->name . '->' . $room->name; } return $ret; }
protected function generateEventColumnData($columnIndex) { $columnIndex = (int) $columnIndex; $columnData = array(); $scheduleEventIterator = new ScheduleEventIterator(); $appointmentIterator = new AppointmentIterator(); if (!isset($this->getCurrentDisplayFilter()->columns[$columnIndex])) { throw new Exception(__("Cannot generate column with that index, there is no filter defined for that column Index: ") . $columnIndex); } $this->_session->currentAppointments[$columnIndex] = array(); $filter = $this->getCurrentDisplayFilter(); $filterTimeStart = strtotime($filter->start); $filterTimeEnd = strtotime($filter->end); $paramFilters = $filter->columns[$columnIndex]; if (isset($paramFilters['dateFilter'])) { $filter->date = date('Y-m-d', strtotime($paramFilters['dateFilter'])); } $paramFilters['start'] = $filter->date . ' ' . $filter->start; $paramFilters['end'] = $filter->date . ' ' . $filter->end; $paramFilters['start'] = $filter->date . ' ' . $filter->start; $paramFilters['end'] = $filter->date . ' 23:59:59'; $scheduleEventIterator->setFilter($paramFilters); // we need to get the length of time to create number of rows in the grid $timeLen = ($filterTimeEnd - $filterTimeStart) / 60 / $filter->increment; for ($i = 0; $i <= $timeLen; $i++) { $row = array(); // assign row id as rowNumber and columnIndex $row['id'] = $i . $columnIndex; $row['data'][0] = ''; $columnData[$i] = $row; } $filterToTimeStart = strtotime($paramFilters['start']); $appointmentIterator->setFilter($paramFilters); // hold the temporary data counter $tmpDataCtr = array(); $colMultiplier = 1; $patient = new Patient(); $room = new Room(); $zIndex = 0; foreach ($appointmentIterator as $row) { $startToTime = strtotime($row->start); $endToTime = strtotime($row->end); $tmpStart = date('H:i', $startToTime); $tmpEnd = date('H:i', $endToTime); $timeLen = ($endToTime - $startToTime) / 60 / $filter->increment; $tmpIndex = ($startToTime - $filterToTimeStart) / 60 / $filter->increment; if (!isset($columnData[$tmpIndex])) { break; } $index = $tmpIndex; for ($j = 1; $j <= $timeLen; $j++) { if (!isset($columnData[$index])) { break; } $index++; } $j--; $height = 20 * $j * 1.1; $marginLeft = 8; $multiplier = 1; // generate ranges code inside if ($multiplier === 1) block $incTime = $startToTime; $ranges = array(); for ($ctr = 1; $ctr <= $timeLen; $ctr++) { $ranges[] = date('H:i', $incTime); $incTime = strtotime("+{$filter->increment} minutes", $incTime); } // check for appointment intersection foreach ($tmpDataCtr as $keyCtr => $dataCtr) { if (in_array($tmpStart, $dataCtr['ranges'])) { // merge the ranges if we need to have a nested multiple bookings // uncomment if this is not the case and move the generate ranges to its proper location for code optimization $tmpDataCtr[$keyCtr]['ranges'] = array_merge($dataCtr['ranges'], $ranges); $tmpDataCtr[$keyCtr]['multiplier']++; $multiplier = $tmpDataCtr[$keyCtr]['multiplier']; break; } } if ($multiplier === 1) { $tmpDataCtr[] = array('ranges' => $ranges, 'multiplier' => $multiplier); } else { $marginLeft = ($multiplier - 1) * 250; } if ($multiplier > $colMultiplier) { $colMultiplier = $multiplier; } $patient->setPersonId($row->patientId); $patient->populate(); $person = $patient->person; $room->setRoomId($row->roomId); $room->populate(); $this->_session->currentAppointments[$columnIndex][$row->appointmentId] = $row; $mark = ''; if (strlen($row->appointmentCode) > 0) { $mark = "({$row->appointmentCode})"; } $zIndex++; // where to use room? $columnData[$tmpIndex]['id'] = $row->appointmentId . 'i' . $columnData[$tmpIndex]['id']; $appointmentId = $row->appointmentId; $columnData[$tmpIndex]['data'][0] .= "<div style=\"float:left;position:absolute;margin-top:-11.9px;height:{$height}px;width:230px;overflow:hidden;border:thin solid black;margin-left:{$marginLeft}px;padding-left:2px;background-color:lightgrey;z-index:{$zIndex};\" class=\"dataForeground\" id=\"event{$appointmentId}\" onmouseover=\"expandAppointment({$appointmentId},this);\" onmouseout=\"shrinkAppointment({$appointmentId},this,{$height},{$zIndex});\">{$tmpStart}-{$tmpEnd} <a href=\"\">{$person->last_name}, {$person->first_name} (#{$row->patientId})</a> <div class=\"bottomInner\" id=\"bottomInnerId{$appointmentId}\">{$row->title} {$mark}</div></div>"; $columnData[$tmpIndex]['userdata']['appointmentId'] = $row->appointmentId; } $columnData[0]['userdata']['colMultiplier'] = $colMultiplier; $columnData[0]['userdata']['providerId'] = $paramFilters['providerId']; $roomId = 0; if (isset($paramFilters['roomId'])) { $roomId = $paramFilters['roomId']; } $columnData[0]['userdata']['roomId'] = $roomId; foreach ($scheduleEventIterator as $event) { $x = explode(' ', $event->start); $eventTimeStart = strtotime($x[1]); $x = explode(' ', $event->end); $eventTimeEnd = strtotime($x[1]); // get the starting index $index = ($eventTimeStart - $filterTimeStart) / 60 / $filter->increment; $tmpIndex = $index; $color = $event->provider->color; if ($event->roomId > 0 && strlen($event->room->color) > 0) { $color = $event->room->color; } if (substr($color, 0, 1) != '#') { $color = '#' . $color; } while ($eventTimeStart < $eventTimeEnd) { $eventDateTimeStart = date('Y-m-d H:i:s', $eventTimeStart); $eventTimeStart = strtotime("+{$filter->increment} minutes", $eventTimeStart); $columnData[$tmpIndex]['style'] = 'background-color:' . $color . ';border-color:lightgrey;'; $columnData[$index]['userdata']['title'] = $event->title; $tmpIndex++; } } $ret = array(); $ret['rows'] = $columnData; return $ret; }
function kodi_plugin_setting_page() { global $_, $myUser; if (isset($_['section']) && $_['section'] == 'kodiCmd') { if ($myUser != false) { $kodiManager = new KodiCmd(); $kodiCmds = $kodiManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); ?> <div class="span9 userBloc"> <h1>KODI</h1> <p>Gestion media-center</p> <ul class="nav nav-tabs"> <li <?php echo !isset($_['block']) || $_['block'] == 'cmd' ? 'class="active"' : ''; ?> > <a href="setting.php?section=kodiCmd&block=cmd"><i class="fa fa-angle-right"></i> Commandes Vocales</a></li> <li <?php echo isset($_['block']) && $_['block'] == 'new' ? 'class="active"' : ''; ?> > <a href="setting.php?section=kodiCmd&block=new"><i class="fa fa-angle-right"></i> Ajouter une Commande</a></li> </ul> <?php if (isset($_['section']) && $_['section'] == 'kodiCmd' && @$_['block'] == 'new') { ?> <form action="action.php?action=kodiCmd_add_kodiCmd" method="POST"> <fieldset> <div class="left"> <label for="name">Nom</label> <input type="text" id="name" onkeyup="$('#vocalCommand').html($(this).val());" name="name" placeholder="musique suivante"/> <small>Commande vocale associée : "<span id="vocalCommand"></span>"</small></label> <label for="description">Description</label> <input type="text" name="description" id="description" placeholder="Lire la prochaine musique" /> <label for="kodiJsonCode">Code json de la commande</label> <input type="text" name="kodiJsonCode" id="kodiJsonCode" placeholder='"method":"Input.Right","id":"1"' /> <a href="http://wiki.kodi.org/index.php?title=JSON-RPC_API/v6" target="_blank" >JSON-RPC_API-V6-WIKI </a> <label for="room">Pièce</label> <select name="room" id="room"> <?php foreach ($rooms as $room) { ?> <option value="<?php echo $room->getId(); ?> " <?php echo $room->getName() == "KODI" ? "selected" : ""; ?> ><?php echo $room->getName(); ?> </option> <?php } ?> </select> <label for="confidence">Confidence</label> <select name="confidence" id="confidence"> <?php for ($confidence = 1; $confidence <= 9; $confidence++) { ?> <option value=0.<?php echo $confidence; ?> <?php echo $confidence == 8 ? "selected" : ""; ?> >0.<?php echo $confidence; ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button type="submit" class="btn">Ajouter</button> </fieldset> <br/> </form> <?php } if (isset($_['section']) && $_['section'] == 'kodiCmd' && @$_['block'] == 'edit') { $kodiCmd = new KodiCmd(); $kodiCmd = $kodiCmd->getById($_['id']); ?> <form action="action.php?action=kodiCmd_edit_kodiCmd" method="POST"> <fieldset> <div class="left"> <label for="name">Nom</label> <input type="hidden" name="id" value="<?php echo $kodiCmd->getId(); ?> " /> <input type="text" id="name" onkeyup="$('#vocalCommand').html($(this).val());" value="<?php echo $kodiCmd->getName(); ?> " name="name" /> <small>Commande vocale associée : "<span id="vocalCommand"></span>"</small></label> <label for="description">Description</label> <input type="text" name="description" value="<?php echo $kodiCmd->getDescription(); ?> " id="description" /> <label for="kodiJsonCode">Code json de la commande</label> <input type="text" name="kodiJsonCode" id="kodiJsonCode" value='<?php echo $kodiCmd->getJson(); ?> ' /> <a href="http://wiki.kodi.org/index.php?title=JSON-RPC_API/v6" target="_blank" >JSON-RPC_API-V6-WIKI </a> <label for="room">Pièce</label> <select name="room" id="room"> <?php foreach ($rooms as $room) { ?> <option value="<?php echo $room->getId(); ?> " <?php echo $room->getId() == $kodiCmd->getRoom() ? "selected" : ""; ?> ><?php echo $room->getName(); ?> </option> <?php } ?> </select> <label for="confidence">Confidence</label> <select name="confidence" id="confidence"> <?php for ($confidence = 1; $confidence <= 9; $confidence++) { ?> <option value=0.<?php echo $confidence; ?> <?php echo '0.' . $confidence == $kodiCmd->getConfidence() ? "selected" : ""; ?> >0.<?php echo $confidence; ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button type="submit" class="btn">Modifier</button> </fieldset> <br/> </form> <?php } if (isset($_['section']) && $_['section'] == 'kodiCmd' && (@$_['block'] == 'cmd' || @$_['block'] == '')) { ?> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th>Code json de la commande</th> <th>Confidence</th> <th>Pièce</th> <th>Actions</th> </tr> </thead> <?php foreach ($kodiCmds as $kodiCmd) { $room = $roomManager->load(array('id' => $kodiCmd->getRoom())); ?> <tr> <td><?php echo $kodiCmd->getName(); ?> </td> <td><?php echo $kodiCmd->getDescription(); ?> </td> <td><?php echo $kodiCmd->getJson(); ?> </td> <td><?php echo $kodiCmd->getConfidence(); ?> </td> <td><?php echo $room->getName(); ?> </td> <td> <a class="btn" href="setting.php?section=kodiCmd&block=edit&id=<?php echo $kodiCmd->getId(); ?> "><i class="fa fa-pencil-square-o fa-lg"></i></a> <a class="btn" href="action.php?action=kodiCmd_delete_kodiCmd&id=<?php echo $kodiCmd->getId(); ?> "><i class="fa fa-trash-o fa-lg"></i></a></td> </tr> <?php } ?> </table> </div> <?php } } else { header('location:index.php?connexion=ko'); } } }
public function paymentReceiptAction() { // d96de46c-be90-45b0-b5f9-0b4abee76483 $referenceId = $this->_getParam('referenceId'); $personId = (int) $this->_getParam('personId'); $visitId = (int) $this->_getParam('visitId'); $data = $this->_getAttachmentData($referenceId); $patient = new Patient(); $patient->personId = $personId; if ($personId > 0) { $patient->populate(); } $person = $patient->person; $visit = new Visit(); $visit->visitId = $visitId; if ($visitId > 0) { $visit->populate(); } $practiceId = (int) $visit->practiceId; if (!$practiceId > 0) { $buildingId = (int) $visit->buildingId; if ($buildingId > 0) { $building = new Building(); $building->buildingId = $buildingId; $building->populate(); $practiceId = (int) $building->practiceId; } else { $roomId = (int) $visit->roomId; if ($roomId > 0) { $room = new Room(); $room->roomId = $roomId; $room->populate(); $practiceId = (int) $room->building->practiceId; } } } $practice = new Practice(); $practice->practiceId = $practiceId; if ($practiceId > 0) { $practice->populate(); } $primaryAddress = $practice->primaryAddress; $xml = new SimpleXMLElement('<data/>'); $xmlPractice = $xml->addChild('practice'); $this->_addChild($xmlPractice, 'name', $practice->name); $this->_addChild($xmlPractice, 'primaryLine1', $primaryAddress->line1); $primaryCityStateZip = $primaryAddress->city . ' ' . $primaryAddress->state . ' ' . $primaryAddress->postalCode; $this->_addChild($xmlPractice, 'primaryCityStateZip', $primaryCityStateZip); $this->_addChild($xmlPractice, 'mainPhone', $practice->mainPhone->number); $xmlPatient = $xml->addChild('patient'); $name = $person->firstName . ' ' . $person->middleName . ' ' . $person->lastName; $this->_addChild($xmlPatient, 'name', $name); $addresses = Address::listAddresses($personId); if (isset($addresses[Address::TYPE_BILLING])) { $address = $addresses[Address::TYPE_BILLING]; } else { if (isset($addresses[Address::TYPE_HOME])) { $address = $addresses[Address::TYPE_HOME]; } else { if (isset($addresses[Address::TYPE_MAIN])) { $address = $addresses[Address::TYPE_MAIN]; } else { if (isset($addresses[Address::TYPE_SEC])) { $address = $addresses[Address::TYPE_SEC]; } else { if (isset($addresses[Address::TYPE_OTHER])) { $address = $addresses[Address::TYPE_OTHER]; } else { $address = array_pop($addresses); } } } } } $billingCityStateZip = $address->city . ' ' . $address->state . ' ' . $address->postalCode; $this->_addChild($xmlPatient, 'billingLine1', $address->line1); $this->_addChild($xmlPatient, 'billingCityStateZip', $billingCityStateZip); $iterator = new PatientProcedureIterator(); $iterator->setFilters(array('visitId' => $visitId)); $procedures = array(); foreach ($iterator as $row) { $procedures[] = $row->code; } $iterator = new PatientDiagnosisIterator(); $iterator->setFilters(array('visitId' => $visitId)); $diagnoses = array(); foreach ($iterator as $row) { $diagnoses[] = $row->code; } $xmlNotes = $xmlPatient->addChild('notes'); $note = implode(',', $procedures) . " \t " . implode(',', $diagnoses) . " \t " . date('m/d/y', strtotime($visit->dateOfTreatment)); $this->_addChild($xmlNotes, 'note', $note); $today = date('Y-m-d'); $todaysTotal = 0; $iterator = new PaymentIterator(); $iterator->setFilters(array('visitId' => $visitId, 'company' => 'System', 'paymentDate' => $today)); $payments = array(); foreach ($iterator as $row) { $payments[] = $row; } $iterator->setFilters(array('personId' => $personId, 'unallocated' => true, 'paymentDate' => $today)); foreach ($iterator as $row) { $payments[] = $row; } foreach ($payments as $row) { $xmlPayment = $xmlPatient->addChild('payments'); $paymentDate = date('m/d/y', strtotime($row->paymentDate)); $this->_addChild($xmlPayment, 'date', $paymentDate); $this->_addChild($xmlPayment, 'description', $row->title . ' .... Thank You'); $this->_addChild($xmlPayment, 'method', $row->paymentType); $amount = (double) $row->amount; $todaysTotal += $amount; $this->_addChild($xmlPayment, 'amount', '-' . number_format($amount, 2)); $this->_addChild($xmlPayment, 'insurance', $row->insuranceDisplay); } $fees = $visit->calculateFees(); $previousBalance = $fees['total']; $this->_addChild($xmlPatient, 'previousBalance', number_format($previousBalance, 2)); $this->_addChild($xmlPatient, 'todaysTotal', '-' . number_format($todaysTotal, 2)); $totalDue = $previousBalance - $todaysTotal; $this->_addChild($xmlPatient, 'totalDue', number_format($totalDue, 2)); $totalDueFromPatient = $previousBalance; $this->_addChild($xmlPatient, 'totalDueFromPatient', number_format($totalDueFromPatient, 2)); try { $content = ReportBase::mergepdfset($xml, $data); $this->getResponse()->setHeader('Content-Type', 'application/pdf'); } catch (Exception $e) { $content = '<script>alert("' . $e->getMessage() . '")</script>'; } $this->view->content = $content; $this->render('binary-template'); }
function door_plugin_setting_page() { global $_, $myUser; if (isset($_['section']) && $_['section'] == 'door') { if ($myUser != false) { $doorManager = new Door(); $doors = $doorManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); ?> <div class="span9 userBloc"> <h1>Porte</h1> <p>Gestion des portes</p> <form action="action.php?action=door_add_door" method="POST"> <fieldset> <legend>Ajout d'un porte</legend> <div class="left"> <label for="nameDoor">Nom</label> <input type="text" id="nameDoor" onkeyup="$('#vocalCommand').html($(this).val());" name="nameDoor" placeholder="Lumiere Canapé…"/> <small>Commande vocale associée : "YANA, ouvre <span id="vocalCommand"></span>"</small> <label for="descriptionDoor">Description</label> <input type="text" name="descriptionDoor" id="descriptionDoor" placeholder="Porte de l'entrée…" /> <label for="pinDoorRelay">Pin GPIO verouillage (relais)</label> <input type="text" name="pinDoorRelay" id="pinDoorRelayRelay" placeholder="0,1,2…" /> <label for="pinDoorRelay">Pin GPIO etat (capteur hall)</label> <input type="text" name="pinDoorCaptor" id="pinDoorCaptor" placeholder="0,1,2…" /> <label for="roomDoor">Pièce</label> <select name="roomDoor" id="roomDoor"> <?php foreach ($rooms as $room) { ?> <option value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button type="submit" class="btn">Ajouter</button> </fieldset> <br/> </form> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th>Pin GPIO verouillage</th> <th>Pin GPIO etat</th> <th>Pièce</th> </tr> </thead> <?php foreach ($doors as $door) { $room = $roomManager->load(array('id' => $door->getRoom())); ?> <tr> <td><?php echo $door->getName(); ?> </td> <td><?php echo $door->getDescription(); ?> </td> <td><?php echo $door->getPinRelay(); ?> </td> <td><?php echo $door->getPinCaptor(); ?> </td> <td><?php echo $room->getName(); ?> </td> <td><a class="btn" href="action.php?action=door_delete_door&id=<?php echo $door->getId(); ?> "><i class="icon-remove"></i></a></td> </tr> <?php } ?> </table> </div> <?php } else { ?> <div id="main" class="wrapper clearfix"> <article> <h3>Vous devez être connecté</h3> </article> </div> <?php } } }
protected static function _generate4010A1($claimId, array $claim) { static $ctr = 0; static $visits = array(); static $practices = array(); static $insurancePrograms = array(); static $providers = array(); static $patients = array(); $claimId = (int) $claimId; $claimLine = new ClaimLine(); $claimLine->populateByClaimId($claimId); $visitId = (int) $claimLine->visitId; if (!isset($visits[$visitId])) { $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); $visits[$visitId] = $visit; } $visit = $visits[$visitId]; $patientId = (int) $visit->patientId; if (!isset($patients[$patientId])) { $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); $patients[$patientId] = $patient; } $patient = $patients[$patientId]; $practiceId = (int) $visit->practiceId; if (!isset($practices[$practiceId])) { $practice = new Practice(); $practice->practiceId = $practiceId; $practice->populate(); $practices[$practiceId] = $practice; } $practice = $practices[$practiceId]; $insuranceProgramId = (int) $visit->activePayerId; if (!isset($insurancePrograms[$insuranceProgramId])) { $insurance = new InsuranceProgram(); $insurance->insuranceProgramId = $insuranceProgramId; $insurance->populate(); $insurancePrograms[$insuranceProgramId] = $insurance; } $insuranceProgram = $insurancePrograms[$insuranceProgramId]; $providerId = (int) $visit->treatingPersonId; if (!isset($providers[$providerId])) { $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $providers[$providerId] = $provider; } $provider = $providers[$providerId]; $billAs = (int) $provider->billAs; if ($billAs > 0) { $providerId = $billAs; if (!isset($providers[$providerId])) { $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $providers[$providerId] = $provider; } $provider = $providers[$providerId]; } $subscribers = array(); $enumeration = new Enumeration(); $enumeration->populateByUniqueName(InsuranceProgram::INSURANCE_ENUM_NAME); $enumerationClosure = new EnumerationClosure(); foreach ($enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true) as $enum) { $rowset = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true); if ($enum->key == InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) { foreach ($rowset as $row) { $subscribers[$row->key] = $row->name; } break; } } $insuredRelationship = new InsuredRelationship(); $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from($insuredRelationship->_table)->where('insurance_program_id = ?', (int) $insuranceProgram->insuranceProgramId)->where('person_id = ?', (int) $patientId)->where('active = 1')->order('program_order')->limit(1); if ($row = $db->fetchRow($sqlSelect)) { $insuredRelationship->populateWithArray($row); } $subs = $insuredRelationship->subscriber; $subscriberAddr = $subs->address; $relationship = null; $relationshipCode = $insuredRelationship->subscriberToPatientRelationship; if (isset($subscribers[$relationshipCode])) { $relationship = $subscribers[$relationshipCode]; } if ($relationship === null) { $relationship = 'Self'; $relationshipCode = 18; $subs = new Person(); $subs->personId = $insuredRelationship->personId; $subs->populate(); } $subscriber = array('id' => (int) $subs->personId, 'relationship_code' => $relationshipCode, 'group_number' => $insuredRelationship->groupNumber, 'group_name' => $insuredRelationship->groupName, 'relationship' => $relationship, 'last_name' => $subs->lastName, 'first_name' => $subs->firstName, 'middle_name' => $subs->middleName, 'address' => array('line1' => $subscriberAddr->line1, 'line2' => $subscriberAddr->line2, 'city' => $subscriberAddr->city, 'state' => $subscriberAddr->state, 'zip' => $subscriberAddr->zipCode), 'date_of_birth' => date('Ymd', strtotime($subs->dateOfBirth)), 'gender' => $subs->gender, 'contract_type_code' => '', 'contract_amount' => '', 'contract_percent' => '', 'contract_code' => '', 'contract_discount_percent' => '', 'contract_version' => ''); $practiceAddr = $practice->primaryAddress; $room = new Room(); $room->roomId = (int) $visit->roomId; $room->populate(); $facility = $room->building; $phoneNumber = PhoneNumber::autoFixNumber($practice->mainPhone->number); $phoneLen = strlen($phoneNumber); if ($phoneLen < 10) { $phoneNumber = str_pad($phoneNumber, 10, '0', STR_PAD_LEFT); } else { if ($phoneLen > 10) { $phoneNumber = substr($phoneNumber, -10); } } $identifierType = ''; $identifier = $practice->identifier; if (strlen($identifier) > 0) { $identifierType = 'XX'; } //24'; $data = array('hlCount' => ++$ctr); $data['practice'] = array('name' => $practice->name, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'address' => array('line1' => $practiceAddr->line1, 'line2' => $practiceAddr->line2, 'city' => $practiceAddr->city, 'state' => $practiceAddr->state, 'zip' => $practiceAddr->zipCode), 'phoneNumber' => $phoneNumber); $data['treating_facility'] = array('identifier' => $facility->identifier); $dateOfTreatment = date('Ymd', strtotime($visit->dateOfTreatment)); $payer2Id = $insuranceProgram->insuranceProgramId; if (strlen($payer2Id) < 2) { $payer2Id = str_pad($payer2Id, 2, '0', STR_PAD_LEFT); } $identifierType = ''; $identifier = $provider->person->identifier; if (strlen($identifier) > 0) { $identifierType = 'XX'; } //34'; $claimData = array('claim' => $claim, 'patient' => array('date_of_initial_treatment' => $dateOfTreatment, 'date_of_onset' => $dateOfTreatment, 'comment_type' => '', 'comment' => ''), 'treating_facility' => array('facility_code' => $facility->facilityCodeId, 'name' => $facility->name, 'address' => array('line1' => $facility->line1, 'line2' => $facility->line2, 'city' => $facility->city, 'state' => $facility->state, 'zip' => $facility->zipCode)), 'provider' => array('signature_on_file' => 'Y', 'accepts_assignment' => 'A', 'last_name' => $provider->person->lastName, 'first_name' => $provider->person->firstName, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'identifier_2' => ''), 'billing_facility' => array('clia_number' => ''), 'subscriber' => $subscriber, 'clearing_house' => array('credit_max_amount' => '', 'repricing_method' => '', 'allowed_amount' => '', 'savings_amount' => '', 'identifier' => '', 'rate' => '', 'apg_code' => '', 'apg_amount' => '', 'reject_code' => '', 'compliance_code' => '', 'exception_code' => ''), 'referring_provider' => array('last_name' => '', 'first_name' => '', 'referral_type' => '', 'identifier_type' => '', 'identifier' => '', 'taxonomy_code' => ''), 'supervising_provider' => array('last_name' => '', 'first_name' => '', 'identifier_type' => '', 'identifier' => ''), 'payer2' => array('id' => $payer2Id, 'name' => $insuranceProgram->name)); $clm = array(); $iterator = new ClaimLineIterator(); $iterator->setFilters(array('claimId' => $claimId)); foreach ($iterator as $row) { $baseFee = (double) $row->baseFee; $adjustedFee = (double) $row->adjustedFee; $paid = (double) $row->paid; $billed = $row->totalMiscCharge; if ($baseFee > 0) { $billed += $baseFee - $adjustedFee; } $balance = abs($billed) - $paid; $clm[] = array('claim' => $claimData['claim'], 'patient' => $claimData['patient'], 'claim_line' => array('amount' => $balance, 'diagnosis1' => preg_replace('/[\\.]/', '', $row->diagnosisCode1), 'diagnosis2' => preg_replace('/[\\.]/', '', $row->diagnosisCode2), 'diagnosis3' => preg_replace('/[\\.]/', '', $row->diagnosisCode3), 'diagnosis4' => preg_replace('/[\\.]/', '', $row->diagnosisCode4), 'diagnosis5' => preg_replace('/[\\.]/', '', $row->diagnosisCode5), 'diagnosis6' => preg_replace('/[\\.]/', '', $row->diagnosisCode6), 'diagnosis7' => preg_replace('/[\\.]/', '', $row->diagnosisCode7), 'diagnosis8' => preg_replace('/[\\.]/', '', $row->diagnosisCode8), 'procedure' => $row->procedureCode, 'modifier1' => $row->modifier1, 'modifier2' => $row->modifier2, 'modifier3' => $row->modifier3, 'modifier4' => $row->modifier4, 'units' => str_replace('.00', '', $row->units), 'date_of_treatment' => $dateOfTreatment, 'clia_number' => ''), 'treating_facility' => $claimData['treating_facility'], 'provider' => $claimData['provider'], 'billing_facility' => $claimData['billing_facility'], 'subscriber' => $subscriber, 'clearing_house' => $claimData['clearing_house'], 'referring_provider' => $claimData['referring_provider'], 'supervising_provider' => $claimData['supervising_provider'], 'payer2' => $claimData['payer2']); } $hl2 = array(); $hl2[] = array('hlCount' => $ctr, 'hlCount2' => ++$ctr, 'payer' => array('responsibility' => 'P'), 'subscriber' => $subscriber, 'patient' => array('weight' => '', 'last_name' => $patient->lastName, 'first_name' => $patient->firstName), 'responsible_party' => array('last_name' => '', 'first_name' => '', 'address' => array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'zip' => '')), 'CLM' => $clm); $data['HL2'] = $hl2; return $data; }
function propise_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'propise') { require_once 'Data.class.php'; require_once 'Sensor.class.php'; if (!$myUser) { throw new Exception('Vous devez être connecté pour effectuer cette action'); } $sensorManager = new Sensor(); $sensors = $sensorManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); $selected = new Sensor(); //Si on est en mode modification if (isset($_['id'])) { $selected = $sensorManager->getById($_['id']); } ?> <div class="span9 userBloc"> <h1>Propise</h1> <p>Gestion des multi-sondes</p> <fieldset> <legend>Ajouter/Modifier une sonde</legend> <div class="left"> <label for="labelSensor">Nom</label> <input type="hidden" id="id" value="<?php echo $selected->id; ?> "> <input type="text" id="labelSensor" value="<?php echo $selected->label; ?> " placeholder="Sonde du salon"/> <label for="uidSensor">UID</label> <input type="text" value="<?php echo $selected->uid; ?> " id="uidSensor" placeholder="sonde-1,sonde-2..." /> <label for="locationSensor">Pièce de la maison</label> <select id="locationSensor"> <?php foreach ($rooms as $room) { ?> <option <?php if ($selected->location == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button onclick="plugin_propise_save(this)" class="btn">Enregistrer</button> </fieldset> <br/> <fieldset> <legend>Consulter les sondes existants</legend> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>UID</th> <th>Pièce</th> <th colspan="2"></th> </tr> </thead> <?php foreach ($sensors as $sensor) { $room = $roomManager->load(array('id' => $sensor->location)); ?> <tr> <td><?php echo $sensor->label; ?> </td> <td><?php echo $sensor->uid; ?> </td> <td><?php echo $room->getName(); ?> </td> <td> <a class="btn" href="setting.php?section=propise&id=<?php echo $sensor->id; ?> "><i class="fa fa-pencil"></i></a> <div class="btn" onclick="plugin_propise_delete(<?php echo $sensor->id; ?> ,this);"><i class="fa fa-times"></i></div> </td> </td> </tr> <?php } ?> </table> </fieldset> </div> <?php } }
function ajaxStationFromAppointmentAction() { $appointmentId = (int) $this->_getParam('appointmentId'); $stationId = $this->_getParam('stationId'); trigger_error('st: ' . $stationId, E_USER_NOTICE); $personId = ''; $routing = new Routing(); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $appointment = new LegacyAppointment(); $appointment->appointmentId = $appointmentId; $appointment->populate(); //appointment already arrived, prevent a dupe if ($appointment->arrived > 0) { return $json->direct(array(false)); } $patientId = $appointment->patientId; $provider = new Provider(); $provider->personId = $appointment->providerId; $provider->populate(); if (strlen($stationId) > 0) { trigger_error('st: ' . $stationId, E_USER_NOTICE); } elseif (strlen($provider->routingStation) > 0) { $stationId = $provider->routingStation; } else { if ($appointment->roomId > 0) { $room = new Room(); $room->roomId = $appointment->roomId; $room->populate(); if (strlen($room->routingStation) > 0) { $stationId = $room->routingStation; } } } $routing->personId = $appointment->patientId; $routing->stationId = $stationId; $routing->appointmentId = $appointment->appointmentId; $routing->providerId = $appointment->providerId; $routing->roomId = $appointment->roomId; $routing->timestamp = date('Y-m-d H:i:s'); if ($routing->personId > 0 && strlen($stationId) > 0) { $appointment->arrived = 1; $appointment->persist(); $routing->persist(); return $json->direct(array(true)); } return $json->direct(array(false)); }
function listNotesAction() { $personId = 0; $personId = (int) $this->_getParam('personId'); $filter = $this->_getParam('filter'); $clinicalNoteIterator = new ClinicalNoteIterator(); $custom = $this->_getParam('custom'); if (count($custom) > 0) { $custom = $this->_getParam('custom'); $custom['personId'] = $personId; $clinicalNoteIterator->customView($custom); } else { $data = array(); $data['personId'] = $personId; if ($filter == 'byAuthoringPersonId') { $data['authoringPersonId'] = $this->_getParam('authoringPersonId'); } if ($filter == 'byDateRange') { $data['dateRange'] = $this->_getParam('dateRange'); } if ($filter == 'byCurrentPractice' || $filter == 'bySelectedVisit') { $visitId = (int) $this->_getParam('visitId'); $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); $building = new Building(); $building->buildingId = $visit->buildingId; $building->populate(); $data['locationId'] = $building->buildingId; $data['selectedVisit'] = date('Y-m-d', strtotime($visit->timestamp)); } if ($filter == 'byVisitPractice' || $filter == 'byVisitBuilding') { $practiceId = 0; $buildingId = 0; $identity = Zend_Auth::getInstance()->getIdentity(); $userId = $identity->userId; $user = new User(); $user->userId = $userId; $user->populate(); if (strlen($user->preferences) > 0) { $this->xmlPreferences = new SimpleXMLElement($user->preferences); $currentLocation = (string) $this->xmlPreferences->currentLocation; $locationId = (int) $currentLocation; if ($locationId > 0) { $room = new Room(); $room->roomId = $locationId; $room->populate(); $practiceId = $room->building->practiceId; $buildingId = $room->buildingId; } } $data['practiceId'] = $practiceId; $data['buildingId'] = $buildingId; } $clinicalNoteIterator->setFilter($filter, $data); } //trigger_error($cnSelect->__toString(),E_USER_NOTICE); //var_dump($db->query($cnSelect)->fetchAll());exit; $notes = array(); foreach ($clinicalNoteIterator as $note) { if ($note['eSignatureId'] > 0) { $img = 'sm-signed.png'; $alt = 'Signed'; } else { $img = 'sm-editproblem.png'; $alt = 'Editing'; } $icon = '<img src="' . Zend_Registry::get('baseUrl') . 'img/' . $img . '" alt="' . $alt . '" />'; $row = array(); $row['id'] = $note['clinicalNoteId']; $row['data'][] = ''; $row['data'][] = $icon . ' ' . date('Y-m-d', strtotime($note['dateTime'])); $row['data'][] = $note['noteTitle']; $row['data'][] = $note['last_name'] . ', ' . $note['first_name'] . ' ' . substr($note['middle_name'], 0, 1); $location = ''; $locationId = (int) $note['locationId']; if ($locationId > 0) { $location = Room::location($locationId); } $row['data'][] = $location; $row['data'][] = $row['id']; $row['data'][] = 0; $xml = simplexml_load_string($note['template']); $genericData = new GenericData(); $filters = array(); $filters['objectId'] = $note['clinicalNoteId']; $filters['objectClass'] = 'ClinicalNote'; $genericDataIterator = $genericData->getIteratorByFilters($filters); $firstData = false; $childIcon = '<img src="' . Zend_Registry::get('baseUrl') . 'img/leaf.gif" alt="-" />'; foreach ($genericDataIterator as $data) { if (!$firstData) { $firstData = true; //$row['id'] .= ':'.$data->revisionId; $row['data'][6] = $data->revisionId; continue; } $tmp = array(); $tmp['id'] = $data->revisionId; $tmp['data'][] = $data->objectId; // ''; $tmp['data'][] = ' ' . $childIcon . ' ' . date('Y-m-d', strtotime($data->dateTime)); $tmp['data'][] = $note['noteTitle']; $tmp['data'][] = ''; // Author $tmp['data'][] = ''; // Location $tmp['data'][] = $note['clinicalNoteId']; $tmp['data'][] = $tmp['id']; $row['rows'][] = $tmp; } $notes[] = $row; } $acj = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $acj->suppressExit = true; $acj->direct(array("rows" => $notes)); }
function ipcam_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'ipcam') { require_once 'Camera.class.php'; if (!$myUser) { throw new Exception('Vous devez être connecté pour effectuer cette action'); } $cameraManager = new Camera(); $cameras = $cameraManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); $selected = new Camera(); //Si on est en mode modification if (isset($_['id'])) { $selected = $cameraManager->getById($_['id']); } ?> <div class="span9 userBloc"> <h1>Camera</h1> <p>Gestion des cameras IP</p> <fieldset> <legend>Ajouter/Modifier une camera</legend> <div class="left"> <label for="labelCamera">Nom</label> <input type="hidden" id="id" value="<?php echo $selected->id; ?> "> <input type="text" id="labelCamera" value="<?php echo $selected->label; ?> " placeholder="Sonde du salon"/> <label for="ipCamera">IP</label> <input type="text" value="<?php echo $selected->ip; ?> " id="ipCamera" placeholder="192.168.11.27:87" /> <label for="loginCamera">Login</label> <input type="text" value="<?php echo $selected->login; ?> " id="loginCamera" placeholder="" /> <label for="passwordCamera">Password</label> <input type="text" value="<?php echo $selected->password; ?> " id="passwordCamera" placeholder="" /> <label for="locationCamera">Pièce de la maison</label> <select id="locationCamera"> <?php foreach ($rooms as $room) { ?> <option <?php if ($selected->location == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button onclick="plugin_ipcam_save(this)" class="btn">Enregistrer</button> </fieldset> <br/> <fieldset> <legend>Consulter les sondes existants</legend> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>IP</th> <th>Pièce</th> <th colspan="2"></th> </tr> </thead> <?php foreach ($cameras as $camera) { $room = $roomManager->load(array('id' => $camera->location)); ?> <tr> <td><?php echo $camera->label; ?> </td> <td><?php echo $camera->ip; ?> </td> <td><?php echo $room->getName(); ?> </td> <td> <a class="btn" href="setting.php?section=ipcam&id=<?php echo $camera->id; ?> "><i class="fa fa-pencil"></i></a> <div class="btn" onclick="plugin_ipcam_delete(<?php echo $camera->id; ?> ,this);"><i class="fa fa-times"></i></div> </td> </td> </tr> <?php } ?> </table> </fieldset> </div> <?php } }
protected static function _getPatientData($patient, $includeProvider = true, $providerId = null, $roomId = null) { $maritalStatusMap = array('SEPARATED' => 'A', 'DIVORCED' => 'D', 'MARRIED' => 'M', 'SINGLE' => 'S', 'WIDOWED' => 'W'); if (!$patient instanceof Patient) { $patientId = (int) $patient; $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); } $personId = (int) $patient->personId; $person = $patient->person; $maritalStatus = $person->maritalStatus; if (isset($maritalStatusMap[$maritalStatus])) { $maritalStatus = $maritalStatusMap[$maritalStatus]; } $ethnicities = array(); $ethnicities['1'] = 1; $ethnicities['Hispanic/Latino'] = 1; $ethnicities['2'] = 2; $ethnicities['Not Hispanic/Latino'] = 2; $ethnicities['3'] = 3; $ethnicities['Unreported / Refused to Report'] = 3; $races = array(); $races['A'] = 'A'; $races['Asian'] = 'A'; $races['N'] = 'N'; $races['Native Hawaiian'] = 'N'; $races['P'] = 'P'; $races['Other Pacific Islander'] = 'P'; $races['B'] = 'B'; $races['Black / African American'] = 'B'; $races['I'] = 'I'; $races['American Indian / Alaska Native'] = 'I'; $races['W'] = 'C'; $races['White'] = 'C'; $races['M'] = 'M'; $races['More than one race'] = 'M'; $races['E'] = 'E'; $races['Unreported / Refused to Report'] = 'E'; $statistics = PatientStatisticsDefinition::getPatientStatistics($personId); $race = ''; if (isset($statistics['Race'])) { $race = $statistics['Race']; } if (isset($statistics['race'])) { $race = $statistics['race']; } $race = isset($races[$race]) ? $races[$race] : 'E'; $ethnicity = ''; if (isset($statistics['Ethnicity'])) { $ethnicity = $statistics['Ethnicity']; } if (isset($statistics['ethnicity'])) { $ethnicity = $statistics['ethnicity']; } $ethnicity = isset($ethnicities[$ethnicity]) ? $ethnicities[$ethnicity] : '3'; $language = ''; if (isset($statistics['Language'])) { $language = $statistics['Language']; } if (isset($statistics['language'])) { $language = $statistics['language']; } $language = ''; // temporarily set to empty $patientData = array(); $patientData['recordNumber'] = $patient->recordNumber; $patientData['lastName'] = $person->lastName; $patientData['firstName'] = $person->firstName; $patientData['middleName'] = $person->middleName; $patientData['suffix'] = $person->suffix; $patientData['dateOfBirth'] = date('Ymd', strtotime($person->dateOfBirth)); $patientData['gender'] = $person->gender; $patientData['race'] = $race; $patientData['ethnicity'] = $ethnicity; $address = $person->address; $patientData['line1'] = $address->line1; $patientData['line2'] = $address->line2; $patientData['city'] = $address->city; $patientData['state'] = $address->state; $patientData['zip'] = $address->postalCode; $homePhone = ''; $businessPhone = ''; $phoneNumber = new PhoneNumber(); $phoneNumber->personId = $personId; $phones = $phoneNumber->getPhoneNumbers(false); foreach ($phones as $phone) { if ($homePhone == '' && $phone['type'] == 'HP') { $homePhone = $phone['number']; } if ($businessPhone == '' && $phone['type'] == 'TE') { $businessPhone = $phone['number']; } if ($homePhone != '' && $businessPhone != '') { break; } } $patientData['homePhone'] = $homePhone; $patientData['businessPhone'] = $businessPhone; $patientData['language'] = $language; $patientData['maritalStatus'] = $maritalStatus; $patientData['accountNumber'] = ''; $patientData['ssn'] = $patient->person->identifierType == 'SSN' ? $patient->identifier : ''; if (!$includeProvider) { return $patientData; } $data = array(); $data['patient'] = $patientData; if ($providerId === null) { $providerId = (int) $patient->defaultProvider; } $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $provider->populate(); $providerData = array(); $providerData['id'] = $provider->personId; $providerData['lastName'] = $provider->person->lastName; $providerData['firstName'] = $provider->person->firstName; $providerData['middleName'] = $provider->person->middleName; $providerData['suffix'] = $provider->person->suffix; $room = new Room(); if ($roomId !== null && $roomId > 0) { $room->roomId = (int) $roomId; $room->populate(); $building = $room->building; $practice = $building->practice; //trigger_error('room: '.$roomId.':'.$room->name); } else { $practice = new Practice(); $building = new Building(); $practiceId = (int) $patient->person->primaryPracticeId; $practice->practiceId = $practiceId; $practice->populate(); //trigger_error('primary practice: '.$practiceId.':'.$practice->name); } $providerData['practice'] = $practice->name; $providerData['building'] = $building->name; $providerData['room'] = $room->name; $data['provider'] = $providerData; return $data; }
function radioRelay_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'radioRelay') { if (!$myUser) { throw new Exception('Vous devez être connecté pour effectuer cette action'); } $radioRelayManager = new RadioRelay(); $radioRelays = $radioRelayManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); $selected = new RadioRelay(); $selected->pulse = 0; $selected->icon = 'fa fa-flash'; //Si on est en mode modification if (isset($_['id'])) { $selected = $radioRelayManager->getById($_['id']); } $icons = array('fa fa-lightbulb-o', 'fa fa-power-off', 'fa fa-flash', 'fa fa-gears', 'fa fa-align-justify', 'fa fa-adjust', 'fa fa-arrow-circle-o-right', 'fa fa-desktop', 'fa fa-music', 'fa fa-bell-o', 'fa fa-beer', 'fa fa-bullseye', 'fa fa-automobile', 'fa fa-book', 'fa fa-bomb', 'fa fa-clock-o', 'fa fa-cutlery', 'fa fa-microphone', 'fa fa-tint'); ?> <div class="span9 userBloc"> <h1>Relais</h1> <p>Gestion des relais radios</p> <fieldset> <legend>Ajouter/Modifier un relais radio</legend> <div class="left"> <label for="nameRadioRelay">Nom</label> <input type="hidden" id="id" value="<?php echo $selected->id; ?> "> <input type="text" id="nameRadioRelay" value="<?php echo $selected->name; ?> " placeholder="Lumiere Canapé…"/> <label for="descriptionRadioRelay">Description</label> <input type="text" value="<?php echo $selected->description; ?> " id="descriptionRadioRelay" placeholder="Relais sous le canapé…" /> <label for="iconRadioRelay">Icone</label> <input type="hidden" value="<?php echo $selected->icon; ?> " id="iconRadioRelay" /> <div> <div style='margin:5px;'> <?php foreach ($icons as $i => $icon) { if ($i % 6 == 0) { echo '</div><div style="margin:5px;">'; } ?> <i style="width:25px;" onclick="plugin_radiorelay_set_icon(this,'<?php echo $icon; ?> ');" class="<?php echo $icon; ?> btn <?php echo $selected->icon == $icon ? 'btn-success' : ''; ?> "></i> <?php } ?> </div> </div> <label for="radioCodeRadioRelay">Code radio</label> <input type="text" value="<?php echo $selected->radiocode; ?> " name="radioCodeRadioRelay" id="radioCodeRadioRelay" placeholder="1234,1111,0022..." /> <label for="onRadioRelay">Commande vocale "ON" associée</label> <?php echo $conf->get('VOCAL_ENTITY_NAME'); ?> , <input type="text" id="onRadioRelay" value="<?php echo $selected->onCommand; ?> " placeholder="Allume la lumière, Ouvre le volet…"/> <label for="offRadioRelay">Commande vocale "OFF" associée</label> <?php echo $conf->get('VOCAL_ENTITY_NAME'); ?> , <input type="text" id="offRadioRelay" value="<?php echo $selected->offCommand; ?> " placeholder="Eteinds la lumière, Ferme le volet…"/> <label for="roomRadioRelay">Pièce de la maison</label> <select id="roomRadioRelay"> <?php foreach ($rooms as $room) { ?> <option <?php if ($selected->room == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> <label for="pinRadioRelay">Mode impulsion (micro secondes)</label> <input type="number" value="<?php echo $selected->pulse; ?> " id="pulseRadioRelay" placeholder="0" /> <small>laisser à zéro pour désactiver le mode impulsion</small> </div> <div class="clear"></div> <br/><button onclick="plugin_radiorelay_save(this)" class="btn">Enregistrer</button> </fieldset> <br/> <fieldset> <legend>Consulter les relais radios existants</legend> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th>Code</th> <th>Pièce</th> <th colspan="2">Impulsion</th> </tr> </thead> <?php foreach ($radioRelays as $radioRelay) { $room = $roomManager->load(array('id' => $radioRelay->room)); ?> <tr> <td><?php echo $radioRelay->name; ?> </td> <td><?php echo $radioRelay->description; ?> </td> <td><?php echo $radioRelay->radiocode; ?> </td> <td><?php echo $room->getName(); ?> </td> <td><?php echo $radioRelay->pulse; ?> </td> <td> <a class="btn" href="setting.php?section=radioRelay&id=<?php echo $radioRelay->id; ?> "><i class="fa fa-pencil"></i></a> <div class="btn" onclick="plugin_radiorelay_delete(<?php echo $radioRelay->id; ?> ,this);"><i class="fa fa-times"></i></div> </td> </td> </tr> <?php } ?> </table> </fieldset> </div> <?php } }
public function getScheduleDataAction() { $dateStart = date('Y-m-d', strtotime($this->_getParam('dateStart'))); $dateEnd = date('Y-m-d', strtotime($this->_getParam('dateEnd'))); $providerId = (int) $this->_getParam('providerId'); $roomId = (int) $this->_getParam('roomId'); $data = array(); $start = $dateStart . ' 00:00:00'; $end = $dateEnd . ' 23:59:59'; $numberOfEvents = ScheduleEvent::getNumberOfEvents($providerId, $roomId, $start, $end); $data['numberOfEvents'] = $numberOfEvents; $title = ''; if ($providerId > 0) { $person = new Person(); $person->personId = $providerId; $person->populate(); $title .= $person->lastName . ', ' . $person->firstName . ', ' . $person->suffix; } else { if ($roomId > 0) { $room = new Room(); $room->roomId = $roomId; $room->populate(); $title .= $room->building->practice->name . '->' . $room->building->name . '->' . $room->name; } } $data['title'] = $title; $data['dateStart'] = date('m/d/Y', strtotime($dateStart)); $data['dateEnd'] = date('m/d/Y', strtotime($dateEnd)); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
function room_plugin_setting_page() { global $myUser, $_; if (isset($_['section']) && $_['section'] == 'room') { if ($myUser != false) { $roomManager = new Room(); $rooms = $roomManager->populate(); //Gestion des modifications if (isset($_['id'])) { $id_mod = $_['id']; $selected = $roomManager->getById($id_mod); $description = $selected->GetName(); $button = "Modifier"; } else { $description = "Ajout d'une pièce"; $button = "Ajouter"; } ?> <div class="span9 userBloc"> <h1>Pièces</h1> <p>Gestion des pièces</p> <form action="action.php?action=room_add_room" method="POST"> <fieldset> <legend><?php echo $description; ?> </legend> <div class="left"> <label for="nameRoom">Nom</label> <?php if (isset($selected)) { echo '<input type="hidden" name="id" value="' . $id_mod . '">'; } ?> <input type="text" value="<?php if (isset($selected)) { echo $selected->getName(); } ?> " id="nameRoom" name="nameRoom" placeholder="Cuisine,salon…"/> <label for="descriptionRoom">Description</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getDescription(); } ?> " name="descriptionRoom" id="descriptionRoom" /> </div> <div class="clear"></div> <br/><button type="submit" class="btn"><?php echo $button; ?> </button> </fieldset> <br/> </form> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Nom</th> <th>Description</th> <th></th> </tr> </thead> <?php foreach ($rooms as $room) { ?> <tr> <td><?php echo $room->getName(); ?> </td> <td><?php echo $room->getDescription(); ?> </td> <td><a class="btn" href="action.php?action=room_delete_room&id=<?php echo $room->getId(); ?> "><i class="fa fa-times"></i></a> <a class="btn" href="setting.php?section=room&id=<?php echo $room->getId(); ?> "><i class="fa fa-pencil"></i></a></td> </tr> <?php } ?> </table> </div> <?php } else { ?> <div id="main" class="wrapper clearfix"> <article> <h3>Vous devez être connecté</h3> </article> </div> <?php } } }
public function setFilters(array $filters) { if (!is_array($filters) || empty($filters)) { throw new Exception(__('Invalid filters')); } $filtersArray = array(); foreach ($filters as $filter) { if (!class_exists($filter)) { $msg = __("Filter {$filter} does not exists"); throw new Exception($msg); } $class = new $filter(); if (!$class instanceof WebVista_Model_ORM) { $msg = __("Filter {$filter} is not an instance of WebVista_Model_ORM"); throw new Exception($msg); } $filtersArray[$filter] = $filter; } $this->_rows = array(); $enumeration = new Enumeration(); $enumeration->populateByUniqueName(self::ENUM_NAME); $enumerationClosure = new EnumerationClosure(); if (isset($filtersArray['Practice'])) { $practices = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1); foreach ($practices as $enumPractice) { if (!$enumPractice->ormId > 0 || $enumPractice->ormClass != 'Practice') { continue; } $practice = new Practice(); $practice->practiceId = $enumPractice->ormId; $practice->populate(); if (isset($filtersArray['Building'])) { $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1); foreach ($buildings as $enumBuilding) { if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') { continue; } $building = new Building(); $building->buildingId = $enumBuilding->ormId; $building->populate(); if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = array('Practice' => $practice, 'Building' => $building, 'Room' => $room); } } else { $this->_rows[] = array('Practice' => $practice, 'Building' => $building); } } } else { $this->_rows[] = $practice; } } } else { if (isset($filtersArray['Building'])) { $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1); foreach ($buildings as $enumBuilding) { if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') { continue; } $building = new Building(); $building->buildingId = $enumBuilding->ormId; $building->populate(); if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = array('Building' => $building, 'Room' => $room); } } else { $this->_rows[] = $building; } } } else { if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = $room; } } } } return $this; }
public function editRoomAction() { $id = (int) $this->_getParam('id'); $enumerationId = (int) $this->_getParam('enumerationId'); $enumerationsClosure = new EnumerationsClosure(); $parentId = $enumerationsClosure->getParentById($enumerationId); $enumeration = new Enumeration(); $enumeration->enumerationId = $parentId; $enumeration->populate(); $orm = new Room(); if ($id > 0) { $orm->roomId = $id; $orm->populate(); } $orm->buildingId = $enumeration->ormId; $form = new WebVista_Form(array('name' => 'edit-room')); $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-room'); $form->loadORM($orm, 'Room'); $form->setWindow('windowEditRoomId'); $this->view->form = $form; $routingStations = LegacyEnum::getEnumArray('routing_stations'); $routingStations = array_merge(array('' => ''), $routingStations); $this->view->colors = Room::getColorList(); $this->view->routingStations = $routingStations; $this->view->enumerationId = $enumerationId; $this->render('edit-room'); }
function sensor_plugin_setting_page() { global $_, $myUser, $conf; if (isset($_['section']) && $_['section'] == 'sensor') { if ($myUser != false) { $sensorManager = new Sensor(); $sensors = $sensorManager->populate(); $roomManager = new Room(); $rooms = $roomManager->populate(); $typeManager = new SensorType(); $sensorTypes = $typeManager->populate(); //Si on est en mode modification if (isset($_['id'])) { $id_mod = $_['id']; $selected = $sensorManager->getById($id_mod); $description = $selected->GetName(); $button = "Modifier"; } else { $description = "Ajout d'un capteur"; $button = "Ajouter"; } ?> <div class="span9 userBloc"> <h1>Capteurs</h1> <p>Gestion des capteurs radio</p> <form action="action.php?action=sensor_add_sensor" method="POST"> <fieldset> <legend><?php echo $description; ?> </legend> <div class="left"> <label for="typeSensor">Type capteur</label> <select name="typeSensor" id="typeSensor"> <?php foreach ($sensorTypes as $sensorType) { if (isset($selected)) { $selected_type = $selected->getType(); } else { if (isset($_['type'])) { $selected_type = $_['type']; } else { $selected_type = null; } } ?> <option <?php if ($selected_type == $sensorType->getId()) { echo "selected"; } ?> value="<?php echo $sensorType->getId(); ?> "><?php echo $sensorType->getName(); ?> </option> <?php } ?> </select> <label for="nameSensor">Nom</label> <?php if (isset($selected)) { echo '<input type="hidden" name="id" value="' . $id_mod . '">'; } ?> <input type="text" id="nameSensor" value="<?php if (isset($selected)) { echo $selected->getName(); } ?> " onkeyup="$('#vocalCommand').html($(this).val());" name="nameSensor" placeholder="Capteur Température Salon"/> <small>Commande vocale associée : "<?php echo $conf->get('VOCAL_ENTITY_NAME'); ?> , donne <span id="vocalCommand"></span>"</small> <label for="descriptionSensor">Description</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getDescription(); } ?> " name="descriptionSensor" id="descriptionSensor" placeholder="Capteur dans le salon" /> <label for="radioCodeSensor">Code radio</label> <input type="text" value="<?php if (isset($selected)) { echo $selected->getRadioCode(); } ?> " name="radioCodeSensor" id="radioCodeSensor" placeholder="0,1,2…" /> <label for="roomSensor">Pièce</label> <select name="roomSensor" id="roomSensor"> <?php foreach ($rooms as $room) { if (isset($selected)) { $selected_room = $selected->getRoom(); } else { if (isset($_['room'])) { $selected_room = $_['room']; } else { $selected_room = null; } } ?> <option <?php if ($selected_room == $room->getId()) { echo "selected"; } ?> value="<?php echo $room->getId(); ?> "><?php echo $room->getName(); ?> </option> <?php } ?> </select> </div> <div class="clear"></div> <br/><button type="submit" class="btn"><?php echo $button; ?> </button> </fieldset> <br/> </form> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Type</th> <th>Nom</th> <th>Description</th> <th>Code radio</th> <th>Pièce</th> <th></th> </tr> </thead> <?php foreach ($sensors as $sensor) { $room = $roomManager->load(array('id' => $sensor->getRoom())); $typeSensor = $typeManager->load(array('id' => $sensor->getType())); ?> <tr> <td><?php echo $typeSensor->getName(); ?> </td> <td><?php echo $sensor->getName(); ?> </td> <td><?php echo $sensor->getDescription(); ?> </td> <td><?php echo $sensor->getRadioCode(); ?> </td> <td><?php echo $room->getName(); ?> </td> <td><a class="btn" href="action.php?action=sensor_delete_sensor&id=<?php echo $sensor->getId(); ?> "><i class="icon-remove"></i></a> <a class="btn" href="setting.php?section=sensor&id=<?php echo $sensor->getId(); ?> "><i class="icon-edit"></i></a></td> </tr> <?php } ?> </table> </div> <?php } else { ?> <div id="main" class="wrapper clearfix"> <article> <h3>Vous devez être connecté</h3> </article> </div> <?php } } }