. */ /** * Barcode Service */ require_once(FILESYSTEMROOTPATH."/jc/include/dao/BarcodeDao.php"); class BarcodeService { private $BarcodeDao; /** * Default constructor * * @param BarcodeDao */ public function __construct(BarcodeDao $BarcodeDao) { $this->BarcodeDao = $BarcodeDao; } /** * Load a sentence by id * * @param string id of the sentence to be loaded * @return a sentence as array */ public function scan($participantId) { if( $this->BarcodeDao->safeToScan() ){ $time = $this->BarcodeDao->loadCurrent($participantId); if( $time == NULL ){ $name = $this->BarcodeDao->loadName($participantId); if( $name == NULL ) { $message = "ERR111: Participant ".$participantId." not found in the database!
If you are a delegate of an antenna, come in and talk to the Chair! Next please!
If you are an envoy of a contact antenna, come in and talk to the Chair! Next please!
If you are not in the above categories, please pass from the entrances for the visitors in the future! Next please!"; }else{ $this->BarcodeDao->enterCurrent($participantId, date("Y-m-d H:i:s")); $message = "

".$name." entered

"; } }else{ $info = $this->BarcodeDao->loadInfo($participantId);//get participant name & uid if( ( $info['name'] == NULL ) OR ( $info['uid'] == NULL )) { $message = "ERR122: Participant ".$participantId." not found in the database!
If you are a delegate of an antenna, talk to the Chair! Next please!
If you are an envoy of a contact antenna, talk to the Chair! Next please!
If you are not in the above categories, please pass from the entrances for the visitors in the future! Next please!"; }else{ $this->BarcodeDao->deleteCurrent($participantId); $this->BarcodeDao->registerPresence( $info['uid'], $time, date("Y-m-d H:i:s") ); $message = "

".$info['name']." exited

"; } } }else{ $message = "ERR133: The previous plenary is still open! Please ask the Chair to close the previous plenary!
Keep people out of the plenary room. They will enter as soon as the Chair does its magic!"; } return $message; } public function setScannerPassword($pass){ return $this->BarcodeDao->setScannerPassword( $pass ); } /** * Load a sentence by id * * @param string id of the sentence to be loaded * @return a sentence as array */ public function CloseOpenSessions($exit) { if( ! $this->BarcodeDao->closeOpenSessions( $exit ) ) return false; if( ! $this->BarcodeDao->emptyCurrentAttendance() ) return false; return true; } } ?>