ILIAS  release_4-4 Revision
ilObjFileGUI Class Reference

GUI class for file objects. More...

+ Inheritance diagram for ilObjFileGUI:
+ Collaboration diagram for ilObjFileGUI:

Public Member Functions

 getType ()
 
 _forwards ()
 
 executeCommand ()
 
 initSingleUploadForm ()
 FORM: Init single upload form. More...
 
 save ()
 save object More...
 
 saveAndMeta ()
 save object More...
 
 initZipUploadForm ($a_mode="create")
 FORM: Init zip upload form. More...
 
 saveUnzip ()
 saveUnzip object More...
 
 update ()
 updates object entry in object_data More...
 
 edit ()
 edit object More...
 
 sendFile ()
 
 versions ()
 file versions/history More...
 
 infoScreen ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreenForward ()
 show information screen More...
 
 setTabs ()
 
 _goto ($a_target, $a_additional=null)
 
 addLocatorItems ()
 
 initMultiUploadForm ()
 Initializes the upload form for multiple files. More...
 
 uploadFiles ()
 Called after a file was uploaded. More...
 
 deleteVersions ()
 Displays a confirmation screen with selected file versions that should be deleted. More...
 
 confirmDeleteVersions ()
 Deletes the file versions that were confirmed by the user. More...
 
 cancelDeleteVersions ()
 Cancels the file version deletion. More...
 
 confirmDeleteFile ()
 Deletes this file object. More...
 
 cancelDeleteFile ()
 Cancels the file deletion. More...
 
 compareHistoryIds ($v1, $v2)
 Compares two versions either by passing a history entry or an id. More...
 
 rollbackVersion ()
 Performs a rollback with the selected file version. More...
 
- Public Member Functions inherited from ilObject2GUI
 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 delete ()
 Display delete confirmation form (repository/workspace switch) More...
 
 confirmedDelete ()
 Delete objects (repository/workspace switch) More...
 
 getHTML ()
 
 withReferences ()
 Final/Private declaration of unchanged parent methods. More...
 
 setCreationMode ($a_mode=true)
 
 getCreationMode ()
 
 isVisible ()
 
 trash ()
 
 undelete ()
 
 cancelDelete ()
 
 removeFromSystem ()
 
 cloneAll ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 Deleted in ilObject. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 Import. More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Protected Member Functions

 initCreationForms ()
 
 initPropertiesForm ()
 
 handleFileUpload ($file_upload)
 Handles the upload of a single file and adds it to the parent object. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here. More...
 
 assignObject ()
 create object instance as internal property (repository/workspace switch) More...
 
 getAccessHandler ()
 Get access handler. More...
 
 setLocator ()
 set Locator More...
 
 deleteConfirmation ()
 Display delete confirmation form (workspace specific) More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) More...
 
 prepareOutput ()
 
 setTitleAndDescription ()
 
 showUpperIcon ()
 
 omitLocator ($a_omit=true)
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 
 setTargetFrame ($a_cmd, $a_target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 setColumnSettings ($column_gui)
 
 checkPermission ($a_perm, $a_cmd="")
 
 showPossibleSubObjects ()
 
 redirectToRefId ()
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 
 searchCloneSource ()
 
 buildCloneSelect ($existing_objs)
 
 addAdminLocatorItems ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation ()
 Deprecated functions. More...
 
 setReturnLocation ()
 
 showActions ()
 
 getTitlesByRefId ()
 
 getTabs ()
 
 __showButton ()
 
 hitsperpageObject ()
 
 __initTableGUI ()
 
 __setTableGUIBasicData ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
 Check permission. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget ($a_append=null, $a_center=false)
 
 handleAutoRating (ilObject $a_new_obj)
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Data Fields inherited from ilObject2GUI
 $tree
 
const OBJECT_ID = 0
 
const REPOSITORY_NODE_ID = 1
 
const WORKSPACE_NODE_ID = 2
 
const REPOSITORY_OBJECT_ID = 3
 
const WORKSPACE_OBJECT_ID = 4
 
const PORTFOLIO_OBJECT_ID = 5
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 

Detailed Description

Member Function Documentation

◆ _forwards()

ilObjFileGUI::_forwards ( )

Definition at line 28 of file class.ilObjFileGUI.php.

29  {
30  return array();
31  }

◆ _goto()

ilObjFileGUI::_goto (   $a_target,
  $a_additional = null 
)

Definition at line 914 of file class.ilObjFileGUI.php.

References $_GET, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

915  {
916  global $ilErr, $lng, $ilAccess;
917 
918  if($a_additional && substr($a_additional, -3) == "wsp")
919  {
920  $_GET["baseClass"] = "ilsharedresourceGUI";
921  $_GET["wsp_id"] = $a_target;
922  include("ilias.php");
923  exit;
924  }
925 
926  // added support for direct download goto links
927  if($a_additional && substr($a_additional, -8) == "download")
928  {
929  ilObjectGUI::_gotoRepositoryNode($a_target, "sendfile");
930  }
931 
932  // static method, no workspace support yet
933 
934  if ($ilAccess->checkAccess("visible", "", $a_target))
935  {
936  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
937  }
938  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
939  {
940  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
943  }
944 
945  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
946  }
exit
Definition: login.php:54
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjFileGUI::addLocatorItems ( )

Definition at line 951 of file class.ilObjFileGUI.php.

References ilObject2GUI\$node_id.

952  {
953  global $ilLocator;
954 
955  if (is_object($this->object))
956  {
957  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $this->node_id);
958  }
959  }

◆ cancelDeleteFile()

ilObjFileGUI::cancelDeleteFile ( )

Cancels the file deletion.

Definition at line 1315 of file class.ilObjFileGUI.php.

1316  {
1317  $this->ctrl->redirect($this, "versions");
1318  }

◆ cancelDeleteVersions()

ilObjFileGUI::cancelDeleteVersions ( )

Cancels the file version deletion.

Definition at line 1286 of file class.ilObjFileGUI.php.

1287  {
1288  $this->ctrl->redirect($this, "versions");
1289  }

◆ compareHistoryIds()

ilObjFileGUI::compareHistoryIds (   $v1,
  $v2 
)

Compares two versions either by passing a history entry or an id.

Parameters
$v1The first version to compare.
$v2The second version to compare.
Returns

Definition at line 1327 of file class.ilObjFileGUI.php.

1328  {
1329  if (is_array($v1))
1330  $v1 = (int)$v1["hist_entry_id"];
1331  else if (!is_int($v1))
1332  $v1 = (int)$v1;
1333 
1334  if (is_array($v2))
1335  $v2 = (int)$v2["hist_entry_id"];
1336  else if (!is_int($v2))
1337  $v2 = (int)$v2;
1338 
1339  return $v1 - $v2;
1340  }

◆ confirmDeleteFile()

ilObjFileGUI::confirmDeleteFile ( )

Deletes this file object.

Definition at line 1294 of file class.ilObjFileGUI.php.

References ilObject2GUI\checkPermissionBool().

1295  {
1296  // has the user the rights to delete the file?
1297  if (!$this->checkPermissionBool("write"))
1298  {
1299  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1300  }
1301 
1302  // delete this file object
1303  include_once("./Services/Repository/classes/class.ilRepUtilGUI.php");
1304  $ru = new ilRepUtilGUI($this);
1305  $ru->deleteObjects($this->parent_id, array($this->ref_id));
1306 
1307  // redirect to parent object
1308  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->parent_id);
1309  $this->ctrl->redirectByClass("ilrepositorygui");
1310  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
Repository GUI Utilities.
+ Here is the call graph for this function:

◆ confirmDeleteVersions()

ilObjFileGUI::confirmDeleteVersions ( )

Deletes the file versions that were confirmed by the user.

Definition at line 1262 of file class.ilObjFileGUI.php.

References $_POST, ilObject2GUI\checkPermissionBool(), and ilUtil\sendSuccess().

1263  {
1264  global $ilTabs;
1265 
1266  // has the user the rights to delete versions?
1267  if (!$this->checkPermissionBool("write"))
1268  {
1269  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1270  }
1271 
1272  // delete versions after confirmation
1273  if (count($_POST["hist_id"]) > 0)
1274  {
1275  $this->object->deleteVersions($_POST["hist_id"]);
1276  ilUtil::sendSuccess($this->lng->txt("file_versions_deleted"), true);
1277  }
1278 
1279  $this->ctrl->setParameter($this, "hist_id", "");
1280  $this->ctrl->redirect($this, "versions");
1281  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
+ Here is the call graph for this function:

◆ deleteVersions()

ilObjFileGUI::deleteVersions ( )

Displays a confirmation screen with selected file versions that should be deleted.

Definition at line 1204 of file class.ilObjFileGUI.php.

References $_GET, $_POST, ilObject\_getIcon(), ilUtil\sendFailure(), and ilUtil\sendQuestion().

1205  {
1206  global $ilTabs, $ilLocator;
1207 
1208  // get ids either from GET (if single item was clicked) or
1209  // from POST (if multiple items were selected)
1210  $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1211 
1212  if (count($version_ids) < 1)
1213  {
1214  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
1215  $this->ctrl->redirect($this, "versions");
1216  }
1217  else
1218  {
1219  $ilTabs->activateTab("id_versions");
1220 
1221  // check if all versions are selected
1222  $versionsToKeep = array_udiff($this->object->getVersions(), $version_ids, array($this, "compareHistoryIds"));
1223  if (count($versionsToKeep) < 1)
1224  {
1225  // set our message
1226  ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_all_versions"));
1227 
1228  // show confirmation gui
1229  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1230  $conf_gui = new ilConfirmationGUI();
1231  $conf_gui->setFormAction($this->ctrl->getFormAction($this, "versions"));
1232  $conf_gui->setCancel($this->lng->txt("cancel"), "cancelDeleteFile");
1233  $conf_gui->setConfirm($this->lng->txt("confirm"), "confirmDeleteFile");
1234 
1235  $conf_gui->addItem("id[]", $this->ref_id, $this->object->getTitle(),
1236  ilObject::_getIcon($this->object->getId(), "small", $this->object->getType()),
1237  $this->lng->txt("icon")." ".$this->lng->txt("obj_".$this->object->getType()));
1238 
1239  $html = $conf_gui->getHTML();
1240  }
1241  else
1242  {
1243  include_once("./Modules/File/classes/class.ilFileVersionTableGUI.php");
1244 
1245  ilUtil::sendQuestion($this->lng->txt("file_confirm_delete_versions"));
1246  $versions = $this->object->getVersions($version_ids);
1247 
1248  $table = new ilFileVersionTableGUI($this, 'versions', true);
1249  $table->setMaxCount(sizeof($versions));
1250  $table->setData($versions);
1251 
1252  $html = $table->getHTML();
1253  }
1254 
1255  $this->tpl->setVariable('ADM_CONTENT', $html);
1256  }
1257  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilFileVersionTableGUI.
Confirmation screen class.
+ Here is the call graph for this function:

◆ edit()

ilObjFileGUI::edit ( )

edit object

public

Definition at line 573 of file class.ilObjFileGUI.php.

References $ilErr, ilObject2GUI\checkPermissionBool(), and initPropertiesForm().

574  {
575  global $ilTabs, $ilErr;
576 
577  if (!$this->checkPermissionBool("write"))
578  {
579  $ilErr->raiseError($this->lng->txt("msg_no_perm_write"));
580  }
581 
582  $ilTabs->activateTab("settings");
583 
584  $form = $this->initPropertiesForm();
585 
586  $val = array();
587  $val['title'] = $this->object->getTitle();
588  $val['description'] = $this->object->getLongDescription();
589  $val['rating'] = $this->object->hasRating();
590  $form->setValuesByArray($val);
591 
592  // Edit ecs export settings
593  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
594  $ecs = new ilECSFileSettings($this->object);
595  $ecs->addSettingsToForm($form, 'file');
596 
597  $this->tpl->setContent($form->getHTML());
598  return true;
599  }
Class ilECSFileSettings.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjFileGUI::executeCommand ( )

Definition at line 33 of file class.ilObjFileGUI.php.

References $_GET, $cmd, $ilCtrl, $ilErr, $ilUser, $ret, ilPaymentBookings\_readBookingByTransaction(), ilPaymentObject\_requiresPurchaseToAccess(), ilObjectGUI\addHeaderAction(), ilMDEditorGUI\addObserver(), ilObject2GUI\checkPermissionBool(), ilObject2GUI\getAccessHandler(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreenForward(), ilObject2GUI\prepareOutput(), ilObject2GUI\setLocator(), and ilFileInputGUI\setPersonalWorkspaceQuotaCheck().

34  {
35  global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
36 
37  $next_class = $this->ctrl->getNextClass($this);
38  $cmd = $this->ctrl->getCmd();
39 
40  if($this->id_type == self::WORKSPACE_NODE_ID)
41  {
42  include_once "Services/Form/classes/class.ilFileInputGUI.php";
44  }
45 
46  if(!$this->getCreationMode())
47  {
48  // do not move this payment block!!
49  if(IS_PAYMENT_ENABLED)
50  {
51  include_once './Services/Payment/classes/class.ilPaymentObject.php';
52  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']))
53  {
54  $transaction = $_GET['transaction'];
55  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
56  $valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
57  }
58 
59  if(ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = (isset($_GET['purchasetype'])
60  ? $_GET['purchasetype'] : NULL) ))
61  {
62  $this->setLocator();
63  $this->tpl->getStandardTemplate();
64 
65  include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
66  $pp = new ilShopPurchaseGUI((int)$this->node_id);
67  $ret = $this->ctrl->forwardCommand($pp);
68  return true;
69  }
70  }
71  else if($this->id_type == self::REPOSITORY_NODE_ID
72  && $this->checkPermissionBool("read"))
73  {
74  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
75  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
76  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
77 
78  // add entry to navigation history
79  $ilNavigationHistory->addItem($this->node_id,
80  $link, "file");
81  }
82  }
83 
84  $this->prepareOutput();
85 
86  switch ($next_class)
87  {
88  case "ilinfoscreengui":
89  $this->infoScreenForward(); // forwards command
90  break;
91 
92  case 'ilmdeditorgui':
93  if(!$this->checkPermissionBool("write"))
94  {
95  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
96  }
97 
98  $ilTabs->activateTab("id_meta");
99 
100  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
101 
102  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
103  $md_gui->addObserver($this->object,'MDUpdateListener','General');
104 
105  // todo: make this work
106  $md_gui->addObserver($this->object,'MDUpdateListener','Technical');
107 
108  $this->ctrl->forwardCommand($md_gui);
109  break;
110 
111  // repository permissions
112  case 'ilpermissiongui':
113  $ilTabs->activateTab("id_permissions");
114  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
115  $perm_gui =& new ilPermissionGUI($this);
116  $ret =& $this->ctrl->forwardCommand($perm_gui);
117  break;
118 
119  case "ilexportgui":
120  if(!$this->checkPermissionBool("write"))
121  {
122  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
123  }
124  $ilTabs->activateTab("export");
125  include_once("./Services/Export/classes/class.ilExportGUI.php");
126  $exp_gui = new ilExportGUI($this);
127  $exp_gui->addFormat("xml");
128  $ret = $this->ctrl->forwardCommand($exp_gui);
129  break;
130 
131  case 'ilobjectcopygui':
132  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
133  $cp = new ilObjectCopyGUI($this);
134  $cp->setType('file');
135  $this->ctrl->forwardCommand($cp);
136  break;
137 
138  // personal workspace permissions
139  case "ilworkspaceaccessgui";
140  $ilTabs->activateTab("id_permissions");
141  include_once('./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
142  $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
143  $this->ctrl->forwardCommand($wspacc);
144  break;
145 
146  case "ilcommonactiondispatchergui":
147  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
149  $this->ctrl->forwardCommand($gui);
150  break;
151 
152  default:
153  // in personal workspace use object2gui
154  if($this->id_type == self::WORKSPACE_NODE_ID)
155  {
156  $this->addHeaderAction();
157 
158  // coming from goto we need default command
159  if (empty($cmd))
160  {
161  $ilCtrl->setCmd("infoScreen");
162  }
163  $ilTabs->clearTargets();
164  return parent::executeCommand();
165  }
166 
167  if (empty($cmd))
168  {
169  $cmd = "infoScreen";
170  }
171 
172  $this->$cmd();
173  break;
174  }
175 
176  $this->addHeaderAction();
177  }
setLocator()
set Locator
infoScreenForward()
show information screen
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
GUI class for the workflow of copying objects.
$_GET["client_id"]
getAccessHandler()
Get access handler.
Class ilShopPurchaseGUI.
$cmd
Definition: sahs_server.php:35
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
addObserver(&$a_class, $a_method, $a_element)
global $ilCtrl
Definition: ilias.php:18
Export User Interface Class.
ACL access handler GUI.
global $ilUser
Definition: imgupload.php:15
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
setPersonalWorkspaceQuotaCheck($a_value)
addHeaderAction()
Add header action menu.
static _readBookingByTransaction($a_transaction)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ getType()

ilObjFileGUI::getType ( )

Definition at line 22 of file class.ilObjFileGUI.php.

23  {
24  return "file";
25  }

◆ handleFileUpload()

ilObjFileGUI::handleFileUpload (   $file_upload)
protected

Handles the upload of a single file and adds it to the parent object.

Parameters
array$file_uploadAn array containing the file upload parameters.
Returns
object The response object.

Definition at line 1052 of file class.ilObjFileGUI.php.

References ilObject2GUI\$access_handler, $filename, $ilUser, $size, ilObject2GUI\$tree, ilObjFileAccess\_getFileExtension(), ilObject\_lookupType(), ilChangeEvent\_recordWriteEvent(), ilObject2GUI\checkPermissionBool(), ilUtil\delDir(), ilObject2GUI\getAccessHandler(), ilMimeTypeUtil\getMimeType(), ilObject2GUI\handleAutoRating(), ilUtil\ilTempnam(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilObject2GUI\putObjectInTree(), and ilUtil\stripSlashes().

Referenced by uploadFiles().

1053  {
1054  global $ilUser;
1055 
1056  // file upload params
1057  $filename = ilUtil::stripSlashes($file_upload["name"]);
1058  $type = ilUtil::stripSlashes($file_upload["type"]);
1059  $size = ilUtil::stripSlashes($file_upload["size"]);
1060  $temp_name = $file_upload["tmp_name"];
1061 
1062  // additional params
1063  $title = ilUtil::stripSlashes($file_upload["title"]);
1064  $description = ilUtil::stripSlashes($file_upload["description"]);
1065  $extract = ilUtil::stripSlashes($file_upload["extract"]);
1066  $keep_structure = ilUtil::stripSlashes($file_upload["keep_structure"]);
1067 
1068  // create answer object
1069  $response = new stdClass();
1070  $response->fileName = $filename;
1071  $response->fileSize = intval($size);
1072  $response->fileType = $type;
1073  $response->fileUnzipped = $extract;
1074  $response->error = null;
1075 
1076  // extract archive?
1077  if ($extract)
1078  {
1079  $zip_file = $filename;
1080  $adopt_structure = $keep_structure;
1081 
1082  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
1083 
1084  // Create unzip-directory
1085  $newDir = ilUtil::ilTempnam();
1086  ilUtil::makeDir($newDir);
1087 
1088  // Check if permission is granted for creation of object, if necessary
1089  if($this->id_type != self::WORKSPACE_NODE_ID)
1090  {
1091  $type = ilObject::_lookupType((int)$this->parent_id, true);
1092  }
1093  else
1094  {
1095  $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
1096  }
1097 
1098  $tree = $access_handler = null;
1099  switch($type)
1100  {
1101  // workspace structure
1102  case 'wfld':
1103  case 'wsrt':
1104  $permission = $this->checkPermissionBool("create", "", "wfld");
1105  $containerType = "WorkspaceFolder";
1106  $tree = $this->tree;
1107  $access_handler = $this->getAccessHandler();
1108  break;
1109 
1110  // use categories as structure
1111  case 'cat':
1112  case 'root':
1113  $permission = $this->checkPermissionBool("create", "", "cat");
1114  $containerType = "Category";
1115  break;
1116 
1117  // use folders as structure (in courses)
1118  default:
1119  $permission = $this->checkPermissionBool("create", "", "fold");
1120  $containerType = "Folder";
1121  break;
1122  }
1123 
1124  try
1125  {
1126  // processZipFile (
1127  // Dir to unzip,
1128  // Path to uploaded file,
1129  // should a structure be created (+ permission check)?
1130  // ref_id of parent
1131  // object that contains files (folder or category)
1132  // should sendInfo be persistent?)
1134  $newDir,
1135  $temp_name,
1136  ($adopt_structure && $permission),
1137  $this->parent_id,
1138  $containerType,
1139  $tree,
1140  $access_handler);
1141  }
1142  catch (ilFileUtilsException $e)
1143  {
1144  $response->error = $e->getMessage();
1145  }
1146  catch (Exception $ex)
1147  {
1148  $response->error = $ex->getMessage();
1149  }
1150 
1151  ilUtil::delDir($newDir);
1152  }
1153  else
1154  {
1155  if (trim($title) == "")
1156  {
1157  $title = $filename;
1158  }
1159  else
1160  {
1161  // BEGIN WebDAV: Ensure that object title ends with the filename extension
1163  $titleExtension = ilObjFileAccess::_getFileExtension($title);
1164  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
1165  {
1166  $title .= '.'.$fileExtension;
1167  }
1168  // END WebDAV: Ensure that object title ends with the filename extension
1169  }
1170 
1171  // create and insert file in grp_tree
1172  include_once("./Modules/File/classes/class.ilObjFile.php");
1173  $fileObj = new ilObjFile();
1174  $fileObj->setTitle($title);
1175  $fileObj->setDescription($description);
1176  $fileObj->setFileName($filename);
1177 
1178  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
1179  $fileObj->setFileType(ilMimeTypeUtil::getMimeType("", $filename, $type));
1180  $fileObj->setFileSize($size);
1181  $this->object_id = $fileObj->create();
1182 
1183  $this->putObjectInTree($fileObj, $this->parent_id);
1184 
1185  // upload file to filesystem
1186  $fileObj->createDirectory();
1187  $fileObj->raiseUploadError(false);
1188  $fileObj->getUploadFile($temp_name, $filename);
1189 
1190  $this->handleAutoRating($fileObj);
1191 
1192  // BEGIN ChangeEvent: Record write event.
1193  require_once('./Services/Tracking/classes/class.ilChangeEvent.php');
1194  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
1195  // END ChangeEvent: Record write event.
1196  }
1197 
1198  return $response;
1199  }
$size
Definition: RandomTest.php:79
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
getAccessHandler()
Get access handler.
static _getFileExtension($a_file_name)
Gets the file extension of the specified file name.
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
Class ilObjFile.
handleAutoRating(ilObject $a_new_obj)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _lookupType($a_id, $a_reference=false)
lookup object type
$filename
Definition: buildRTE.php:89
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
global $ilUser
Definition: imgupload.php:15
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
Class to report exception.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjFileGUI::infoScreen ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 736 of file class.ilObjFileGUI.php.

References infoScreenForward().

737  {
738  $this->ctrl->setCmd("showSummary");
739  $this->ctrl->setCmdClass("ilinfoscreengui");
740  $this->infoScreenForward();
741  }
infoScreenForward()
show information screen
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjFileGUI::infoScreenForward ( )

show information screen

Definition at line 746 of file class.ilObjFileGUI.php.

References ilObject2GUI\$access_handler, $ilErr, $preview, ilObjectGUI\$tpl, ilObjFileAccess\_getPermanentDownloadLink(), ilObjFile\_lookupFileSize(), ilObject2GUI\checkPermissionBool(), ilPreviewGUI\CONTEXT_REPOSITORY, ilPreviewGUI\CONTEXT_WORKSPACE, ilFormat\formatSize(), ilUserUtil\getNamePresentation(), ilObject2GUI\getPermanentLinkWidget(), and ilPreview\hasPreview().

Referenced by executeCommand(), and infoScreen().

747  {
748  global $ilTabs, $ilErr;
749 
750  $ilTabs->activateTab("id_info");
751 
752  if (!$this->checkPermissionBool("visible"))
753  {
754  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
755  }
756 
757  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
758  $info = new ilInfoScreenGUI($this);
759 
760  if ($this->checkPermissionBool("read", "sendfile"))
761  {
762  // 9876
763  $this->lng->loadLanguageModule("file");
764 
765  // get permanent download link for repository
766  if ($this->id_type == self::REPOSITORY_NODE_ID)
767  $info->addButton($this->lng->txt("file_download"), ilObjFileAccess::_getPermanentDownloadLink($this->node_id), "", "top", true);
768  else
769  $info->addButton($this->lng->txt("file_download"), $this->ctrl->getLinkTarget($this, "sendfile"), "", "top", true);
770  }
771 
772  $info->enablePrivateNotes();
773 
774  if ($this->checkPermissionBool("read"))
775  {
776  $info->enableNews();
777  }
778 
779  // no news editing for files, just notifications
780  $info->enableNewsEditing(false);
781  if ($this->checkPermissionBool("write"))
782  {
783  $news_set = new ilSetting("news");
784  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
785 
786  if ($enable_internal_rss)
787  {
788  $info->setBlockProperty("news", "settings", true);
789  $info->setBlockProperty("news", "public_notifications_option", true);
790  }
791  }
792 
793 
794  // standard meta data
795  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
796 
797  $info->addSection($this->lng->txt("file_info"));
798  $info->addProperty($this->lng->txt("filename"),
799  $this->object->getFileName());
800  // BEGIN WebDAV Guess file type.
801  $info->addProperty($this->lng->txt("type"),
802  $this->object->guessFileType());
803  // END WebDAV Guess file type.
804  $info->addProperty($this->lng->txt("size"),
805  ilFormat::formatSize(ilObjFile::_lookupFileSize($this->object->getId()),'long'));
806  $info->addProperty($this->lng->txt("version"),
807  $this->object->getVersion());
808 
809  // using getVersions function instead of ilHistory direct
810  $uploader = $this->object->getVersions();
811  $uploader = array_shift($uploader);
812  $uploader = $uploader["user_id"];
813 
814  $this->lng->loadLanguageModule("file");
815  include_once "Services/User/classes/class.ilUserUtil.php";
816  $info->addProperty($this->lng->txt("file_uploaded_by"), ilUserUtil::getNamePresentation($uploader));
817 
818  // download link added in repository
819  if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read", "sendfile"))
820  {
821  $tpl = new ilTemplate("tpl.download_link.html", true, true, "Modules/File");
822  $tpl->setVariable("LINK", ilObjFileAccess::_getPermanentDownloadLink($this->node_id));
823  $info->addProperty($this->lng->txt("download_link"), $tpl->get());
824  }
825 
826  if($this->id_type == self::WORKSPACE_NODE_ID)
827  {
828  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
829  }
830 
831  // display previews
832  include_once("./Services/Preview/classes/class.ilPreview.php");
833  if (!$this->ctrl->isAsynch() &&
834  ilPreview::hasPreview($this->object->getId(), $this->object->getType()) &&
835  $this->checkPermissionBool("read"))
836  {
837  include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
838 
839  // get context for access checks later on
840  $context;
841  switch ($this->id_type)
842  {
843  case self::WORKSPACE_NODE_ID:
844  case self::WORKSPACE_OBJECT_ID:
846  break;
847 
848  default:
850  break;
851  }
852 
853  $preview = new ilPreviewGUI($this->node_id, $context, $this->object->getId(), $this->access_handler);
854  $info->addProperty($this->lng->txt("preview"), $preview->getInlineHTML());
855  }
856 
857  // forward the command
858  // $this->ctrl->setCmd("showSummary");
859  // $this->ctrl->setCmdClass("ilinfoscreengui");
860  $this->ctrl->forwardCommand($info);
861  }
ILIAS Setting Class.
static _getPermanentDownloadLink($ref_id)
Gets the permanent download link for the file.
Class ilInfoScreenGUI.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
getPermanentLinkWidget($a_append=null, $a_center=false)
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true)
Default behaviour is:
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
special template class to simplify handling of ITX/PEAR
$preview
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
_lookupFileSize($a_id)
Lookups the file size of the file in bytes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjFileGUI::initCreationForms ( )
protected

Definition at line 179 of file class.ilObjFileGUI.php.

References ilObject2GUI\fillCloneTemplate(), initMultiUploadForm(), initSingleUploadForm(), initZipUploadForm(), ilFileUploadSettings\isDragAndDropUploadEnabled(), ilDiskQuotaHandler\isUploadPossible(), and ilUtil\sendFailure().

180  {
181  $forms = array();
182 
183  if($this->id_type == self::WORKSPACE_NODE_ID)
184  {
185  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
187  {
188  $this->lng->loadLanguageModule("file");
189  ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
190  $this->ctrl->redirect($this, "cancel");
191  }
192  }
193 
194  // use drag-and-drop upload if configured
195  require_once("Services/FileUpload/classes/class.ilFileUploadSettings.php");
197  {
198  $forms[] = $this->initMultiUploadForm();
199  }
200  else
201  {
202  $forms[] = $this->initSingleUploadForm();
203  $forms[] = $this->initZipUploadForm();
204  }
205 
206  // repository only
207  if($this->id_type != self::WORKSPACE_NODE_ID)
208  {
209  $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, "file");
210  }
211 
212  return $forms;
213  }
initSingleUploadForm()
FORM: Init single upload form.
initZipUploadForm($a_mode="create")
FORM: Init zip upload form.
fillCloneTemplate($a_tpl_varname, $a_type)
static isUploadPossible($a_additional_size=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initMultiUploadForm()
Initializes the upload form for multiple files.
static isDragAndDropUploadEnabled()
Gets whether drag and drop file upload is enabled.
+ Here is the call graph for this function:

◆ initHeaderAction()

ilObjFileGUI::initHeaderAction (   $a_sub_type = null,
  $a_sub_id = null 
)
protected

Definition at line 1373 of file class.ilObjFileGUI.php.

1374  {
1375  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1376  if(is_object($lg))
1377  {
1378  if($this->object->hasRating())
1379  {
1380  $lg->enableRating(true, null, false,
1381  array("ilcommonactiondispatchergui", "ilratinggui"));
1382  }
1383  }
1384  return $lg;
1385  }

◆ initMultiUploadForm()

ilObjFileGUI::initMultiUploadForm ( )

Initializes the upload form for multiple files.

Returns
object The created property form.

Definition at line 966 of file class.ilObjFileGUI.php.

References ilUtil\getImagePath(), ilObject2GUI\getTargetFrame(), and ilDragDropFileInputGUI\setArchiveSuffixes().

Referenced by initCreationForms(), and uploadFiles().

967  {
968  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
969  $dnd_form_gui = new ilPropertyFormGUI();
970  $dnd_form_gui->setMultipart(true);
971  $dnd_form_gui->setHideLabels();
972 
973  // file input
974  include_once("Services/Form/classes/class.ilDragDropFileInputGUI.php");
975  $dnd_input = new ilDragDropFileInputGUI($this->lng->txt("files"), "upload_files");
976  $dnd_input->setArchiveSuffixes(array("zip"));
977  $dnd_input->setCommandButtonNames("uploadFiles", "cancel");
978  $dnd_form_gui->addItem($dnd_input);
979 
980  // add commands
981  $dnd_form_gui->addCommandButton("uploadFiles", $this->lng->txt("upload_files"));
982  $dnd_form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
983 
984  $dnd_form_gui->setTableWidth("100%");
985  $dnd_form_gui->setTarget($this->getTargetFrame("save"));
986  $dnd_form_gui->setTitle($this->lng->txt("upload_files_title"));
987  $dnd_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.gif'), $this->lng->txt('obj_file'));
988 
989  $this->ctrl->setParameter($this, "new_type", "file");
990  $dnd_form_gui->setFormAction($this->ctrl->getFormAction($this, "uploadFiles"));
991 
992  return $dnd_form_gui;
993  }
This class represents a property form user interface.
setArchiveSuffixes($a_suffixes)
Set accepted archive suffixes.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getTargetFrame($a_cmd, $a_target_frame="")
This class represents a file input property where multiple files can be dopped in a property form...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPropertiesForm()

ilObjFileGUI::initPropertiesForm ( )
protected
Parameters

Definition at line 606 of file class.ilObjFileGUI.php.

References $file, ilDiskQuotaHandler\isUploadPossible(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilTextAreaInputGUI\setRows(), and ilTextInputGUI\setValue().

Referenced by edit(), and update().

607  {
608  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
609 
610  $this->lng->loadLanguageModule('file');
611 
612  $form = new ilPropertyFormGUI();
613  $form->setFormAction($this->ctrl->getFormAction($this),'update');
614  $form->setTitle($this->lng->txt('file_edit'));
615  $form->addCommandButton('update',$this->lng->txt('save'));
616  $form->addCommandButton('cancel',$this->lng->txt('cancel'));
617 
618  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
619  $title->setValue($this->object->getTitle());
620  $title->setInfo($this->lng->txt("if_no_title_then_filename"));
621  $form->addItem($title);
622 
623  $upload_possible = true;
624  if($this->id_type == self::WORKSPACE_NODE_ID)
625  {
626  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
627  $upload_possible = ilDiskQuotaHandler::isUploadPossible();
628  }
629 
630  if($upload_possible)
631  {
632  $file = new ilFileInputGUI($this->lng->txt('obj_file'),'file');
633  $file->setRequired(false);
634  // $file->enableFileNameSelection('title');
635  $form->addItem($file);
636 
637  $group = new ilRadioGroupInputGUI('','replace');
638  $group->setValue(0);
639 
640  $replace = new ilRadioOption($this->lng->txt('replace_file'),1);
641  $replace->setInfo($this->lng->txt('replace_file_info'));
642  $group->addOption($replace);
643 
644 
645  $keep = new ilRadioOption($this->lng->txt('file_new_version'),0);
646  $keep->setInfo($this->lng->txt('file_new_version_info'));
647  $group->addOption($keep);
648 
649  $file->addSubItem($group);
650  }
651  else
652  {
653  $file = new ilNonEditableValueGUI($this->lng->txt('obj_file'));
654  $file->setValue($this->lng->txt("personal_workspace_quota_exceeded_warning"));
655  $form->addItem($file);
656  }
657 
658  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
659  $desc->setRows(3);
660  #$desc->setCols(40);
661  $form->addItem($desc);
662 
663  if($this->id_type == self::REPOSITORY_NODE_ID)
664  {
665  $this->lng->loadLanguageModule('rating');
666  $rate = new ilCheckboxInputGUI($this->lng->txt('rating_activate_rating'), 'rating');
667  $rate->setInfo($this->lng->txt('rating_activate_rating_info'));
668  $form->addItem($rate);
669  }
670 
671  return $form;
672  }
This class represents an option in a radio group.
print $file
This class represents a property form user interface.
This class represents a file property in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
This class represents a text property in a property form.
static isUploadPossible($a_additional_size=null)
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSingleUploadForm()

ilObjFileGUI::initSingleUploadForm ( )

FORM: Init single upload form.

Definition at line 218 of file class.ilObjFileGUI.php.

References ilObjectGUI\$lng, ilUtil\getImagePath(), ilObject2GUI\getTargetFrame(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), and ilObject\TITLE_LENGTH.

Referenced by initCreationForms(), and save().

219  {
220  global $lng;
221 
222  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
223  $single_form_gui = new ilPropertyFormGUI();
224  $single_form_gui->setMultipart(true);
225 
226  // File Title
227  $in_title = new ilTextInputGUI($lng->txt("title"), "title");
228  $in_title->setInfo($this->lng->txt("if_no_title_then_filename"));
229  $in_title->setSize(min(40, ilObject::TITLE_LENGTH));
230  $in_title->setMaxLength(ilObject::TITLE_LENGTH);
231  $single_form_gui->addItem($in_title);
232 
233  // File Description
234  $in_descr = new ilTextAreaInputGUI($lng->txt("description"), "description");
235  $single_form_gui->addItem($in_descr);
236 
237  // File
238  $in_file = new ilFileInputGUI($lng->txt("file"), "upload_file");
239  $in_file->setRequired(true);
240  $single_form_gui->addItem($in_file);
241 
242  $single_form_gui->addCommandButton("save", $this->lng->txt($this->type."_add"));
243  $single_form_gui->addCommandButton("saveAndMeta", $this->lng->txt("file_add_and_metadata"));
244  $single_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
245 
246  $single_form_gui->setTableWidth("600px");
247  $single_form_gui->setTarget($this->getTargetFrame("save"));
248  $single_form_gui->setTitle($this->lng->txt($this->type."_new"));
249  $single_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
250 
251  $this->ctrl->setParameter($this, "new_type", "file");
252 
253  $single_form_gui->setFormAction($this->ctrl->getFormAction($this, "save"));
254 
255  return $single_form_gui;
256  }
This class represents a property form user interface.
const TITLE_LENGTH
max length of object title
This class represents a file property in a property form.
setInfo($a_info)
Set Information Text.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a text property in a property form.
getTargetFrame($a_cmd, $a_target_frame="")
This class represents a text area property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initZipUploadForm()

ilObjFileGUI::initZipUploadForm (   $a_mode = "create")

FORM: Init zip upload form.

Definition at line 356 of file class.ilObjFileGUI.php.

References ilObjectGUI\$lng, ilUtil\getImagePath(), ilObject2GUI\getTargetFrame(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by initCreationForms(), and saveUnzip().

357  {
358  global $lng;
359 
360  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
361  $zip_form_gui = new ilPropertyFormGUI();
362  $zip_form_gui->setMultipart(true);
363 
364  // File
365  $in_file = new ilFileInputGUI($lng->txt("file"), "zip_file");
366  $in_file->setRequired(true);
367  $in_file->setSuffixes(array("zip"));
368  $zip_form_gui->addItem($in_file);
369 
370  // Take over structure
371  $in_str = new ilCheckboxInputGUI($this->lng->txt("take_over_structure"), "adopt_structure");
372  $in_str->setInfo($this->lng->txt("take_over_structure_info"));
373  $zip_form_gui->addItem($in_str);
374 
375  $zip_form_gui->addCommandButton("saveUnzip", $this->lng->txt($this->type."_add"));
376  $zip_form_gui->addCommandButton("cancel", $lng->txt("cancel"));
377 
378  $zip_form_gui->setTableWidth("600px");
379  $zip_form_gui->setTarget($this->getTargetFrame("save"));
380  $zip_form_gui->setTitle($this->lng->txt("header_zip"));
381  $zip_form_gui->setTitleIcon(ilUtil::getImagePath('icon_file.png'), $this->lng->txt('obj_file'));
382 
383  $this->ctrl->setParameter($this, "new_type", "file");
384 
385  $zip_form_gui->setFormAction($this->ctrl->getFormAction($this, "saveUnzip"));
386 
387  return $zip_form_gui;
388  }
This class represents a property form user interface.
This class represents a file property in a property form.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getTargetFrame($a_cmd, $a_target_frame="")
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rollbackVersion()

ilObjFileGUI::rollbackVersion ( )

Performs a rollback with the selected file version.

Definition at line 1345 of file class.ilObjFileGUI.php.

References $_GET, $_POST, ilObject2GUI\checkPermissionBool(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

1346  {
1347  global $ilTabs;
1348 
1349  // has the user the rights to delete the file?
1350  if (!$this->checkPermissionBool("write"))
1351  {
1352  $this->ilErr->raiseError($this->lng->txt("permission_denied"), $this->ilErr->MESSAGE);
1353  }
1354 
1355  // get ids either from GET (if single item was clicked) or
1356  // from POST (if multiple items were selected)
1357  $version_ids = isset($_GET["hist_id"]) ? array($_GET["hist_id"]) : $_POST["hist_id"];
1358 
1359  // more than one entry selected?
1360  if (count($version_ids) != 1)
1361  {
1362  ilUtil::sendInfo($this->lng->txt("file_rollback_select_exact_one"), true);
1363  $this->ctrl->redirect($this, "versions");
1364  }
1365 
1366  // rollback the version
1367  $new_version = $this->object->rollback($version_ids[0]);
1368 
1369  ilUtil::sendSuccess(sprintf($this->lng->txt("file_rollback_done"), $new_version["rollback_version"]), true);
1370  $this->ctrl->redirect($this, "versions");
1371  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ save()

ilObjFileGUI::save ( )

save object

public

Definition at line 263 of file class.ilObjFileGUI.php.

References $ilUser, ilObjectGUI\$objDefinition, ilObjFileAccess\_getFileExtension(), ilChangeEvent\_recordWriteEvent(), ilObject2GUI\checkPermissionBool(), ilMimeTypeUtil\getMimeType(), ilObject2GUI\handleAutoRating(), initSingleUploadForm(), ilObject2GUI\putObjectInTree(), ilUtil\redirect(), and ilUtil\sendSuccess().

Referenced by saveAndMeta().

264  {
265  global $objDefinition, $ilUser;
266 
267  if (!$this->checkPermissionBool("create", "", "file"))
268  {
269  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
270  }
271 
272  $single_form_gui = $this->initSingleUploadForm();
273 
274  if ($single_form_gui->checkInput())
275  {
276  $title = $single_form_gui->getInput("title");
277  $description = $single_form_gui->getInput("description");
278  $upload_file = $single_form_gui->getInput("upload_file");
279 
280  if (trim($title) == "")
281  {
282  $title = $upload_file["name"];
283  }
284  else
285  {
286  // BEGIN WebDAV: Ensure that object title ends with the filename extension
287  $fileExtension = ilObjFileAccess::_getFileExtension($upload_file["name"]);
288  $titleExtension = ilObjFileAccess::_getFileExtension($title);
289  if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
290  {
291  $title .= '.'.$fileExtension;
292  }
293  // END WebDAV: Ensure that object title ends with the filename extension
294  }
295 
296  // create and insert file in grp_tree
297  include_once("./Modules/File/classes/class.ilObjFile.php");
298  $fileObj = new ilObjFile();
299  $fileObj->setTitle($title);
300  $fileObj->setDescription($description);
301  $fileObj->setFileName($upload_file["name"]);
302  //$fileObj->setFileType($upload_file["type"]);
303  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
304  $fileObj->setFileType(ilMimeTypeUtil::getMimeType(
305  "", $upload_file["name"], $upload_file["type"]));
306  $fileObj->setFileSize($upload_file["size"]);
307  $this->object_id = $fileObj->create();
308 
309  $this->putObjectInTree($fileObj, $this->parent_id);
310 
311  // upload file to filesystem
312  $fileObj->createDirectory();
313  $fileObj->getUploadFile($upload_file["tmp_name"],
314  $upload_file["name"]);
315 
316  $this->handleAutoRating($fileObj);
317 
318  // BEGIN ChangeEvent: Record write event.
319  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
320  ilChangeEvent::_recordWriteEvent($fileObj->getId(), $ilUser->getId(), 'create');
321  // END ChangeEvent: Record write event.
322 
323  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
324 
325  if ($this->ctrl->getCmd() == "saveAndMeta")
326  {
327  $this->ctrl->setParameter($this, "new_type", "");
328  $target = $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilmdeditorgui"), "listSection", "", false, false);
329  ilUtil::redirect($target);
330  }
331  else
332  {
333  $this->ctrl->returnToParent($this);
334  }
335  }
336  else
337  {
338  $single_form_gui->setValuesByPost();
339  $this->tpl->setContent($single_form_gui->getHTML());
340  }
341  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initSingleUploadForm()
FORM: Init single upload form.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static _getFileExtension($a_file_name)
Gets the file extension of the specified file name.
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
Class ilObjFile.
handleAutoRating(ilObject $a_new_obj)
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAndMeta()

ilObjFileGUI::saveAndMeta ( )

save object

public

Definition at line 348 of file class.ilObjFileGUI.php.

References save().

349  {
350  $this->save();
351  }
save()
save object
+ Here is the call graph for this function:

◆ saveUnzip()

ilObjFileGUI::saveUnzip ( )

saveUnzip object

public

Definition at line 395 of file class.ilObjFileGUI.php.

References ilObject2GUI\$access_handler, ilObject2GUI\$tree, ilObject\_lookupType(), ilObject2GUI\checkPermissionBool(), ilUtil\delDir(), ilObject2GUI\getAccessHandler(), ilUtil\ilTempnam(), initZipUploadForm(), ilUtil\makeDir(), ilFileUtils\processZipFile(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

396  {
397  $zip_form_gui = $this->initZipUploadForm();
398 
399  if ($this->checkPermissionBool("create", "", "file"))
400  {
401  if ($zip_form_gui->checkInput())
402  {
403  $zip_file = $zip_form_gui->getInput("zip_file");
404  $adopt_structure = $zip_form_gui->getInput("adopt_structure");
405 
406  include_once ("Services/Utilities/classes/class.ilFileUtils.php");
407 
408  // Create unzip-directory
409  $newDir = ilUtil::ilTempnam();
410  ilUtil::makeDir($newDir);
411 
412  // Check if permission is granted for creation of object, if necessary
413  if($this->id_type != self::WORKSPACE_NODE_ID)
414  {
415 
416  $type = ilObject::_lookupType((int)$this->parent_id, true);
417  }
418  else
419  {
420  $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
421  }
422 
423  $tree = $access_handler = null;
424  switch($type)
425  {
426  // workspace structure
427  case 'wfld':
428  case 'wsrt':
429  $permission = $this->checkPermissionBool("create", "", "wfld");
430  $containerType = "WorkspaceFolder";
431  $tree = $this->tree;
432  $access_handler = $this->getAccessHandler();
433  break;
434 
435  // use categories as structure
436  case 'cat':
437  case 'root':
438  $permission = $this->checkPermissionBool("create", "", "cat");
439  $containerType = "Category";
440  break;
441 
442  // use folders as structure (in courses)
443  default:
444  $permission = $this->checkPermissionBool("create", "", "fold");
445  $containerType = "Folder";
446  break;
447  }
448  // processZipFile (
449  // Dir to unzip,
450  // Path to uploaded file,
451  // should a structure be created (+ permission check)?
452  // ref_id of parent
453  // object that contains files (folder or category)
454  // should sendInfo be persistent?)
455  try
456  {
457  $processDone = ilFileUtils::processZipFile( $newDir,
458  $zip_file["tmp_name"],
459  ($adopt_structure && $permission),
460  $this->parent_id,
461  $containerType,
462  $tree,
464  ilUtil::sendSuccess($this->lng->txt("file_added"),true);
465  }
466  catch (ilFileUtilsException $e)
467  {
468  ilUtil::sendFailure($e->getMessage(), true);
469  }
470 
471  ilUtil::delDir($newDir);
472  $this->ctrl->returnToParent($this);
473  }
474  else
475  {
476  $zip_form_gui->setValuesByPost();
477  $this->tpl->setContent($zip_form_gui->getHTML());
478  }
479  }
480  else
481  {
482  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
483  }
484  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
getAccessHandler()
Get access handler.
initZipUploadForm($a_mode="create")
FORM: Init zip upload form.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
Class to report exception.
+ Here is the call graph for this function:

◆ sendFile()

ilObjFileGUI::sendFile ( )

Definition at line 674 of file class.ilObjFileGUI.php.

References $_GET, $ilCtrl, $ilUser, ilChangeEvent\_recordReadEvent(), and ilObject2GUI\checkPermissionBool().

675  {
676  global $ilUser, $ilCtrl;
677 
678  if(ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction']) )
679  {
680  $this->object->sendFile($_GET["hist_id"]);
681  }
682 
683  if ($this->checkPermissionBool("read"))
684  {
685  // BEGIN ChangeEvent: Record read event.
686  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
687  global $ilUser;
688  // Record read event and catchup with write events
689  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
690  $this->object->getId(), $ilUser->getId());
691  // END ChangeEvent: Record read event.
692 
693  $this->object->sendFile($_GET["hist_id"]);
694  }
695  else
696  {
697  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
698  }
699  return true;
700  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ setTabs()

ilObjFileGUI::setTabs ( )

Definition at line 865 of file class.ilObjFileGUI.php.

References ilObjectGUI\$lng, and ilObject2GUI\checkPermissionBool().

866  {
867  global $ilTabs, $lng, $ilHelp;
868 
869  $ilHelp->setScreenIdComponent("file");
870 
871  $this->ctrl->setParameter($this,"ref_id",$this->node_id);
872 
873  if ($this->checkPermissionBool("visible"))
874  {
875  $ilTabs->addTab("id_info",
876  $lng->txt("info_short"),
877  $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
878  }
879 
880  if ($this->checkPermissionBool("write"))
881  {
882  $ilTabs->addTab("settings",
883  $lng->txt("edit"),
884  $this->ctrl->getLinkTarget($this, "edit"));
885  }
886 
887  if ($this->checkPermissionBool("write"))
888  {
889  $ilTabs->addTab("id_versions",
890  $lng->txt("versions"),
891  $this->ctrl->getLinkTarget($this, "versions"));
892  }
893 
894  // meta data
895  if ($this->checkPermissionBool("write"))
896  {
897  $ilTabs->addTab("id_meta",
898  $lng->txt("meta_data"),
899  $this->ctrl->getLinkTargetByClass(array('ilobjfilegui','ilmdeditorgui'),'listSection'));
900  }
901 
902  // export
903  if ($this->checkPermissionBool("write"))
904  {
905  $ilTabs->addTab("export",
906  $lng->txt("export"),
907  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
908  }
909 
910  // will add permission tab if needed
911  parent::setTabs();
912  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
+ Here is the call graph for this function:

◆ update()

ilObjFileGUI::update ( )

updates object entry in object_data

public

Definition at line 491 of file class.ilObjFileGUI.php.

References ilObjectGUI\$data, $filename, $ilUser, ilChangeEvent\_catchupWriteEvents(), ilChangeEvent\_recordWriteEvent(), ilMimeTypeUtil\getMimeType(), initPropertiesForm(), ilUtil\redirect(), and ilUtil\sendSuccess().

492  {
493  global $ilTabs;
494 
495  $form = $this->initPropertiesForm();
496  if(!$form->checkInput())
497  {
498  $ilTabs->activateTab("settings");
499  $form->setValuesByPost();
500  $this->tpl->setContent($form->getHTML());
501  return false;
502  }
503 
504  $data = $form->getInput('file');
505 
506  // delete trailing '/' in filename
507  while (substr($data["name"],-1) == '/')
508  {
509  $data["name"] = substr($data["name"],0,-1);
510  }
511 
512  $filename = empty($data["name"]) ? $this->object->getFileName() : $data["name"];
513  $title = $form->getInput('title');
514  if(strlen(trim($title)) == 0)
515  {
516  $title = $filename;
517  }
518  else
519  {
520  $title = $this->object->checkFileExtension($filename,$title);
521  }
522  $this->object->setTitle($title);
523 
524  if (!empty($data["name"]))
525  {
526  switch($form->getInput('replace'))
527  {
528  case 1:
529  $this->object->deleteVersions();
530  $this->object->clearDataDirectory();
531  $this->object->replaceFile($data['tmp_name'],$data['name']);
532  break;
533  case 0:
534  $this->object->addFileVersion($data['tmp_name'],$data['name']);
535  break;
536  }
537  $this->object->setFileName($data['name']);
538  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
539  $this->object->setFileType(ilMimeTypeUtil::getMimeType(
540  "", $data["name"], $data["type"]));
541  $this->object->setFileSize($data['size']);
542  }
543 
544  $this->object->setDescription($form->getInput('description'));
545  $this->object->setRating($form->getInput('rating'));
546 
547  $this->update = $this->object->update();
548 
549  // BEGIN ChangeEvent: Record update event.
550  if (!empty($data["name"]))
551  {
552  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
553  global $ilUser;
554  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
555  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
556  }
557  // END ChangeEvent: Record update event.
558 
559  // Update ecs export settings
560  include_once 'Modules/File/classes/class.ilECSFileSettings.php';
561  $ecs = new ilECSFileSettings($this->object);
562  $ecs->handleSettingsUpdate();
563 
564  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
565  ilUtil::redirect($this->ctrl->getLinkTarget($this,'edit','',false,false));
566  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilECSFileSettings.
static getMimeType($a_file="", $a_filename="", $a_mime="")
Get Mime type.
$filename
Definition: buildRTE.php:89
global $ilUser
Definition: imgupload.php:15
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static redirect($a_script)
http redirect to other script
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
update()
updates object entry in object_data
+ Here is the call graph for this function:

◆ uploadFiles()

ilObjFileGUI::uploadFiles ( )

Called after a file was uploaded.

Definition at line 998 of file class.ilObjFileGUI.php.

References ilObject2GUI\checkPermissionBool(), ilJsonUtil\encode(), exit, handleFileUpload(), and initMultiUploadForm().

999  {
1000  include_once("./Services/JSON/classes/class.ilJsonUtil.php");
1001 
1002  $response = new stdClass();
1003  $response->error = null;
1004  $response->debug = null;
1005 
1006  $files = $_FILES;
1007 
1008  // load form
1009  $dnd_form_gui = $this->initMultiUploadForm();
1010  if ($dnd_form_gui->checkInput())
1011  {
1012  try
1013  {
1014  if (!$this->checkPermissionBool("create", "", "file"))
1015  {
1016  $response->error = $this->lng->txt("permission_denied");
1017  }
1018  else
1019  {
1020  // handle the file
1021  $fileresult = $this->handleFileUpload($dnd_form_gui->getInput("upload_files"));
1022  if ($fileresult)
1023  $response = (object)array_merge((array)$response, (array)$fileresult);
1024  }
1025  }
1026  catch (Exception $ex)
1027  {
1028  $response->error = $ex->getMessage() . " ## " . $ex->getTraceAsString();
1029  }
1030  }
1031  else
1032  {
1033  $dnd_input = $dnd_form_gui->getItemByPostVar("upload_files");
1034  $response->error = $dnd_input->getAlert();
1035  }
1036 
1037  // send response object (don't use 'application/json' as IE wants to download it!)
1038  header('Vary: Accept');
1039  header('Content-type: text/plain');
1040  echo ilJsonUtil::encode($response);
1041 
1042  // no further processing!
1043  exit;
1044  }
exit
Definition: login.php:54
handleFileUpload($file_upload)
Handles the upload of a single file and adds it to the parent object.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static encode($mixed, $suppress_native=false)
initMultiUploadForm()
Initializes the upload form for multiple files.
+ Here is the call graph for this function:

◆ versions()

ilObjFileGUI::versions ( )

file versions/history

public

Definition at line 708 of file class.ilObjFileGUI.php.

References ilObject2GUI\checkPermissionBool().

709  {
710  global $ilTabs;
711 
712  $ilTabs->activateTab("id_versions");
713 
714  if (!$this->checkPermissionBool("write"))
715  {
716  $this->ilErr->raiseError($this->lng->txt("permission_denied"),$this->ilErr->MESSAGE);
717  }
718 
719  // get versions
720  $versions = $this->object->getVersions();
721 
722  // build versions table
723  require_once("Modules/File/classes/class.ilFileVersionTableGUI.php");
724  $table = new ilFileVersionTableGUI($this, "versions");
725  $table->setMaxCount(sizeof($versions));
726  $table->setData($versions);
727 
728  $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
729  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
Class ilFileVersionTableGUI.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: