function render() { $estimate = $this->object->tracking()->getEstimate(); if ($estimate instanceof Estimate) { $estimate_value = $estimate->getValue(); $estimate_autogenerated = $this->object->tracking()->isEstimateAutogenerated(); } else { $estimate_value = 0; $estimate_autogenerated = false; } // if $settings = array('value' => $estimate_value, 'summed_time' => $this->object->tracking()->sumTime(Authentication::getLoggedUser()), 'estimate_autogenerated' => $estimate_autogenerated, 'short_format' => true, 'can_change' => $this->object->tracking()->canEstimate(Authentication::getLoggedUser()), 'estimates_url' => $this->object->tracking()->getEstimatesUrl(), 'set_estimate_url' => $this->object->tracking()->getSetEstimateUrl(), 'object_id' => $this->object->getId()); return '(function (field, object, client_interface) { App.Inspector.Properties.MilestoneEstimation.apply(field, [object, ' . JSON::encode($settings) . ']); })'; }
/** * Return array or property => value pairs that describes this object * * @param IUser $user * @param boolean $detailed * @return array */ function describeForApi(IUser $user, $detailed = false) { $mil_t = new Milestone($this->getId()); $result = $mil_t->describeForApi($user, $detailed, $for_interface); // In this exact order, it's important! $result = array_merge(parent::describeForApi($user, $detailed, $for_interface), $result); $result['id'] = $this->getId(); if ($detailed) { $result['custom_percent_complete'] = $this->getPercentsDone(false); $result['remaining_time'] = $this->getRemainingTime(); $result['summed_time'] = $this->tracking()->sumTime(Authentication::getLoggedUser()); } return $result; }