public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $data = json_decode($this->data); if (is_array($data)) { $worksheet = new \Worksheet\Worksheet($this->id); if ($worksheet->getStatus() == 1) { $blocks = $worksheet->getBlocks(); if ($blocks and count($blocks) > 0) { $i = 0; foreach ($blocks as $block) { $d = array(); foreach ($data[$i] as $key => $value) { $d[$key] = $value; } $block->setSolution($d); $i++; } } } } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml(""); $ajaxResponseObject->addWidget($rawHtml); $ajaxResponseObject->setStatus("ok"); return $ajaxResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $tpl = new \Worksheet\Template($this->id); $worksheet = new \Worksheet\Worksheet($this->id); $worksheet->validateRole("edit"); $tplBlocks = array(); /* get all blocks for this worksheet */ $blocks = $worksheet->getBlocks(); foreach ($blocks as $block) { $tplBlocks[] = array("id" => $block->getId(), "name" => $block->getName(), "type" => $block->getType(), "order" => $block->getOrder(), "content" => $block->getEditHtml($worksheet->getStatus())); } if (count($blocks) == 0) { $tplBlocks = false; } $tpl->assign("blocks", $tplBlocks); if ($worksheet->getStatus() > 1) { $tpl->display("EditLocked.template.html"); } else { $tpl->display("Edit.template.html"); } if ($worksheet->getStatus() == 1) { /* action bar */ $actionBar = new \Widgets\ActionBar(); $actionBar->setActions(array(array("name" => "Arbeitsblatt abgeben", "link" => "javascript: worksheet_finish()"), array("name" => "Speichern", "link" => "javascript: worksheet_save()"))); $frameResponseObject->addWidget($actionBar); } /* template output */ $tpl->parse($frameResponseObject); if ($worksheet->getStatus() == 1) { /* action bar */ $actionBar = new \Widgets\ActionBar(); $actionBar->setActions(array(array("name" => "Arbeitsblatt abgeben", "link" => "javascript: worksheet_finish()"), array("name" => "Speichern", "link" => "javascript: worksheet_save()"))); $frameResponseObject->addWidget($actionBar); } /* page title */ $frameResponseObject->setTitle($worksheet->getName()); $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Edit/" . $this->id))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $tpl = new \Worksheet\Template($this->id); $worksheet = new \Worksheet\Worksheet($this->id); $worksheet->validateRole("edit"); $tplBlocks = array(); /* get all blocks for this worksheet */ $blocks = $worksheet->getBlocks(); foreach ($blocks as $block) { $tplBlocks[] = array("id" => $block->getId(), "name" => $block->getName(), "type" => $block->getType(), "order" => $block->getOrder(), "content" => $block->getEditHtml($worksheet->getStatus())); } if (count($blocks) == 0) { $tplBlocks = false; } $tpl->assign("blocks", $tplBlocks); $tpl->display("TeacherView.template.html"); $sourceWorksheet = new \Worksheet\Worksheet($this->source); /* template output */ $tpl->parse($frameResponseObject); /* page title */ $frameResponseObject->setTitle($worksheet->getName()); $frameResponseObject->setHeadline(array(array("name" => $sourceWorksheet->getName(), "link" => PATH_URL . "worksheet/View/" . $this->source), array("name" => "Arbeitsblätter korrigieren", "link" => PATH_URL . "worksheet/CopyList/" . $this->source), array("name" => $worksheet->getName()))); return $frameResponseObject; }