ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups 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.
 delete ()
 delete userfolder and all related data DISABLED public
 getExportFilename ($a_mode="userfolder_export_excel_x86")
 getExportDirectory ()
 Get the location of the export directory for the user accounts.
 getExportFiles ()
 Get a list of the already exported files in the export directory.
 escapeXML ($value)
 createXMLExport (&$settings, &$data, $filename)
 getUserDefinedExportFields ()
 Get all exportable user defined fields.
 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
 createExportDirectory ()
 creates data directory for export files (data_dir/usrf_data/export, depending on data directory that is set in ILIAS setup/ini)
 _writeNewAccountMail ($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
 _lookupNewAccountMail ($a_lang)
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getRefId ()
 get reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 _lookupObjIdByImportId ($a_import_id)
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 update ()
 update object in db
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupDescription ($a_id)
 lookup object description
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _lookupObjectId ($a_ref_id)
 lookup object id
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 createReference ()
 creates reference for object
 countReferences ()
 count references of object
 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
 createRoleFolder ()
 creates a local role folder
 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.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0)
 Clone object permissions, put in tree ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.

Static Public Member Functions

static getExportSettings ()
 getExport Settings
static & getProfileFields ()
 Get profile fields (DEPRECATED, use ilUserProfile() instead)
static _updateUserFolderAssignment ($a_old_id, $a_new_id)
 Update user folder assignment Typically called after deleting a category with local user accounts.
- Static Public Member Functions inherited from ilObject
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupObjId ($a_id)
static _lookupType ($a_id, $a_reference=false)
 lookup object type
 _exists ($a_id, $a_reference=false)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

ilObjUserFolder::_lookupNewAccountMail (   $a_lang)

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

References $ilDB, and DB_FETCHMODE_ASSOC.

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

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM mail_template ".
" WHERE type='nacc' AND lang = ".$ilDB->quote($a_lang,'text'));
if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
return $rec;
}
return array();
}

+ Here is the caller graph for this function:

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

References $ilDB, and $query.

Referenced by ilObjCategory\delete().

{
global $ilDB;
$query = "UPDATE usr_data SET time_limit_owner = ".$ilDB->quote($a_new_id, "integer")." ".
"WHERE time_limit_owner = ".$ilDB->quote($a_old_id, "integer")." ";
$ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

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

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

References $ilDB.

{
global $ilDB;
if(self::_lookupNewAccountMail($a_lang))
{
$values = array(
'subject' => array('text',$a_subject),
'body' => array('clob',$a_body),
'sal_g' => array('text',$a_sal_g),
'sal_f' => array('text',$a_sal_f),
'sal_m' => array('text',$a_sal_m)
);
$ilDB->update('mail_template',
$values,
array('lang' => array('text',$a_lang), 'type' => array('text','nacc'))
);
}
else
{
$values = array(
'subject' => array('text',$a_subject),
'body' => array('clob',$a_body),
'sal_g' => array('text',$a_sal_g),
'sal_f' => array('text',$a_sal_f),
'sal_m' => array('text',$a_sal_m),
'lang' => array('text',$a_lang),
'type' => array('text','nacc')
);
$ilDB->insert('mail_template',$values);
}
}
ilObjUserFolder::buildExportFile (   $a_mode = "userfolder_export_excel_x86",
  $user_data_filter = FALSE 
)

build xml export file

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

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

{
global $ilBench;
global $log;
global $ilDB;
global $ilias;
global $lng;
//get Log File
$expDir = $this->getExportDirectory();
//$expLog = &$log;
//$expLog->delete();
//$expLog->setLogFormat("");
//$expLog->write(date("[y-m-d H:i:s] ")."Start export of user data");
// create export directory if needed
//get data
//$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
$settings =& $this->getExportSettings();
// user languages
$query = "SELECT * FROM usr_pref WHERE keyword = ".$ilDB->quote('language','text');
$res = $ilDB->query($query);
$languages = array();
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$languages[$row['usr_id']] = $row['value'];
}
$data = array();
$query = "SELECT usr_data.* FROM usr_data ".
" ORDER BY usr_data.lastname, usr_data.firstname";
$result = $ilDB->query($query);
while ($row = $ilDB->fetchAssoc($result))
{
if(isset($languages[$row['usr_id']]))
{
$row['language'] = $languages[$row['usr_id']];
}
else
{
$row['language'] = $lng->getDefaultLanguage();
}
if (is_array($user_data_filter))
{
if (in_array($row["usr_id"], $user_data_filter)) array_push($data, $row);
}
else
{
array_push($data, $row);
}
}
//$expLog->write(date("[y-m-d H:i:s] ")."User data export: build an array of all user data entries");
$fullname = $expDir."/".$this->getExportFilename($a_mode);
switch ($a_mode)
{
case "userfolder_export_excel_x86":
$this->createExcelExport($settings, $data, $fullname, "latin1");
break;
case "userfolder_export_csv":
$this->createCSVExport($settings, $data, $fullname);
break;
case "userfolder_export_xml":
$this->createXMLExport($settings, $data, $fullname);
break;
}
//$expLog->write(date("[y-m-d H:i:s] ")."Finished export of user data");
return $fullname;
}

