本文整理汇总了PHP中app\models\Client::wherein方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::wherein方法的具体用法?PHP Client::wherein怎么用?PHP Client::wherein使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Client
的用法示例。
在下文中一共展示了Client::wherein方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clients
public function clients($client = null)
{
$start = Input::get('start', Date::now()->sub('1 day'));
$end = Input::get('end', Date::now());
$clientselected = Input::get('Client', $client);
$client = Client::where('clientid', '=', $clientselected)->first();
$user = Sentry::getUser();
// Get Clients to fill the Client Select Box And Select Values From Permissions
$permissions = Userspermissions::where('id', '=', $user->id)->remember(10)->first();
if ($permissions !== null) {
$permissions = unserialize($permissions->clients);
$clients = Client::wherein('clientid', $permissions)->remember(10)->get();
$clientSelectBox = Client::clientSelectBox($clients->toArray());
} else {
$clientSelectBox = Client::clientSelectBox();
}
///// End Permissions
if ($client == Null) {
$platform = "";
$fileretension = "";
$jobretension = "";
$autoprune = "";
$terminatedJobs = "0";
$cancelJobs = "0";
$runningJobs = "0";
$wattingJobs = "0";
$errorJobs = "0";
// Indicates Failed and Okay Jobs
$nTransBytes = "0";
$nTransFiles = "0";
$graphOkJob = "0";
$graphFailedJob = "0";
} else {
$platform = $client->Uname;
$autoprune = $client->AutoPrune;
/* Calculate the Retension Period */
$to = Date::now();
$text = " Days";
/* 86400 -> equal to seconds in i day*/
$fileretension = $client->fileretention / 86400 . $text;
if ($fileretension >= 365) {
$type = ' Year';
$fileretension = intval($fileretension / 31536000) . $type;
}
/* 86400 -> equal to seconds in i day*/
$jobretension = $client->jobretention / 86400 . $text;
if ($jobretension >= 365) {
$type = ' Year';
$jobretension = intval($jobretension / 31536000) . $type;
}
/* Get Terminated Jobs */
$tjobs = Job::where('jobstatus', '=', 'T')->where('starttime', '>=', $start)->where('endtime', '<=', $end)->where('clientid', '=', $client->clientid)->remember(10)->get();
// Number Terminate Jobs
$terminatedJobs = count($tjobs);
/* Get Canceled Jobs */
$canceledJobs = Job::where('jobstatus', '=', 'A')->where('starttime', '>=', $start)->where('endtime', '<=', $end)->where('clientid', '=', $client->ClientId)->remember(10)->get();
// Number Terminate Jobs
$cancelJobs = count($canceledJobs);
/* Get Canceled Jobs */
$canceledJobs = Job::where('jobstatus', '=', 'A')->where('starttime', '>=', $start)->where('endtime', '<=', $end)->where('clientid', '=', $client->ClientId)->remember(10)->get();
// Number Terminate Jobs
$cancelJobs = count($canceledJobs);
/* Get Running Jobs */
$runJobs = Job::where('jobstatus', '=', 'R')->where('starttime', '>=', $start)->where('endtime', '<=', $end)->where('clientid', '=', $client->ClientId)->remember(10)->get();
// Number Running Jobs
$runningJobs = count($runJobs);
/* Get Watting Jobs */
$wateJobs = Job::wherein('jobstatus', array('c', 'F', 'j', 'M', 'm', 'p', 's', 't'))->where('endtime', '<=', $end)->where('starttime', '>=', $start)->where('clientid', '=', $client->ClientId)->remember(10)->get();
// Number Watting Jobs
$wattingJobs = count($wateJobs);
/* Get Error Jobs */
$errJobs = Job::wherein('jobstatus', array('e', 'f', 'E'))->where('starttime', '>=', $start)->where('endtime', '<=', $end)->where('clientid', '=', $client->ClientId)->remember(10)->get();
// Number Error Jobs
$errorJobs = count($errJobs);
$nTransBytes = 0;
$nTransFiles = 0;
$terminatedJobs = count($tjobs);
/* Calculate Jobs and Bytes */
$tjobs = $tjobs->toArray();
$nTransFiles = array_sum(array_fetch($tjobs, 'jobfiles'));
$nTransBytes = array_sum(array_fetch($tjobs, 'jobbytes'));
// Value for The Graphs
$graphOkJob = $terminatedJobs != 0 ? $terminatedJobs / ($terminatedJobs + $errorJobs) * 100 : 0;
$graphFailedJob = $errorJobs != 0 ? $errorJobs / ($errorJobs + $terminatedJobs) * 100 : 0;
$nTransFiles = preg_replace("/(?<=\\d)(?=(\\d{3})+(?!\\d))/", ",", $nTransFiles);
$nTransBytes = $this->byte_format($nTransBytes);
}
/* Draws Files Graph */
$graphFiles = DB::table($this->tables['job'])->where('clientid', '=', $clientselected)->where('starttime', '>=', $start)->where('endtime', '<=', $end)->orderby('starttime', 'asc')->remember(10)->get(array(DB::raw('date(' . $this->tables['job'] . '.starttime) as date'), DB::raw('jobfiles as files')));
$graphFiles = json_encode((array) $graphFiles);
/* Draws Bytes Graph */
$graphBytes = DB::table($this->tables['job'])->where('clientid', '=', $clientselected)->where('starttime', '>=', $start)->where('endtime', '<=', $end)->orderby('starttime', 'asc')->remember(10)->get(array(DB::raw('date(' . $this->tables['job'] . '.starttime) as date'), DB::raw('jobbytes as bytes')));
$graphBytes = json_encode((array) $graphBytes);
Former::populate(array('date' => $start . ' - ' . $end), array('Client' => $clientselected));
return View::make('clients', array('terminatedJobs' => $terminatedJobs, 'nTransFiles' => $nTransFiles, 'cancelJobs' => $cancelJobs, 'runningJobs' => $runningJobs, 'wattingJobs' => $wattingJobs, 'errorJobs' => $errorJobs, 'nTransBytes' => $nTransBytes, 'start' => $start, 'end' => $end, 'type' => 'terminated', 'clientSelected' => $clientselected, 'graphOkJob' => $graphOkJob, 'graphFailedJob' => $graphFailedJob, 'platform' => $platform, 'fileretension' => $fileretension, 'jobretension' => $jobretension, 'autoprune' => $autoprune, 'clientSelectBox' => $clientSelectBox, 'graphFiles' => $graphFiles, 'graphBytes' => $graphBytes));
}