ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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="userfolder_export_excel_x86")
 
 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...
 
 escapeXML ($value)
 
 createXMLExport (&$settings, &$data, $filename)
 
 getUserDefinedExportFields ()
 Get all exportable user defined fields. More...
 
 createCSVExport (&$settings, &$data, $filename)
 
 createExcelExport (&$settings, &$data, $filename)
 
 buildExportFile ($a_mode="userfolder_export_excel_x86", $user_data_filter=FALSE)
 build xml export file More...
 
 createExportDirectory ()
 creates data directory for export files (data_dir/usrf_data/export, depending on data directory that is set in ILIAS setup/ini) 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...
 
 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 ()
 
 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 ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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 _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)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. 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...
 

Additional Inherited Members

- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $ilias
 
 $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
 

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 26 of file class.ilObjUserFolder.php.

27 {
28 $this->type = "usrf";
29 parent::__construct($a_id,$a_call_by_reference);
30 }

Member Function Documentation

◆ _deleteAccountMailAttachment()

static ilObjUserFolder::_deleteAccountMailAttachment (   $a_lang)
static

Delete account mail attachment.

Parameters
$a_lang

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

623 {
624 global $ilDB;
625
626 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
628 $path = $fs->getAbsolutePath()."/";
629
630 unlink($path.$a_lang);
631
632 $ilDB->update('mail_template',
633 array('att_file' => array('text', '')),
634 array('lang' => array('text',$a_lang), 'type' => array('text','nacc')));
635 }
$path
Definition: aliased.php:25
const USER_FOLDER_ID
Class ilObjUserFolder.
global $ilDB

References $ilDB, $path, and USER_FOLDER_ID.

◆ _lookupNewAccountMail()

static ilObjUserFolder::_lookupNewAccountMail (   $a_lang)
static

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

638 {
639 global $ilDB;
640
641 $set = $ilDB->query("SELECT * FROM mail_template ".
642 " WHERE type='nacc' AND lang = ".$ilDB->quote($a_lang,'text'));
643
644 if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
645 {
646 return $rec;
647 }
648 return array();
649 }

References $ilDB, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilAccountRegistrationGUI\__distributeMails(), ilStartUpGUI\confirmRegistration(), ilObjUserFolderGUI\importUserRoleAssignmentObject(), ilAuthContainerSOAP\loginObserver(), ilAccountMail\readAccountMail(), and ilUserImportParser\readAccountMailFromCache().

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

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

603 {
604 global $ilDB;
605
606 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
608 $fs->create();
609 $path = $fs->getAbsolutePath()."/";
610
611 ilUtil::moveUploadedFile($a_tmp_name, $a_lang, $path.$a_lang);
612
613 $ilDB->update('mail_template',
614 array('att_file' => array('text', $a_name)),
615 array('lang' => array('text',$a_lang), 'type' => array('text','nacc')));
616 }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

References $ilDB, $path, 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

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

663 {
664 global $ilDB;
665
666 $query = "UPDATE usr_data SET time_limit_owner = ".$ilDB->quote($a_new_id, "integer")." ".
667 "WHERE time_limit_owner = ".$ilDB->quote($a_old_id, "integer")." ";
668 $ilDB->manipulate($query);
669
670 return true;
671 }

References $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 562 of file class.ilObjUserFolder.php.

563 {
564 global $ilDB;
565
566 if(self::_lookupNewAccountMail($a_lang))
567 {
568 $values = array(
569 'subject' => array('text',$a_subject),
570 'body' => array('clob',$a_body),
571 'sal_g' => array('text',$a_sal_g),
572 'sal_f' => array('text',$a_sal_f),
573 'sal_m' => array('text',$a_sal_m)
574 );
575 $ilDB->update('mail_template',
576 $values,
577 array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
578 );
579 }
580 else
581 {
582 $values = array(
583 'subject' => array('text',$a_subject),
584 'body' => array('clob',$a_body),
585 'sal_g' => array('text',$a_sal_g),
586 'sal_f' => array('text',$a_sal_f),
587 'sal_m' => array('text',$a_sal_m),
588 'lang' => array('text',$a_lang),
589 'type' => array('text','nacc')
590 );
591 $ilDB->insert('mail_template',$values);
592 }
593 }

References $ilDB.

◆ buildExportFile()

ilObjUserFolder::buildExportFile (   $a_mode = "userfolder_export_excel_x86",
  $user_data_filter = FALSE 
)

build xml export file

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

421 {
422 global $ilBench;
423 global $log;
424 global $ilDB;
425 global $ilias;
426 global $lng;
427
428 //get Log File
429 $expDir = $this->getExportDirectory();
430 //$expLog = &$log;
431 //$expLog->delete();
432 //$expLog->setLogFormat("");
433 //$expLog->write(date("[y-m-d H:i:s] ")."Start export of user data");
434
435 // create export directory if needed
436 $this->createExportDirectory();
437
438 //get data
439 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
440 $settings =& $this->getExportSettings();
441
442 // user languages
443 $query = "SELECT * FROM usr_pref WHERE keyword = ".$ilDB->quote('language','text');
444 $res = $ilDB->query($query);
445 $languages = array();
446 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
447 {
448 $languages[$row['usr_id']] = $row['value'];
449 }
450
451 // multi-text
452 $multi = array();
453 $set = $ilDB->query("SELECT * FROM usr_data_multi");
454 while($row = $ilDB->fetchAssoc($set))
455 {
456 if(!is_array($user_data_filter) ||
457 in_array($row["usr_id"], $user_data_filter))
458 {
459 $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
460 }
461 }
462
463 $data = array();
464 $query = "SELECT usr_data.* FROM usr_data ".
465 " ORDER BY usr_data.lastname, usr_data.firstname";
466 $result = $ilDB->query($query);
467 while ($row = $ilDB->fetchAssoc($result))
468 {
469 if(isset($languages[$row['usr_id']]))
470 {
471 $row['language'] = $languages[$row['usr_id']];
472 }
473 else
474 {
475 $row['language'] = $lng->getDefaultLanguage();
476 }
477
478 if(isset($multi[$row["usr_id"]]))
479 {
480 $row = array_merge($row, $multi[$row["usr_id"]]);
481 }
482
483 if (is_array($user_data_filter))
484 {
485 if (in_array($row["usr_id"], $user_data_filter)) array_push($data, $row);
486 }
487 else
488 {
489 array_push($data, $row);
490 }
491 }
492 //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
493
494 $fullname = $expDir."/".$this->getExportFilename($a_mode);
495 switch ($a_mode)
496 {
497 case "userfolder_export_excel_x86":
498 $this->createExcelExport($settings, $data, $fullname);
499 break;
500 case "userfolder_export_csv":
501 $this->createCSVExport($settings, $data, $fullname);
502 break;
503 case "userfolder_export_xml":
504 $this->createXMLExport($settings, $data, $fullname);
505 break;
506 }
507 //$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
508
509 return $fullname;
510 }
$result
createExportDirectory()
creates data directory for export files (data_dir/usrf_data/export, depending on data directory that ...
getExportFilename($a_mode="userfolder_export_excel_x86")
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.
$languages
Definition: cssgen2.php:34
global $ilBench
Definition: ilias.php:18

References $data, $ilBench, $ilDB, ilObject\$ilias, $languages, ilObject\$lng, $log, $query, $res, $result, $row, createCSVExport(), createExcelExport(), createExportDirectory(), createXMLExport(), ilDBConstants\FETCHMODE_ASSOC, getExportDirectory(), getExportFilename(), and getExportSettings().

+ Here is the call graph for this function:

◆ createCSVExport()

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

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

201 {
202
203 // header
204 $headerrow = array();
205 $udf_ex_fields = $this->getUserDefinedExportFields();
206 foreach ($settings as $value) // standard fields
207 {
208 array_push($headerrow, $this->lng->txt($value));
209 }
210 foreach ($udf_ex_fields as $f) // custom fields
211 {
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 {
221 $csvrow = array();
222 foreach ($settings as $header) // standard fields
223 {
224 // multi-text
225 if(is_array($row[$header]))
226 {
227 $row[$header] = implode(", ", $row[$header]);
228 }
229
230 array_push($csvrow, $row[$header]);
231 }
232
233 // custom fields
234 reset($udf_ex_fields);
235 if (count($udf_ex_fields) > 0)
236 {
237 include_once("./Services/User/classes/class.ilUserDefinedData.php");
238 $udf = new ilUserDefinedData($row["usr_id"]);
239 foreach ($udf_ex_fields as $f) // custom fields
240 {
241 array_push($csvrow, $udf->get("f_".$f["id"]));
242 }
243 }
244
245 $formattedrow =& ilUtil::processCSVRow($csvrow, TRUE, $separator);
246 fwrite($file, join ($separator, $formattedrow) ."\n");
247 }
248 fclose($file);
249 }
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.
$header
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $data, $file, $filename, $header, $row, 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 
)

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

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

References $data, $filename, $row, $worksheet, 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 ( )

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 518 of file class.ilObjUserFolder.php.

519 {
520 if (!@is_dir($this->getExportDirectory()))
521 {
522 $usrf_data_dir = ilUtil::getDataDir()."/usrf_data";
523 ilUtil::makeDir($usrf_data_dir);
524 if(!is_writable($usrf_data_dir))
525 {
526 $this->ilias->raiseError("Userfolder data directory (".$usrf_data_dir
527 .") not writeable.",$this->ilias->error_obj->MESSAGE);
528 }
529
530 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
531 $export_dir = $usrf_data_dir."/export";
532 ilUtil::makeDir($export_dir);
533 if(!@is_dir($export_dir))
534 {
535 $this->ilias->raiseError("Creation of Userfolder Export Directory failed.",$this->ilias->error_obj->MESSAGE);
536 }
537 }
538 }
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 
)

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 $rbacreview;
157 global $ilDB;
158 global $log;
159
160 $file = fopen($filename, "w");
161
162 if (is_array($data))
163 {
164 include_once './Services/User/classes/class.ilUserXMLWriter.php';
165
166 $xmlWriter = new ilUserXMLWriter();
167 $xmlWriter->setObjects($data);
168 $xmlWriter->setSettings($settings);
169 $xmlWriter->setAttachRoles (true);
170
171 if($xmlWriter->start())
172 {
173 fwrite($file, $xmlWriter->getXML());
174 }
175 }
176 }
XML writer class.

