public function getDashboardItemData()
 {
     $data = array();
     $emp = new Employee();
     $data['numberOfEmployees'] = $emp->Count("1 = 1");
     return $data;
 }
 public function getInitData($req)
 {
     $data = array();
     $employees = new Employee();
     $data['numberOfEmployees'] = $employees->Count("1 = 1");
     $company = new CompanyStructure();
     $data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
     $user = new User();
     $data['numberOfUsers'] = $user->Count("1 = 1");
     $project = new Project();
     $data['numberOfProjects'] = $project->Count("status = 'Active'");
     $attendance = new Attendance();
     $data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     if (empty($data['numberOfAttendanceLastWeek'])) {
         $data['numberOfAttendanceLastWeek'] = 0;
     }
     $empLeave = new EmployeeLeave();
     $data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
     $timeEntry = new EmployeeTimeEntry();
     $data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     $candidate = new Candidate();
     $data['numberOfCandidates'] = $candidate->Count("1 = 1");
     $job = new Job();
     $data['numberOfJobs'] = $job->Count("status = 'Active'");
     $course = new Course();
     $data['numberOfCourses'] = $course->Count("1 = 1");
     return new IceResponse(IceResponse::SUCCESS, $data);
 }
 public function deleteProfileImage($req)
 {
     $profileId = $this->getCurrentProfileId();
     $subordinate = new Employee();
     $subordinatesCount = $subordinate->Count("supervisor = ? and id = ?", array($profileId, $req->id));
     if ($this->user->user_level == 'Admin' || $this->user->employee == $req->id || $subordinatesCount == 1) {
         $fs = FileService::getInstance();
         $res = $fs->deleteProfileImage($req->id);
         return new IceResponse(IceResponse::SUCCESS, $res);
     }
     return new IceResponse(IceResponse::ERROR, "Not allowed to delete profile image");
 }
 public function getInitData($req)
 {
     $data = array();
     $emp = new Employee();
     $data['numberOfEmployees'] = $emp->Count("status = 'Active' and supervisor = ?", array($this->getCurrentProfileId()));
     $data['lastTimeSheetHours'] = $this->getLastTimeSheetHours($req)->getData();
     $data['activeProjects'] = $this->getEmployeeActiveProjects($req)->getData();
     $data['pendingLeaves'] = $this->getPendingLeaves($req)->getData();
     $candidate = new Candidate();
     $data['numberOfCandidates'] = $candidate->Count("1 = 1");
     $job = new Job();
     $data['numberOfJobs'] = $job->Count("status = 'Active'");
     $attendance = new Attendance();
     $data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     $course = new Course();
     $data['numberOfCourses'] = $course->Count("1 = 1");
     return new IceResponse(IceResponse::SUCCESS, $data);
 }