Ejemplo n.º 1
0
 public static function close()
 {
     $currentUserId = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId();
     $presence = new Presence();
     $presence->setUserId($currentUserId);
     $presenceManager = new PresenceManager();
     $presenceManager->close($presence);
 }
Ejemplo n.º 2
0
 public function deletePresence(Presence $presence)
 {
     try {
         $searchPresence = new Presence();
         $searchPresence->setUserId($presence->getUserId());
         $results = $this->dao->search($searchPresence);
         if (isset($results) && is_array($results) && count($results)) {
             $deletePresence = current($results);
             $this->dao->delete($deletePresence);
         }
     } catch (Exception $e) {
         throw new EyeDAOException('Unable to delete the Presence', 0, $e);
     }
 }
Ejemplo n.º 3
0
 public function destroy($id)
 {
     Presence::destroy($id);
     Session::flash('message', 'Sukses menghapus presensi');
 }
 public function testGetPresence()
 {
     $User = unserialize(file_get_contents('user1.dat'));
     $a = array('RequestMethod' => 'GetPresence', 'ID' => (string) $User->ID);
     $r = new HttpRequest($this->server_url, HttpRequest::METH_POST);
     $r->addPostFields($a);
     $r->send();
     $this->assertEquals(200, $r->getResponseCode());
     $Presence2 = Presence::fromOSD($r->GetResponseBody());
     file_put_contents('presence2.dat', serialize($Presence2));
 }
Ejemplo n.º 5
0
 /**
  * Notify to the System the user is disconnected
  *
  * @param Presence $presence
  */
 public function close(Presence $presence)
 {
     if (!isset($presence) || !$presence instanceof Presence) {
         throw new EyeInvalidArgumentException('Missing or invalid $presence');
     }
     //var_dump($presence->getUserId());
     $searchPresence = self::retrievePresencesByUsersId(array($presence->getUserId()));
     if ($searchPresence !== null && is_array($searchPresence) && count($searchPresence) == 1) {
         $searchPresence = current($searchPresence);
         // var_dump($searchPresence);
         $this->getProvider()->deletePresence($searchPresence);
         $this->notifyClosedPresence($searchPresence);
     }
 }
Ejemplo n.º 6
0
 private function countPermits($id, $month, $year)
 {
     $permits = $absents = $presents = Presence::whereHas('teach', function ($q) use($month, $year) {
         $q->where(DB::raw('month(course_date)'), '=', $month);
         $q->where(DB::raw('year(course_date)'), '=', $year);
     })->where('issue_id', '=', $id)->where('presence', '=', 0)->where('description', '=', 'Izin')->count();
     return $permits;
 }