ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjUserFolder Class Reference
+ Inheritance diagram for ilObjUserFolder:
+ Collaboration diagram for ilObjUserFolder:

Public Member Functions

 ilObjUserFolder ($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, $a_mode)
 
 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...
 
 _writeNewAccountMail ($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
 
 _updateAccountMailAttachment ($a_lang, $a_tmp_name, $a_name)
 
 _deleteAccountMailAttachment ($a_lang)
 
 _lookupNewAccountMail ($a_lang)
 
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ($a_force_db=false)
 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 ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 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...
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) 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...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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) public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

static getExportSettings ()
 getExport Settings More...
 
static & getProfileFields ()
 Get profile fields (DEPRECATED, use ilUserProfile() instead) More...
 
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 _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id 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 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
 
 $obj_data_record
 object_data record More...
 

Detailed Description

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

Member Function Documentation

◆ _deleteAccountMailAttachment()

ilObjUserFolder::_deleteAccountMailAttachment (   $a_lang)

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

References $ilDB, $path, and ilObject\getId().

625  {
626  global $ilDB;
627 
628  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
629  $fs = new ilFSStorageUserFolder($this->getId());
630  $path = $fs->getAbsolutePath()."/";
631 
632  @unlink($path.$a_lang);
633 
634  $ilDB->update('mail_template',
635  array('att_file' => array('text', '')),
636  array('lang' => array('text',$a_lang), 'type' => array('text','nacc')));
637  }
getId()
get object id public
$path
Definition: index.php:22
global $ilDB
+ Here is the call graph for this function:

◆ _lookupNewAccountMail()

ilObjUserFolder::_lookupNewAccountMail (   $a_lang)

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

References $ilDB, and DB_FETCHMODE_ASSOC.

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

