ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 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 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 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)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 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 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 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 596 of file class.ilObjUserFolder.php.

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

597  {
598  global $DIC;
599 
600  $ilDB = $DIC['ilDB'];
601 
602  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
604  $path = $fs->getAbsolutePath() . "/";
605 
606  if (file_exists($path . $a_lang)) {
607  unlink($path . $a_lang);
608  }
609 
610  $ilDB->update(
611  'mail_template',
612  array('att_file' => array('text', '')),
613  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
614  );
615  }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
global $ilDB
const USER_FOLDER_ID
Class ilObjUserFolder.

◆ _lookupNewAccountMail()

static ilObjUserFolder::_lookupNewAccountMail (   $a_lang)
static

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

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

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

618  {
619  global $DIC;
620 
621  $ilDB = $DIC['ilDB'];
622 
623  $set = $ilDB->query("SELECT * FROM mail_template " .
624  " WHERE type='nacc' AND lang = " . $ilDB->quote($a_lang, 'text'));
625 
626  if ($rec = $set->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
627  return $rec;
628  }
629  return array();
630  }
global $DIC
Definition: saml.php:7
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 572 of file class.ilObjUserFolder.php.

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

573  {
574  global $DIC;
575 
576  $ilDB = $DIC['ilDB'];
577 
578  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
580  $fs->create();
581  $path = $fs->getAbsolutePath() . "/";
582 
583  ilUtil::moveUploadedFile($a_tmp_name, $a_lang, $path . $a_lang);
584 
585  $ilDB->update(
586  'mail_template',
587  array('att_file' => array('text', $a_name)),
588  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
589  );
590  }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
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 643 of file class.ilObjUserFolder.php.

References $DIC, $ilDB, and $query.

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

644  {
645  global $DIC;
646 
647  $ilDB = $DIC['ilDB'];
648 
649  $query = "UPDATE usr_data SET time_limit_owner = " . $ilDB->quote($a_new_id, "integer") . " " .
650  "WHERE time_limit_owner = " . $ilDB->quote($a_old_id, "integer") . " ";
651  $ilDB->manipulate($query);
652 
653  return true;
654  }
global $DIC
Definition: saml.php:7
$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 532 of file class.ilObjUserFolder.php.

References $DIC, $ilDB, and $values.

533  {
534  global $DIC;
535 
536  $ilDB = $DIC['ilDB'];
537 
538  if (self::_lookupNewAccountMail($a_lang)) {
539  $values = array(
540  'subject' => array('text',$a_subject),
541  'body' => array('clob',$a_body),
542  'sal_g' => array('text',$a_sal_g),
543  'sal_f' => array('text',$a_sal_f),
544  'sal_m' => array('text',$a_sal_m)
545  );
546  $ilDB->update(
547  'mail_template',
548  $values,
549  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
550  );
551  } else {
552  $values = array(
553  'subject' => array('text',$a_subject),
554  'body' => array('clob',$a_body),
555  'sal_g' => array('text',$a_sal_g),
556  'sal_f' => array('text',$a_sal_f),
557  'sal_m' => array('text',$a_sal_m),
558  'lang' => array('text',$a_lang),
559  'type' => array('text','nacc')
560  );
561  $ilDB->insert('mail_template', $values);
562  }
563  }
global $DIC
Definition: saml.php:7
$values
global $ilDB

◆ buildExportFile()

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

build xml export file

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

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

395  {
396  global $DIC;
397 
398  $ilBench = $DIC['ilBench'];
399  global $DIC;
400 
401  $log = $DIC['log'];
402  global $DIC;
403 
404  $ilDB = $DIC['ilDB'];
405  global $DIC;
406 
407  $ilias = $DIC['ilias'];
408  global $DIC;
409 
410  $lng = $DIC['lng'];
411 
412  //get Log File
413  $expDir = $this->getExportDirectory();
414  //$expLog = &$log;
415  //$expLog->delete();
416  //$expLog->setLogFormat("");
417  //$expLog->write(date("[y-m-d H:i:s] ")."Start export of user data");
418 
419  // create export directory if needed
420  $this->createExportDirectory();
421 
422  //get data
423  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
424  $settings = &$this->getExportSettings();
425 
426  // user languages
427  $query = "SELECT * FROM usr_pref WHERE keyword = " . $ilDB->quote('language', 'text');
428  $res = $ilDB->query($query);
429  $languages = array();
430  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
431  $languages[$row['usr_id']] = $row['value'];
432  }
433 
434  // multi-text
435  $multi = array();
436  $set = $ilDB->query("SELECT * FROM usr_data_multi");
437  while ($row = $ilDB->fetchAssoc($set)) {
438  if (!is_array($user_data_filter) ||
439  in_array($row["usr_id"], $user_data_filter)) {
440  $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
441  }
442  }
443 
444  $data = array();
445  $query = "SELECT usr_data.* FROM usr_data " .
446  " ORDER BY usr_data.lastname, usr_data.firstname";
447  $result = $ilDB->query($query);
448  while ($row = $ilDB->fetchAssoc($result)) {
449  if (isset($languages[$row['usr_id']])) {
450  $row['language'] = $languages[$row['usr_id']];
451  } else {
452  $row['language'] = $lng->getDefaultLanguage();
453  }
454 
455  if (isset($multi[$row["usr_id"]])) {
456  $row = array_merge($row, $multi[$row["usr_id"]]);
457  }
458 
459  if (is_array($user_data_filter)) {
460  if (in_array($row["usr_id"], $user_data_filter)) {
461  array_push($data, $row);
462  }
463  } else {
464  array_push($data, $row);
465  }
466  }
467  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
468 
469  $fullname = $expDir . "/" . $this->getExportFilename($a_mode);
470  switch ($a_mode) {
471  case "userfolder_export_excel_x86":
472  $this->createExcelExport($settings, $data, $fullname);
473  break;
474  case "userfolder_export_csv":
475  $this->createCSVExport($settings, $data, $fullname);
476  break;
477  case "userfolder_export_xml":
478  $this->createXMLExport($settings, $data, $fullname);
479  break;
480  }
481  //$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
482 
483  return $fullname;
484  }
getExportFilename($a_mode="userfolder_export_excel_x86")
$result
global $DIC
Definition: saml.php:7
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
$row
global $ilBench
Definition: ilias.php:18
global $ilDB
$languages
Definition: cssgen2.php:34
createExcelExport(&$settings, &$data, $filename)
$data
Definition: bench.php:6
createCSVExport(&$settings, &$data, $filename)
+ Here is the call graph for this function:

◆ createCSVExport()

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

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

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

Referenced by buildExportFile().

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

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

Referenced by buildExportFile().

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

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

Referenced by buildExportFile().

493  {
494  if (!@is_dir($this->getExportDirectory())) {
495  $usrf_data_dir = ilUtil::getDataDir() . "/usrf_data";
496  ilUtil::makeDir($usrf_data_dir);
497  if (!is_writable($usrf_data_dir)) {
498  $this->ilias->raiseError("Userfolder data directory (" . $usrf_data_dir
499  . ") not writeable.", $this->ilias->error_obj->MESSAGE);
500  }
501 
502  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
503  $export_dir = $usrf_data_dir . "/export";
504  ilUtil::makeDir($export_dir);
505  if (!@is_dir($export_dir)) {
506  $this->ilias->raiseError("Creation of Userfolder Export Directory failed.", $this->ilias->error_obj->MESSAGE);
507  }
508  }
509  }
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, $DIC, $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 $DIC;
152 
153  $rbacreview = $DIC['rbacreview'];
154  global $DIC;
155 
156  $ilDB = $DIC['ilDB'];
157  global $DIC;
158 
159  $log = $DIC['log'];
160 
161  $file = fopen($filename, "w");
162 
163  if (is_array($data)) {
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  fwrite($file, $xmlWriter->getXML());
173  }
174  }
175  }
global $DIC
Definition: saml.php:7
XML writer class.
$filename
Definition: buildRTE.php:89
global $ilDB
$data
Definition: bench.php:6
+ 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.

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  }
$filename
Definition: buildRTE.php:89
+ 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 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.
+ Here is the call graph for this function:

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

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

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

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

References $f.

518  {
519  include_once("./Services/User/classes/class.ilUserProfile.php");
520  $up = new ilUserProfile();
521  $up->skipField("username");
522  $up->skipField("roles");
523  $up->skipGroup("preferences");
524  $fds = $up->getStandardFields();
525  foreach ($fds as $k => $f) {
526  $profile_fields[] = $k;
527  }
528 
529  return $profile_fields;
530  }
Class ilUserProfile.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

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