Public Member Functions

ilObjUserFolder Class Reference

Inheritance diagram for ilObjUserFolder:
Collaboration diagram for ilObjUserFolder:

Public Member Functions

 ilObjUserFolder ($a_id, $a_call_by_reference=true)
 Constructor public.
 ilClone ($a_parent_ref)
 copy all properties and subobjects of a userfolder.
 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)
 createCSVExport (&$settings, &$data, $filename)
 createExcelExport (&$settings, &$data, $filename, $a_mode)
 getExportSettings ()
 buildExportFile ($a_mode="userfolder_export_excel_x86")
 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)
getProfileFields ()
 _writeNewAccountMail ($a_lang, $a_subject, $a_sal_g, $a_sal_f, $a_sal_m, $a_body)
 _lookupNewAccountMail ($a_lang)

Detailed Description

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


Member Function Documentation

ilObjUserFolder::_lookupNewAccountMail ( a_lang  ) 

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

References $set.

Referenced by ilRegistrationGUI::__distributeMails(), ilObjUserGUI::createObject(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilSOAPAuth::login(), and ilAccountMail::readAccountMail().

        {
                global $ilDB;

                $set = $ilDB->query("SELECT * FROM usr_new_account_mail ".
                        " WHERE lang = ".$ilDB->quote($a_lang));

                if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        return $rec;
                }
                return array();
        }

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

        {
                global $ilDB;

                $ilDB->query("REPLACE INTO usr_new_account_mail ".
                        "(lang, subject, body, sal_g, sal_f, sal_m) VALUES ".
                        "(".$ilDB->quote($a_lang).",".$ilDB->quote($a_subject).",".$ilDB->quote($a_body).
                        ",".$ilDB->quote($a_sal_g).",".$ilDB->quote($a_sal_f).",".$ilDB->quote($a_sal_m).")");
        }

ilObjUserFolder::buildExportFile ( a_mode = "userfolder_export_excel_x86"  ) 

build xml export file

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

References $data, $ilBench, ilObject::$ilias, $log, $query, $result, $row, createCSVExport(), createExcelExport(), createExportDirectory(), createXMLExport(), getExportDirectory(), getExportFilename(), and getExportSettings().

        {
                global $ilBench;
                global $log;
                global $ilDB;
                global $ilias;

                //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
                $this->createExportDirectory();

                //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();
                $data = array();
                $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";
                $result = $ilDB->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
//                      $datarow = array();
                        array_push($data, $row);
//                      array_push($data, $datarow);
                }
                //$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 461 of file class.ilObjUserFolder.php.

References $data, $file, $row, $separator, and ilUtil::processCSVRow().

Referenced by buildExportFile().

        {
                $headerrow = array();
                foreach ($settings as $value)
                {
                        array_push($headerrow, $this->lng->txt($value));
                }
                $separator = ";";
                $file = fopen($filename, "w");
                $formattedrow =& ilUtil::processCSVRow($headerrow, TRUE, $separator);
                fwrite($file, join ($separator, $formattedrow) ."");
                foreach ($data as $row)
                {
                        $csvrow = array();
                        foreach ($settings as $header)
                        {
                                array_push($csvrow, $row[$header]);
                        }
                        $formattedrow =& ilUtil::processCSVRow($csvrow, TRUE, $separator);
                        fwrite($file, join ($separator, $formattedrow) ."");
                }
                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 485 of file class.ilObjUserFolder.php.

References $data, $row, ilExcelUtils::_convert_text(), and ilUtil::excelTime().

Referenced by buildExportFile().

        {
                include_once ("./classes/class.ilExcelUtils.php");
                include_once "./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;

                foreach ($settings as $value)
                {
                        $worksheet->write($row, $col, ilExcelUtils::_convert_text($this->lng->txt($value), $a_mode), $format_title);
                        $col++;
                }


                foreach ($data as $index => $rowdata)
                {
                        $row++;
                        $col = 0;
                        foreach ($settings as $fieldname)
                        {
//                      foreach ($rowdata as $rowindex => $value)
//                      {
                                $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++;
                        }
                }
                $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 665 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 191 of file class.ilObjUserFolder.php.

References $data, $file, $key, $log, $q, $query, $rbacreview, $row, ilObject::$type, ilObjUser::_lookupPref(), escapeXML(), and ilUtil::getWebspaceDir().

Referenced by buildExportFile().

        {
                include_once 'classes/class.ilUserDefinedData.php';
                include_once "./classes/class.ilObjUser.php";

                global $rbacreview;
                global $ilDB;
                global $log;

                $file = fopen($filename, "w");
                fwrite($file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
                fwrite($file, "<!DOCTYPE Users SYSTEM \"ilias_user_3_7.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."\">".$this->escapeXML($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>";
                        }

                        // 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 call graph for this function:

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

Referenced by createXMLExport().

        {
                $value = str_replace("&", "&amp;", $value);
                $value = str_replace("<", "&lt;", $value);
                $value = str_replace(">", "&gt;", $value);
                return $value;
        }

Here is the caller graph for this function:

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

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

References $dir, $file, and getExportDirectory().

        {
                $dir = $this->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:

ilObjUserFolder::getExportSettings (  ) 

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

References $key, $query, $result, $row, and getProfileFields().

Referenced by buildExportFile().

        {
                global $ilDB;

                $db_settings = array();
                $profile_fields =& $this->getProfileFields();
                $query = "SELECT * FROM `settings` WHERE keyword LIKE '%usr_settings_export_%' AND value = '1'";
                $result = $ilDB->query($query);
                while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        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($value, $db_settings))
                        {
                                if (strcmp($value, "password") == 0)
                                {
                                        array_push($export_settings, "passwd");
                                }
                                else
                                {
                                        array_push($export_settings, $value);
                                }
                        }
                }
                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");
                return $export_settings;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilObjUserFolder::getProfileFields (  ) 

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

Referenced by getExportSettings().

        {
                $profile_fields = array(
                        "gender",
                        "firstname",
                        "lastname",
                        "title",
                        "upload",
                        "password",
                        "institution",
                        "department",
                        "street",
                        "zipcode",
                        "city",
                        "country",
                        "phone_office",
                        "phone_home",
                        "phone_mobile",
                        "fax",
                        "email",
                        "hobby",
                        "referral_comment",
                        "matriculation",
                        "language",
                        "skin_style",
                        "hits_per_page",
                        "show_users_online"
                );
                return $profile_fields;
        }

Here is the caller graph for this function:

ilObjUserFolder::ilClone ( a_parent_ref  ) 

copy all properties and subobjects of a userfolder.

DISABLED public

Returns:
integer new ref id

Reimplemented from ilObject.

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

References $rbacadmin.

        {
                // DISABLED
                return false;

                global $rbacadmin;

                // always call parent ilClone function first!!
                $new_ref_id = parent::ilClone($a_parent_ref);

                // put here userfolder specific stuff

                // ... and finally always return new reference ID!!
                return $new_ref_id;
        }

ilObjUserFolder::ilObjUserFolder ( a_id,
a_call_by_reference = true 
)

Constructor public.

Parameters:
integer reference_id or object_id
boolean treat the id as reference_id (true) or object_id (false)

Definition at line 45 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: