ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjUserFolder Class Reference
+ Inheritance diagram for ilObjUserFolder:
+ Collaboration diagram for ilObjUserFolder:

Public Member Functions

 ilObjUserFolder ($a_id, $a_call_by_reference=true)
 Constructor @access public. More...
 
 delete ()
 delete userfolder and all related data DISABLED @access public More...
 
 getExportFilename ($a_mode="userfolder_export_excel_x86")
 
 getExportDirectory ()
 Get the location of the export directory for the user accounts. More...
 
 getExportFiles ()
 Get a list of the already exported files in the export directory. More...
 
 escapeXML ($value)
 
 createXMLExport (&$settings, &$data, $filename)
 
 getUserDefinedExportFields ()
 Get all exportable user defined fields. More...
 
 createCSVExport (&$settings, &$data, $filename)
 
 createExcelExport (&$settings, &$data, $filename, $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 @access 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 @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 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) @access 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...
 
 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 _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 _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 @global 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@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static 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 623 of file class.ilObjUserFolder.php.

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

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

+ Here is the call graph for this function:

◆ _lookupNewAccountMail()

ilObjUserFolder::_lookupNewAccountMail (   $a_lang)

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

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

References $ilDB, and DB_FETCHMODE_ASSOC.

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

+ Here is the caller graph for this function:

◆ _updateAccountMailAttachment()

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

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

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

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

+ Here is the call graph for this function:

◆ _updateUserFolderAssignment()

static ilObjUserFolder::_updateUserFolderAssignment (   $a_old_id,
  $a_new_id 
)
static

Update user folder assignment Typically called after deleting a category with local user accounts.

These users will be assigned to the global user folder.

@access public

Parameters
intold_id
intnew id

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

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

References $ilDB, and $query.

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

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

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

References $ilDB.

◆ buildExportFile()

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

build xml export file

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

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

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

+ Here is the call graph for this function:

◆ createCSVExport()

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

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

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

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

Referenced by buildExportFile().

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

◆ createExcelExport()

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

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

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 }
_convert_text($a_text, $a_target="has been removed")
Class ilExcelWriterAdapter.
static excelTime($year="", $month="", $day="", $hour="", $minute="", $second="")
Calculates a Microsoft Excel date/time value.

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

Referenced by buildExportFile().

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

◆ createExportDirectory()

ilObjUserFolder::createExportDirectory ( )

creates data directory for export files (data_dir/usrf_data/export, depending on data directory that is set in ILIAS setup/ini)

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

531 {
532 if (!@is_dir($this->getExportDirectory()))
533 {
534 $usrf_data_dir = ilUtil::getDataDir()."/usrf_data";
535 ilUtil::makeDir($usrf_data_dir);
536 if(!is_writable($usrf_data_dir))
537 {
538 $this->ilias->raiseError("Userfolder data directory (".$usrf_data_dir
539 .") not writeable.",$this->ilias->error_obj->MESSAGE);
540 }
541
542 // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
543 $export_dir = $usrf_data_dir."/export";
544 ilUtil::makeDir($export_dir);
545 if(!@is_dir($export_dir))
546 {
547 $this->ilias->raiseError("Creation of Userfolder Export Directory failed.",$this->ilias->error_obj->MESSAGE);
548 }
549 }
550 }
static getDataDir()
get data directory (outside webspace)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
redirection script todo: (a better solution should control the processing via a xml file)

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

Referenced by buildExportFile().

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

◆ createXMLExport()

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

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

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

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

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ delete()

ilObjUserFolder::delete ( )

delete userfolder and all related data DISABLED @access public

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

Reimplemented from ilObject.

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

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

◆ escapeXML()

ilObjUserFolder::escapeXML (   $value)

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

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

◆ getExportDirectory()

ilObjUserFolder::getExportDirectory ( )

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

Get the location of the export directory for the user accounts

@access public

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

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

References ilUtil\getDataDir().

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

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

◆ getExportFilename()

ilObjUserFolder::getExportFilename (   $a_mode = "userfolder_export_excel_x86")

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

57 {
58 $filename = "";
59 //$settings = $this->ilias->getAllSettings();
60 //$this->inst_id = $settings["inst_id"];
61 $inst_id = IL_INST_ID;
62
63 $date = time();
64
65 switch($a_mode)
66 {
67 case "userfolder_export_excel_x86":
68 $filename = $date."__".$inst_id."__xls_usrf.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 }

References $filename.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ getExportFiles()

ilObjUserFolder::getExportFiles ( )

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

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

Returns
array A list of file names @access public

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

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

References $file, and getExportDirectory().

+ Here is the call graph for this function:

◆ getExportSettings()

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

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 return $export_settings;
427 }
Class ilUserProfile.

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

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

+ Here is the caller graph for this function:

◆ getProfileFields()

static & ilObjUserFolder::getProfileFields ( )
static

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

Returns
array of fieldnames

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

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

◆ getUserDefinedExportFields()

ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

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

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

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

◆ ilObjUserFolder()

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

Constructor @access public.

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

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

27 {
28 $this->type = "usrf";
29 $this->ilObject($a_id,$a_call_by_reference);
30 }
ilObject($a_id=0, $a_reference=true)
Constructor @access public.

References ilObject\ilObject().

+ Here is the call graph for this function:

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