/** * Update a slice. @see Hermes_Slice::readForm() for the data expeted in * the posted form. * * @return array The new slice data. */ public function updateSlice() { $slice = new Hermes_Slice(); $slice->readForm(); try { $GLOBALS['injector']->getInstance('Hermes_Driver')->updateTime(array($slice)); if ($slice['employee'] == $GLOBALS['registry']->getAuth()) { $GLOBALS['notification']->push(_("Your time was successfully updated."), 'horde.success'); } else { $GLOBALS['notification']->push(sprintf(_("The time was successfully updated and saved to the time sheet of %s."), $slice['employee']), 'horde.success'); } $new = current($GLOBALS['injector']->getInstance('Hermes_Driver')->getHours(array('id' => $slice['id']))); Hermes::updateCostObject($new); return $new->toJson(); } catch (Hermes_Exception $e) { $GLOBALS['notification']->push($e, 'horde.error'); } }