+ Here is the call graph for this function:

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

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

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

Referenced by buildExportFile().

{
// header
$headerrow = array();
$udf_ex_fields = $this->getUserDefinedExportFields();
foreach ($settings as $value) // standard fields
{
array_push($headerrow, $this->lng->txt($value));
}
foreach ($udf_ex_fields as $f) // custom fields
{
array_push($headerrow, $f["name"]);
}
$separator = ";";
$file = fopen($filename, "w");
$formattedrow =& ilUtil::processCSVRow($headerrow, TRUE, $separator);
fwrite($file, join ($separator, $formattedrow) ."\n");
foreach ($data as $row)
{
$csvrow = array();
foreach ($settings as $header) // standard fields
{
array_push($csvrow, $row[$header]);
}
// custom fields
reset($udf_ex_fields);
if (count($udf_ex_fields) > 0)
{
include_once("./Services/User/classes/class.ilUserDefinedData.php");
$udf = new ilUserDefinedData($row["usr_id"]);
foreach ($udf_ex_fields as $f) // custom fields
{
array_push($csvrow, $udf->get("f_".$f["id"]));
}
}
$formattedrow =& ilUtil::processCSVRow($csvrow, TRUE, $separator);
fwrite($file, join ($separator, $formattedrow) ."\n");
}
fclose($file);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by buildExportFile().

{
include_once "./Services/Excel/classes/class.ilExcelUtils.php";
include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
$adapter = new ilExcelWriterAdapter($filename, FALSE);
$workbook = $adapter->getWorkbook();
// Creating a worksheet
$format_bold =& $workbook->addFormat();
$format_bold->setBold();
$format_percent =& $workbook->addFormat();
$format_percent->setNumFormat("0.00%");
$format_datetime =& $workbook->addFormat();
$format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
$format_title =& $workbook->addFormat();
$format_title->setBold();
$format_title->setColor('black');
$format_title->setPattern(1);
$format_title->setFgColor('silver');
$worksheet =& $workbook->addWorksheet();
$row = 0;
$col = 0;
$udf_ex_fields = $this->getUserDefinedExportFields();
// title row
foreach ($settings as $value) // standard fields
{
$worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($value), $a_mode), $format_title);
$col++;
}
foreach ($udf_ex_fields as $f) // custom fields
{
$worksheet->write($row, $col, ilExcelUtils::_convert_text($f["name"], $a_mode), $format_title);
$col++;
}
foreach ($data as $index => $rowdata)
{
$row++;
$col = 0;
// standard fields
foreach ($settings as $fieldname)
{
$value = $rowdata[$fieldname];
switch ($fieldname)
{
case "language":
$worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt("lang_".$value), $a_mode));
break;
case "time_limit_from":
case "time_limit_until":
$date = strftime("%Y-%m-%d %H:%M:%S", $value);
if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date, $matches))
{
$worksheet->write($row, $col, ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
}
break;
case "last_login":
case "last_update":
case "create_date":
case "approve_date":
case "agree_date":
if (preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $value, $matches))
{
$worksheet->write($row, $col, ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
}
break;
default:
$worksheet->write($row, $col, ilExcelUtils::_convert_text($value, $a_mode));
break;
}
$col++;
}
// custom fields
reset($udf_ex_fields);
if (count($udf_ex_fields) > 0)
{
include_once("./Services/User/classes/class.ilUserDefinedData.php");
$udf = new ilUserDefinedData($rowdata["usr_id"]);
foreach ($udf_ex_fields as $f) // custom fields
{
$worksheet->write($row, $col, ilExcelUtils::_convert_text($udf->get("f_".$f["id"]), $a_mode));
$col++;
}
}
}
$workbook->close();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Referenced by buildExportFile().

