ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjUserFolder Class Reference

Class ilObjUserFolder. More...

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

Public Member Functions

 __construct (int $a_id, bool $a_call_by_reference=true)
 
 delete ()
 
 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
 getObjectProperties ()
 
 flushObjectProperties ()
 
 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 $description)
 
 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 getIconForType (string $type)
 
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 ()
 
 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
 
LOMServices $lom_services
 
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 = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Detailed Description

Class ilObjUserFolder.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilObjUserFolder::__construct ( int  $a_id,
bool  $a_call_by_reference = true 
)

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

References ILIAS\GlobalScreen\Provider\__construct().

36  {
37  $this->type = "usrf";
38  parent::__construct($a_id, $a_call_by_reference);
39  }
__construct(Container $dic, ilPlugin $plugin)
+ 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 533 of file class.ilObjUserFolder.php.

References $DIC, $ilDB, $path, and USER_FOLDER_ID.

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

535  : void {
536  global $DIC;
537 
538  $ilDB = $DIC['ilDB'];
539 
541  $path = $fs->getAbsolutePath() . "/";
542 
543  if (file_exists($path . $a_lang)) {
544  unlink($path . $a_lang);
545  }
546 
547  $ilDB->update(
548  'mail_template',
549  ['att_file' => ['text', '']],
550  ['lang' => ['text',$a_lang], 'type' => ['text','nacc']]
551  );
552  }
const USER_FOLDER_ID
Definition: constants.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:29
global $DIC
Definition: shib_login.php:22
+ 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 558 of file class.ilObjUserFolder.php.

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

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

558  : array
559  {
560  global $DIC;
561 
562  $ilDB = $DIC['ilDB'];
563 
564  $set = $ilDB->query("SELECT * FROM mail_template " .
565  " WHERE type='nacc' AND lang = " . $ilDB->quote($a_lang, 'text'));
566 
567  if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
568  return $rec;
569  }
570 
571  return [];
572  }
global $DIC
Definition: shib_login.php:22
+ 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 508 of file class.ilObjUserFolder.php.

References $DIC, $ilDB, $path, ilFileUtils\moveUploadedFile(), and USER_FOLDER_ID.

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

512  : void {
513  global $DIC;
514 
515  $ilDB = $DIC['ilDB'];
516 
518  $fs->create();
519  $path = $fs->getAbsolutePath() . "/";
520 
521  ilFileUtils::moveUploadedFile($a_tmp_name, $a_lang, $path . $a_lang);
522 
523  $ilDB->update(
524  'mail_template',
525  ['att_file' => ['text', $a_name]],
526  ['lang' => ['text',$a_lang], 'type' => ['text','nacc']]
527  );
528  }
const USER_FOLDER_ID
Definition: constants.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:29
global $DIC
Definition: shib_login.php:22
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:
+ 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 579 of file class.ilObjUserFolder.php.

References $DIC, and $ilDB.

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

582  : void {
583  global $DIC;
584 
585  $ilDB = $DIC['ilDB'];
586 
587  $query = "UPDATE usr_data SET time_limit_owner = " . $ilDB->quote($a_new_id, "integer") . " " .
588  "WHERE time_limit_owner = " . $ilDB->quote($a_old_id, "integer") . " ";
589  $ilDB->manipulate($query);
590  }
global $DIC
Definition: shib_login.php:22
+ 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 465 of file class.ilObjUserFolder.php.

References $DIC, and $ilDB.

Referenced by ilObjUserFolderGUI\saveNewAccountMailObject().

