id) : 0; $job = $jobid > 0 ? $this->getModule('job')->getJobById($jobid)->name : $params->name; $level = $params->level; $fileset = $params->fileset; $clientid = intval($params->clientid); $client = $this->getModule('client')->getClientById($clientid); $accurateJob = intval($params->accurate); $accurate = $accurateJob === 1 ? 'yes' : 'no'; if(!is_null($job)) { $isValidLevel = $this->getModule('misc')->isValidJobLevel($params->level); if($isValidLevel === true) { if(!is_null($fileset)) { if(!is_null($client)) { $joblevels = $this->getModule('misc')->getJobLevels(); $estimation = $this->getModule('bconsole')->bconsoleCommand($this->director, array('estimate', 'job="' . $job . '"', 'level="' . $joblevels[$level] . '"', 'fileset="' . $fileset. '"', 'client="' . $client->name . '"', 'accurate="' . $accurate . '"'), $this->user); $this->output = $estimation->output; $this->error = (integer)$estimation->exitcode; } else { $this->output = JobError::MSG_ERROR_CLIENTID_DOES_NOT_EXISTS; $this->error = JobError::ERROR_CLIENTID_DOES_NOT_EXISTS; } } else { $this->output = JobError::MSG_ERROR_FILESETID_DOES_NOT_EXISTS; $this->error = JobError::ERROR_FILESETID_DOES_NOT_EXISTS; } } else { $this->output = JobError::MSG_ERROR_INVALID_JOBLEVEL; $this->error = JobError::ERROR_INVALID_JOBLEVEL; } } else { $this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS; $this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS; } } } ?>