ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjUserFolder Class Reference
+ Inheritance diagram for ilObjUserFolder:
+ Collaboration diagram for ilObjUserFolder:

Public Member Functions

 __construct ($a_id, $a_call_by_reference=true)
 Constructor @access public. More...
 
 delete ()
 delete userfolder and all related data DISABLED @access public More...
 
 getExportFilename ($a_mode=self::FILE_TYPE_EXCEL)
 
 getExportDirectory ()
 Get the location of the export directory for the user accounts. More...
 
 getExportFiles ()
 Get a list of the already exported files in the export directory. More...
 
 buildExportFile ($a_mode=self::FILE_TYPE_EXCEL, $user_data_filter=false, $use_temp_dir=false)
 build xml export file More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 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 If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getExportSettings ()
 getExport Settings More...
 
static & getProfileFields ()
 Get profile fields (DEPRECATED, use ilUserProfile() instead) More...
 
static _writeNewAccountMail ($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
 
static _updateAccountMailAttachment ($a_lang, $a_tmp_name, $a_name)
 Update account mail attachment. More...
 
static _deleteAccountMailAttachment ($a_lang)
 Delete account mail attachment. More...
 
static _lookupNewAccountMail ($a_lang)
 
static _updateUserFolderAssignment ($a_old_id, $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 ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

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
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Protected Member Functions

 escapeXML ($value)
 
 createXMLExport (&$settings, &$data, $filename)
 
 getUserDefinedExportFields ()
 Get all exportable user defined fields. More...
 
 createCSVExport (&$settings, &$data, $filename)
 
 createExcelExport (&$settings, &$data, $filename)
 
 createExportDirectory ()
 creates data directory for export files (data_dir/usrf_data/export, depending on data directory that is set in ILIAS setup/ini) More...
 

Additional Inherited Members

- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

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

32 {
33 $this->type = "usrf";
34 parent::__construct($a_id, $a_call_by_reference);
35 }
__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 (   $a_lang)
static

Delete account mail attachment.

Parameters
$a_lang

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

606 {
607 global $DIC;
608
609 $ilDB = $DIC['ilDB'];
610
611 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
613 $path = $fs->getAbsolutePath() . "/";
614
615 if (file_exists($path . $a_lang)) {
616 unlink($path . $a_lang);
617 }
618
619 $ilDB->update(
620 'mail_template',
621 array('att_file' => array('text', '')),
622 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
623 );
624 }
const USER_FOLDER_ID
Class ilObjUserFolder.
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, $ilDB, and USER_FOLDER_ID.

◆ _lookupNewAccountMail()

static ilObjUserFolder::_lookupNewAccountMail (   $a_lang)
static
Parameters
string$a_lang
Returns
array

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

631 {
632 global $DIC;
633
634 $ilDB = $DIC['ilDB'];
635
636 $set = $ilDB->query("SELECT * FROM mail_template " .
637 " WHERE type='nacc' AND lang = " . $ilDB->quote($a_lang, 'text'));
638
639 if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
640 return $rec;
641 }
642 return array();
643 }

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

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

+ Here is the caller graph for this function:

◆ _updateAccountMailAttachment()

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

Update account mail attachment.

Parameters
$a_lang
$a_tmp_name
$a_name
Exceptions
ilException

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

582 {
583 global $DIC;
584
585 $ilDB = $DIC['ilDB'];
586
587 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
589 $fs->create();
590 $path = $fs->getAbsolutePath() . "/";
591
592 ilUtil::moveUploadedFile($a_tmp_name, $a_lang, $path . $a_lang);
593
594 $ilDB->update(
595 'mail_template',
596 array('att_file' => array('text', $a_name)),
597 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
598 );
599 }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

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

+ Here is the call graph for this function:

◆ _updateUserFolderAssignment()

static ilObjUserFolder::_updateUserFolderAssignment (   $a_old_id,
  $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.

@access public

Parameters
intold_id
intnew id
Returns
bool

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

658 {
659 global $DIC;
660
661 $ilDB = $DIC['ilDB'];
662
663 $query = "UPDATE usr_data SET time_limit_owner = " . $ilDB->quote($a_new_id, "integer") . " " .
664 "WHERE time_limit_owner = " . $ilDB->quote($a_old_id, "integer") . " ";
665 $ilDB->manipulate($query);
666
667 return true;
668 }
$query

References $DIC, $ilDB, and $query.

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

+ Here is the caller graph for this function:

◆ _writeNewAccountMail()

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

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

542 {
543 global $DIC;
544
545 $ilDB = $DIC['ilDB'];
546
547 if (self::_lookupNewAccountMail($a_lang)) {
548 $values = array(
549 'subject' => array('text',$a_subject),
550 'body' => array('clob',$a_body),
551 'sal_g' => array('text',$a_sal_g),
552 'sal_f' => array('text',$a_sal_f),
553 'sal_m' => array('text',$a_sal_m)
554 );
555 $ilDB->update(
556 'mail_template',
557 $values,
558 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
559 );
560 } else {
561 $values = array(
562 'subject' => array('text',$a_subject),
563 'body' => array('clob',$a_body),
564 'sal_g' => array('text',$a_sal_g),
565 'sal_f' => array('text',$a_sal_f),
566 'sal_m' => array('text',$a_sal_m),
567 'lang' => array('text',$a_lang),
568 'type' => array('text','nacc')
569 );
570 $ilDB->insert('mail_template', $values);
571 }
572 }

References $DIC, and $ilDB.

◆ buildExportFile()

ilObjUserFolder::buildExportFile (   $a_mode = self::FILE_TYPE_EXCEL,
  $user_data_filter = false,
  $use_temp_dir = false 
)

build xml export file

Parameters
string$a_mode
bool$user_data_filter
bool$use_temp_dir
Returns
string

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

405 {
406 global $DIC;
407
408 $ilBench = $DIC['ilBench'];
409 global $DIC;
410
411 $log = $DIC['log'];
412 global $DIC;
413
414 $ilDB = $DIC['ilDB'];
415 global $DIC;
416
417 $ilias = $DIC['ilias'];
418 global $DIC;
419
420 $lng = $DIC['lng'];
421
422 if ($use_temp_dir) {
423 $expDir = ilUtil::ilTempnam();
424 $fullname = $expDir;
425 } else {
426 $expDir = $this->getExportDirectory();
427 // create export directory if needed
428 $this->createExportDirectory();
429 $fullname = $expDir . "/" . $this->getExportFilename($a_mode);
430 }
431
432 //get data
433 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
434 $settings = &$this->getExportSettings();
435
436 // user languages
437 $query = "SELECT * FROM usr_pref WHERE keyword = " . $ilDB->quote('language', 'text');
438 $res = $ilDB->query($query);
439 $languages = array();
440 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
441 $languages[$row['usr_id']] = $row['value'];
442 }
443
444 // multi-text
445 $multi = array();
446 $set = $ilDB->query("SELECT * FROM usr_data_multi");
447 while ($row = $ilDB->fetchAssoc($set)) {
448 if (!is_array($user_data_filter) ||
449 in_array($row["usr_id"], $user_data_filter)) {
450 $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
451 }
452 }
453
454 $data = array();
455 $query = "SELECT usr_data.* FROM usr_data " .
456 " ORDER BY usr_data.lastname, usr_data.firstname";
457 $result = $ilDB->query($query);
458 while ($row = $ilDB->fetchAssoc($result)) {
459 if (isset($languages[$row['usr_id']])) {
460 $row['language'] = $languages[$row['usr_id']];
461 } else {
462 $row['language'] = $lng->getDefaultLanguage();
463 }
464
465 if (isset($multi[$row["usr_id"]])) {
466 $row = array_merge($row, $multi[$row["usr_id"]]);
467 }
468
469 if (is_array($user_data_filter)) {
470 if (in_array($row["usr_id"], $user_data_filter)) {
471 array_push($data, $row);
472 }
473 } else {
474 array_push($data, $row);
475 }
476 }
477 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
478
479 switch ($a_mode) {
481 $this->createExcelExport($settings, $data, $fullname);
482 break;
484 $this->createCSVExport($settings, $data, $fullname);
485 break;
487 $this->createXMLExport($settings, $data, $fullname);
488 break;
489 }
490 //$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
491
492 return $fullname;
493 }
$result
createExportDirectory()
creates data directory for export files (data_dir/usrf_data/export, depending on data directory that ...
getExportFilename($a_mode=self::FILE_TYPE_EXCEL)
createExcelExport(&$settings, &$data, $filename)
createCSVExport(&$settings, &$data, $filename)
createXMLExport(&$settings, &$data, $filename)
static getExportSettings()
getExport Settings
getExportDirectory()
Get the location of the export directory for the user accounts.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
global $ilBench
Definition: ilias.php:21
foreach($_POST as $key=> $value) $res
$data
Definition: storeScorm.php:23

References $data, $DIC, $ilBench, $ilDB, ilObject\$lng, ilObject\$log, $query, $res, $result, createCSVExport(), createExcelExport(), createExportDirectory(), createXMLExport(), ilDBConstants\FETCHMODE_ASSOC, FILE_TYPE_CSV, FILE_TYPE_EXCEL, FILE_TYPE_XML, getExportDirectory(), getExportFilename(), getExportSettings(), and ilUtil\ilTempnam().

+ Here is the call graph for this function:

◆ createCSVExport()

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

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

203 {
204
205 // header
206 $headerrow = array();
207 $udf_ex_fields = $this->getUserDefinedExportFields();
208 foreach ($settings as $value) { // standard fields
209 array_push($headerrow, $this->lng->txt($value));
210 }
211 foreach ($udf_ex_fields as $f) { // custom fields
212 array_push($headerrow, $f["name"]);
213 }
214
215 $separator = ";";
216 $file = fopen($filename, "w");
217 $formattedrow = &ilUtil::processCSVRow($headerrow, true, $separator);
218 fwrite($file, join($separator, $formattedrow) . "\n");
219 foreach ($data as $row) {
220 $csvrow = array();
221 foreach ($settings as $header) { // standard fields
222 // multi-text
223 if (is_array($row[$header])) {
224 $row[$header] = implode(", ", $row[$header]);
225 }
226
227 array_push($csvrow, $row[$header]);
228 }
229
230 // custom fields
231 reset($udf_ex_fields);
232 if (count($udf_ex_fields) > 0) {
233 include_once("./Services/User/classes/class.ilUserDefinedData.php");
234 $udf = new ilUserDefinedData($row["usr_id"]);
235 foreach ($udf_ex_fields as $f) { // custom fields
236 array_push($csvrow, $udf->get("f_" . $f["id"]));
237 }
238 }
239
240 $formattedrow = &ilUtil::processCSVRow($csvrow, true, $separator);
241 fwrite($file, join($separator, $formattedrow) . "\n");
242 }
243 fclose($file);
244 }
$filename
Definition: buildRTE.php:89
getUserDefinedExportFields()
Get all exportable user defined fields.
Class ilUserDefinedData.
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.

References $data, Vendor\Package\$f, $filename, getUserDefinedExportFields(), and ilUtil\processCSVRow().

Referenced by buildExportFile().

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

◆ createExcelExport()

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

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

247 {
248 include_once "./Services/Excel/classes/class.ilExcel.php";
249 $worksheet = new ilExcel();
250 $worksheet->addSheet($this->lng->txt("users"));
251
252 $row = 1;
253 $col = 0;
254
255 $udf_ex_fields = $this->getUserDefinedExportFields();
256
257 // title row
258 foreach ($settings as $value) { // standard fields
259 if ($value == 'ext_account') {
260 $value = 'user_ext_account';
261 }
262 $worksheet->setCell($row, $col, $this->lng->txt($value));
263 $col++;
264 }
265 foreach ($udf_ex_fields as $f) { // custom fields
266 $worksheet->setCell($row, $col, $f["name"]);
267 $col++;
268 }
269 $worksheet->setBold("A1:" . $worksheet->getColumnCoord($col - 1) . "1");
270
271 $this->lng->loadLanguageModule("meta");
272 foreach ($data as $index => $rowdata) {
273 $row++;
274 $col = 0;
275
276 // standard fields
277 foreach ($settings as $fieldname) {
278 $value = $rowdata[$fieldname];
279 switch ($fieldname) {
280 case "language":
281 $worksheet->setCell($row, $col, $this->lng->txt("meta_l_" . $value));
282 break;
283 case "time_limit_from":
284 case "time_limit_until":
285 $value = $value
286 ? new ilDateTime($value, IL_CAL_UNIX)
287 : null;
288 $worksheet->setCell($row, $col, $value);
289 break;
290 case "last_login":
291 case "last_update":
292 case "create_date":
293 case "approve_date":
294 case "agree_date":
295 $value = $value
296 ? new ilDateTime($value, IL_CAL_DATETIME)
297 : null;
298 $worksheet->setCell($row, $col, $value);
299 break;
300
301 case "interests_general":
302 case "interests_help_offered":
303 case "interests_help_looking":
304 if (is_array($value) && sizeof($value)) {
305 $value = implode(", ", $value);
306 } else {
307 $value = null;
308 }
309 // fallthrough
310
311 // no break
312 default:
313 $worksheet->setCell($row, $col, $value);
314 break;
315 }
316 $col++;
317 }
318
319 // custom fields
320 reset($udf_ex_fields);
321 if (count($udf_ex_fields) > 0) {
322 include_once("./Services/User/classes/class.ilUserDefinedData.php");
323 $udf = new ilUserDefinedData($rowdata["usr_id"]);
324 foreach ($udf_ex_fields as $f) { // custom fields
325 $worksheet->setCell($row, $col, $udf->get("f_" . $f["id"]));
326 $col++;
327 }
328 }
329 }
330
331 $worksheet->writeToFile($filename);
332 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
$index
Definition: metadata.php:128

References $data, Vendor\Package\$f, $filename, $index, getUserDefinedExportFields(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by buildExportFile().

+ 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 (data_dir/usrf_data/export, depending on data directory that is set in ILIAS setup/ini)

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

502 {
503 if (!@is_dir($this->getExportDirectory())) {
504 $usrf_data_dir = ilUtil::getDataDir() . "/usrf_data";
505 ilUtil::makeDir($usrf_data_dir);
506 if (!is_writable($usrf_data_dir)) {
507 $this->ilias->raiseError("Userfolder data directory (" . $usrf_data_dir
508 . ") not writeable.", $this->ilias->error_obj->MESSAGE);
509 }
510
511 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
512 $export_dir = $usrf_data_dir . "/export";
513 ilUtil::makeDir($export_dir);
514 if (!@is_dir($export_dir)) {
515 $this->ilias->raiseError("Creation of Userfolder Export Directory failed.", $this->ilias->error_obj->MESSAGE);
516 }
517 }
518 }
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
redirection script todo: (a better solution should control the processing via a xml file)

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

Referenced by buildExportFile().

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

◆ createXMLExport()

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

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

152 {
153 include_once './Services/User/classes/class.ilUserDefinedData.php';
154 include_once './Services/User/classes/class.ilObjUser.php';
155
156 global $DIC;
157
158 $rbacreview = $DIC['rbacreview'];
159 global $DIC;
160
161 $ilDB = $DIC['ilDB'];
162 global $DIC;
163
164 $log = $DIC['log'];
165
166 $file = fopen($filename, "w");
167
168 if (is_array($data)) {
169 include_once './Services/User/classes/class.ilUserXMLWriter.php';
170
171 $xmlWriter = new ilUserXMLWriter();
172 $xmlWriter->setObjects($data);
173 $xmlWriter->setSettings($settings);
174 $xmlWriter->setAttachRoles(true);
175
176 if ($xmlWriter->start()) {
177 fwrite($file, $xmlWriter->getXML());
178 }
179 }
180 }
XML writer class.

References $data, $DIC, $filename, $ilDB, ilObject\$log, and ilObject\$rbacreview.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ delete()

ilObjUserFolder::delete ( )

delete userfolder and all related data DISABLED @access public

Returns
boolean true if all object data were removed; false if only a references were removed

Reimplemented from ilObject.

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

45 {
46 // DISABLED
47 return false;
48
49 // always call parent delete function first!!
50 if (!parent::delete()) {
51 return false;
52 }
53 // put here userfolder specific stuff
54
55 // always call parent delete function at the end!!
56 return true;
57 }

◆ escapeXML()

ilObjUserFolder::escapeXML (   $value)
protected

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

144 {
145 $value = str_replace("&", "&amp;", $value);
146 $value = str_replace("<", "&lt;", $value);
147 $value = str_replace(">", "&gt;", $value);
148 return $value;
149 }

◆ getExportDirectory()

ilObjUserFolder::getExportDirectory ( )

Get the location of the export directory for the user accounts.

Get the location of the export directory for the user accounts

@access public

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

92 {
93 $export_dir = ilUtil::getDataDir() . "/usrf_data/export";
94
95 return $export_dir;
96 }

References ilUtil\getDataDir().

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

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

◆ getExportFilename()

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

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

61 {
62 $filename = "";
63 //$settings = $this->ilias->getAllSettings();
64 //$this->inst_id = $settings["inst_id"];
65 $inst_id = IL_INST_ID;
66
67 $date = time();
68
69 switch ($a_mode) {
71 $filename = $date . "__" . $inst_id . "__xls_usrf";
72 break;
74 $filename = $date . "__" . $inst_id . "__csv_usrf.csv";
75 break;
77 $filename = $date . "__" . $inst_id . "__xml_usrf.xml";
78 break;
79 }
80 return $filename;
81 }
const IL_INST_ID
Definition: constants.php:38

References $filename, FILE_TYPE_CSV, FILE_TYPE_EXCEL, FILE_TYPE_XML, and IL_INST_ID.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ getExportFiles()

ilObjUserFolder::getExportFiles ( )

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

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

Returns
array A list of file names @access public

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

107 {
108 $dir = $this->getExportDirectory();
109
110 // quit if export dir not available
111 if (!@is_dir($dir) or
112 !is_writeable($dir)) {
113 return array();
114 }
115
116 // open directory
117 $dir = dir($dir);
118
119 // initialize array
120 $file = array();
121
122 // get files and save the in the array
123 while ($entry = $dir->read()) {
124 if ($entry != "." and
125 $entry != ".." and
126 preg_match("/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,4}\$/", $entry, $matches)) {
127 $filearray["filename"] = $entry;
128 $filearray["filesize"] = filesize($this->getExportDirectory() . "/" . $entry);
129 array_push($file, $filearray);
130 }
131 }
132
133 // close import directory
134 $dir->close();
135
136 // sort files
137 sort($file);
138 reset($file);
139
140 return $file;
141 }

References getExportDirectory().

+ Here is the call graph for this function:

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

340 {
341 global $DIC;
342
343 $ilDB = $DIC['ilDB'];
344
345 $db_settings = array();
346
347 include_once("./Services/User/classes/class.ilUserProfile.php");
348 $up = new ilUserProfile();
349 $up->skipField("roles");
350 $profile_fields = $up->getStandardFields();
351
352 /*$profile_fields =& ilObjUserFolder::getProfileFields();
353 $profile_fields[] = "preferences";*/
354
355 $query = "SELECT * FROM settings WHERE " .
356 $ilDB->like("keyword", "text", '%usr_settings_export_%');
357 $result = $ilDB->query($query);
358 while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
359 if ($row["value"] == "1") {
360 if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting)) {
361 array_push($db_settings, $setting[1]);
362 }
363 }
364 }
365 $export_settings = array();
366 foreach ($profile_fields as $key => $value) {
367 if (in_array($key, $db_settings)) {
368 if (strcmp($key, "password") == 0) {
369 // we do not support password export with ILIAS >= 4.5.x
370 continue;
371 } else {
372 array_push($export_settings, $key);
373 }
374 }
375 }
376 array_push($export_settings, "usr_id");
377 array_push($export_settings, "login");
378 array_push($export_settings, "last_login");
379 array_push($export_settings, "last_update");
380 array_push($export_settings, "create_date");
381 array_push($export_settings, "time_limit_owner");
382 array_push($export_settings, "time_limit_unlimited");
383 array_push($export_settings, "time_limit_from");
384 array_push($export_settings, "time_limit_until");
385 array_push($export_settings, "time_limit_message");
386 array_push($export_settings, "active");
387 array_push($export_settings, "approve_date");
388 array_push($export_settings, "agree_date");
389 array_push($export_settings, "client_ip");
390 array_push($export_settings, "auth_mode");
391 array_push($export_settings, "ext_account");
392 array_push($export_settings, "feedhash");
393 return $export_settings;
394 }
Class ilUserProfile.

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

Referenced by ilUserXMLWriter\__handleUser(), and buildExportFile().

+ Here is the caller graph for this function:

◆ getProfileFields()

static & ilObjUserFolder::getProfileFields ( )
static

Get profile fields (DEPRECATED, use ilUserProfile() instead)

Returns
array of fieldnames

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

527 {
528 include_once("./Services/User/classes/class.ilUserProfile.php");
529 $up = new ilUserProfile();
530 $up->skipField("username");
531 $up->skipField("roles");
532 $up->skipGroup("preferences");
533 $fds = $up->getStandardFields();
534 foreach ($fds as $k => $f) {
535 $profile_fields[] = $k;
536 }
537
538 return $profile_fields;
539 }

References Vendor\Package\$f.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )
protected

Get all exportable user defined fields.

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

187 {
188 include_once './Services/User/classes/class.ilUserDefinedFields.php';
190
191 $udf_ex_fields = array();
192 foreach ($udf_obj->getDefinitions() as $definition) {
193 if ($definition["export"] != false) {
194 $udf_ex_fields[] = array("name" => $definition["field_name"],
195 "id" => $definition["field_id"]);
196 }
197 }
198
199 return $udf_ex_fields;
200 }
static _getInstance()
Get instance.

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

+ 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'

◆ FILE_TYPE_EXCEL

const ilObjUserFolder::FILE_TYPE_EXCEL = 'userfolder_export_excel_x86'

◆ FILE_TYPE_XML

const ilObjUserFolder::FILE_TYPE_XML = 'userfolder_export_xml'

◆ ORG_OP_EDIT_USER_ACCOUNTS


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