Example #1
0
 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;
 }
Example #2
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     /* get the sample text for a block identified by $this->id */
     $block = new \Worksheet\Block($this->id);
     $value = $block->getSampleText();
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($value);
     $ajaxResponseObject->addWidget($rawHtml);
     $ajaxResponseObject->setStatus("ok");
     return $ajaxResponseObject;
 }
Example #3
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $block = new \Worksheet\Block($this->id);
     $block->setSampleDisplayed();
     $value = "ok";
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($value);
     $ajaxResponseObject->addWidget($rawHtml);
     $ajaxResponseObject->setStatus("ok");
     return $ajaxResponseObject;
 }
Example #4
0
 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;
 }
Example #5
0
 public static function create($type, $steamObj)
 {
     if (!self::checkType($type)) {
         throw new \Exception("unknown block type");
     }
     $doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Neue Aufgabe", "", "text/html", $steamObj);
     $newBlock = new \Worksheet\Block($doc->get_id());
     $newBlock->setType($type);
     return $newBlock;
 }