ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjExerciseVerificationGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once('./Services/Object/classes/class.ilObject2GUI.php');
6
18{
19 public function getType()
20 {
21 return "excv";
22 }
23
27 public function create()
28 {
29 $ilTabs = $this->tabs_gui;
30
31 if ($this->id_type == self::WORKSPACE_NODE_ID) {
32 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
34 $this->lng->loadLanguageModule("file");
35 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
36 $this->ctrl->redirect($this, "cancel");
37 }
38 }
39
40 $this->lng->loadLanguageModule("excv");
41
42 $ilTabs->setBackTarget(
43 $this->lng->txt("back"),
44 $this->ctrl->getLinkTarget($this, "cancel")
45 );
46
47 include_once "Modules/Exercise/classes/class.ilExerciseVerificationTableGUI.php";
48 $table = new ilExerciseVerificationTableGUI($this, "create");
49 $this->tpl->setContent($table->getHTML());
50 }
51
55 public function save()
56 {
58
59 $exercise_id = $_REQUEST["exc_id"];
60 if ($exercise_id) {
61 include_once "Modules/Exercise/classes/class.ilObjExercise.php";
62 $exercise = new ilObjExercise($exercise_id, false);
63
64 include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
65 $newObj = ilObjExerciseVerification::createFromExercise($exercise, $ilUser->getId());
66 if ($newObj) {
68 $this->node_id = null;
69 $this->putObjectInTree($newObj, $parent_id);
70
71 $this->afterSave($newObj);
72 } else {
73 ilUtil::sendFailure($this->lng->txt("msg_failed"));
74 }
75 } else {
76 ilUtil::sendFailure($this->lng->txt("select_one"));
77 }
78 $this->create();
79 }
80
81 public function deliver()
82 {
83 $file = $this->object->getFilePath();
84 if ($file) {
85 ilUtil::deliverFile($file, $this->object->getTitle() . ".pdf");
86 }
87 }
88
95 public function render($a_return = false, $a_url = false)
96 {
99
100 if (!$a_return) {
101 $this->deliver();
102 } else {
103 $tree = new ilWorkspaceTree($ilUser->getId());
104 $wsp_id = $tree->lookupNodeId($this->object->getId());
105
106 $caption = $lng->txt("wsp_type_excv") . ' "' . $this->object->getTitle() . '"';
107
108 $valid = true;
109 if (!file_exists($this->object->getFilePath())) {
110 $valid = false;
111 $message = $lng->txt("url_not_found");
112 } elseif (!$a_url) {
113 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
115 if (!$access_handler->checkAccess("read", "", $wsp_id)) {
116 $valid = false;
117 $message = $lng->txt("permission_denied");
118 }
119 }
120
121 if ($valid) {
122 if (!$a_url) {
123 $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
124 }
125 return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
126 } else {
127 return '<div>' . $caption . ' (' . $message . ')</div>';
128 }
129 }
130 }
131
133 {
134 include_once "Services/COPage/classes/class.ilPCVerification.php";
135 if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
136 $this->deliver();
137 }
138
139 include_once "Modules/Exercise/exceptions/class.ilExerciseException.php";
140 throw new ilExerciseException($this->lng->txt('permission_denied'));
141 }
142
143 public static function _goto($a_target)
144 {
145 $id = explode("_", $a_target);
146
147 $_GET["baseClass"] = "ilsharedresourceGUI";
148 $_GET["wsp_id"] = $id[0];
149 include("ilias.php");
150 exit;
151 }
152}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static isUploadPossible($a_additional_size=null)
Exercise exceptions class.
List all completed exercises for current user.
GUI class for exercise verification.
create()
List all exercises in which current user participated.
render($a_return=false, $a_url=false)
Render content.
getType()
Functions that must be overwritten.
static createFromExercise(ilObjExercise $a_exercise, $a_user_id)
Import relevant properties from given exercise.
Class ilObjExercise.
New implementation of ilObjectGUI.
getAccessHandler()
Get access handler.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
Page for user portfolio.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Access handler for personal workspace.
Tree handler for personal workspace.
$valid
if(!array_key_exists('StateId', $_REQUEST)) $id
catch(Exception $e) $message
if(empty($password)) $table
Definition: pwgen.php:24
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
$ilUser
Definition: imgupload.php:18