ILIAS  release_8 Revision v8.24
ilObjUserFolder Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjUserFolder:
+ Collaboration diagram for ilObjUserFolder:

Public Member Functions

 __construct (int $a_id, bool $a_call_by_reference=true)
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 getExportFilename (string $a_mode=self::FILE_TYPE_EXCEL)
 
 getExportDirectory ()
 
 getExportFiles ()
 Get a list of the already exported files in the export directory. More...
 
 buildExportFile (string $a_mode=self::FILE_TYPE_EXCEL, ?array $user_data_filter=null, bool $use_temp_dir=false)
 build xml export file More...
 
- Public Member Functions inherited from ilObject
 __construct (int $id=0, bool $reference=true)
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getExportSettings ()
 
static getProfileFields ()
 Get profile fields. More...
 
static _writeNewAccountMail (string $a_lang, string $a_subject, string $a_sal_g, string $a_sal_f, string $a_sal_m, string $a_body)
 
static _updateAccountMailAttachment (string $a_lang, string $a_tmp_name, string $a_name)
 Update account mail attachment. More...
 
static _deleteAccountMailAttachment (string $a_lang)
 Delete account mail attachment. More...
 
static _lookupNewAccountMail (string $a_lang)
 
static _updateUserFolderAssignment (int $a_old_id, int $a_new_id)
 Update user folder assignment Typically called after deleting a category with local user accounts. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, \ilDBInterface $ilDB=null)
 

Data Fields

const ORG_OP_EDIT_USER_ACCOUNTS = 'edit_user_accounts'
 
const FILE_TYPE_EXCEL = 'userfolder_export_excel_x86'
 
const FILE_TYPE_CSV = 'userfolder_export_csv'
 
const FILE_TYPE_XML = 'userfolder_export_xml'
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 escapeXML (string $value)
 
 createXMLExport (array $settings, array $data, string $filename)
 
 getUserDefinedExportFields ()
 Get all exportable user defined fields. More...
 
 createCSVExport (array $settings, array $data, string $filename)
 
 createExcelExport (array $settings, array $data, string $filename)
 
 createExportDirectory ()
 creates data directory for export files More...
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Additional Inherited Members

- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
int $id
 
bool $referenced
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjUserFolder

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilObjUserFolder.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjUserFolder::__construct ( int  $id,
bool  $reference = true 
)
Parameters
int$idreference_id or object_id
bool$referencebool treat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

Definition at line 31 of file class.ilObjUserFolder.php.

34 {
35 $this->type = "usrf";
36 parent::__construct($a_id, $a_call_by_reference);
37 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAccountMailAttachment()

static ilObjUserFolder::_deleteAccountMailAttachment ( string  $a_lang)
static

Delete account mail attachment.

Definition at line 550 of file class.ilObjUserFolder.php.

552 : void {
553 global $DIC;
554
555 $ilDB = $DIC['ilDB'];
556
558 $path = $fs->getAbsolutePath() . "/";
559
560 if (file_exists($path . $a_lang)) {
561 unlink($path . $a_lang);
562 }
563
564 $ilDB->update(
565 'mail_template',
566 array('att_file' => array('text', '')),
567 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
568 );
569 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const USER_FOLDER_ID
Definition: constants.php:33
global $DIC
Definition: feed.php:28
$path
Definition: ltiservices.php:32

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

+ Here is the caller graph for this function:

◆ _lookupNewAccountMail()

static ilObjUserFolder::_lookupNewAccountMail ( string  $a_lang)
static
Parameters
string$a_lang
Returns
array{lang: string, subject: string|null, body: string|null, salf_m: string|null sal_f: string|null, sal_g: string|null, type: string, att_file: string|null}

Definition at line 575 of file class.ilObjUserFolder.php.

575 : array
576 {
577 global $DIC;
578
579 $ilDB = $DIC['ilDB'];
580
581 $set = $ilDB->query("SELECT * FROM mail_template " .
582 " WHERE type='nacc' AND lang = " . $ilDB->quote($a_lang, 'text'));
583
584 if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
585 return $rec;
586 }
587
588 return [];
589 }

References $DIC, $ilDB, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjUserFolderGUI\initNewAccountMailForm(), ilObjUserFolderGUI\initUserRoleAssignmentForm(), ilAccountMail\readAccountMail(), and ilAccountRegistrationMail\trySendingUserDefinedAccountMail().

+ Here is the caller graph for this function:

◆ _updateAccountMailAttachment()

static ilObjUserFolder::_updateAccountMailAttachment ( string  $a_lang,
string  $a_tmp_name,
string  $a_name 
)
static

Update account mail attachment.

Exceptions
ilException

Definition at line 525 of file class.ilObjUserFolder.php.

529 : void {
530 global $DIC;
531
532 $ilDB = $DIC['ilDB'];
533
535 $fs->create();
536 $path = $fs->getAbsolutePath() . "/";
537
538 ilFileUtils::moveUploadedFile($a_tmp_name, $a_lang, $path . $a_lang);
539
540 $ilDB->update(
541 'mail_template',
542 array('att_file' => array('text', $a_name)),
543 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
544 );
545 }
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

+ Here is the caller graph for this function:

◆ _updateUserFolderAssignment()

static ilObjUserFolder::_updateUserFolderAssignment ( int  $a_old_id,
int  $a_new_id 
)
static

Update user folder assignment Typically called after deleting a category with local user accounts.

These users will be assigned to the global user folder.

Definition at line 596 of file class.ilObjUserFolder.php.

599 : void {
600 global $DIC;
601
602 $ilDB = $DIC['ilDB'];
603
604 $query = "UPDATE usr_data SET time_limit_owner = " . $ilDB->quote($a_new_id, "integer") . " " .
605 "WHERE time_limit_owner = " . $ilDB->quote($a_old_id, "integer") . " ";
606 $ilDB->manipulate($query);
607 }
$query

Referenced by ilObjCategory\delete(), and ilObjOrgUnit\delete().

+ Here is the caller graph for this function:

◆ _writeNewAccountMail()

static ilObjUserFolder::_writeNewAccountMail ( string  $a_lang,
string  $a_subject,
string  $a_sal_g,
string  $a_sal_f,
string  $a_sal_m,
string  $a_body 
)
static

Definition at line 482 of file class.ilObjUserFolder.php.

489 : void {
490 global $DIC;
491
492 $ilDB = $DIC['ilDB'];
493
494 if (self::_lookupNewAccountMail($a_lang)) {
495 $values = array(
496 'subject' => array('text',$a_subject),
497 'body' => array('clob',$a_body),
498 'sal_g' => array('text',$a_sal_g),
499 'sal_f' => array('text',$a_sal_f),
500 'sal_m' => array('text',$a_sal_m)
501 );
502 $ilDB->update(
503 'mail_template',
504 $values,
505 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
506 );
507 } else {
508 $values = array(
509 'subject' => array('text',$a_subject),
510 'body' => array('clob',$a_body),
511 'sal_g' => array('text',$a_sal_g),
512 'sal_f' => array('text',$a_sal_f),
513 'sal_m' => array('text',$a_sal_m),
514 'lang' => array('text',$a_lang),
515 'type' => array('text','nacc')
516 );
517 $ilDB->insert('mail_template', $values);
518 }
519 }

References $ilDB.

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

+ Here is the caller graph for this function:

◆ buildExportFile()

ilObjUserFolder::buildExportFile ( string  $a_mode = self::FILE_TYPE_EXCEL,
?array  $user_data_filter = null,
bool  $use_temp_dir = false 
)

build xml export file

Definition at line 358 of file class.ilObjUserFolder.php.

362 : string {
363 global $DIC;
364
365 $ilDB = $DIC['ilDB'];
366 $lng = $DIC['lng'];
367
368 if ($use_temp_dir) {
369 $expDir = ilFileUtils::ilTempnam();
370 $fullname = $expDir;
371 } else {
372 $expDir = $this->getExportDirectory();
373 // create export directory if needed
374 $this->createExportDirectory();
375 $fullname = $expDir . "/" . $this->getExportFilename($a_mode);
376 }
377
378 //get data
379 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
381
382 // user languages
383 $query = "SELECT * FROM usr_pref WHERE keyword = " . $ilDB->quote('language', 'text');
384 $res = $ilDB->query($query);
385 $languages = array();
386 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
387 $languages[$row['usr_id']] = $row['value'];
388 }
389
390 // multi-text
391 $multi = array();
392 $set = $ilDB->query("SELECT * FROM usr_data_multi");
393 while ($row = $ilDB->fetchAssoc($set)) {
394 if (!is_array($user_data_filter) ||
395 in_array($row["usr_id"], $user_data_filter)) {
396 $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
397 }
398 }
399
400 $data = array();
401 $query = "SELECT usr_data.* FROM usr_data " .
402 " ORDER BY usr_data.lastname, usr_data.firstname";
403 $result = $ilDB->query($query);
404 while ($row = $ilDB->fetchAssoc($result)) {
405 if (isset($languages[$row['usr_id']])) {
406 $row['language'] = $languages[$row['usr_id']];
407 } else {
408 $row['language'] = $lng->getDefaultLanguage();
409 }
410
411 if (isset($multi[$row["usr_id"]])) {
412 $row = array_merge($row, $multi[$row["usr_id"]]);
413 }
414
415 if (is_array($user_data_filter)) {
416 if (in_array($row["usr_id"], $user_data_filter)) {
417 $data[] = $row;
418 }
419 } else {
420 $data[] = $row;
421 }
422 }
423 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
424
425 switch ($a_mode) {
427 $this->createExcelExport($settings, $data, $fullname);
428 break;
430 $this->createCSVExport($settings, $data, $fullname);
431 break;
433 $this->createXMLExport($settings, $data, $fullname);
434 break;
435 }
436 return $fullname;
437 }
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
getDefaultLanguage()
Return default language.
createExportDirectory()
creates data directory for export files
createCSVExport(array $settings, array $data, string $filename)
createXMLExport(array $settings, array $data, string $filename)
createExcelExport(array $settings, array $data, string $filename)
getExportFilename(string $a_mode=self::FILE_TYPE_EXCEL)
ilLanguage $lng
$res
Definition: ltiservices.php:69
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References ilFileUtils\ilTempnam().

