private function _putIdAction($path) { $xmlstr = $this->getPayload(); $xml_in = new SimpleXMLElement($xmlstr); $in_id = array_shift($path); if (empty($in_id)) { $this->_error("ID was not provided."); } if (null == ($event = DAO_WorkerEvent::get($in_id))) { $this->_error("ID not valid."); } $fields = array(); $flds = DAO_WorkerEvent::getFields(); unset($flds[DAO_WorkerEvent::ID]); foreach ($flds as $idx => $f) { $idx_name = $this->translate($idx, true); if ($idx_name == null) { continue; } @($value = DevblocksPlatform::importGPC($xml_in->{$idx_name}, 'string')); if ($this->isValid($idx_name, $value)) { $fields[$idx] = $value; } } if (!empty($fields)) { DAO_WorkerEvent::update($event->id, $fields); } $this->_getIdAction(array($event->id)); }
/** * Open an event, mark it read, and redirect to its URL. * Used by Home->Notifications view. * */ function redirectReadAction() { $worker = PortSensorApplication::getActiveWorker(); $request = DevblocksPlatform::getHttpRequest(); $stack = $request->path; array_shift($stack); // home array_shift($stack); // redirectReadAction @($id = array_shift($stack)); // id if (null != ($event = DAO_WorkerEvent::get($id))) { // Mark as read before we redirect DAO_WorkerEvent::update($id, array(DAO_WorkerEvent::IS_READ => 1)); DAO_WorkerEvent::clearCountCache($worker->id); session_write_close(); header("Location: " . $event->url); } exit; }