References $data, $file, $filename, $ilDB, and $log.

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 39 of file class.ilObjUserFolder.php.

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

◆ escapeXML()

ilObjUserFolder::escapeXML (   $value)

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 88 of file class.ilObjUserFolder.php.

89 {
90 $export_dir = ilUtil::getDataDir()."/usrf_data/export";
91
92 return $export_dir;
93 }

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 = "userfolder_export_excel_x86")

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

57 {
58 $filename = "";
59 //$settings = $this->ilias->getAllSettings();
60 //$this->inst_id = $settings["inst_id"];
61 $inst_id = IL_INST_ID;
62
63 $date = time();
64
65 switch($a_mode)
66 {
67 case "userfolder_export_excel_x86":
68 $filename = $date."__".$inst_id."__xls_usrf";
69 break;
70 case "userfolder_export_csv":
71 $filename = $date."__".$inst_id."__csv_usrf.csv";
72 break;
73 case "userfolder_export_xml":
74 $filename = $date."__".$inst_id."__xml_usrf.xml";
75 break;
76 }
77 return $filename;
78 }

References $filename.

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 103 of file class.ilObjUserFolder.php.

104 {
105 $dir = $this->getExportDirectory();
106
107 // quit if export dir not available
108 if (!@is_dir($dir) or
109 !is_writeable($dir))
110 {
111 return array();
112 }
113
114 // open directory
115 $dir = dir($dir);
116
117 // initialize array
118 $file = array();
119
120 // get files and save the in the array
121 while ($entry = $dir->read())
122 {
123 if ($entry != "." and
124 $entry != ".." and
125 preg_match("/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,4}\$/", $entry, $matches))
126 {
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 $file, and getExportDirectory().

+ Here is the call graph for this function:

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

355 {
356 global $ilDB;
357
358 $db_settings = array();
359
360 include_once("./Services/User/classes/class.ilUserProfile.php");
361 $up = new ilUserProfile();
362 $up->skipField("roles");
363 $profile_fields = $up->getStandardFields();
364
365 /*$profile_fields =& ilObjUserFolder::getProfileFields();
366 $profile_fields[] = "preferences";*/
367
368 $query = "SELECT * FROM settings WHERE ".
369 $ilDB->like("keyword", "text", '%usr_settings_export_%');
370 $result = $ilDB->query($query);
371 while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC))
372 {
373 if ($row["value"] == "1")
374 {
375 if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting))
376 {
377 array_push($db_settings, $setting[1]);
378 }
379 }
380 }
381 $export_settings = array();
382 foreach ($profile_fields as $key => $value)
383 {
384 if (in_array($key, $db_settings))
385 {
386 if (strcmp($key, "password") == 0)
387 {
388 // we do not support password export with ILIAS >= 4.5.x
389 continue;
390 }
391 else
392 {
393 array_push($export_settings, $key);
394 }
395 }
396 }
397 array_push($export_settings, "usr_id");
398 array_push($export_settings, "login");
399 array_push($export_settings, "last_login");
400 array_push($export_settings, "last_update");
401 array_push($export_settings, "create_date");
402 array_push($export_settings, "time_limit_owner");
403 array_push($export_settings, "time_limit_unlimited");
404 array_push($export_settings, "time_limit_from");
405 array_push($export_settings, "time_limit_until");
406 array_push($export_settings, "time_limit_message");
407 array_push($export_settings, "active");
408 array_push($export_settings, "approve_date");
409 array_push($export_settings, "agree_date");
410 array_push($export_settings, "client_ip");
411 array_push($export_settings, "auth_mode");
412 array_push($export_settings, "ext_account");
413 array_push($export_settings, "feedhash");
414 return $export_settings;
415 }
Class ilUserProfile.

References $ilDB, $query, $result, $row, 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 546 of file class.ilObjUserFolder.php.

547 {
548 include_once("./Services/User/classes/class.ilUserProfile.php");
549 $up = new ilUserProfile();
550 $up->skipField("username");
551 $up->skipField("roles");
552 $up->skipGroup("preferences");
553 $fds = $up->getStandardFields();
554 foreach ($fds as $k => $f)
555 {
556 $profile_fields[] = $k;
557 }
558
559 return $profile_fields;
560 }

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

183 {
184 include_once './Services/User/classes/class.ilUserDefinedFields.php';
186
187 $udf_ex_fields = array();
188 foreach($udf_obj->getDefinitions() as $definition)
189 {
190 if ($definition["export"] != FALSE)
191 {
192 $udf_ex_fields[] = array("name" => $definition["field_name"],
193 "id" => $definition["field_id"]);
194 }
195 }
196
197 return $udf_ex_fields;
198 }
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:

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