+ Here is the call graph for this function:

◆ createCSVExport()

ilObjUserFolder::createCSVExport ( array  $settings,
array  $data,
string  $filename 
)
protected

Definition at line 164 of file class.ilObjUserFolder.php.

168 : void {
169
170 // header
171 $headerrow = array();
172 $udf_ex_fields = $this->getUserDefinedExportFields();
173 foreach ($settings as $value) { // standard fields
174 $headerrow[] = $this->lng->txt($value);
175 }
176 foreach ($udf_ex_fields as $f) { // custom fields
177 $headerrow[] = $f["name"];
178 }
179
180 $separator = ";";
181 $file = fopen($filename, 'wb');
182 $formattedrow = &ilCSVUtil::processCSVRow($headerrow, true, $separator);
183 fwrite($file, implode($separator, $formattedrow) . "\n");
184 foreach ($data as $row) {
185 $csvrow = array();
186 foreach ($settings as $header) { // standard fields
187 // multi-text
188 if (isset($row[$header]) && is_array($row[$header])) {
189 $row[$header] = implode(", ", $row[$header]);
190 }
191
192 $csvrow[] = $row[$header] ?? '';
193 }
194
195 // custom fields
196 reset($udf_ex_fields);
197 if (count($udf_ex_fields) > 0) {
198 $udf = new ilUserDefinedData($row["usr_id"]);
199 foreach ($udf_ex_fields as $f) { // custom fields
200 $csvrow[] = $udf->get("f_" . $f["id"]);
201 }
202 }
203
204 $formattedrow = &ilCSVUtil::processCSVRow($csvrow, true, $separator);
205 fwrite($file, implode($separator, $formattedrow) . "\n");
206 }
207 fclose($file);
208 }
$filename
Definition: buildRTE.php:78
static & processCSVRow(array &$row, bool $quoteAll=false, string $separator=";", bool $outUTF8=false, bool $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
getUserDefinedExportFields()
Get all exportable user defined fields.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ createExcelExport()

ilObjUserFolder::createExcelExport ( array  $settings,
array  $data,
string  $filename 
)
protected

Definition at line 210 of file class.ilObjUserFolder.php.

214 : void {
215 $worksheet = new ilExcel();
216 $worksheet->addSheet($this->lng->txt("users"));
217
218 $row = 1;
219 $col = 0;
220
221 $udf_ex_fields = $this->getUserDefinedExportFields();
222
223 // title row
224 foreach ($settings as $value) { // standard fields
225 if ($value == 'ext_account') {
226 $value = 'user_ext_account';
227 }
228 $worksheet->setCell($row, $col, $this->lng->txt($value));
229 $col++;
230 }
231 foreach ($udf_ex_fields as $f) { // custom fields
232 $worksheet->setCell($row, $col, $f["name"]);
233 $col++;
234 }
235 $worksheet->setBold("A1:" . $worksheet->getColumnCoord($col - 1) . "1");
236
237 $this->lng->loadLanguageModule("meta");
238 foreach ($data as $index => $rowdata) {
239 $row++;
240 $col = 0;
241
242 // standard fields
243 foreach ($settings as $fieldname) {
244 $value = $rowdata[$fieldname] ?? "";
245 switch ($fieldname) {
246 case "language":
247 $worksheet->setCell($row, $col, $this->lng->txt("meta_l_" . $value));
248 break;
249 case "time_limit_from":
250 case "time_limit_until":
251 $value = $value
252 ? new ilDateTime($value, IL_CAL_UNIX)
253 : null;
254 $worksheet->setCell($row, $col, $value);
255 break;
256 case "last_login":
257 case "last_update":
258 case "create_date":
259 case "approve_date":
260 case "agree_date":
261 $value = $value
262 ? new ilDateTime($value, IL_CAL_DATETIME)
263 : null;
264 $worksheet->setCell($row, $col, $value);
265 break;
266
267 case "interests_general":
268 case "interests_help_offered":
269 case "interests_help_looking":
270 if (is_array($value) && count($value)) {
271 $value = implode(", ", $value);
272 } else {
273 $value = null;
274 }
275 // fallthrough
276
277 // no break
278 default:
279 $worksheet->setCell($row, $col, $value);
280 break;
281 }
282 $col++;
283 }
284
285 // custom fields
286 reset($udf_ex_fields);
287 if (count($udf_ex_fields) > 0) {
288 $udf = new ilUserDefinedData($rowdata["usr_id"]);
289 foreach ($udf_ex_fields as $f) { // custom fields
290 $worksheet->setCell($row, $col, $udf->get("f_" . $f["id"]));
291 $col++;
292 }
293 }
294 }
295
296 $worksheet->writeToFile($filename);
297 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
$index
Definition: metadata.php:145

◆ createExportDirectory()

ilObjUserFolder::createExportDirectory ( )
protected

creates data directory for export files

Definition at line 443 of file class.ilObjUserFolder.php.

443 : void
444 {
445 if (!is_dir($this->getExportDirectory())) {
446 $usrf_data_dir = ilFileUtils::getDataDir() . "/usrf_data";
447 ilFileUtils::makeDir($usrf_data_dir);
448 if (!is_writable($usrf_data_dir)) {
449 $this->ilias->raiseError("Userfolder data directory (" . $usrf_data_dir
450 . ") not writeable.", $this->ilias->error_obj->MESSAGE);
451 }
452
453 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
454 $export_dir = $usrf_data_dir . "/export";
455 ilFileUtils::makeDir($export_dir);
456 if (!is_dir($export_dir)) {
457 $this->ilias->raiseError("Creation of Userfolder Export Directory failed.", $this->ilias->error_obj->MESSAGE);
458 }
459 }
460 }
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
header include for all ilias files.

References ilFileUtils\getDataDir(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ createXMLExport()

ilObjUserFolder::createXMLExport ( array  $settings,
array  $data,
string  $filename 
)
protected

Definition at line 120 of file class.ilObjUserFolder.php.

124 : void {
125 global $DIC;
126
127 $rbacreview = $DIC['rbacreview'];
128 $ilDB = $DIC['ilDB'];
129 $log = $DIC['log'];
130
131 $file = fopen($filename, 'wb');
132
133 if (is_array($data)) {
134 $xmlWriter = new ilUserXMLWriter();
135 $xmlWriter->setObjects($data);
136 $xmlWriter->setSettings($settings);
137 $xmlWriter->setAttachRoles(true);
138
139 if ($xmlWriter->start()) {
140 fwrite($file, $xmlWriter->getXML());
141 }
142 }
143 }
ilLogger $log
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ delete()

ilObjUserFolder::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

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

40 : bool
41 {
42 return false;
43 }

◆ escapeXML()

ilObjUserFolder::escapeXML ( string  $value)
protected

Definition at line 114 of file class.ilObjUserFolder.php.

114 : string
115 {
116 $value = str_replace(["&", "<", ">"], ["&amp;", "&lt;", "&gt;"], $value);
117 return $value;
118 }

◆ getExportDirectory()

ilObjUserFolder::getExportDirectory ( )

Definition at line 67 of file class.ilObjUserFolder.php.

67 : string
68 {
69 $export_dir = ilFileUtils::getDataDir() . "/usrf_data/export";
70
71 return $export_dir;
72 }

References ilFileUtils\getDataDir().

+ Here is the call graph for this function:

◆ getExportFilename()

ilObjUserFolder::getExportFilename ( string  $a_mode = self::FILE_TYPE_EXCEL)

Definition at line 45 of file class.ilObjUserFolder.php.

47 : string {
48 $filename = "";
49 $inst_id = IL_INST_ID;
50
51 $date = time();
52
53 switch ($a_mode) {
55 $filename = $date . "__" . $inst_id . "__xls_usrf";
56 break;
58 $filename = $date . "__" . $inst_id . "__csv_usrf.csv";
59 break;
61 $filename = $date . "__" . $inst_id . "__xml_usrf.xml";
62 break;
63 }
64 return $filename;
65 }
const IL_INST_ID
Definition: constants.php:40

◆ getExportFiles()

ilObjUserFolder::getExportFiles ( )

Get a list of the already exported files in the export directory.

Returns
array<string,string>[]

Definition at line 78 of file class.ilObjUserFolder.php.

78 : array
79 {
80 $dir = $this->getExportDirectory();
81
82 // quit if export dir not available
83 if (!is_dir($dir) or
84 !is_writable($dir)) {
85 return array();
86 }
87
88 // open directory
89 $dir = dir($dir);
90
91 // initialize array
92 $file = array();
93
94 // get files and save the in the array
95 while ($entry = $dir->read()) {
96 if ($entry != "." and
97 $entry != ".." and
98 preg_match("/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,4}\$/", $entry, $matches)) {
99 $filearray["filename"] = $entry;
100 $filearray["filesize"] = filesize($this->getExportDirectory() . "/" . $entry);
101 $file[] = $filearray;
102 }
103 }
104
105 // close import directory
106 $dir->close();
107
108 // sort files
109 sort($file);
110
111 return $file;
112 }

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static
Returns
array of exportable fields

Definition at line 302 of file class.ilObjUserFolder.php.

302 : array // Missing array type.
303 {
304 global $DIC;
305
306 $ilDB = $DIC['ilDB'];
307
308 $db_settings = array();
309
310 $up = new ilUserProfile();
311 $up->skipField("roles");
312 $profile_fields = $up->getStandardFields();
313
314 $query = "SELECT * FROM settings WHERE " .
315 $ilDB->like("keyword", "text", '%usr_settings_export_%');
316 $result = $ilDB->query($query);
317 while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
318 if ($row["value"] == "1") {
319 if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting)) {
320 $db_settings[] = $setting[1];
321 }
322 }
323 }
324 $export_settings = array();
325 foreach ($profile_fields as $key => $value) {
326 if (in_array($key, $db_settings)) {
327 if (strcmp($key, "password") == 0) {
328 // we do not support password export with ILIAS >= 4.5.x
329 continue;
330 } else {
331 $export_settings[] = $key;
332 }
333 }
334 }
335 $export_settings[] = "usr_id";
336 $export_settings[] = "login";
337 $export_settings[] = "last_login";
338 $export_settings[] = "last_update";
339 $export_settings[] = "create_date";
340 $export_settings[] = "time_limit_owner";
341 $export_settings[] = "time_limit_unlimited";
342 $export_settings[] = "time_limit_from";
343 $export_settings[] = "time_limit_until";
344 $export_settings[] = "time_limit_message";
345 $export_settings[] = "active";
346 $export_settings[] = "approve_date";
347 $export_settings[] = "agree_date";
348 $export_settings[] = "client_ip";
349 $export_settings[] = "auth_mode";
350 $export_settings[] = "ext_account";
351 $export_settings[] = "feedhash";
352 return $export_settings;
353 }
Class ilUserProfile.
string $key
Consumer key/client ID value.
Definition: System.php:193

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, $query, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilUserXMLWriter\__handleUser().

+ Here is the caller graph for this function:

◆ getProfileFields()

static ilObjUserFolder::getProfileFields ( )
static

Get profile fields.

Deprecated:
use ilUserProfile() instead

Definition at line 467 of file class.ilObjUserFolder.php.

467 : array // Missing array type.
468 {
469 $up = new ilUserProfile();
470 $up->skipField("username");
471 $up->skipField("roles");
472 $up->skipGroup("preferences");
473 $fds = $up->getStandardFields();
474 $profile_fields = [];
475 foreach ($fds as $k => $f) {
476 $profile_fields[] = $k;
477 }
478
479 return $profile_fields;
480 }

References Vendor\Package\$f.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )
protected

Get all exportable user defined fields.

Definition at line 149 of file class.ilObjUserFolder.php.

149 : array // Missing array type.
150 {
152
153 $udf_ex_fields = array();
154 foreach ($udf_obj->getDefinitions() as $definition) {
155 if ($definition["export"] != false) {
156 $udf_ex_fields[] = array("name" => $definition["field_name"],
157 "id" => $definition["field_id"]);
158 }
159 }
160
161 return $udf_ex_fields;
162 }

References ilUserDefinedFields\_getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ FILE_TYPE_CSV

const ilObjUserFolder::FILE_TYPE_CSV = 'userfolder_export_csv'

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

Referenced by ilObjUserFolderGUI\usrExportCsvObject().

◆ FILE_TYPE_EXCEL

const ilObjUserFolder::FILE_TYPE_EXCEL = 'userfolder_export_excel_x86'

Definition at line 27 of file class.ilObjUserFolder.php.

Referenced by ilObjUserFolderGUI\usrExportX86Object().

◆ FILE_TYPE_XML

const ilObjUserFolder::FILE_TYPE_XML = 'userfolder_export_xml'

Definition at line 29 of file class.ilObjUserFolder.php.

Referenced by ilObjUserFolderGUI\usrExportXmlObject().

◆ ORG_OP_EDIT_USER_ACCOUNTS


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