ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilObjSAHSLearningModuleGUI Class Reference

SCORM Learning Modules. More...

+ Inheritance diagram for ilObjSAHSLearningModuleGUI:
+ Collaboration diagram for ilObjSAHSLearningModuleGUI:

Public Member Functions

 __construct ($data, int $id, bool $call_by_reference, bool $prepare_output=true)
 Constructor. More...
 
 listFiles ()
 List files tab: forward to the container view once migrated, otherwise show an info box. More...
 
 importFromUploadDir ()
 
 getUploadDirectory ()
 
 getUploadFiles ()
 
 executeCommand ()
 execute command More...
 
 properties ()
 module properties More...
 
 saveProperties ()
 
 uploadObject ()
 display status information or report errors messages in case of error More...
 
 upload ()
 
 getTemplate ()
 output main header (title and locator) More...
 
 certificate ()
 Shows the certificate editor. More...
 
 addLocatorItems ()
 
 setSettingsSubTabs ()
 
 export ()
 
 exportModule ()
 
 getType ()
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 getAdminTabs ()
 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto (string $a_target)
 goto target course More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Data Fields

const CMD_IMPORT_FROM_UPLOAD_DIR = 'importFromUploadDir'
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Protected Member Functions

 infoScreen ()
 
 infoScreenForward ()
 
 initCreateForm (string $new_type)
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 setTabs ()
 
 getTabs ()
 adds tabs to tab gui object More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 @abstract overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Private Attributes

ilPropertyFormGUI $form
 
 $archives
 

Additional Inherited Members

- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSAHSLearningModuleGUI::__construct (   $data,
int  $id,
bool  $call_by_reference,
bool  $prepare_output = true 
)

Constructor.

Reimplemented in ilObjSCORMLearningModuleGUI.

Definition at line 47 of file class.ilObjSAHSLearningModuleGUI.php.

48 {
49 global $DIC;
50 $this->archives = $DIC->legacyArchives();
51 $lng = $DIC->language();
52 $rbacsystem = $DIC->access();
53 $lng->loadLanguageModule("content");
54 $lng->loadLanguageModule("sahs");
55 $this->type = "sahs";
57 }
loadLanguageModule(string $a_module)
Load language module.
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References ilObjectGUI\$call_by_reference, ilObjectGUI\$data, $DIC, ilObjectGUI\$id, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), and ilLanguage\loadLanguageModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjSAHSLearningModuleGUI::_goto ( string  $a_target)
static

goto target course

Definition at line 949 of file class.ilObjSAHSLearningModuleGUI.php.

949 : void
950 {
951 global $DIC;
952 $main_tpl = $DIC->ui()->mainTemplate();
953 $ilAccess = $DIC->access();
954 $ilErr = $DIC['ilErr'];
955 $lng = $DIC->language();
956
957 $targetParameters = explode('_', $a_target);
958 $id = (int) $targetParameters[0];
959
960 if ($id <= 0) {
961 $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
962 }
963
964 if ($ilAccess->checkAccess("write", "", $id)) {
965 $DIC->ctrl()->setParameterByClass("ilSAHSEditGUI", "ref_id", (string) $id);
966 $DIC->ctrl()->redirectByClass("ilSAHSEditGUI", "infoScreen"); //cmd was "" in 7
967 }
968
969 if ($ilAccess->checkAccess("visible", "", $id) || $ilAccess->checkAccess("read", "", $id)) {
970 $DIC->ctrl()->setParameterByClass("ilSAHSPresentationGUI", "ref_id", (string) $id);
971 $DIC->ctrl()->redirectByClass("ilSAHSPresentationGUI", "infoScreen");
972 } else {
973 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
974 $main_tpl->setOnScreenMessage('info', sprintf(
975 $lng->txt("msg_no_perm_read_item"),
977 ), true);
979 }
980 }
981
982 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
983 }
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
const ROOT_FOLDER_ID
Definition: constants.php:32

References $DIC, ilObjectGUI\$id, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ILIAS\Repository\int(), ROOT_FOLDER_ID, and ilLanguage\txt().

Referenced by ILIAS\StaticURL\Handler\LegacyGotoHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjSAHSLearningModuleGUI::addLocatorItems ( )
Exceptions
ilCtrlException

Reimplemented from ilObjectGUI.

Definition at line 988 of file class.ilObjSAHSLearningModuleGUI.php.

988 : void
989 {
990 global $DIC;
991 $ilLocator = $DIC['ilLocator'];
992
993 if (is_object($this->object)) {
994 $ilLocator->addItem(
995 $this->object->getTitle(),
996 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
997 "",
998 $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int())
999 );
1000 }
1001 }

References $DIC, and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ certificate()

ilObjSAHSLearningModuleGUI::certificate ( )

Shows the certificate editor.

Definition at line 804 of file class.ilObjSAHSLearningModuleGUI.php.

804 : void
805 {
806 $guiFactory = new ilCertificateGUIFactory();
807 $output_gui = $guiFactory->create($this->object);
808
809 $output_gui->certificateEditor();
810 }

◆ executeCommand()

ilObjSAHSLearningModuleGUI::executeCommand ( )

execute command

Exceptions
ilCtrlException
ilException

Reimplemented from ilObjectGUI.

Reimplemented in ilObjSCORM2004LearningModuleGUI.

Definition at line 208 of file class.ilObjSAHSLearningModuleGUI.php.

208 : void
209 {
210 global $DIC;
211 $ilAccess = $DIC->access();
212 $ilTabs = $DIC->tabs();
213 $ilErr = $DIC['ilErr'];
214 $navigationHistory = $DIC['ilNavigationHistory'];
215
216 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
217 $ilLog = ilLoggerFactory::getLogger('sahs');
218 $ilLog->debug("bc:" . $baseClass . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
219 if (strtolower($baseClass) === "iladministrationgui" ||
220 strtolower($baseClass) === "ilsahspresentationgui" ||
221 $this->getCreationMode() == true) {
222 $this->prepareOutput();
223 } else {
224 $this->getTemplate();
225 $this->setLocator();
226 $this->setTabs();
227 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
228 $this->tpl->setTitle($this->object->getTitle());
229 $navigationHistory->addItem(
230 $this->object->getRefId(),
231 ilLink::_getLink($this->object->getRefId(), $this->object->getType()),
232 $this->object->getType()
233 );
234 }
235
236 $next_class = $this->ctrl->getNextClass($this);
237 $cmd = $this->ctrl->getCmd();
238
239 switch ($next_class) {
240 case 'illtiproviderobjectsettinggui':
241 $this->setSettingsSubTabs();
242 $ilTabs->setSubTabActive('lti_provider');
243 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
244 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
245 $lti_gui->offerLTIRolesForSelection(false);
246 $this->ctrl->forwardCommand($lti_gui);
247 break;
248
249
250 case 'ilobjectmetadatagui':
251 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
252 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
253 }
254 $md_gui = new ilObjectMetaDataGUI($this->object);
255 $this->ctrl->forwardCommand($md_gui);
256 break;
257
258 // case 'ilexportgui':
259 // $exp = new ilExportGUI($this);
260 // $exp->addFormat('xml');
261 // $this->ctrl->forwardCommand($exp);
262 // break;
263
264 case 'ilpermissiongui':
265 $perm_gui = new ilPermissionGUI($this);
266 $this->ctrl->forwardCommand($perm_gui);
267 break;
268
269 case "ilfilesystemgui":
270 // legacy on-disk file editing is no longer offered; content is
271 // managed through the Resource Storage container once migrated
272 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
273 break;
274
275 case strtolower(ilContainerResourceGUI::class):
276 if (!$this->object->hasContainerResource()) {
277 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
278 }
279 $ilTabs->setTabActive('cont_list_files');
280 $check_access = $ilAccess->checkAccess('write', '', $this->object->getRefId());
281 $view_config = new ContainerViewConfiguration(
282 $this->object->getResource(),
283 new ilSAHSStakeholder(),
284 $this->lng->txt('files'),
286 250,
287 $check_access,
288 $check_access
289 );
290 if ($check_access) {
291 $upload_files = $this->getUploadFiles();
292 if ($upload_files !== []) {
293 $options = [];
294 foreach ($upload_files as $file) {
295 $options[$file] = $file;
296 }
297
298 $modal = $DIC->ui()->factory()->modal()->roundtrip(
299 $this->lng->txt('sahs_import_from_upload_dir'),
300 [],
301 [
302 $DIC->ui()->factory()->input()->field()->select(
303 $this->lng->txt('sahs_import_from_upload_dir_file_name'),
304 $options,
305 $this->lng->txt('sahs_import_from_upload_dir_info')
306 )->withRequired(true)
307 ],
308 $this->ctrl->getFormAction(
309 $this,
310 self::CMD_IMPORT_FROM_UPLOAD_DIR
311 )
312 );
313
314 $top_action = new TopAction(
315 $this->lng->txt('sahs_import_from_upload_dir'),
316 $modal->getShowSignal()
317 );
318 $view_config = $view_config->withExternalTopAction(
319 'sahs_import_from_upload_dir',
320 $top_action,
321 $modal
322 );
323 }
324 }
325 $container_gui = new ilContainerResourceGUI($view_config);
326 $this->ctrl->forwardCommand($container_gui);
327 break;
328
329 case "ilcertificategui":
330 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
331 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
332 }
333 $this->setSettingsSubTabs();
334 $ilTabs->setSubTabActive('certificate');
335
336 $guiFactory = new ilCertificateGUIFactory();
337 $output_gui = $guiFactory->create($this->object);
338
339 $this->ctrl->forwardCommand($output_gui);
340 break;
341
342 case "illearningprogressgui":
344 $this->ctrl->forwardCommand($new_gui);
345
346 break;
347
348 case "ilinfoscreengui":
349 $ilTabs->setTabActive('info_short');
350 $this->infoScreenForward();
351 break;
352
353 case "ilcommonactiondispatchergui":
355 if ($gui !== null) {
356 $this->ctrl->forwardCommand($gui);
357 }
358 break;
359
360 case 'ilobjectcopygui':
361 $this->prepareOutput();
362 $cp = new ilObjectCopyGUI($this);
363 $cp->setType('sahs');
364 $this->ctrl->forwardCommand($cp);
365 break;
366
367 default:
368 // if ($this->object && !$this->object->getEditable()) {
369 $cmd = $this->ctrl->getCmd("properties");
370 // }
371 if ((strtolower($baseClass) === "iladministrationgui" ||
372 $this->getCreationMode() == true) &&
373 $cmd !== "frameset") {
374 $cmd .= "Object";
375 }
376
377 // #9225
378 if ($cmd === "redrawHeaderAction") {
379 $cmd .= "Object";
380 }
381
382 $this->$cmd();
383 break;
384 }
385 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
The tab of an ILIAS object that releases it to the platforms allowed for its type,...
Class ilObjUserTrackingGUI.
static getLogger(string $a_component_id)
Get component logger.
getTemplate()
output main header (title and locator)
GUI class for the workflow of copying objects.
prepareOutput(bool $show_sub_objects=true)
Class ilObjectMetaDataGUI.
Stakeholder for SCORM/AICC learning module content (table sahs_lm).
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists('../ilias.ini.php'))
$GLOBALS["DIC"]
Definition: wac.php:66
$refId
Definition: xapitoken.php:58

References $DIC, $GLOBALS, ILIAS\UI\Implementation\Component\Input\Field\$options, $refId, ILIAS\Repository\ctrl(), ILIAS\components\ResourceStorage\Container\View\DATA_TABLE, ilObjectGUI\getCreationMode(), ilUtil\getImagePath(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilLoggerFactory\getLogger(), getTemplate(), getUploadFiles(), infoScreenForward(), ILIAS\Repository\lng(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ILIAS\Repository\object(), ilObjectGUI\prepareOutput(), ILIAS\Repository\rbac(), ilObjectGUI\setLocator(), setSettingsSubTabs(), and setTabs().

+ Here is the call graph for this function:

◆ export()

ilObjSAHSLearningModuleGUI::export ( )
Exceptions
ilCtrlException

Definition at line 1084 of file class.ilObjSAHSLearningModuleGUI.php.

1084 : mixed
1085 {
1086 $GLOBALS['DIC']->tabs()->setTabActive('export');
1087 $exp_gui = new ilExportGUI($this);
1088 // Here used to be $this->ctrl->setCmd("listExportFiles") in <10
1089 $exp_gui->addFormat("xml");
1090 return $this->ctrl->forwardCommand($exp_gui);
1091 }
Export User Interface Class.

References $GLOBALS, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ exportModule()

ilObjSAHSLearningModuleGUI::exportModule ( )

Definition at line 1093 of file class.ilObjSAHSLearningModuleGUI.php.

1093 : void
1094 {
1095 global $DIC;
1096 // $ilDB = $DIC->database();
1097 //
1098 $moduleId = ilObject::_lookupObjectId($DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int()));
1100 // $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
1101 }
static _lookupObjectId(int $ref_id)

References $DIC, ILIAS\TestQuestionPool\ExportImport\Foundation\Export\$exporter, and ilObject\_lookupObjectId().

+ Here is the call graph for this function:

◆ getTabs()

ilObjSAHSLearningModuleGUI::getTabs ( )
protected

adds tabs to tab gui object

Exceptions
ilCtrlException

Reimplemented from ilObjectGUI.

Definition at line 816 of file class.ilObjSAHSLearningModuleGUI.php.

816 : void
817 {
818 global $DIC;
819 $rbacsystem = $DIC->access();
820 $ilCtrl = $DIC->ctrl();
821 $ilHelp = $DIC->help();
822
823 if ($this->ctrl->getCmd() === "delete") {
824 return;
825 }
826
827 switch ($this->object->getSubType()) {
828 case "scorm2004":
829 $ilHelp->setScreenIdComponent("sahs13");
830 break;
831
832 case "scorm":
833 $ilHelp->setScreenIdComponent("sahs12");
834 break;
835 }
836
837 // list files tab — routes to the container view (migrated) or an
838 // info box (not yet migrated); legacy on-disk editing is gone
839 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
840 $this->tabs_gui->addTarget(
841 "cont_list_files",
842 $this->ctrl->getLinkTarget($this, "listFiles"),
843 "",
844 ""
845 );
846 }
847 // info screen
848 $force_active = ($this->ctrl->getNextClass() === "ilinfoscreengui")
849 ? true
850 : false;
851 $this->tabs_gui->addTarget(
852 "info_short",
853 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
854 "",
855 "ilinfoscreengui",
856 "",
857 $force_active
858 );
859
860 // properties
861 $this->tabs_gui->addTarget(
862 "settings",
863 $this->ctrl->getLinkTarget($this, "properties"),
864 array("", "properties"),
865 get_class($this)
866 );
867
868 // if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
869 // $this->tabs_gui->addTarget(
870 // 'learning_progress',
871 // $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
872 // '',
873 // array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
874 // );
875 // }
876
877 // tracking data
878 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
879 $ar_rights = [];
880 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId())) {
881 $ar_rights = ['illplistofobjectsgui'];
882 }
883 if ($rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
884 $ar_rights[] = 'illplistofsettingsgui';
885 }
886 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
887 $this->tabs_gui->addTarget(
888 'learning_progress',
889 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
890 '',
891 $ar_rights
892 );
893 }
894
895 if ($this->object->getSubType() === "scorm2004" || $this->object->getSubType() === "scorm") {
897 if ($privacy->enabledSahsProtocolData()) {
898 $scormClass = "ilobjscormlearningmodulegui";
899 if ($this->object->getSubType() === "scorm2004") {
900 $scormClass = "ilobjscorm2004learningmodulegui";
901 }
902 $this->ctrl->setParameterByClass($scormClass, "ref_id", $this->object->getRefId());
903 $this->tabs_gui->addTarget(
904 "cont_tracking_data",
905 $this->ctrl->getLinkTargetByClass(['ilsahseditgui',$scormClass], "showTrackingItems"),
906 "showTrackingItems"
907 );
908 }
909 }
910 }
911
912 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
913 $mdgui = new ilObjectMetaDataGUI($this->object);
914 $mdtab = $mdgui->getTab();
915 if ($mdtab) {
916 $this->tabs_gui->addTarget(
917 "meta_data",
918 $mdtab,
919 "",
920 "ilmdeditorgui"
921 );
922 }
923 }
924 // export - Jour Fixe Date for Decission not to allow for Users with Right Wirite?
925 if ($rbacsystem->checkAccess("edit", "", $this->object->getRefId())) {
926 $this->tabs_gui->addTarget(
927 "export",
928 $this->ctrl->getLinkTarget($this, "export"),
929 array("", "export"),
930 get_class($this)
931 );
932 }
933
934 // perm
935 if ($rbacsystem->checkAccess('edit_permission', "", $this->object->getRefId())) {
936 $this->tabs_gui->addTarget(
937 "perm_settings",
938 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
939 array("perm","info","owner"),
940 'ilpermissiongui'
941 );
942 }
943 }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress

References $DIC, ilLearningProgressAccess\checkAccess(), ILIAS\Repository\ctrl(), ilPrivacySettings\getInstance(), and ILIAS\Repository\object().

Referenced by setTabs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplate()

ilObjSAHSLearningModuleGUI::getTemplate ( )

output main header (title and locator)

Definition at line 771 of file class.ilObjSAHSLearningModuleGUI.php.

771 : void
772 {
773 global $DIC;
774 $lng = $DIC->language();
775
776 $this->tpl->loadStandardTemplate();
777 }

References $DIC, and ilObjectGUI\$lng.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getType()

ilObjSAHSLearningModuleGUI::getType ( )

Definition at line 1103 of file class.ilObjSAHSLearningModuleGUI.php.

1103 : string
1104 {
1105 return "sahs";
1106 }

◆ getUploadDirectory()

ilObjSAHSLearningModuleGUI::getUploadDirectory ( )

Definition at line 167 of file class.ilObjSAHSLearningModuleGUI.php.

167 : string
168 {
169 $import_file_factory = new ilImportDirectoryFactory();
170 try {
171 $import_directory = $import_file_factory->getInstanceForComponent(ilImportDirectoryFactory::TYPE_SAHS);
172 } catch (InvalidArgumentException) {
173 return '';
174 }
175 return $import_directory->getAbsolutePath();
176 }

References ilImportDirectoryFactory\TYPE_SAHS.

Referenced by getUploadFiles(), and importFromUploadDir().

+ Here is the caller graph for this function:

◆ getUploadFiles()

ilObjSAHSLearningModuleGUI::getUploadFiles ( )
Returns
string[]

Definition at line 181 of file class.ilObjSAHSLearningModuleGUI.php.

181 : array
182 {
183 $upload_dir = $this->getUploadDirectory();
184 if ($upload_dir === '') {
185 return [];
186 }
187 $handle = opendir($upload_dir);
188 if ($handle === false) {
189 return [];
190 }
191 $files = [];
192 while (false !== ($file = readdir($handle))) {
193 $full_path = $upload_dir . "/" . $file;
194 if (is_file($full_path) && is_readable($full_path)) {
195 $files[] = $file;
196 }
197 }
198 closedir($handle);
199 sort($files);
200 return $files;
201 }