640  {
641  global $ilDB;
642 
643  $set = $ilDB->query("SELECT * FROM mail_template ".
644  " WHERE type='nacc' AND lang = ".$ilDB->quote($a_lang,'text'));
645 
646  if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
647  {
648  return $rec;
649  }
650  return array();
651  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilDB
+ Here is the caller graph for this function:

◆ _updateAccountMailAttachment()

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

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

References $ilDB, $path, and ilObject\getId().

609  {
610  global $ilDB;
611 
612  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
613  $fs = new ilFSStorageUserFolder($this->getId());
614  $fs->create();
615  $path = $fs->getAbsolutePath()."/";
616 
617  move_uploaded_file($a_tmp_name, $path.$a_lang);
618 
619  $ilDB->update('mail_template',
620  array('att_file' => array('text', $a_name)),
621  array('lang' => array('text',$a_lang), 'type' => array('text','nacc')));
622  }
getId()
get object id public
$path
Definition: index.php:22
global $ilDB
+ 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.

public

Parameters
intold_id
intnew id

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

References $ilDB, and $query.

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

665  {
666  global $ilDB;
667 
668  $query = "UPDATE usr_data SET time_limit_owner = ".$ilDB->quote($a_new_id, "integer")." ".
669  "WHERE time_limit_owner = ".$ilDB->quote($a_old_id, "integer")." ";
670  $ilDB->manipulate($query);
671 
672  return true;
673  }
global $ilDB
+ Here is the caller graph for this function:

◆ _writeNewAccountMail()

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

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

References $ilDB.

576  {
577  global $ilDB;
578 
579  if(self::_lookupNewAccountMail($a_lang))
580  {
581  $values = array(
582  'subject' => array('text',$a_subject),
583  'body' => array('clob',$a_body),
584  'sal_g' => array('text',$a_sal_g),
585  'sal_f' => array('text',$a_sal_f),
586  'sal_m' => array('text',$a_sal_m)
587  );
588  $ilDB->update('mail_template',
589  $values,
590  array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
591  );
592  }
593  else
594  {
595  $values = array(
596  'subject' => array('text',$a_subject),
597  'body' => array('clob',$a_body),
598  'sal_g' => array('text',$a_sal_g),
599  'sal_f' => array('text',$a_sal_f),
600  'sal_m' => array('text',$a_sal_m),
601  'lang' => array('text',$a_lang),
602  'type' => array('text','nacc')
603  );
604  $ilDB->insert('mail_template',$values);
605  }
606  }
global $ilDB

◆ buildExportFile()

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

build xml export file

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

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

434  {
435  global $ilBench;
436  global $log;
437  global $ilDB;
438  global $ilias;
439  global $lng;
440 
441  //get Log File
442  $expDir = $this->getExportDirectory();
443  //$expLog = &$log;
444  //$expLog->delete();
445  //$expLog->setLogFormat("");
446  //$expLog->write(date("[y-m-d H:i:s] ")."Start export of user data");
447 
448  // create export directory if needed
449  $this->createExportDirectory();
450 
451  //get data
452  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
453  $settings =& $this->getExportSettings();
454 
455  // user languages
456  $query = "SELECT * FROM usr_pref WHERE keyword = ".$ilDB->quote('language','text');
457  $res = $ilDB->query($query);
458  $languages = array();
459  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
460  {
461  $languages[$row['usr_id']] = $row['value'];
462  }
463 
464  // multi-text
465  $multi = array();
466  $set = $ilDB->query("SELECT * FROM usr_data_multi");
467  while($row = $ilDB->fetchAssoc($set))
468  {
469  if(!is_array($user_data_filter) ||
470  in_array($row["usr_id"], $user_data_filter))
471  {
472  $multi[$row["usr_id"]][$row["field_id"]][] = $row["value"];
473  }
474  }
475 
476  $data = array();
477  $query = "SELECT usr_data.* FROM usr_data ".
478  " ORDER BY usr_data.lastname, usr_data.firstname";
479  $result = $ilDB->query($query);
480  while ($row = $ilDB->fetchAssoc($result))
481  {
482  if(isset($languages[$row['usr_id']]))
483  {
484  $row['language'] = $languages[$row['usr_id']];
485  }
486  else
487  {
488  $row['language'] = $lng->getDefaultLanguage();
489  }
490 
491  if(isset($multi[$row["usr_id"]]))
492  {
493  $row = array_merge($row, $multi[$row["usr_id"]]);
494  }
495 
496  if (is_array($user_data_filter))
497  {
498  if (in_array($row["usr_id"], $user_data_filter)) array_push($data, $row);
499  }
500  else
501  {
502  array_push($data, $row);
503  }
504  }
505  //$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
506 
507  $fullname = $expDir."/".$this->getExportFilename($a_mode);
508  switch ($a_mode)
509  {
510  case "userfolder_export_excel_x86":
511  $this->createExcelExport($settings, $data, $fullname, "latin1");
512  break;
513  case "userfolder_export_csv":
514  $this->createCSVExport($settings, $data, $fullname);
515  break;
516  case "userfolder_export_xml":
517  $this->createXMLExport($settings, $data, $fullname);
518  break;
519  }
520  //$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
521 
522  return $fullname;
523  }
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
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilBench
Definition: ilias.php:18
global $ilDB
createExcelExport(&$settings, &$data, $filename, $a_mode)
createCSVExport(&$settings, &$data, $filename)
+ Here is the call graph for this function:

◆ createCSVExport()

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

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

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

Referenced by buildExportFile().

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  }
print $file
$separator
Class ilUserDefinedData.
static & processCSVRow(&$row, $quoteAll=FALSE, $separator=";", $outUTF8=FALSE, $compatibleWithMSExcel=TRUE)
Convertes an array for CSV usage.
$filename
Definition: buildRTE.php:89
getUserDefinedExportFields()
Get all exportable user defined fields.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExcelExport()

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

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

References $data, $filename, $row, ilExcelUtils\_convert_text(), ilUtil\excelTime(), and getUserDefinedExportFields().

Referenced by buildExportFile().

252  {
253  include_once "./Services/Excel/classes/class.ilExcelUtils.php";
254  include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
255  $adapter = new ilExcelWriterAdapter($filename, FALSE);
256  $workbook = $adapter->getWorkbook();
257  // Creating a worksheet
258  $format_bold =& $workbook->addFormat();
259  $format_bold->setBold();
260  $format_percent =& $workbook->addFormat();
261  $format_percent->setNumFormat("0.00%");
262  $format_datetime =& $workbook->addFormat();
263  $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
264  $format_title =& $workbook->addFormat();
265  $format_title->setBold();
266  $format_title->setColor('black');
267  $format_title->setPattern(1);
268  $format_title->setFgColor('silver');
269  $worksheet =& $workbook->addWorksheet();
270  $row = 0;
271  $col = 0;
272 
273  $udf_ex_fields = $this->getUserDefinedExportFields();
274 
275  // title row
276  foreach ($settings as $value) // standard fields
277  {
278  if($value == 'ext_account')
279  {
280  $value = 'user_ext_account';
281  }
282  $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($value), $a_mode), $format_title);
283  $col++;
284  }
285  foreach ($udf_ex_fields as $f) // custom fields
286  {
287  $worksheet->write($row, $col, ilExcelUtils::_convert_text($f["name"], $a_mode), $format_title);
288  $col++;
289  }
290 
291  $this->lng->loadLanguageModule("meta");
292  foreach ($data as $index => $rowdata)
293  {
294  $row++;
295  $col = 0;
296 
297  // standard fields
298  foreach ($settings as $fieldname)
299  {
300  $value = $rowdata[$fieldname];
301  switch ($fieldname)
302  {
303  case "language":
304  $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("meta_l_".$value), $a_mode));
305  break;
306  case "time_limit_from":
307  case "time_limit_until":
308  $date = strftime("%Y-%m-%d %H:%M:%S", $value);
309  if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date, $matches))
310  {
311  $worksheet->write($row, $col, ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
312  }
313  break;
314  case "last_login":
315  case "last_update":
316  case "create_date":
317  case "approve_date":
318  case "agree_date":
319  if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $value, $matches))
320  {
321  $worksheet->write($row, $col, ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
322  }
323  break;
324 
325  case "interests_general":
326  case "interests_help_offered":
327  case "interests_help_looking":
328  if(is_array($value) && sizeof($value))
329  {
330  $value = implode(", ", $value);
331  }
332  else
333  {
334  $value = null;
335  }
336  // fallthrough
337 
338  default:
339  $worksheet->write($row, $col, ilExcelUtils::_convert_text($value, $a_mode));
340  break;
341  }
342  $col++;
343  }
344 
345  // custom fields
346  reset($udf_ex_fields);
347  if (count($udf_ex_fields) > 0)
348  {
349  include_once("./Services/User/classes/class.ilUserDefinedData.php");
350  $udf = new ilUserDefinedData($rowdata["usr_id"]);
351  foreach ($udf_ex_fields as $f) // custom fields
352  {
353  $worksheet->write($row, $col, ilExcelUtils::_convert_text($udf->get("f_".$f["id"]), $a_mode));
354  $col++;
355  }
356  }
357  }
358  $workbook->close();
359  }
Class ilUserDefinedData.
_convert_text($a_text, $a_target="has been removed")
Class ilExcelWriterAdapter.
$filename
Definition: buildRTE.php:89
getUserDefinedExportFields()
Get all exportable user defined fields.
static excelTime($year="", $month="", $day="", $hour="", $minute="", $second="")
Calculates a Microsoft Excel date/time value.
+ 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 531 of file class.ilObjUserFolder.php.

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

Referenced by buildExportFile().

532  {
533  if (!@is_dir($this->getExportDirectory()))
534  {
535  $usrf_data_dir = ilUtil::getDataDir()."/usrf_data";
536  ilUtil::makeDir($usrf_data_dir);
537  if(!is_writable($usrf_data_dir))
538  {
539  $this->ilias->raiseError("Userfolder data directory (".$usrf_data_dir
540  .") not writeable.",$this->ilias->error_obj->MESSAGE);
541  }
542 
543  // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
544  $export_dir = $usrf_data_dir."/export";
545  ilUtil::makeDir($export_dir);
546  if(!@is_dir($export_dir))
547  {
548  $this->ilias->raiseError("Creation of Userfolder Export Directory failed.",$this->ilias->error_obj->MESSAGE);
549  }
550  }
551  }
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 151 of file class.ilObjUserFolder.php.

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

Referenced by buildExportFile().

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  }
print $file
XML writer class.
$filename
Definition: buildRTE.php:89
global $ilDB
+ 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  {
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

public

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

References ilUtil\getDataDir().

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

89  {
90  $export_dir = ilUtil::getDataDir()."/usrf_data/export";
91 
92  return $export_dir;
93  }
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 56 of file class.ilObjUserFolder.php.

References $filename.

Referenced by buildExportFile().

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.xls";
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  }
$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 103 of file class.ilObjUserFolder.php.

References $file, and getExportDirectory().

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,3}\$/", $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  }
print $file
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 366 of file class.ilObjUserFolder.php.

References $ilDB, $query, $result, $row, and DB_FETCHMODE_ASSOC.

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

367  {
368  global $ilDB;
369 
370  $db_settings = array();
371 
372  include_once("./Services/User/classes/class.ilUserProfile.php");
373  $up = new ilUserProfile();
374  $up->skipField("roles");
375  $profile_fields = $up->getStandardFields();
376 
377  /*$profile_fields =& ilObjUserFolder::getProfileFields();
378  $profile_fields[] = "preferences";*/
379 
380  $query = "SELECT * FROM settings WHERE ".
381  $ilDB->like("keyword", "text", '%usr_settings_export_%');
382  $result = $ilDB->query($query);
383  while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
384  {
385  if ($row["value"] == "1")
386  {
387  if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting))
388  {
389  array_push($db_settings, $setting[1]);
390  }
391  }
392  }
393  $export_settings = array();
394  foreach ($profile_fields as $key => $value)
395  {
396  if (in_array($key, $db_settings))
397  {
398  if (strcmp($key, "password") == 0)
399  {
400  // we do not support password export with ILIAS >= 4.5.x
401  continue;
402  }
403  else
404  {
405  array_push($export_settings, $key);
406  }
407  }
408  }
409  array_push($export_settings, "usr_id");
410  array_push($export_settings, "login");
411  array_push($export_settings, "last_login");
412  array_push($export_settings, "last_update");
413  array_push($export_settings, "create_date");
414  array_push($export_settings, "time_limit_owner");
415  array_push($export_settings, "time_limit_unlimited");
416  array_push($export_settings, "time_limit_from");
417  array_push($export_settings, "time_limit_until");
418  array_push($export_settings, "time_limit_message");
419  array_push($export_settings, "active");
420  array_push($export_settings, "approve_date");
421  array_push($export_settings, "agree_date");
422  array_push($export_settings, "client_ip");
423  array_push($export_settings, "auth_mode");
424  array_push($export_settings, "ext_account");
425  array_push($export_settings, "feedhash");
426 
427  return $export_settings;
428  }
$result
Class ilUserProfile.
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilDB
+ 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 559 of file class.ilObjUserFolder.php.

560  {
561  include_once("./Services/User/classes/class.ilUserProfile.php");
562  $up = new ilUserProfile();
563  $up->skipField("username");
564  $up->skipField("roles");
565  $up->skipGroup("preferences");
566  $fds = $up->getStandardFields();
567  foreach ($fds as $k => $f)
568  {
569  $profile_fields[] = $k;
570  }
571 
572  return $profile_fields;
573  }
Class ilUserProfile.

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

183  {
184  include_once './Services/User/classes/class.ilUserDefinedFields.php';
185  $udf_obj =& ilUserDefinedFields::_getInstance();
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilObjUserFolder()

ilObjUserFolder::ilObjUserFolder (   $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.

References ilObject\ilObject().

27  {
28  $this->type = "usrf";
29  $this->ilObject($a_id,$a_call_by_reference);
30  }
ilObject($a_id=0, $a_reference=true)
Constructor public.
+ Here is the call graph for this function:

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