ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjCourseVerificationGUI.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 
5 include_once('./Services/Object/classes/class.ilObject2GUI.php');
6 
18 {
19  public function getType()
20  {
21  return "crsv";
22  }
23 
27  public function create()
28  {
29  global $ilTabs;
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("crsv");
41 
42  $ilTabs->setBackTarget(
43  $this->lng->txt("back"),
44  $this->ctrl->getLinkTarget($this, "cancel")
45  );
46 
47  include_once "Modules/Course/classes/Verification/class.ilCourseVerificationTableGUI.php";
48  $table = new ilCourseVerificationTableGUI($this, "create");
49  $this->tpl->setContent($table->getHTML());
50  }
51 
55  public function save()
56  {
57  global $ilUser;
58 
59  $course_id = $_REQUEST["crs_id"];
60  if ($course_id) {
61  include_once "Modules/Course/classes/class.ilObjCourse.php";
62  $course = new ilObjCourse($course_id, false);
63 
64  include_once "Modules/Course/classes/Verification/class.ilObjCourseVerification.php";
65  $newObj = ilObjCourseVerification::createFromCourse($course, $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  {
97  global $ilUser, $lng;
98 
99  if (!$a_return) {
100  $this->deliver();
101  } else {
102  $tree = new ilWorkspaceTree($ilUser->getId());
103  $wsp_id = $tree->lookupNodeId($this->object->getId());
104 
105  $caption = $lng->txt("wsp_type_crsv") . ' "' . $this->object->getTitle() . '"';
106 
107  $valid = true;
108  if (!file_exists($this->object->getFilePath())) {
109  $valid = false;
110  $message = $lng->txt("url_not_found");
111  } elseif (!$a_url) {
112  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
114  if (!$access_handler->checkAccess("read", "", $wsp_id)) {
115  $valid = false;
116  $message = $lng->txt("permission_denied");
117  }
118  }
119 
120  if ($valid) {
121  if (!$a_url) {
122  $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
123  }
124  return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
125  } else {
126  return '<div>' . $caption . ' (' . $message . ')</div>';
127  }
128  }
129  }
130 
132  {
133  global $ilErr;
134 
135  include_once "Services/COPage/classes/class.ilPCVerification.php";
136  if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
137  $this->deliver();
138  }
139 
140  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
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 }
static createFromCourse(ilObjCourse $a_course, $a_user_id)
Import relevant properties from given course.
New implementation of ilObjectGUI.
List all completed course for current user.
$_GET["client_id"]
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
getAccessHandler()
Get access handler.
$valid
create()
List all tests in which current user participated.
if(!array_key_exists('StateId', $_REQUEST)) $id
Access handler for personal workspace.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
Tree handler for personal workspace.
render($a_return=false, $a_url=false)
Render content.
GUI class for course verification.
catch(Exception $e) $message
Class ilObjCourse.
static isUploadPossible($a_additional_size=null)
$ilUser
Definition: imgupload.php:18
Page for user portfolio.
downloadFromPortfolioPage(ilPortfolioPage $a_page)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
save()
create new instance and save it
Create new PHPExcel object
obj_idprivate
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
Definition: pwgen.php:24
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.