34 require_once
"./classes/class.ilObject.php";
36 define(
'USER_FOLDER_ID',7);
49 $this->
ilObject($a_id,$a_call_by_reference);
65 if (!parent::delete())
81 $inst_id = IL_INST_ID;
87 case "userfolder_export_excel_x86":
88 $filename = $date.
"__".$inst_id.
"__xls_usrf.xls";
90 case "userfolder_export_csv":
91 $filename = $date.
"__".$inst_id.
"__csv_usrf.csv";
93 case "userfolder_export_xml":
94 $filename = $date.
"__".$inst_id.
"__xml_usrf.xml";
128 if (!@is_dir(
$dir) or
141 while ($entry =
$dir->read())
143 if ($entry !=
"." and
145 preg_match(
"/^[0-9]{10}_{2}[0-9]+_{2}([a-z0-9]{3})_usrf\.[a-z]{1,3}\$/", $entry, $matches))
147 $filearray[
"filename"] = $entry;
149 array_push(
$file, $filearray);
165 $value = str_replace(
"&",
"&", $value);
166 $value = str_replace(
"<",
"<", $value);
167 $value = str_replace(
">",
">", $value);
173 include_once
'./Services/User/classes/class.ilUserDefinedData.php';
174 include_once
'./Services/User/classes/class.ilObjUser.php';
184 include_once
'./Services/User/classes/class.ilUserXMLWriter.php';
187 $xmlWriter->setObjects(
$data);
188 $xmlWriter->setSettings($settings);
189 $xmlWriter->setAttachRoles (
true);
191 if($xmlWriter->start())
193 fwrite(
$file, $xmlWriter->getXML());
470 $headerrow = array();
471 foreach ($settings as $value)
473 array_push($headerrow, $this->lng->txt($value));
479 foreach (
$data as $row)
482 foreach ($settings as $header)
484 array_push($csvrow, $row[$header]);
494 include_once
"./classes/class.ilExcelUtils.php";
495 include_once
"./classes/class.ilExcelWriterAdapter.php";
497 $workbook = $adapter->getWorkbook();
499 $format_bold =& $workbook->addFormat();
500 $format_bold->setBold();
501 $format_percent =& $workbook->addFormat();
502 $format_percent->setNumFormat(
"0.00%");
503 $format_datetime =& $workbook->addFormat();
504 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
505 $format_title =& $workbook->addFormat();
506 $format_title->setBold();
507 $format_title->setColor(
'black');
508 $format_title->setPattern(1);
509 $format_title->setFgColor(
'silver');
510 $worksheet =& $workbook->addWorksheet();
514 foreach ($settings as $value)
521 foreach (
$data as $index => $rowdata)
525 foreach ($settings as $fieldname)
529 $value = $rowdata[$fieldname];
535 case "time_limit_from":
536 case "time_limit_until":
537 $date = strftime(
"%Y-%m-%d %H:%M:%S", $value);
538 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date, $matches))
540 $worksheet->write($row, $col,
ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
548 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $value, $matches))
550 $worksheet->write($row, $col,
ilUtil::excelTime($matches[1],$matches[2],$matches[3],$matches[4],$matches[5],$matches[6]), $format_datetime);
572 $db_settings = array();
574 $profile_fields[] =
"preferences";
576 $query =
"SELECT * FROM `settings` WHERE keyword LIKE '%usr_settings_export_%'";
577 $result = $ilDB->query($query);
578 $export_pref_settings_found =
false;
581 if (preg_match(
"/usr_settings_export_(.*)/", $row[
"keyword"], $setting))
583 $export_pref_settings_found = $setting[1] ==
"preferences";
584 if ($row[
"value"] == 1)
585 array_push($db_settings, $setting[1]);
589 if (!$export_pref_settings_found)
590 array_push($db_settings,
"preferences");
592 $export_settings = array();
593 foreach ($profile_fields as $key => $value)
595 if (in_array($value, $db_settings))
597 if (strcmp($value,
"password") == 0)
599 array_push($export_settings,
"passwd");
603 array_push($export_settings, $value);
607 array_push($export_settings,
"login");
608 array_push($export_settings,
"last_login");
609 array_push($export_settings,
"last_update");
610 array_push($export_settings,
"create_date");
611 array_push($export_settings,
"i2passwd");
612 array_push($export_settings,
"time_limit_owner");
613 array_push($export_settings,
"time_limit_unlimited");
614 array_push($export_settings,
"time_limit_from");
615 array_push($export_settings,
"time_limit_until");
616 array_push($export_settings,
"time_limit_message");
617 array_push($export_settings,
"active");
618 array_push($export_settings,
"approve_date");
619 array_push($export_settings,
"agree_date");
620 array_push($export_settings,
"ilinc_id");
621 array_push($export_settings,
"ilinc_login");
622 array_push($export_settings,
"ilinc_passwd");
623 array_push($export_settings,
"client_ip");
624 array_push($export_settings,
"auth_mode");
625 array_push($export_settings,
"ext_account");
626 array_push($export_settings,
"feedhash");
628 return $export_settings;
634 function buildExportFile($a_mode =
"userfolder_export_excel_x86", $user_data_filter = FALSE)
655 $query =
"SELECT usr_data.*, usr_pref.value AS language FROM usr_data, usr_pref WHERE usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = 'language' ORDER BY usr_data.lastname, usr_data.firstname";
656 $result = $ilDB->query($query);
659 if (is_array($user_data_filter))
661 if (in_array($row[
"usr_id"], $user_data_filter)) array_push(
$data, $row);
665 array_push(
$data, $row);
673 case "userfolder_export_excel_x86":
676 case "userfolder_export_csv":
679 case "userfolder_export_xml":
700 if(!is_writable($usrf_data_dir))
702 $this->ilias->raiseError(
"Userfolder data directory (".$usrf_data_dir
703 .
") not writeable.",$this->ilias->error_obj->MESSAGE);
707 $export_dir = $usrf_data_dir.
"/export";
709 if(!@is_dir($export_dir))
711 $this->ilias->raiseError(
"Creation of Userfolder Export Directory failed.",$this->ilias->error_obj->MESSAGE);
723 $profile_fields = array(
748 "instant_messengers",
749 "hide_own_online_status"
751 return $profile_fields;
758 $ilDB->query(
"REPLACE INTO usr_new_account_mail ".
759 "(lang, subject, body, sal_g, sal_f, sal_m) VALUES ".
760 "(".$ilDB->quote($a_lang).
",".$ilDB->quote($a_subject).
",".$ilDB->quote($a_body).
761 ",".$ilDB->quote($a_sal_g).
",".$ilDB->quote($a_sal_f).
",".$ilDB->quote($a_sal_m).
")");
768 $set = $ilDB->query(
"SELECT * FROM usr_new_account_mail ".
769 " WHERE lang = ".$ilDB->quote($a_lang));
793 $query =
"UPDATE usr_data SET time_limit_owner = ".$ilDB->quote($a_new_id).
" ".
794 "WHERE time_limit_owner = ".$ilDB->quote($a_old_id).
" ";
795 $ilDB->query($query);