472  : void {
473  global $DIC;
474 
475  $ilDB = $DIC['ilDB'];
476 
477  if (self::_lookupNewAccountMail($a_lang)) {
478  $values = [
479  'subject' => ['text',$a_subject],
480  'body' => ['clob',$a_body],
481  'sal_g' => ['text',$a_sal_g],
482  'sal_f' => ['text',$a_sal_f],
483  'sal_m' => ['text',$a_sal_m]
484  ];
485  $ilDB->update(
486  'mail_template',
487  $values,
488  ['lang' => ['text',$a_lang], 'type' => ['text','nacc']]
489  );
490  } else {
491  $values = [
492  'subject' => ['text',$a_subject],
493  'body' => ['clob',$a_body],
494  'sal_g' => ['text',$a_sal_g],
495  'sal_f' => ['text',$a_sal_f],
496  'sal_m' => ['text',$a_sal_m],
497  'lang' => ['text',$a_lang],
498  'type' => ['text','nacc']
499  ];
500  $ilDB->insert('mail_template', $values);
501  }
502  }
global $DIC
Definition: shib_login.php:22
+ 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 341 of file class.ilObjUserFolder.php.

References $data, $DIC, $ilDB, ilObject\$lng, $res, createCSVExport(), createExcelExport(), createExportDirectory(), createXMLExport(), ilDBConstants\FETCHMODE_ASSOC, ilLanguage\getDefaultLanguage(), getExportDirectory(), getExportFilename(), and ilFileUtils\ilTempnam().

345  : string {
346  global $DIC;
347 
348  $ilDB = $DIC['ilDB'];
349  $lng = $DIC['lng'];
350 
351  if ($use_temp_dir) {
352  $expDir = ilFileUtils::ilTempnam();
353  $fullname = $expDir;
354  } else {
355  $expDir = $this->getExportDirectory();
356  // create export directory if needed
357  $this->createExportDirectory();
358  $fullname = $expDir . "/" . $this->getExportFilename($a_mode);
359  }
360 
361  //get data
362  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
363  $settings = self::getExportSettings();
364 
365  // user languages
366  $query = "SELECT * FROM usr_pref WHERE keyword = " . $ilDB->quote('language', 'text');
367  $res = $ilDB->query($query);
368  $languages = [];
369  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
370  $languages[$row['usr_id']] = $row['value'];
371  }
372 
373  // multi-text
374  $multi = [];
375  $set = $ilDB->query("SELECT * FROM usr_data_multi");
376  while ($row = $ilDB->fetchAssoc($set)) {
377  if (!is_array($user_data_filter) ||
378  in_array($row["usr_id"], $user_data_filter)) {
379  $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
380  }
381  }
382 
383  $data = [];
384  $query = "SELECT usr_data.* FROM usr_data " .
385  " ORDER BY usr_data.lastname, usr_data.firstname";
386  $result = $ilDB->query($query);
387  while ($row = $ilDB->fetchAssoc($result)) {
388  if (isset($languages[$row['usr_id']])) {
389  $row['language'] = $languages[$row['usr_id']];
390  } else {
391  $row['language'] = $lng->getDefaultLanguage();
392  }
393 
394  if (isset($multi[$row["usr_id"]])) {
395  $row = array_merge($row, $multi[$row["usr_id"]]);
396  }
397 
398  if (is_array($user_data_filter)) {
399  if (in_array($row["usr_id"], $user_data_filter)) {
400  $data[] = $row;
401  }
402  } else {
403  $data[] = $row;
404  }
405  }
406  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
407 
408  switch ($a_mode) {
409  case self::FILE_TYPE_EXCEL:
410  $this->createExcelExport($settings, $data, $fullname);
411  break;
412  case self::FILE_TYPE_CSV:
413  $this->createCSVExport($settings, $data, $fullname);
414  break;
415  case self::FILE_TYPE_XML:
416  $this->createXMLExport($settings, $data, $fullname);
417  break;
418  }
419  return $fullname;
420  }
createXMLExport(array $settings, array $data, string $filename)
$res
Definition: ltiservices.php:66
getDefaultLanguage()
Return default language.
createExportDirectory()
creates data directory for export files
createExcelExport(array $settings, array $data, string $filename)
createCSVExport(array $settings, array $data, string $filename)
getExportFilename(string $a_mode=self::FILE_TYPE_EXCEL)
ilLanguage $lng
global $DIC
Definition: shib_login.php:22
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
+ Here is the call graph for this function:

