public function frameResponse(\FrameResponseObject $frameResponseObject) { $tpl = new \Worksheet\Template($this->id); $tpl->loadEditor(); $tpl->assign("BLOCK_ID", $this->blockId); $worksheet = new \Worksheet\Worksheet($this->id); $worksheet->validateRole("build"); /* get current block object */ $block = new \Worksheet\Block($this->blockId); if (!isset($_POST['name'])) { $tpl->assign("content", $block->getBuildEditHtml()); $name = \Worksheet\Helper::htmlentitiesDeep($block->getName()); $tpl->assign("name", $name); $tpl->display("EditBlock.template.html"); } else { $block->saveBuildEdit($_POST); $_SESSION["confirmation"] = "Die Aufgabe wurde gespeichert."; header("Location: " . PATH_URL . "worksheet/Build/" . $this->id); } /* template output */ $tpl->parse($frameResponseObject); /* page title */ $frameResponseObject->setTitle("Aufgabe bearbeiten"); $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Build/" . $this->id), array("name" => "Aufgabe bearbeiten"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $tpl = new \Worksheet\Template($this->id); $tpl->loadEditor(); $worksheet = new \Worksheet\Worksheet($this->id); $worksheet->validateRole("build"); if (!isset($_POST['delete'])) { $block = new \Worksheet\Block($this->blockId); $tpl->assign("name", $block->getName()); $tpl->assign("BLOCK_ID", $this->blockId); $tpl->display("DeleteBlock.template.html"); } else { /* delete block */ $worksheet->deleteBlock($this->blockId); $_SESSION["confirmation"] = "Die Aufgabe wurde gelöscht."; header("Location: " . PATH_URL . "worksheet/Build/" . $this->id); } /* template output */ $tpl->parse($frameResponseObject); /* page title */ $frameResponseObject->setTitle("Aufgabe löschen"); $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Build/" . $this->id), array("name" => "Aufgabe löschen"))); return $frameResponseObject; }