public function POSTupdate($request) { $element = \Models\Graph::ID($_POST['src']); $document = $element->ownerDocument; $plot = $element->appendChild($document->createElement('plot')); $plot->setAttribute('t', implode(' ', $_POST['plot']['t'])); $plot->setAttribute('r', implode(' ', $_POST['plot']['r'])); $document->save(PATH . \Models\Graph::DB . '.xml'); return print_r($element->write(), true) . print_r($_POST, true); }
public static function ID($id) { if ($id === null) { return null; } if (!($element = Graph::instance()->storage->getElementById($id))) { throw new \InvalidArgumentException("{$id}... Doesn't ring a bell.", 1); } return $element; }