コード例 #1
0
ファイル: Correct.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #2
0
ファイル: View.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #3
0
ファイル: SaveBlockOrder.class.php プロジェクト: rolwi/koala
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $order = json_decode($this->order);
     if (is_array($order)) {
         $worksheet = new \Worksheet\Worksheet($this->id);
         $blocks = $worksheet->getBlocks();
         if ($blocks and count($blocks) > 0) {
             foreach ($blocks as $block) {
                 /* get position of current block in posted order */
                 $key = array_search($block->getId(), $order);
                 if ($key !== false) {
                     /* use the found key for order attribute */
                     $block->setOrder($key);
                 } else {
                     /* current blocks id was not found in posted order */
                     $block->setOrder(-1);
                 }
             }
         }
     }
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml("");
     $ajaxResponseObject->addWidget($rawHtml);
     $ajaxResponseObject->setStatus("ok");
     return $ajaxResponseObject;
 }
コード例 #4
0
ファイル: SaveSolution.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #5
0
ファイル: Build.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #6
0
ファイル: EditBlock.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #7
0
ファイル: StartEdit.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #8
0
ファイル: Index.class.php プロジェクト: rolwi/koala
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $myExtension = \Worksheet::getInstance();
     $worksheet = new \Worksheet\Worksheet($this->id);
     $role = $worksheet->getRole();
     if ($role == "build") {
         header("Location: " . PATH_URL . "worksheet/Build/" . $this->id);
     } elseif ($role == "view") {
         header("Location: " . PATH_URL . "worksheet/View/" . $this->id);
     } elseif ($role == "edit") {
         header("Location: " . PATH_URL . "worksheet/Edit/" . $this->id);
     }
     return $frameResponseObject;
 }
コード例 #9
0
ファイル: NewWorksheet.class.php プロジェクト: rolwi/koala
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $worksheetObject = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $worksheet = new \Worksheet\Worksheet($worksheetObject->get_id());
        $worksheet->setup();
        $worksheet->setName($worksheet->getName() . " (Vorlage)");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
コード例 #10
0
ファイル: CorrectFinish.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #11
0
ファイル: CopyList.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #12
0
ファイル: AddBlock.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #13
0
ファイル: Deploy.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #14
0
ファイル: DeleteBlock.class.php プロジェクト: rolwi/koala
 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;
 }
コード例 #15
0
ファイル: Finish.class.php プロジェクト: rolwi/koala
 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;
 }