References $files, getUploadDirectory(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFile()

ilObjSAHSLearningModuleGUI::importFile ( string  $file_to_import,
string  $path_to_uploaded_file_in_temp_dir 
)
protected

ILIAS\DI\Container $DIC

Reimplemented from ilObjectGUI.

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

674 : void
675 {
677 global $DIC;
678 $ilLog = $DIC['log'];
679
680 $lm_temp_dir = ilFileUtils::ilTempnam();
681 ilFileUtils::makeDir($lm_temp_dir);
682 $zar = new ZipArchive();
683 $zar->open($file_to_import);
684 $zar->extractTo($lm_temp_dir);
685 $zar->close();
686 ilFileUtils::renameExecutables($lm_temp_dir);
687 $importer = new ilScormAiccImporter();
688 $import_dirname = $lm_temp_dir . '/' . substr(basename($file_to_import), 0, -4);
689 $importer->importXmlRepresentation("sahs", "", $import_dirname, null);
690 $import_result = $importer->getResult();
691
692 if ($import_result->isOK()) {
693 $properties = $import_result->value();
694 if (($subType = $properties['SubType']) === 'scorm') {
695 $new_obj = new ilObjSCORMLearningModule();
696 } else {
697 $new_obj = new ilObjSCORM2004LearningModule();
698 }
699 $name = $properties['Title'];
700 $description = $properties['Description'];
701 } else {
702 ilFileUtils::delDir($lm_temp_dir, false);
703 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
704 $ilLog->error('SCORM import of ILIAS exportfile not possible because parsing error');
705 $ilLog->error($import_result->error());
706 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("import_file_not_valid_here"), true);
707 return;
708 }
709
710 $new_obj->setTitle($name);
711 $new_obj->setSubType($subType);
712 $new_obj->setDescription($description);
713 $new_obj->create(true);
714 $this->putObjectInTree($new_obj);
715 $new_obj->setOfflineStatus(false);
716
717 // create data directory, copy file to directory
718 $new_obj->createDataDirectory();
719
720 // Handle content.zip
721 $scorm_file = "content.zip";
722 $file_path = $import_dirname . "/" . $scorm_file;
723 // Unzip content.zip before copying
724 $content_unzip_dir = $import_dirname . '/content';
725 $this->archives->unzip(
726 $file_path,
727 $content_unzip_dir,
728 false,
729 false,
730 false
731 );
732 // Handle ILIAS 9 Exports containing 'lm_x' directories
733 $source_dir_for_copy = $content_unzip_dir;
734 $content_unzip_dir_iterator = new DirectoryIterator($content_unzip_dir);
735 foreach ($content_unzip_dir_iterator as $fileinfo) {
736 if ($fileinfo->isDir() && !$fileinfo->isDot()) {
737 if (preg_match('/^lm_\d+$/', $fileinfo->getFilename())) {
738 $source_dir_for_copy = $source_dir_for_copy . '/' . $fileinfo->getFilename();
739 break;
740 }
741 }
742 }
743 // Move content
744 ilFileUtils::rename($source_dir_for_copy, $new_obj->getDataDirectory());
745 // Cleanup
746 ilFileUtils::delDir($lm_temp_dir, false);
747 ilFileUtils::renameExecutables($new_obj->getDataDirectory());
748
749 $title = $new_obj->readObject();
750 if ($title !== "") {
751 ilObject::_writeTitle($new_obj->getId(), $title);
752 }
753
754 // move the imported package into a Resource Storage container
755 $new_obj->moveDataDirectoryToContainer();
756
757 //auto set learning progress settings
758 $new_obj->setLearningProgressSettingsAtUpload();
759
760 $importer->writeData("sahs", "5.1.0", $new_obj->getId());
761
762 $this->tpl->setOnScreenMessage('info', $this->lng->txt($new_obj->getType() . "_added"), true);
763 $this->ctrl->setParameterByClass(self::class, 'ref_id', $new_obj->getRefId());
764 $this->ctrl->redirectByClass(self::class);
765 }
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static rename(string $a_source, string $a_target)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static renameExecutables(string $a_dir)
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
deleteUploadedImportFile(string $path_to_uploaded_file_in_temp_dir)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
static _writeTitle(int $obj_id, string $title)
write title to db (static)

References $DIC, ilObject\_writeTitle(), ILIAS\Repository\ctrl(), ilFileUtils\delDir(), ilObjectGUI\deleteUploadedImportFile(), ilFileUtils\ilTempnam(), ILIAS\Repository\lng(), ilFileUtils\makeDir(), ilObjectGUI\putObjectInTree(), ilFileUtils\rename(), and ilFileUtils\renameExecutables().

+ Here is the call graph for this function:

◆ importFromUploadDir()

ilObjSAHSLearningModuleGUI::importFromUploadDir ( )

Definition at line 77 of file class.ilObjSAHSLearningModuleGUI.php.

77 : void
78 {
79 global $DIC;
80 if (!$DIC->access()->checkAccess("write", "", $this->object->getRefId())) {
81 $DIC->ui()->mainTemplate()->setOnScreenMessage(
82 'failure',
83 $this->lng->txt("msg_no_perm_write"),
84 true
85 );
87 return;
88 }
89
90 $resource = $this->object->getResource();
91 if ($resource === null) {
92 $DIC->ui()->mainTemplate()->setOnScreenMessage(
93 'failure',
94 $this->lng->txt('permission_denied'),
95 true
96 );
97 $this->ctrl->redirect($this, "listFiles");
98 return;
99 }
100
101 $file = '';
102 if ($DIC->http()->wrapper()->post()->has('form/input_0')) {
103 $file = $DIC->http()->wrapper()->post()->retrieve(
104 'form/input_0',
105 $DIC->refinery()->kindlyTo()->string()
106 );
107 }
108
109 $upload_directory = $this->getUploadDirectory();
110 $path = $upload_directory . DIRECTORY_SEPARATOR . $file;
111 $real_path = realpath($path);
112 $upload_directory_prefix = rtrim($upload_directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
113 $is_upload_file = $upload_directory !== ''
114 && $real_path !== false
115 && is_readable($real_path)
116 && str_starts_with($real_path, $upload_directory_prefix);
117
118 if ($file === '') {
119 $DIC->ui()->mainTemplate()->setOnScreenMessage(
120 'failure',
121 $this->lng->txt('sahs_import_from_upload_dir_info'),
122 true
123 );
124 } elseif ($is_upload_file) {
125 $stream_resource = fopen($real_path, 'rb');
126 if ($stream_resource === false) {
127 $DIC->ui()->mainTemplate()->setOnScreenMessage(
128 'failure',
129 $this->lng->txt('sahs_file_import_from_upload_dir_failed'),
130 true
131 );
132 } else {
133 try {
134 $success = $DIC->resourceStorage()->manageContainer()->addStreamToContainer(
135 $resource->getIdentification(),
136 Streams::ofResource($stream_resource),
137 $file
138 );
139 } finally {
140 fclose($stream_resource);
141 }
142 if ($success) {
143 $DIC->ui()->mainTemplate()->setOnScreenMessage(
144 'success',
145 $this->lng->txt('sahs_file_imported_from_upload_dir'),
146 true
147 );
148 } else {
149 $DIC->ui()->mainTemplate()->setOnScreenMessage(
150 'failure',
151 $this->lng->txt('sahs_file_import_from_upload_dir_failed'),
152 true
153 );
154 }
155 }
156 } else {
157 $DIC->ui()->mainTemplate()->setOnScreenMessage(
158 'failure',
159 $this->lng->txt('sahs_file_import_from_upload_dir_failed'),
160 true
161 );
162 }
163
164 $this->ctrl->redirect($this, "listFiles");
165 }

References $DIC, ilObjectGUI\_gotoRepositoryRoot(), ILIAS\Repository\ctrl(), getUploadDirectory(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ infoScreen()

ilObjSAHSLearningModuleGUI::infoScreen ( )
protected

Definition at line 387 of file class.ilObjSAHSLearningModuleGUI.php.

387 : void
388 {
389 if (strtolower($this->ctrl->getCmd() ?? '') === 'infoscreen') {
390 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, 'showSummary');
391 }
392
393 $this->infoScreenForward();
394 }

References ILIAS\Repository\ctrl(), and infoScreenForward().

+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjSAHSLearningModuleGUI::infoScreenForward ( )
protected

Definition at line 396 of file class.ilObjSAHSLearningModuleGUI.php.

396 : void
397 {
398 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
399 $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
400 }
401
402 $info = new ilInfoScreenGUI($this);
403 $info->enablePrivateNotes();
404 $info->enableLearningProgress();
405
406 // add read / back button
407 if ($this->checkPermissionBool("read")) {
408 $ilToolbar = $GLOBALS['DIC']->toolbar();
409 $ilToolbar->addComponent($this->object->getViewButton());
410 }
411
412 $info->enableNewsEditing(false);
413 if ($this->checkPermissionBool("write")) {
414 $news_set = new ilSetting("news");
415 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
416 if ($enable_internal_rss) {
417 $info->setBlockProperty("news", "settings", "");
418 $info->setBlockProperty("news", "public_notifications_option", "true");
419 }
420 }
421 // show standard meta data section
422 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
423
424 // forward the command
425 $this->ctrl->forwardCommand($info);
426 }
Class ilInfoScreenGUI.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ILIAS Setting Class.
$info
Definition: entry_point.php:21

