예제 #1
0
파일: Job.php 프로젝트: acrixl/Reportula
 public static function jobSelectBox($jobsall = null)
 {
     // Code to resolve pgsql names
     $f_Name = 'Name';
     $f_JobID = 'JobId';
     if (Config::get('database.default') == 'pgsql') {
         $f_Name = strtolower($f_Name);
         $f_JobID = strtolower($f_JobID);
     }
     if ($jobsall == null) {
         $jobsall = Job::select($f_JobID, $f_Name)->distinct($f_Name)->orderBy($f_Name, 'asc')->get()->toArray();
     }
     $jobsName = array_fetch($jobsall, $f_Name);
     $jobsId = array_fetch($jobsall, $f_JobID);
     $jobsSelectBox = array_unique(array_combine($jobsId, $jobsName));
     natsort($jobsSelectBox);
     return $jobsSelectBox;
 }
예제 #2
0
 public function getclients()
 {
     $start = Input::get('start', Date::now()->format('date'));
     $end = Input::get('end', Date::now()->format('date'));
     $client = Client::where('clientid', '=', Input::get('Client'))->first();
     $tjobs = Job::select(array('jobid', 'name', 'starttime', 'endtime', 'level', 'jobbytes', 'jobfiles', 'jobstatus'))->where('clientid', '=', $client->clientid)->where('starttime', '>=', $start)->where('endtime', '<=', $end);
     switch (Input::get('type')) {
         case "terminated":
             $tjobs->where('jobstatus', '=', 'T');
             break;
         case "running":
             $tjobs->where('jobstatus', '=', 'R');
             break;
         case "watting":
             $tjobs->wherein('jobstatus', array('c', 'F', 'j', 'M', 'm', 'p', 's', 't'));
             break;
         case "error":
             $tjobs->wherein('jobstatus', array('e', 'f', 'E'));
             break;
         case "cancel":
             $tjobs->where('jobstatus', '=', 'A');
             break;
     }
     return Datatables::of($tjobs)->edit_column('name', '{{ link_to_route("jobs", $name ,array("Job" => $jobid)) }} ')->edit_column('jobid', '{{ link_to_route("jobs", $jobid ,array("Job" => $jobid)) }} ')->make();
 }
예제 #3
0
 public function getjobs()
 {
     $start = Input::get('start', Date::now()->sub('1 day'));
     $end = Input::get('end', Date::now());
     $jobselected = Job::select('name')->where('jobid', '=', Input::get('Job'))->get()->first()->name;
     $tjobs = Job::select(array($this->tables['media'] . '.mediaid', $this->tables['job'] . '.jobid', 'starttime', 'endtime', 'volumename', 'level', 'jobbytes', 'jobfiles', 'jobstatus'))->join($this->tables['jobmedia'], $this->tables['jobmedia'] . '.jobid', '=', $this->tables['job'] . '.jobid')->join($this->tables['media'], $this->tables['media'] . '.mediaid', '=', $this->tables['jobmedia'] . '.mediaid')->where('name', '=', $jobselected)->where('starttime', '>=', $start)->where('endtime', '<=', $end)->groupby($this->tables['job'] . '.jobid')->groupby($this->tables['job'] . '.name')->groupby($this->tables['job'] . '.starttime')->groupby($this->tables['job'] . '.endtime')->groupby($this->tables['media'] . '.volumename')->groupby($this->tables['media'] . '.mediaid')->groupby($this->tables['job'] . '.level')->groupby($this->tables['job'] . '.jobbytes')->groupby($this->tables['job'] . '.jobfiles')->groupby($this->tables['job'] . '.jobstatus')->remember(10);
     switch (Input::get('type')) {
         case "terminated":
             $tjobs->where('jobstatus', '=', 'T');
             break;
         case "running":
             $tjobs->where('jobstatus', '=', 'R');
             break;
         case "watting":
             $tjobs->wherein('jobstatus', array('c', 'F', 'j', 'M', 'm', 'p', 's', 't'));
             break;
         case "error":
             $tjobs->wherein('jobstatus', array('e', 'f', 'E'));
             break;
         case "cancel":
             $tjobs->where('jobstatus', '=', 'A');
             break;
     }
     return Datatables::of($tjobs)->edit_column('volumename', '{{ link_to_route("volumes", $volumename ,array("Volume" => $mediaid)) }} ')->edit_column('jobid', '{{ link_to_route("files", $jobid ,array("Files" => $jobid)) }} ')->remove_column('mediaid')->make();
 }
예제 #4
0
 public function getvolumes()
 {
     $tjobs = Job::select(array($this->tables['job'] . '.jobid', 'name', 'starttime', 'endtime', 'level', 'jobbytes', 'jobfiles', 'jobstatus'))->join($this->tables['jobmedia'], $this->tables['jobmedia'] . '.jobid', '=', $this->tables['job'] . '.jobid')->join($this->tables['media'], $this->tables['media'] . '.mediaid', '=', $this->tables['jobmedia'] . '.mediaid')->where($this->tables['media'] . '.mediaid', '=', Input::get('Volume'))->groupby($this->tables['job'] . '.jobid')->groupby('starttime')->groupby('endtime')->groupby('level')->groupby('jobbytes')->groupby('jobfiles')->groupby('jobstatus')->groupby('name')->groupby('volumename');
     return Datatables::of($tjobs)->edit_column('name', '{{ link_to_route("jobs", $name ,array("Job" => $jobid)) }} ')->edit_column('jobid', '{{ link_to_route("jobs", $jobid ,array("Job" => $jobid)) }} ')->make();
 }
예제 #5
0
 public function getjobs($data = null)
 {
     $date = new Date('last ' . Input::get('date'));
     $tjobs = Job::select(array('jobid', 'name', 'starttime', 'endtime', 'level', 'jobbytes', 'jobfiles', 'jobstatus'))->where('starttime', '>=', (string) $date);
     switch (Input::get('type')) {
         case 'terminated':
             $tjobs->where('jobstatus', '=', 'T');
             break;
         case 'running':
             $tjobs->where('jobstatus', '=', 'R');
             break;
         case 'waiting':
             $tjobs->wherein('jobstatus', array('c', 'F', 'j', 'M', 'm', 'p', 's', 't'));
             break;
         case 'error':
             $tjobs->wherein('jobstatus', array('e', 'f', 'E'));
             break;
         case 'cancel':
             $tjobs->where('jobstatus', '=', 'A');
             break;
     }
     // Group Permissions
     /* if ($this->group_permissions_jobs[0]<>'') {
             $tjobs->where_in('name', $this->group_permissions_jobs);
        }*/
     return Datatables::of($tjobs)->edit_column('name', '{{ link_to_route("jobs", $name ,array("Job" => $jobid)) }} ')->edit_column('jobid', '{{ link_to_route("files", $jobid ,array("Files" => $jobid)) }} ')->make();
 }