{
if (!@is_dir($this->getExportDirectory()))
{
$usrf_data_dir = ilUtil::getDataDir()."/usrf_data";
ilUtil::makeDir($usrf_data_dir);
if(!is_writable($usrf_data_dir))
{
$this->ilias->raiseError("Userfolder data directory (".$usrf_data_dir
.") not writeable.",$this->ilias->error_obj->MESSAGE);
}
// create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
$export_dir = $usrf_data_dir."/export";
ilUtil::makeDir($export_dir);
if(!@is_dir($export_dir))
{
$this->ilias->raiseError("Creation of Userfolder Export Directory failed.",$this->ilias->error_obj->MESSAGE);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by buildExportFile().

{
include_once './Services/User/classes/class.ilUserDefinedData.php';
include_once './Services/User/classes/class.ilObjUser.php';
global $rbacreview;
global $ilDB;
global $log;
$file = fopen($filename, "w");
if (is_array($data))
{
include_once './Services/User/classes/class.ilUserXMLWriter.php';
$xmlWriter = new ilUserXMLWriter();
$xmlWriter->setObjects($data);
$xmlWriter->setSettings($settings);
$xmlWriter->setAttachRoles (true);
if($xmlWriter->start())
{
fwrite($file, $xmlWriter->getXML());
}
}
/*
fwrite($file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fwrite($file, "<!DOCTYPE Users SYSTEM \"".ILIAS_HTTP_PATH."/xml/ilias_user_3_8.dtd\">\n");
fwrite($file, "<Users>");
foreach ($data as $row)
{
//$log->write(date("[y-m-d H:i:s] ")."User data export: processing user " . $row["login"]);
foreach ($row as $key => $value)
{
$row[$key] = $this->escapeXML($value);
}
$userline = "";
// TODO: Define combobox for "Action" ???
if (strlen($row["language"]) == 0) $row["language"] = "en";
$userline .= "<User Id=\"il_".IL_INST_ID."_usr_".$row["usr_id"]."\" Language=\"".$row["language"]."\" Action=\"Insert\">";
if (array_search("login", $settings) !== FALSE)
{
$userline .= "<Login>".$row["login"]."</Login>";
}
// Alternative way to get the roles of a user?
$query = sprintf("SELECT object_data.title, rbac_fa.* FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
$ilDB->quote($row["usr_id"])
);
$rbacresult = $ilDB->query($query);
while ($rbacrow = $rbacresult->fetchRow(DB_FETCHMODE_ASSOC))
{
$type = "";
if ($rbacrow["assign"] == "y")
{
if ($rbacrow["parent"] == ROLE_FOLDER_ID)
{
$type = "Global";
}
else
{
$type = "Local";
}
if (strlen($type))
{
$userline .= "<Role Id=\"il_".IL_INST_ID."_role_".$rbacrow["rol_id"]."\" Type=\"".$type."\">".$rbacrow["title"]."</Role>";
}
}
}
//$log->write(date("[y-m-d H:i:s] ")."User data export: get all roles");
/* the export of roles is to expensive. on a system with 6000 users the following
section needs 37 seconds
$roles = $rbacreview->getRolesByFilter(1, $row["usr_id"]);
$ass_roles = $rbacreview->assignedRoles($row["usr_id"]);
foreach ($roles as $role)
{
if (array_search($role["obj_id"], $ass_roles) !== FALSE)
{
$type = "";
switch ($role["role_type"])
{
case "global":
$type = "Global";
break;
case "local":
$type = "Local";
break;
}
if (strlen($type))
{
$userline .= "<Role Id=\"".$role["obj_id"]."\" Type=\"".$type."\">".$role["title"]."</Role>";
}
}
}
*/
/* //$log->write(date("[y-m-d H:i:s] ")."User data export: got all roles");
$i2passwd = FALSE;
if (array_search("i2passwd", $settings) !== FALSE)
{
if (strlen($row["i2passwd"])) $i2passwd = TRUE;
if ($i2passwd) $userline .= "<Password Type=\"ILIAS2\">".$row["i2passwd"]."</Password>";
}
if ((!$i2passwd) && (array_search("passwd", $settings) !== FALSE))
{
if (strlen($row["passwd"])) $userline .= "<Password Type=\"ILIAS3\">".$row["passwd"]."</Password>";
}
if (array_search("firstname", $settings) !== FALSE)
{
if (strlen($row["firstname"])) $userline .= "<Firstname>".$row["firstname"]."</Firstname>";
}
if (array_search("lastname", $settings) !== FALSE)
{
if (strlen($row["lastname"])) $userline .= "<Lastname>".$row["lastname"]."</Lastname>";
}
if (array_search("title", $settings) !== FALSE)
{
if (strlen($row["title"])) $userline .= "<Title>".$row["title"]."</Title>";
}
if (array_search("upload", $settings) !== FALSE)
{
// personal picture
$q = sprintf("SELECT value FROM usr_pref WHERE usr_id=%s AND keyword='profile_image'", $ilDB->quote($row["usr_id"] . ""));
$r = $ilDB->query($q);
if ($r->numRows() == 1)
{
$personal_picture_data = $r->fetchRow(DB_FETCHMODE_ASSOC);
$personal_picture = $personal_picture_data["value"];
$webspace_dir = ilUtil::getWebspaceDir();
$image_file = $webspace_dir."/usr_images/".$personal_picture;
if (@is_file($image_file))
{
$fh = fopen($image_file, "rb");
if ($fh)
{
$image_data = fread($fh, filesize($image_file));
fclose($fh);
$base64 = base64_encode($image_data);
$imagetype = "image/jpeg";
if (preg_match("/.*\.(png|gif)$/", $personal_picture, $matches))
{
$imagetype = "image/".$matches[1];
}
$userline .= "<PersonalPicture imagetype=\"$imagetype\" encoding=\"Base64\">$base64</PersonalPicture>";
}
}
}
}
if (array_search("gender", $settings) !== FALSE)
{
if (strlen($row["gender"])) $userline .= "<Gender>".$row["gender"]."</Gender>";
}
if (array_search("email", $settings) !== FALSE)
{
if (strlen($row["email"])) $userline .= "<Email>".$row["email"]."</Email>";
}
if (array_search("institution", $settings) !== FALSE)
{
if (strlen($row["institution"])) $userline .= "<Institution>".$row["institution"]."</Institution>";
}
if (array_search("street", $settings) !== FALSE)
{
if (strlen($row["street"])) $userline .= "<Street>".$row["street"]."</Street>";
}
if (array_search("city", $settings) !== FALSE)
{
if (strlen($row["city"])) $userline .= "<City>".$row["city"]."</City>";
}
if (array_search("zipcode", $settings) !== FALSE)
{
if (strlen($row["zipcode"])) $userline .= "<PostalCode>".$row["zipcode"]."</PostalCode>";
}
if (array_search("country", $settings) !== FALSE)
{
if (strlen($row["country"])) $userline .= "<Country>".$row["country"]."</Country>";
}
if (array_search("phone_office", $settings) !== FALSE)
{
if (strlen($row["phone_office"])) $userline .= "<PhoneOffice>".$row["phone_office"]."</PhoneOffice>";
}
if (array_search("phone_home", $settings) !== FALSE)
{
if (strlen($row["phone_home"])) $userline .= "<PhoneHome>".$row["phone_home"]."</PhoneHome>";
}
if (array_search("phone_mobile", $settings) !== FALSE)
{
if (strlen($row["phone_mobile"])) $userline .= "<PhoneMobile>".$row["phone_mobile"]."</PhoneMobile>";
}
if (array_search("fax", $settings) !== FALSE)
{
if (strlen($row["fax"])) $userline .= "<Fax>".$row["fax"]."</Fax>";
}
if (strlen($row["hobby"])) if (array_search("hobby", $settings) !== FALSE)
{
$userline .= "<Hobby>".$row["hobby"]."</Hobby>";
}
if (array_search("department", $settings) !== FALSE)
{
if (strlen($row["department"])) $userline .= "<Department>".$row["department"]."</Department>";
}
if (array_search("referral_comment", $settings) !== FALSE)
{
if (strlen($row["referral_comment"])) $userline .= "<Comment>".$row["referral_comment"]."</Comment>";
}
if (array_search("matriculation", $settings) !== FALSE)
{
if (strlen($row["matriculation"])) $userline .= "<Matriculation>".$row["matriculation"]."</Matriculation>";
}
if (array_search("active", $settings) !== FALSE)
{
if ($row["active"])
{
$userline .= "<Active>true</Active>";
}
else
{
$userline .= "<Active>false</Active>";
}
}
if (array_search("client_ip", $settings) !== FALSE)
{
if (strlen($row["client_ip"])) $userline .= "<ClientIP>".$row["client_ip"]."</ClientIP>";
}
if (array_search("time_limit_owner", $settings) !== FALSE)
{
if (strlen($row["time_limit_owner"])) $userline .= "<TimeLimitOwner>".$row["time_limit_owner"]."</TimeLimitOwner>";
}
if (array_search("time_limit_unlimited", $settings) !== FALSE)
{
if (strlen($row["time_limit_unlimited"])) $userline .= "<TimeLimitUnlimited>".$row["time_limit_unlimited"]."</TimeLimitUnlimited>";
}
if (array_search("time_limit_from", $settings) !== FALSE)
{
if (strlen($row["time_limit_from"])) $userline .= "<TimeLimitFrom>".$row["time_limit_from"]."</TimeLimitFrom>";
}
if (array_search("time_limit_until", $settings) !== FALSE)
{
if (strlen($row["time_limit_until"])) $userline .= "<TimeLimitUntil>".$row["time_limit_until"]."</TimeLimitUntil>";
}
if (array_search("time_limit_message", $settings) !== FALSE)
{
if (strlen($row["time_limit_message"])) $userline .= "<TimeLimitMessage>".$row["time_limit_message"]."</TimeLimitMessage>";
}
if (array_search("approve_date", $settings) !== FALSE)
{
if (strlen($row["approve_date"])) $userline .= "<ApproveDate>".$row["approve_date"]."</ApproveDate>";
}
if (array_search("agree_date", $settings) !== FALSE)
{
if (strlen($row["agree_date"])) $userline .= "<AgreeDate>".$row["agree_date"]."</AgreeDate>";
}
if ((int) $row["ilinc_id"] !=0) {
if (array_search("ilinc_id", $settings) !== FALSE)
{
if (strlen($row["ilinc_id"])) $userline .= "<iLincID>".$row["ilinc_id"]."</iLincID>";
}
if (array_search("ilinc_login", $settings) !== FALSE)
{
if (strlen($row["ilinc_login"])) $userline .= "<iLincLogin>".$row["ilinc_login"]."</iLincLogin>";
}
if (array_search("ilinc_passwd", $settings) !== FALSE)
{
if (strlen($row["ilinc_passwd"])) $userline .= "<iLincPasswd>".$row["ilinc_passwd"]."</iLincPasswd>";
}
}
if (array_search("auth_mode", $settings) !== FALSE)
{
if (strlen($row["auth_mode"])) $userline .= "<AuthMode type=\"".$row["auth_mode"]."\"></AuthMode>";
}
if (array_search("skin_style", $settings) !== FALSE)
{
$userline .=
"<Look Skin=\"" . ilObjUser::_lookupPref($row["usr_id"], "skin") . "\" " .
"Style=\"" . ilObjUser::_lookupPref($row["usr_id"], "style") . "\"></Look>";
}
if (array_search("last_update", $settings) !== FALSE)
{
if (strlen($row["last_update"])) $userline .= "<LastUpdate>".$row["last_update"]."</LastUpdate>";
}
if (array_search("last_login", $settings) !== FALSE)
{
if (strlen($row["last_login"])) $userline .= "<LastLogin>".$row["last_login"]."</LastLogin>";
}
// Append User defined field data
$udf_data = new ilUserDefinedData($row['usr_id']);
$userline .= $udf_data->toXML();
$userline .= "</User>";
fwrite($file, $userline);
}
fwrite($file, "</Users>");
fclose($file);*/
}

+ Here is the caller graph for this function:

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

Reimplemented from ilObject.

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

{
// DISABLED
return false;
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// put here userfolder specific stuff
// always call parent delete function at the end!!
return true;
}
ilObjUserFolder::escapeXML (   $value)

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

{
$value = str_replace("&", "&amp;", $value);
$value = str_replace("<", "&lt;", $value);
$value = str_replace(">", "&gt;", $value);
return $value;
}
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().

{
$export_dir = ilUtil::getDataDir()."/usrf_data/export";
return $export_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $filename.

Referenced by buildExportFile().

{
$filename = "";
//$settings = $this->ilias->getAllSettings();
//$this->inst_id = $settings["inst_id"];
$inst_id = IL_INST_ID;
$date = time();
switch($a_mode)
{
case "userfolder_export_excel_x86":
$filename = $date."__".$inst_id."__xls_usrf.xls";
break;
case "userfolder_export_csv":
$filename = $date."__".$inst_id."__csv_usrf.csv";
break;
case "userfolder_export_xml":
$filename = $date."__".$inst_id."__xml_usrf.xml";
break;
}
return $filename;
}

+ Here is the caller graph for this function:

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 $dir, $file, and getExportDirectory().

{
// quit if export dir not available
if (!@is_dir($dir) or
!is_writeable($dir))
{
return array();
}
// open directory
$dir = dir($dir);
// initialize array
$file = array();
// get files and save the in the array
while ($entry = $dir->read())
{
if ($entry != "." and
$entry != ".." and
preg_match("/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,3}\$/", $entry, $matches))
{
$filearray["filename"] = $entry;
$filearray["filesize"] = filesize($this->getExportDirectory()."/".$entry);
array_push($file, $filearray);
}
}
// close import directory
$dir->close();
// sort files
sort ($file);
reset ($file);
return $file;
}

+ Here is the call graph for this function:

static ilObjUserFolder::getExportSettings ( )
static

getExport Settings

Returns
array of exportable fields

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

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

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

{
global $ilDB;
$db_settings = array();
include_once("./Services/User/classes/class.ilUserProfile.php");
$up = new ilUserProfile();
$up->skipField("roles");
$profile_fields = $up->getStandardFields();
/*$profile_fields =& ilObjUserFolder::getProfileFields();
$profile_fields[] = "preferences";*/
$query = "SELECT * FROM settings WHERE ".
$ilDB->like("keyword", "text", '%usr_settings_export_%');
$result = $ilDB->query($query);
while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($row["value"] == "1")
{
if (preg_match("/usr_settings_export_(.*)/", $row["keyword"], $setting))
{
array_push($db_settings, $setting[1]);
}
}
}
$export_settings = array();
foreach ($profile_fields as $key => $value)
{
if (in_array($key, $db_settings))
{
if (strcmp($key, "password") == 0)
{
array_push($export_settings, "passwd");
}
else
{
array_push($export_settings, $key);
}
}
}
array_push($export_settings, "login");
array_push($export_settings, "last_login");
array_push($export_settings, "last_update");
array_push($export_settings, "create_date");
array_push($export_settings, "i2passwd");
array_push($export_settings, "time_limit_owner");
array_push($export_settings, "time_limit_unlimited");
array_push($export_settings, "time_limit_from");
array_push($export_settings, "time_limit_until");
array_push($export_settings, "time_limit_message");
array_push($export_settings, "active");
array_push($export_settings, "approve_date");
array_push($export_settings, "agree_date");
array_push($export_settings, "ilinc_id");
array_push($export_settings, "ilinc_login");
array_push($export_settings, "ilinc_passwd");
array_push($export_settings, "client_ip");
array_push($export_settings, "auth_mode");
array_push($export_settings, "ext_account");
array_push($export_settings, "feedhash");
return $export_settings;
}

+ Here is the caller graph for this function:

static& ilObjUserFolder::getProfileFields ( )
static

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

Returns
array of fieldnames

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

References $f, and $up.

{
include_once("./Services/User/classes/class.ilUserProfile.php");
$up = new ilUserProfile();
$up->skipField("username");
$up->skipField("roles");
$up->skipGroup("preferences");
$fds = $up->getStandardFields();
foreach ($fds as $k => $f)
{
$profile_fields[] = $k;
}
return $profile_fields;
}
ilObjUserFolder::getUserDefinedExportFields ( )

Get all exportable user defined fields.

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

References ilUserDefinedFields\_getInstance().

Referenced by createCSVExport(), and createExcelExport().

{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$udf_ex_fields = array();
foreach($udf_obj->getDefinitions() as $definition)
{
if ($definition["export"] != FALSE)
{
$udf_ex_fields[] = array("name" => $definition["field_name"],
"id" => $definition["field_id"]);
}
}
return $udf_ex_fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
$this->type = "usrf";
$this->ilObject($a_id,$a_call_by_reference);
}

+ Here is the call graph for this function:


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