References $GLOBALS, $info, ilObjectGUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by executeCommand(), and infoScreen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreateForm()

ilObjSAHSLearningModuleGUI::initCreateForm ( string  $new_type)
protected

Reimplemented from ilObjectGUI.

Definition at line 458 of file class.ilObjSAHSLearningModuleGUI.php.

459 {
460 global $DIC;
461 $lng = $DIC->language();
462 $ilCtrl = $DIC->ctrl();
463 $form = new ilPropertyFormGUI();
464
465 // type selection
466 $radg = new ilRadioGroupInputGUI($lng->txt("type"), "sub_type");
467 $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm"), "scorm");
468 $op0->setInfo($this->lng->txt("lm_type_scorm_info"));
469 $radg->addOption($op0);
470 $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm2004"), "scorm2004");
471 $op0->setInfo($this->lng->txt("lm_type_scorm2004_info"));
472 $radg->addOption($op0);
473 $radg->setValue("scorm");
474 $form->addItem($radg);
475
476 $options = array();
478 $options[""] = $this->lng->txt("cont_select_from_upload_dir");
480 foreach ($files as $file) {
481 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
482 $options[$file] = $file;
483 }
484 }
485 if (count($options) > 1) {
486 // choose upload directory
487 $radg = new ilRadioGroupInputGUI($lng->txt("cont_choose_file_source"), "file_source");
488 $op0 = new ilRadioOption($this->lng->txt("cont_choose_local"), "local");
489 $radg->addOption($op0);
490 $op1 = new ilRadioOption($this->lng->txt("cont_choose_upload_dir"), "upload_dir");
491 $radg->addOption($op1);
492 $radg->setValue("local");
493
494 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
495 $fi->setRequired(true);
496 $op0->addSubItem($fi);
497
498 $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
499 $si->setOptions($options);
500 $op1->addSubItem($si);
501
502 $form->addItem($radg);
503 } else {
504 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
505 $fi->setRequired(true);
506 $form->addItem($fi);
507 }
508
509 $form->addCommandButton("upload", $lng->txt("create"));
510 $form->addCommandButton("cancel", $lng->txt("cancel"));
511
512 $form->setTitle($lng->txt("import_sahs"));
513 $form->setFormAction($ilCtrl->getFormAction($this, "upload"));
515 return $form;
516 }
This class represents a file property in a property form.
setFormAction(string $a_formaction)
setTarget(string $a_target)
static _getFrame(string $a_class)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
static _getUploadDirectory()

References $DIC, $files, $form, ilObjectGUI\$lng, ILIAS\UI\Implementation\Component\Input\Field\$options, ilFrameTargetInfo\_getFrame(), ilUploadFiles\_getUploadDirectory(), ilUploadFiles\_getUploadFiles(), ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), ilFormGUI\setTarget(), ilPropertyFormGUI\setTitle(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ listFiles()

ilObjSAHSLearningModuleGUI::listFiles ( )

List files tab: forward to the container view once migrated, otherwise show an info box.

Definition at line 63 of file class.ilObjSAHSLearningModuleGUI.php.

63 : void
64 {
65 global $DIC;
66 if ($this->object->hasContainerResource()) {
67 $this->ctrl->redirectByClass(ilContainerResourceGUI::class);
68 return;
69 }
70 $this->tabs_gui->setTabActive('cont_list_files');
71 $message_box = $DIC->ui()->factory()->messageBox()->info(
72 $this->lng->txt('infobox_files_not_migrated')
73 );
74 $this->tpl->setContent($DIC->ui()->renderer()->render([$message_box]));
75 }

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ properties()

ilObjSAHSLearningModuleGUI::properties ( )

module properties

Reimplemented in ilObjSCORM2004LearningModuleGUI, and ilObjSCORMLearningModuleGUI.

Definition at line 444 of file class.ilObjSAHSLearningModuleGUI.php.

444 : void
445 {
446 $this->ctrl->setParameterByClass(
447 "ilSAHSEditGUI",
448 "ref_id",
449 $this->ref_id
450 );
451 $this->ctrl->redirectByClass(ilSAHSEditGUI::class);
452 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ saveProperties()

ilObjSAHSLearningModuleGUI::saveProperties ( )

Reimplemented in ilObjSCORM2004LearningModuleGUI, and ilObjSCORMLearningModuleGUI.

Definition at line 454 of file class.ilObjSAHSLearningModuleGUI.php.

454 : void
455 {
456 }

◆ setSettingsSubTabs()

ilObjSAHSLearningModuleGUI::setSettingsSubTabs ( )
Exceptions
ilCtrlException

Definition at line 1024 of file class.ilObjSAHSLearningModuleGUI.php.

1024 : void
1025 {
1026 global $DIC;
1027 $lng = $DIC->language();
1028 $ilTabs = $DIC->tabs();
1029 $ilCtrl = $DIC->ctrl();
1030
1031 $ilTabs->addSubTabTarget(
1032 "general",
1033 $this->ctrl->getLinkTarget($this, "properties"),
1034 array("edit", ""),
1035 get_class($this)
1036 );
1037
1038 $ilTabs->addSubTabTarget(
1039 "cont_sc_new_version",
1040 $this->ctrl->getLinkTarget($this, "newModuleVersion"),
1041 array("edit", ""),
1042 get_class($this)
1043 );
1044
1045 if (method_exists($this, 'adoptSettings')) {
1046 $ilTabs->addSubTabTarget(
1047 "sahs_adopt_settings",
1048 $this->ctrl->getLinkTarget($this, "adoptSettings"),
1049 array("edit", ""),
1050 get_class($this)
1051 );
1052 }
1053
1054 $validator = new ilCertificateActiveValidator();
1055 if (true === $validator->validate()) {
1056 // // create and insert object in objecttree
1057 // $ilTabs->addSubTabTarget("certificate",
1058 // $this->ctrl->getLinkTarget($this, "certificate"),
1059 // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
1060 // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
1061 // );
1062 $ilTabs->addSubTabTarget(
1063 "certificate",
1064 $this->ctrl->getLinkTargetByClass([static::class, "ilcertificategui"], "certificateeditor"),
1065 "",
1066 "ilcertificategui"
1067 );
1068 }
1069
1070 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1071 if ($lti_settings->hasSettingsAccess()) {
1072 $ilTabs->addSubTabTarget(
1073 'lti_provider',
1074 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1075 );
1076 }
1077
1078 $ilTabs->setTabActive('settings');
1079 }

References $DIC, ilObjectGUI\$lng, ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

Referenced by ilObjSCORMLearningModuleGUI\adoptSettings(), ilObjSCORMLearningModuleGUI\applyAdoptSettings(), executeCommand(), ilObjSCORMLearningModuleGUI\newModuleVersion(), ilObjSCORM2004LearningModuleGUI\properties(), and ilObjSCORMLearningModuleGUI\properties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTabs()

ilObjSAHSLearningModuleGUI::setTabs ( )
protected
Exceptions
ilCtrlException

Reimplemented from ilObjectGUI.

Definition at line 782 of file class.ilObjSAHSLearningModuleGUI.php.

782 : void
783 {
784 global $DIC;
785 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
786 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
787 $this->tpl->setTitle($this->object->getTitle());
788 $this->tpl->setDescription($this->object->getDescription());
789 if ($this->object && $this->object->getOfflineStatus()) {
790 $this->tpl->setAlertProperties(array(
791 array("alert" => true,
792 "property" => $this->lng->txt("status"),
793 "value" => $this->lng->txt("offline"))
794 ));
795 }
796 if (strtolower($baseClass) === "ilsahseditgui" || strtolower($baseClass) === "ilrepositorygui") {
797 $this->getTabs();
798 }
799 }

References $DIC, $refId, ilUtil\getImagePath(), getTabs(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ upload()

ilObjSAHSLearningModuleGUI::upload ( )
Exceptions
ilDatabaseException
ilException
ilFileUtilsException
ilObjectNotFoundException

Definition at line 669 of file class.ilObjSAHSLearningModuleGUI.php.

669 : void
670 {
671 $this->uploadObject();
672 }
uploadObject()
display status information or report errors messages in case of error

References uploadObject().

+ Here is the call graph for this function:

◆ uploadObject()

ilObjSAHSLearningModuleGUI::uploadObject ( )

display status information or report errors messages in case of error

Exceptions
ilDatabaseException
ilException
ilFileUtilsException
ilObjectNotFoundException

Definition at line 526 of file class.ilObjSAHSLearningModuleGUI.php.

526 : void
527 {
528 global $DIC;
529 $rbacsystem = $DIC->access();
530 $ilErr = $DIC['ilErr'];
531 $ilLog = ilLoggerFactory::getLogger('sahs');
532 $refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
533 $importFromXml = false;
534
535 // check create permission
536 if (!$rbacsystem->checkAccess("create", '', $refId, "sahs")) {
537 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->WARNING);
538 } elseif ($_FILES["scormfile"]["name"]) {
539 // check if file was uploaded
540 $source = $_FILES["scormfile"]["tmp_name"];
541 if (($source === 'none') || (!$source)) {
542 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
543 }
544 // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
545 switch ($_FILES["scormfile"]["error"]) {
546 case UPLOAD_ERR_INI_SIZE:
547 case UPLOAD_ERR_FORM_SIZE:
548 $ilErr->raiseError($this->lng->txt("err_max_file_size_exceeds"), $ilErr->MESSAGE);
549 break;
550
551 case UPLOAD_ERR_PARTIAL:
552 $ilErr->raiseError($this->lng->txt("err_partial_file_upload"), $ilErr->MESSAGE);
553 break;
554
555 case UPLOAD_ERR_NO_FILE:
556 $ilErr->raiseError($this->lng->txt("err_no_file_uploaded"), $ilErr->MESSAGE);
557 break;
558 }
559
560 $file = pathinfo($_FILES["scormfile"]["name"]);
561 } elseif ($DIC->http()->wrapper()->post()->has('uploaded_file')) {
562 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
563 // check if the file is in the upload directory and readable
564 if (!ilUploadFiles::_checkUploadFile($uploadedFile)) {
565 $ilErr->raiseError($this->lng->txt("upload_error_file_not_found"), $ilErr->MESSAGE);
566 }
567
568 $file = pathinfo($uploadedFile);
569 } else {
570 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
571 }
572
573 $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
574 if ($name == "") {
575 $name = $this->lng->txt("no_title");
576 }
577
578 $description = "";
579
580 $subType = "scorm2004";
581 if ($DIC->http()->wrapper()->post()->has('sub_type')) {
582 $subType = $DIC->http()->wrapper()->post()->retrieve('sub_type', $DIC->refinery()->kindlyTo()->string());
583 }
584
585 // always import authoring packages as scorm2004, see bug #27801
586 // if ($_POST["editable"] == 'y') {
587 // $subType = "scorm2004";
588 // }
589
590 // create and insert object in objecttree
591 switch ($subType) {
592 case "scorm2004":
593 $newObj = new ilObjSCORM2004LearningModule();
594 break;
595
596 case "scorm":
597 $newObj = new ilObjSCORMLearningModule();
598 break;
599 }
600
601 $newObj->setTitle($name);
602 $newObj->setSubType($subType);
603 $newObj->setDescription($description);
604 $newObj->create(true);
605 $newObj->createReference();
606 $newObj->putInTree($refId);
607 $newObj->setPermissions($refId);
608 $newObj->setOfflineStatus(true);
609
610 // create data directory, copy file to directory
611 $newObj->createDataDirectory();
612
613 if ($_FILES["scormfile"]["name"]) {
614 // copy uploaded file to data directory
615 $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
617 $_FILES["scormfile"]["tmp_name"],
618 $_FILES["scormfile"]["name"],
619 $file_path
620 );
621 $this->archives->unzip(
622 $file_path,
623 $newObj->getDataDirectory(),
624 false,
625 false,
626 false
627 );
628 } else {
629 // copy uploaded file to data directory
630 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
631 $file_path = $newObj->getDataDirectory() . "/" . $uploadedFile;
632 ilUploadFiles::_copyUploadFile($uploadedFile, $file_path);
633 $this->archives->unzip(
634 $file_path,
635 $newObj->getDataDirectory(),
636 false,
637 false,
638 false
639 );
640 }
641 ilFileUtils::renameExecutables($newObj->getDataDirectory());
642
643 $title = $newObj->readObject();
644 if ($title != "") {
645 $newObj->setTitle($title);
646 ilObject::_writeTitle($newObj->getId(), $title);
647 }
648
649 // move the freshly uploaded package into a Resource Storage container
650 $newObj->moveDataDirectoryToContainer();
651
652 //auto set learning progress settings
653 $newObj->setLearningProgressSettingsAtUpload();
654
655 if ($importFromXml) {
656 $importer->writeData("sahs", "5.1.0", $newObj->getId());
657 }
658
659 $this->tpl->setOnScreenMessage('info', $this->lng->txt($newObj->getType() . "_added"), true);
660 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
661 }
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
static _checkUploadFile(string $a_file)
static redirect(string $a_script)

References $DIC, $refId, ilUploadFiles\_checkUploadFile(), ilUploadFiles\_copyUploadFile(), ilObject\_writeTitle(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), ilFileUtils\moveUploadedFile(), ilUtil\redirect(), and ilFileUtils\renameExecutables().

Referenced by upload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $archives

ilObjSAHSLearningModuleGUI::$archives
private

Definition at line 42 of file class.ilObjSAHSLearningModuleGUI.php.

◆ $form

ilPropertyFormGUI ilObjSAHSLearningModuleGUI::$form
private

Definition at line 41 of file class.ilObjSAHSLearningModuleGUI.php.

Referenced by initCreateForm().

◆ CMD_IMPORT_FROM_UPLOAD_DIR

const ilObjSAHSLearningModuleGUI::CMD_IMPORT_FROM_UPLOAD_DIR = 'importFromUploadDir'

Definition at line 40 of file class.ilObjSAHSLearningModuleGUI.php.


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