ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjUserFolder Class Reference
+ Inheritance diagram for ilObjUserFolder:
+ Collaboration diagram for ilObjUserFolder:

Public Member Functions

 __construct ($a_id, $a_call_by_reference=true)
 Constructor public. More...
 
 delete ()
 delete userfolder and all related data DISABLED 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 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 public More...
 
 setId ($a_id)
 set object id public More...
 
 setRefId ($a_id)
 set reference id public More...
 
 getRefId ()
 get reference id public More...
 
 getType ()
 get object type public More...
 
 setType ($a_type)
 set object type public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title public More...
 
 getUntranslatedTitle ()
 get untranslated object title 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 public More...
 
 getLastUpdateDate ()
 get last update date 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...
 
 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) 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 _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 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 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
 
 $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 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 public.

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

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

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

575  {
576  global $ilDB;
577 
578  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
580  $path = $fs->getAbsolutePath() . "/";
581 
582  if (file_exists($path . $a_lang)) {
583  unlink($path . $a_lang);
584  }
585 
586  $ilDB->update(
587  'mail_template',
588  array('att_file' => array('text', '')),
589  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
590  );
591  }
Create styles array
The data for the language used.
global $ilDB
const USER_FOLDER_ID
Class ilObjUserFolder.

◆ _lookupNewAccountMail()

static ilObjUserFolder::_lookupNewAccountMail (   $a_lang)
static

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

References $ilDB, array, and ilDBConstants\FETCHMODE_ASSOC.

Referenced by ilObjUserFolderGUI\importUserRoleAssignmentObject(), ilAuthContainerSOAP\loginObserver(), ilAccountMail\readAccountMail(), ilUserImportParser\readAccountMailFromCache(), and ilAccountRegistrationMail\trySendingUserDefinedAccountMail().

594  {
595  global $ilDB;
596 
597  $set = $ilDB->query("SELECT * FROM mail_template " .
598  " WHERE type='nacc' AND lang = " . $ilDB->quote($a_lang, 'text'));
599 
600  if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
601  return $rec;
602  }
603  return array();
604  }
Create styles array
The data for the language used.
global $ilDB
+ 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 552 of file class.ilObjUserFolder.php.

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

553  {
554  global $ilDB;
555 
556  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
558  $fs->create();
559  $path = $fs->getAbsolutePath() . "/";
560 
561  ilUtil::moveUploadedFile($a_tmp_name, $a_lang, $path . $a_lang);
562 
563  $ilDB->update(
564  'mail_template',
565  array('att_file' => array('text', $a_name)),
566  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
567  );
568  }
Create styles array
The data for the language used.
global $ilDB
const USER_FOLDER_ID
Class ilObjUserFolder.

◆ _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.

public

Parameters
intold_id
intnew id

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

References $ilDB, and $query.

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

618  {
619  global $ilDB;
620 
621  $query = "UPDATE usr_data SET time_limit_owner = " . $ilDB->quote($a_new_id, "integer") . " " .
622  "WHERE time_limit_owner = " . $ilDB->quote($a_old_id, "integer") . " ";
623  $ilDB->manipulate($query);
624 
625  return true;
626  }
$query
global $ilDB
+ 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 514 of file class.ilObjUserFolder.php.

References $ilDB, and array.

515  {
516  global $ilDB;
517 
518  if (self::_lookupNewAccountMail($a_lang)) {
519  $values = array(
520  'subject' => array('text',$a_subject),
521  'body' => array('clob',$a_body),
522  'sal_g' => array('text',$a_sal_g),
523  'sal_f' => array('text',$a_sal_f),
524  'sal_m' => array('text',$a_sal_m)
525  );
526  $ilDB->update(
527  'mail_template',
528  $values,
529  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
530  );
531  } else {
532  $values = array(
533  'subject' => array('text',$a_subject),
534  'body' => array('clob',$a_body),
535  'sal_g' => array('text',$a_sal_g),
536  'sal_f' => array('text',$a_sal_f),
537  'sal_m' => array('text',$a_sal_m),
538  'lang' => array('text',$a_lang),
539  'type' => array('text','nacc')
540  );
541  $ilDB->insert('mail_template', $values);
542  }
543  }
Create styles array
The data for the language used.
global $ilDB

◆ buildExportFile()

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

build xml export file

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

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

387  {
388  global $ilBench;
389  global $log;
390  global $ilDB;
391  global $ilias;
392  global $lng;
393 
394  //get Log File
395  $expDir = $this->getExportDirectory();
396  //$expLog = &$log;
397  //$expLog->delete();
398  //$expLog->setLogFormat("");
399  //$expLog->write(date("[y-m-d H:i:s] ")."Start export of user data");
400 
401  // create export directory if needed
402  $this->createExportDirectory();
403 
404  //get data
405  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
406  $settings =&$this->getExportSettings();
407 
408  // user languages
409  $query = "SELECT * FROM usr_pref WHERE keyword = " . $ilDB->quote('language', 'text');
410  $res = $ilDB->query($query);
411  $languages = array();
412  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
413  $languages[$row['usr_id']] = $row['value'];
414  }
415 
416  // multi-text
417  $multi = array();
418  $set = $ilDB->query("SELECT * FROM usr_data_multi");
419  while ($row = $ilDB->fetchAssoc($set)) {
420  if (!is_array($user_data_filter) ||
421  in_array($row["usr_id"], $user_data_filter)) {
422  $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
423  }
424  }
425 
426  $data = array();
427  $query = "SELECT usr_data.* FROM usr_data " .
428  " ORDER BY usr_data.lastname, usr_data.firstname";
429  $result = $ilDB->query($query);
430  while ($row = $ilDB->fetchAssoc($result)) {
431  if (isset($languages[$row['usr_id']])) {
432  $row['language'] = $languages[$row['usr_id']];
433  } else {
434  $row['language'] = $lng->getDefaultLanguage();
435  }
436 
437  if (isset($multi[$row["usr_id"]])) {
438  $row = array_merge($row, $multi[$row["usr_id"]]);
439  }
440 
441  if (is_array($user_data_filter)) {
442  if (in_array($row["usr_id"], $user_data_filter)) {
443  array_push($data, $row);
444  }
445  } else {
446  array_push($data, $row);
447  }
448  }
449  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
450 
451  $fullname = $expDir . "/" . $this->getExportFilename($a_mode);
452  switch ($a_mode) {
453  case "userfolder_export_excel_x86":
454  $this->createExcelExport($settings, $data, $fullname);
455  break;
456  case "userfolder_export_csv":
457  $this->createCSVExport($settings, $data, $fullname);
458  break;
459  case "userfolder_export_xml":
460  $this->createXMLExport($settings, $data, $fullname);
461  break;
462  }
463  //$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
464 
465  return $fullname;
466  }
getExportFilename($a_mode="userfolder_export_excel_x86")
$result
getExportDirectory()
Get the location of the export directory for the user accounts.
createXMLExport(&$settings, &$data, $filename)
createExportDirectory()
creates data directory for export files (data_dir/usrf_data/export, depending on data directory that ...
static getExportSettings()
getExport Settings
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilBench
Definition: ilias.php:18
global $ilDB
createExcelExport(&$settings, &$data, $filename)
createCSVExport(&$settings, &$data, $filename)
+ Here is the call graph for this function:

◆ createCSVExport()

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

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

References $data, $file, $filename, $header, $row, array, getUserDefinedExportFields(), and ilUtil\processCSVRow().

Referenced by buildExportFile().

192  {
193 
194  // header
195  $headerrow = array();
196  $udf_ex_fields = $this->getUserDefinedExportFields();
197  foreach ($settings as $value) { // standard fields
198  array_push($headerrow, $this->lng->txt($value));
199  }
200  foreach ($udf_ex_fields as $f) { // custom fields
201  array_push($headerrow, $f["name"]);
202  }
203 
204  $separator = ";";
205  $file = fopen($filename, "w");
206  $formattedrow =&ilUtil::processCSVRow($headerrow, true, $separator);
207  fwrite($file, join($separator, $formattedrow) . "\n");
208  foreach ($data as $row) {
209  $csvrow = array();
210  foreach ($settings as $header) { // standard fields
211  // multi-text
212  if (is_array($row[$header])) {
213  $row[$header] = implode(", ", $row[$header]);
214  }
215 
216  array_push($csvrow, $row[$header]);
217  }
218 
219  // custom fields
220  reset($udf_ex_fields);
221  if (count($udf_ex_fields) > 0) {
222  include_once("./Services/User/classes/class.ilUserDefinedData.php");
223  $udf = new ilUserDefinedData($row["usr_id"]);
224  foreach ($udf_ex_fields as $f) { // custom fields
225  array_push($csvrow, $udf->get("f_" . $f["id"]));
226  }
227  }
228 
229  $formattedrow =&ilUtil::processCSVRow($csvrow, true, $separator);
230  fwrite($file, join($separator, $formattedrow) . "\n");
231  }
232  fclose($file);
233  }
Class ilUserDefinedData.
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
Create styles array
The data for the language used.
getUserDefinedExportFields()
Get all exportable user defined fields.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 235 of file class.ilObjUserFolder.php.

References $data, $filename, $index, $row, $worksheet, getUserDefinedExportFields(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by buildExportFile().

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

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

Referenced by buildExportFile().

475  {
476  if (!@is_dir($this->getExportDirectory())) {
477  $usrf_data_dir = ilUtil::getDataDir() . "/usrf_data";
478  ilUtil::makeDir($usrf_data_dir);
479  if (!is_writable($usrf_data_dir)) {
480  $this->ilias->raiseError("Userfolder data directory (" . $usrf_data_dir
481  . ") not writeable.", $this->ilias->error_obj->MESSAGE);
482  }
483 
484  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
485  $export_dir = $usrf_data_dir . "/export";
486  ilUtil::makeDir($export_dir);
487  if (!@is_dir($export_dir)) {
488  $this->ilias->raiseError("Creation of Userfolder Export Directory failed.", $this->ilias->error_obj->MESSAGE);
489  }
490  }
491  }
getExportDirectory()
Get the location of the export directory for the user accounts.
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ 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 146 of file class.ilObjUserFolder.php.

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

Referenced by buildExportFile().

147  {
148  include_once './Services/User/classes/class.ilUserDefinedData.php';
149  include_once './Services/User/classes/class.ilObjUser.php';
150 
151  global $rbacreview;
152  global $ilDB;
153  global $log;
154 
155  $file = fopen($filename, "w");
156 
157  if (is_array($data)) {
158  include_once './Services/User/classes/class.ilUserXMLWriter.php';
159 
160  $xmlWriter = new ilUserXMLWriter();
161  $xmlWriter->setObjects($data);
162  $xmlWriter->setSettings($settings);
163  $xmlWriter->setAttachRoles(true);
164 
165  if ($xmlWriter->start()) {
166  fwrite($file, $xmlWriter->getXML());
167  }
168  }
169  }
XML writer class.
global $ilDB
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ delete()

ilObjUserFolder::delete ( )

delete userfolder and all related data DISABLED public

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

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  return false;
47  }
48  // put here userfolder specific stuff
49 
50  // always call parent delete function at the end!!
51  return true;
52  }

◆ escapeXML()

ilObjUserFolder::escapeXML (   $value)

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

139  {
140  $value = str_replace("&", "&amp;", $value);
141  $value = str_replace("<", "&lt;", $value);
142  $value = str_replace(">", "&gt;", $value);
143  return $value;
144  }

◆ 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

public

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

References ilUtil\getDataDir().

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

87  {
88  $export_dir = ilUtil::getDataDir() . "/usrf_data/export";
89 
90  return $export_dir;
91  }
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 (   $a_mode = "userfolder_export_excel_x86")

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

References $filename, and time.

Referenced by buildExportFile().

56  {
57  $filename = "";
58  //$settings = $this->ilias->getAllSettings();
59  //$this->inst_id = $settings["inst_id"];
60  $inst_id = IL_INST_ID;
61 
62  $date = time();
63 
64  switch ($a_mode) {
65  case "userfolder_export_excel_x86":
66  $filename = $date . "__" . $inst_id . "__xls_usrf";
67  break;
68  case "userfolder_export_csv":
69  $filename = $date . "__" . $inst_id . "__csv_usrf.csv";
70  break;
71  case "userfolder_export_xml":
72  $filename = $date . "__" . $inst_id . "__xml_usrf.xml";
73  break;
74  }
75  return $filename;
76  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 public

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

References $file, array, and getExportDirectory().

102  {
103  $dir = $this->getExportDirectory();
104 
105  // quit if export dir not available
106  if (!@is_dir($dir) or
107  !is_writeable($dir)) {
108  return array();
109  }
110 
111  // open directory
112  $dir = dir($dir);
113 
114  // initialize array
115  $file = array();
116 
117  // get files and save the in the array
118  while ($entry = $dir->read()) {
119  if ($entry != "." and
120  $entry != ".." and
121  preg_match("/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,4}\$/", $entry, $matches)) {
122  $filearray["filename"] = $entry;
123  $filearray["filesize"] = filesize($this->getExportDirectory() . "/" . $entry);
124  array_push($file, $filearray);
125  }
126  }
127 
128  // close import directory
129  $dir->close();
130 
131  // sort files
132  sort($file);
133  reset($file);
134 
135  return $file;
136  }
getExportDirectory()
Get the location of the export directory for the user accounts.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

References $ilDB, $key, $query, $result, $row, array, and ilDBConstants\FETCHMODE_ASSOC.

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

329  {
330  global $ilDB;
331 
332  $db_settings = array();
333 
334  include_once("./Services/User/classes/class.ilUserProfile.php");
335  $up = new ilUserProfile();
336  $up->skipField("roles");
337  $profile_fields = $up->getStandardFields();
338 
339  /*$profile_fields =& ilObjUserFolder::getProfileFields();
340  $profile_fields[] = "preferences";*/
341 
342  $query = "SELECT * FROM settings WHERE " .
343  $ilDB->like("keyword", "text", '%usr_settings_export_%');
344  $result = $ilDB->query($query);
345  while ($row = $result->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
346  if ($row["value"] == "1") {
347  if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting)) {
348  array_push($db_settings, $setting[1]);
349  }
350  }
351  }
352  $export_settings = array();
353  foreach ($profile_fields as $key => $value) {
354  if (in_array($key, $db_settings)) {
355  if (strcmp($key, "password") == 0) {
356  // we do not support password export with ILIAS >= 4.5.x
357  continue;
358  } else {
359  array_push($export_settings, $key);
360  }
361  }
362  }
363  array_push($export_settings, "usr_id");
364  array_push($export_settings, "login");
365  array_push($export_settings, "last_login");
366  array_push($export_settings, "last_update");
367  array_push($export_settings, "create_date");
368  array_push($export_settings, "time_limit_owner");
369  array_push($export_settings, "time_limit_unlimited");
370  array_push($export_settings, "time_limit_from");
371  array_push($export_settings, "time_limit_until");
372  array_push($export_settings, "time_limit_message");
373  array_push($export_settings, "active");
374  array_push($export_settings, "approve_date");
375  array_push($export_settings, "agree_date");
376  array_push($export_settings, "client_ip");
377  array_push($export_settings, "auth_mode");
378  array_push($export_settings, "ext_account");
379  array_push($export_settings, "feedhash");
380  return $export_settings;
381  }
$result
Class ilUserProfile.
$query
Create styles array
The data for the language used.
global $ilDB
$key
Definition: croninfo.php:18
+ 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 499 of file class.ilObjUserFolder.php.

500  {
501  include_once("./Services/User/classes/class.ilUserProfile.php");
502  $up = new ilUserProfile();
503  $up->skipField("username");
504  $up->skipField("roles");
505  $up->skipGroup("preferences");
506  $fds = $up->getStandardFields();
507  foreach ($fds as $k => $f) {
508  $profile_fields[] = $k;
509  }
510 
511  return $profile_fields;
512  }
Class ilUserProfile.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

References ilUserDefinedFields\_getInstance(), and array.

Referenced by createCSVExport(), and createExcelExport().

176  {
177  include_once './Services/User/classes/class.ilUserDefinedFields.php';
179 
180  $udf_ex_fields = array();
181  foreach ($udf_obj->getDefinitions() as $definition) {
182  if ($definition["export"] != false) {
183  $udf_ex_fields[] = array("name" => $definition["field_name"],
184  "id" => $definition["field_id"]);
185  }
186  }
187 
188  return $udf_ex_fields;
189  }
static _getInstance()
Get instance.
Create styles array
The data for the language used.
+ 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: