Esempio n. 1
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("build");
     $tplBlocks = array();
     /* get all blocks for this worksheet */
     $blocks = $worksheet->getBlocks();
     foreach ($blocks as $block) {
         $tplBlocks[] = array("id" => $block->getId(), "name" => $block->getName(), "content" => $block->getBuildViewHtml(), "type" => $block->getType(), "order" => $block->getOrder());
     }
     if (count($blocks) == 0) {
         $tplBlocks = false;
     }
     $tpl->assign("blocks", $tplBlocks);
     $tpl->display("Build.template.html");
     /* action bar */
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Eine Aufgabe hinzufügen", "link" => PATH_URL . "worksheet/AddBlock/" . $this->id), array("name" => "Arbeitsblatt veröffentlichen", "link" => PATH_URL . "worksheet/Deploy/" . $this->id)));
     $frameResponseObject->addWidget($actionBar);
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Build/" . $this->id)));
     return $frameResponseObject;
 }
Esempio n. 2
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("edit");
     $worksheet->validateStatus(2);
     $tplBlocks = array();
     /* get all blocks for this worksheet */
     $blocks = $worksheet->getBlocks();
     foreach ($blocks as $block) {
         $tplBlocks[] = array("id" => $block->getId(), "name" => $block->getName(), "content" => $block->getCorrectHtml(), "type" => $block->getType(), "order" => $block->getOrder());
     }
     if (count($blocks) == 0) {
         $tplBlocks = false;
     }
     $tpl->assign("blocks", $tplBlocks);
     $tpl->display("Correct.template.html");
     $sourceWorksheet = new \Worksheet\Worksheet($this->source);
     /* action bar */
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Arbeitsblatt zurückgeben", "link" => "javascript: worksheet_finish('" . $this->source . "')"), array("name" => "Speichern", "link" => "javascript: worksheet_save()")));
     $frameResponseObject->addWidget($actionBar);
     /* template output */
     $tpl->parse($frameResponseObject);
     /* action bar */
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Arbeitsblatt zurückgeben", "link" => "javascript: worksheet_finish('" . $this->source . "')"), array("name" => "Speichern", "link" => "javascript: worksheet_save()")));
     $frameResponseObject->addWidget($actionBar);
     /* 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;
 }
Esempio n. 3
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("view");
     $tplBlocks = array();
     /* get all blocks for this worksheet */
     $blocks = $worksheet->getBlocks();
     foreach ($blocks as $block) {
         $tplBlocks[] = array("id" => $block->getId(), "name" => $block->getName(), "content" => $block->getViewHtml(), "type" => $block->getType(), "order" => $block->getOrder());
     }
     if (count($blocks) == 0) {
         $tplBlocks = false;
     }
     $tpl->assign("blocks", $tplBlocks);
     $tpl->display("View.template.html");
     /* action bar */
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Arbeitsblätter korrigieren", "link" => PATH_URL . "worksheet/CopyList/" . $this->id), array("name" => "Arbeitsblatt ausfüllen", "link" => PATH_URL . "worksheet/StartEdit/" . $this->id)));
     $frameResponseObject->addWidget($actionBar);
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/View/" . $this->id)));
     return $frameResponseObject;
 }
Esempio n. 4
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("view");
     $newWorksheet = $worksheet->startEdit();
     header("Location: " . PATH_URL . "worksheet/Edit/" . $newWorksheet->getId());
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Edit/" . $this->id)));
     return $frameResponseObject;
 }
Esempio n. 5
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;
 }
Esempio n. 6
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("edit");
     if (!isset($_POST['confirm'])) {
         $tpl->display("Finish.template.html");
     } else {
         $worksheet->finish();
         $_SESSION["confirmation"] = "Das Arbeitsblatt wurde abgegeben.";
         header("Location: " . PATH_URL . "worksheet/Edit/" . $worksheet->getId());
     }
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Edit/" . $this->id), array("name" => "Arbeitsblatt abgeben")));
     return $frameResponseObject;
 }
Esempio n. 7
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $sourceWorksheet = new \Worksheet\Worksheet($this->source);
     $worksheet->validateRole("edit");
     if (!isset($_POST['confirm'])) {
         $tpl->assign("SOURCE_ID", $this->source);
         $tpl->display("CorrectFinish.template.html");
     } else {
         $worksheet->correctionFinish(isset($_POST['lock']) and $_POST['lock'] == "1");
         $_SESSION["confirmation"] = "Das Arbeitsblatt wurde zurückgegeben.";
         header("Location: " . PATH_URL . "worksheet/CopyList/" . $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(), "link" => PATH_URL . "worksheet/Correct/" . $this->id . "/" . $this->source), array("name" => "Arbeitsblatt zurückgeben")));
     return $frameResponseObject;
 }
Esempio n. 8
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("view");
     $tplData = array();
     $copies = $worksheet->getEditCopiesList();
     if ($copies) {
         foreach ($copies as $copy) {
             $usrObj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $copy['user']);
             $maxScore = $copy['worksheet']->getMaxScore();
             if ($maxScore === false) {
                 $score = false;
             } else {
                 if ($copy['worksheet']->getMaxScore() == 0) {
                     $p = false;
                 } else {
                     $p = round($copy['worksheet']->getScore() * 100 / $copy['worksheet']->getMaxScore(), 1);
                     if ($p < 0) {
                         $p = 0;
                     }
                 }
                 $score = array("score" => $copy['worksheet']->getScore(), "percent" => $p, "max" => $maxScore);
             }
             $picId = $usrObj->get_attribute("OBJ_ICON")->get_id();
             $img = PATH_URL . "download/image/" . $picId . "/40/60/";
             $tplData[] = array("user" => array("name" => $usrObj->get_name(), "fullname" => $usrObj->get_attribute(USER_FULLNAME), "firstname" => $usrObj->get_attribute(USER_FIRSTNAME), "id" => $copy['user'], "img" => $img), "worksheet" => array("id" => $copy['worksheet']->getId(), "name" => $copy['worksheet']->getName(), "status" => $copy['worksheet']->getStatus()), "score" => $score);
         }
     } else {
         $tplData = false;
     }
     $tpl->assign("data", $tplData);
     $tpl->display("CopyList.template.html");
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/View/" . $this->id), array("name" => "Arbeitsblätter korrigieren")));
     return $frameResponseObject;
 }
Esempio n. 9
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("build");
     if (!$this->blockType) {
         /* show blocktype selection */
         $blockTypes = \Worksheet\Block::getBlockTypes();
         $tpl->assign("blockTypes", $blockTypes);
         $tpl->display("AddBlock.template.html");
     } else {
         /* create new block of specified type */
         $block = $worksheet->createBlock($this->blockType);
         header("Location: " . PATH_URL . "worksheet/EditBlock/" . $this->id . "/" . $block->getId());
     }
     /* 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 hinzufügen")));
     return $frameResponseObject;
 }
Esempio n. 10
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $tpl = new \Worksheet\Template($this->id);
     $worksheet = new \Worksheet\Worksheet($this->id);
     $worksheet->validateRole("build");
     if (!isset($_POST['confirm'])) {
         $tpl->display("Deploy.template.html");
     } else {
         $newWorksheet = $worksheet->deploy();
         $_SESSION["confirmation"] = "Das Arbeitsblatt wurde veröffentlicht.";
         header("Location: " . PATH_URL . "worksheet/View/" . $newWorksheet->getId());
     }
     /* action bar */
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Eine Aufgabe hinzufügen", "link" => PATH_URL . "worksheet/AddBlock/" . $this->id), array("name" => "Arbeitsblatt verteilen", "link" => PATH_URL . "worksheet/Deploy/" . $this->id)));
     $frameResponseObject->addWidget($actionBar);
     /* template output */
     $tpl->parse($frameResponseObject);
     /* page title */
     $frameResponseObject->setTitle($worksheet->getName());
     $frameResponseObject->setHeadline(array(array("name" => $worksheet->getName(), "link" => PATH_URL . "worksheet/Edit/" . $this->id)));
     return $frameResponseObject;
 }
Esempio n. 11
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;
 }
Esempio n. 12
0
 public function getCorrectHtml()
 {
     $tpl = new \Worksheet\Template();
     $content = $this->getContent();
     $type = $this->getType();
     $solution = $this->getSolution();
     $correction = $this->getCorrection();
     if (file_exists(dirname(__FILE__) . "/../blocks/" . $type . "/correct.php")) {
         include dirname(__FILE__) . "/../blocks/" . $type . "/correct.php";
     }
     //temp:
     //$content['text'] = preg_replace('@\<\!\-\-\ Worksheet\_\[(.*)\]\[(.*)\]\[(.*)\]\ \-\-\>@isU', '<img src="http://192.168.124.134/bidowl-3_0/worksheet/asset/js/tinymce/plugins/WorksheetVideo/img/test.png" alt="" />', $content['text']);
     $tpl->assign("data", $content);
     $tpl->assign("correction", $correction);
     $tpl->assign("solution", $solution);
     $tpl->assign("old_solutions", $this->getOld_solutions());
     $tpl->assign("BLOCK_ID", $this->id);
     $tpl->display("../../blocks/" . $type . "/correct.html");
     return $tpl->getHtml();
 }