◆ createCSVExport()

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

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

References Vendor\Package\$f, getUserDefinedExportFields(), ILIAS\Repository\lng(), and ilCSVUtil\processCSVRow().

Referenced by buildExportFile().

153  : void {
154  $headerrow = [];
155  $udf_ex_fields = $this->getUserDefinedExportFields();
156  foreach ($settings as $value) { // standard fields
157  $headerrow[] = $this->lng->txt($value);
158  }
159  foreach ($udf_ex_fields as $f) { // custom fields
160  $headerrow[] = $f["name"];
161  }
162 
163  $separator = ";";
164  $file = fopen($filename, 'wb');
165  $formattedrow = &ilCSVUtil::processCSVRow($headerrow, true, $separator);
166  fwrite($file, implode($separator, $formattedrow) . "\n");
167  foreach ($data as $row) {
168  $csvrow = [];
169  foreach ($settings as $header) { // standard fields
170  // multi-text
171  if (isset($row[$header]) && is_array($row[$header])) {
172  $row[$header] = implode(", ", $row[$header]);
173  }
174 
175  $csvrow[] = $row[$header] ?? '';
176  }
177 
178  // custom fields
179  reset($udf_ex_fields);
180  if (count($udf_ex_fields) > 0) {
181  $udf = new ilUserDefinedData($row["usr_id"]);
182  foreach ($udf_ex_fields as $f) { // custom fields
183  $csvrow[] = $udf->get("f_" . $f["id"]);
184  }
185  }
186 
187  $formattedrow = &ilCSVUtil::processCSVRow($csvrow, true, $separator);
188  fwrite($file, implode($separator, $formattedrow) . "\n");
189  }
190  fclose($file);
191  }
static & processCSVRow(array &$row, bool $quoteAll=false, string $separator=';', bool $outUTF8=false, bool $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExcelExport()

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

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

References Vendor\Package\$f, getUserDefinedExportFields(), IL_CAL_DATETIME, IL_CAL_UNIX, ILIAS\Repository\lng(), and null.

Referenced by buildExportFile().

197  : void {
198  $worksheet = new ilExcel();
199  $worksheet->addSheet($this->lng->txt("users"));
200 
201  $row = 1;
202  $col = 0;
203 
204  $udf_ex_fields = $this->getUserDefinedExportFields();
205 
206  // title row
207  foreach ($settings as $value) { // standard fields
208  if ($value == 'ext_account') {
209  $value = 'user_ext_account';
210  }
211  $worksheet->setCell($row, $col, $this->lng->txt($value));
212  $col++;
213  }
214  foreach ($udf_ex_fields as $f) { // custom fields
215  $worksheet->setCell($row, $col, $f["name"]);
216  $col++;
217  }
218  $worksheet->setBold("A1:" . $worksheet->getColumnCoord($col - 1) . "1");
219 
220  $this->lng->loadLanguageModule("meta");
221  foreach ($data as $index => $rowdata) {
222  $row++;
223  $col = 0;
224 
225  // standard fields
226  foreach ($settings as $fieldname) {
227  $value = $rowdata[$fieldname] ?? "";
228  switch ($fieldname) {
229  case "language":
230  $worksheet->setCell($row, $col, $this->lng->txt("meta_l_" . $value));
231  break;
232  case "time_limit_from":
233  case "time_limit_until":
234  $value = $value
235  ? new ilDateTime($value, IL_CAL_UNIX)
236  : null;
237  $worksheet->setCell($row, $col, $value);
238  break;
239  case "last_login":
240  case "last_update":
241  case "create_date":
242  case "approve_date":
243  case "agree_date":
244  $value = $value
245  ? new ilDateTime($value, IL_CAL_DATETIME)
246  : null;
247  $worksheet->setCell($row, $col, $value);
248  break;
249 
250  case "interests_general":
251  case "interests_help_offered":
252  case "interests_help_looking":
253  if (is_array($value) && count($value)) {
254  $value = implode(", ", $value);
255  } else {
256  $value = null;
257  }
258  // fallthrough
259 
260  // no break
261  default:
262  $worksheet->setCell($row, $col, $value);
263  break;
264  }
265  $col++;
266  }
267 
268  // custom fields
269  reset($udf_ex_fields);
270  if (count($udf_ex_fields) > 0) {
271  $udf = new ilUserDefinedData($rowdata["usr_id"]);
272  foreach ($udf_ex_fields as $f) { // custom fields
273  $worksheet->setCell($row, $col, $udf->get("f_" . $f["id"]));
274  $col++;
275  }
276  }
277  }
278 
279  $worksheet->writeToFile($filename);
280  }
const IL_CAL_DATETIME
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportDirectory()

ilObjUserFolder::createExportDirectory ( )
protected

creates data directory for export files

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

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

Referenced by buildExportFile().

426  : void
427  {
428  if (!is_dir($this->getExportDirectory())) {
429  $usrf_data_dir = ilFileUtils::getDataDir() . "/usrf_data";
430  ilFileUtils::makeDir($usrf_data_dir);
431  if (!is_writable($usrf_data_dir)) {
432  $this->ilias->raiseError("Userfolder data directory (" . $usrf_data_dir
433  . ") not writeable.", $this->ilias->error_obj->MESSAGE);
434  }
435 
436  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
437  $export_dir = $usrf_data_dir . "/export";
438  ilFileUtils::makeDir($export_dir);
439  if (!is_dir($export_dir)) {
440  $this->ilias->raiseError("Creation of Userfolder Export Directory failed.", $this->ilias->error_obj->MESSAGE);
441  }
442  }
443  }
Class ilObjForumAdministration.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createXMLExport()

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

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

Referenced by buildExportFile().

125  : void {
126  $xml_writer = new ilUserXMLWriter();
127  $xml_writer->setObjects($data);
128  $xml_writer->setSettings($settings);
129  $xml_writer->setAttachRoles(true);
130 
131  if ($xml_writer->start()) {
132  fwrite(fopen($filename, 'wb'), $xml_writer->getXML());
133  }
134  }
XML writer class Class to simplify manual writing of xml documents.
$filename
Definition: buildRTE.php:78
+ Here is the caller graph for this function:

◆ delete()

ilObjUserFolder::delete ( )

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

42  : bool
43  {
44  return false;
45  }

◆ escapeXML()

ilObjUserFolder::escapeXML ( string  $value)
protected

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

116  : string
117  {
118  return str_replace(['&', '<', '>'], ['&amp;', '&lt;', '&gt;'], $value);
119  }

◆ getExportDirectory()

ilObjUserFolder::getExportDirectory ( )

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

References ilFileUtils\getDataDir().

Referenced by buildExportFile(), createExportDirectory(), and getExportFiles().

69  : string
70  {
71  $export_dir = ilFileUtils::getDataDir() . "/usrf_data/export";
72 
73  return $export_dir;
74  }
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportFilename()

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

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

References $filename, and IL_INST_ID.

Referenced by buildExportFile().

49  : string {
50  $filename = "";
51  $inst_id = IL_INST_ID;
52 
53  $date = time();
54 
55  switch ($a_mode) {
56  case self::FILE_TYPE_EXCEL:
57  $filename = $date . "__" . $inst_id . "__xls_usrf";
58  break;
59  case self::FILE_TYPE_CSV:
60  $filename = $date . "__" . $inst_id . "__csv_usrf.csv";
61  break;
62  case self::FILE_TYPE_XML:
63  $filename = $date . "__" . $inst_id . "__xml_usrf.xml";
64  break;
65  }
66  return $filename;
67  }
const IL_INST_ID
Definition: constants.php:40
$filename
Definition: buildRTE.php:78
+ Here is the caller graph for this function:

◆ getExportFiles()

ilObjUserFolder::getExportFiles ( )

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

Returns
array<string,string>[]

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

References getExportDirectory(), and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

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

◆ getExportSettings()

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

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

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

Referenced by ilUserXMLWriter\__handleUser().

285  : array // Missing array type.
286  {
287  global $DIC;
288 
289  $ilDB = $DIC['ilDB'];
290 
291  $db_settings = [];
292 
293  $up = new ilUserProfile();
294  $up->skipField("roles");
295  $profile_fields = $up->getStandardFields();
296 
297  $query = "SELECT * FROM settings WHERE " .
298  $ilDB->like("keyword", "text", '%usr_settings_export_%');
299  $result = $ilDB->query($query);
300  while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
301  if ($row["value"] == "1") {
302  if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting)) {
303  $db_settings[] = $setting[1];
304  }
305  }
306  }
307  $export_settings = [];
308  foreach ($profile_fields as $key => $value) {
309  if (in_array($key, $db_settings)) {
310  if (strcmp($key, "password") == 0) {
311  // we do not support password export with ILIAS >= 4.5.x
312  continue;
313  } else {
314  $export_settings[] = $key;
315  }
316  }
317  }
318  $export_settings[] = "usr_id";
319  $export_settings[] = "login";
320  $export_settings[] = "last_login";
321  $export_settings[] = "last_update";
322  $export_settings[] = "create_date";
323  $export_settings[] = "time_limit_owner";
324  $export_settings[] = "time_limit_unlimited";
325  $export_settings[] = "time_limit_from";
326  $export_settings[] = "time_limit_until";
327  $export_settings[] = "time_limit_message";
328  $export_settings[] = "active";
329  $export_settings[] = "approve_date";
330  $export_settings[] = "agree_date";
331  $export_settings[] = "client_ip";
332  $export_settings[] = "auth_mode";
333  $export_settings[] = "ext_account";
334  $export_settings[] = "feedhash";
335  return $export_settings;
336  }
Class ilUserProfile.
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getProfileFields()

static ilObjUserFolder::getProfileFields ( )
static

Get profile fields.

Deprecated:
use ilUserProfile() instead

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

References Vendor\Package\$f.

450  : array // Missing array type.
451  {
452  $up = new ilUserProfile();
453  $up->skipField("username");
454  $up->skipField("roles");
455  $up->skipGroup("preferences");
456  $fds = $up->getStandardFields();
457  $profile_fields = [];
458  foreach ($fds as $k => $f) {
459  $profile_fields[] = $k;
460  }
461 
462  return $profile_fields;
463  }
Class ilUserProfile.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )
protected

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

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

136  : array // Missing array type.
137  {
138  $udf_ex_fields = [];
139  foreach (ilUserDefinedFields::_getInstance()->getDefinitions() as $definition) {
140  if ($definition['export'] != false) {
141  $udf_ex_fields[] = ['name' => $definition['field_name'],
142  'id' => $definition['field_id']];
143  }
144  }
145 
146  return $udf_ex_fields;
147  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ FILE_TYPE_CSV

const ilObjUserFolder::FILE_TYPE_CSV = 'userfolder_export_csv'

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

Referenced by ilObjUserFolderGUI\usrExportCsvObject().

◆ FILE_TYPE_EXCEL

const ilObjUserFolder::FILE_TYPE_EXCEL = 'userfolder_export_excel_x86'

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

Referenced by ilObjUserFolderGUI\usrExportX86Object().

◆ FILE_TYPE_XML

const ilObjUserFolder::FILE_TYPE_XML = 'userfolder_export_xml'

Definition at line 31 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: