Public Member Functions

ilUtil Class Reference
[Services/Utilities]

util class various functions, usage as namespace More...

Public Member Functions

 getImageTagByType ($a_type, $a_path, $a_big=false)
 Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Code to your template file public.
 getImagePath ($img, $in_module=false, $mode="output", $offline=false)
 get image path (for images located in a template directory)
 getHtmlPath ($relative_path)
 get url of path
 getJSPath ($a_js)
 Get the full JavaScript path for a JavaScript file name.
 getStyleSheetLocation ($mode="output")
 get full style sheet file name (path inclusive) of current user
 getP3PLocation ()
 Get p3p file path.
 getNewContentStyleSheetLocation ($mode="output")
 get full style sheet file name (path inclusive) of current user
 formSelect ($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="")
 Builds a select form field with options and shows the selected option first.
 getSelectName ($selected, $values)
 ???
 formCheckbox ($checked, $varname, $value, $disabled=false)
 ??? public
 formDisabledRadioButton ($checked, $varname, $value, $disabled)
 ???
 formRadioButton ($checked, $varname, $value)
 ??? public
 checkInput ($vars)
 ???
 setPathStr ($a_path)
 ??? public
 switchColor ($a_num, $a_css1, $a_css2)
 switches style sheets for each even $a_num (used for changing colors of different result rows)
 showTabs ($a_hl, $a_o)
 show the tabs in admin section
 checkFormEmpty ($emptyFields)
 ??? public
 Linkbar ($AScript, $AHits, $ALimit, $AOffset, $AParams=array(), $ALayout=array())
 Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und den entsprechenden Seitenzahlen.
 makeClickable ($a_text)
 makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
 StopWatch ($begin=-1)
 StopWatch benchmark scriptcode.
 makeDateSelect ($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true)
 Creates a combination of HTML selects for date inputs.
 makeTimeSelect ($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true)
 Creates a combination of HTML selects for time inputs.
 is_email ($a_email)
 isPassword ($a_passwd)
 isLogin ($a_login)
 shortenText ($a_str, $a_len, $a_dots=false, $a_next_blank=false)
 shorten a string to given length.
 attribsToArray ($a_str)
 converts a string of format var1 = "val1" var2 = "val2" ...
 rCopy ($a_sdir, $a_tdir)
 Copies content of a directory $a_sdir recursively to a directory $a_tdir.
 getWebspaceDir ($mode="filesystem")
 get webspace directory
 getDataDir ()
 get data directory (outside webspace)
 getUsersOnline ($a_user_id=0)
 reads all active sessions from db and returns users that are online OR returns only one active user if a user_id is given
 getAssociatedUsersOnline ($a_user_id)
 reads all active sessions from db and returns users that are online and who have a local role in a group or a course for which the the current user has also a local role.
 ilTempnam ()
 Create a temporary file in an ILIAS writable directory.
 createDirectory ($a_dir, $a_mod=0755)
 create directory
 unzip ($a_file, $overwrite=false)
 unzip file
 zip ($a_dir, $a_file)
 zips given directory/file into given zip.file
 getConvertCmd ()
 get convert command
 convertImage ($a_from, $a_to, $a_target_format="", $a_geometry="")
 convert image
 resizeImage ($a_from, $a_to, $a_width, $a_height)
 resize image
 html2pdf ($html, $pdf_file)
 produce pdf out of html with htmldoc
 deliverData ($a_data, $a_filename, $mime="application/octet-stream", $charset="")
 deliver data for download via browser.
 deliverFile ($a_file, $a_filename, $a_mime= '')
 deliver file for download via browser.
 readFile ($a_file)
 there are some known problems with the original readfile method, which sometimes truncates delivered files regardless of php.ini setting (see http://de.php.net/manual/en/function.readfile.php) use this method to avoid these problems.
 getASCIIFilename ($a_filename)
 convert utf8 to ascii filename
 getJavaPath ()
 get full java path (dir + java command)
 appendUrlParameterString ($a_url, $a_par)
 append URL parameter string ("par1=value1&par2=value2...") to given URL string
 makeDir ($a_dir)
 creates a new directory and inherits all filesystem permissions of the parent directory You may pass only the name of your new directory or with the entire path or relative path information.
 makeDirParents ($a_dir)
 Create a new directory and all parent directories.
 delDir ($a_dir)
 removes a dir and all its content (subdirs and files) recursively
 getDir ($a_dir)
 get directory
 getGroupId ($a_parent_ref)
 get the tree_id of a group where an object with the passed ref_id belongs to.
 stripSlashes ($a_str, $a_strip_html=true, $a_allow="")
 strip slashes if magic qoutes is enabled
 stripScriptHTML ($a_str, $a_allow="", $a_rm_js=true)
 strip only html tags (4.0) from text $allowed contains tags to be allowed, in format tags a and b are allowed todo: needs to be optimized-> not very efficient
 addSlashes ($a_str)
 add slashes if magic qoutes is disabled don't use that for db inserts/updates! use prepareDBString instead
 prepareFormOutput ($a_str, $a_strip=false)
 prepares string output for html forms public
 prepareDBString ($a_str)
 prepare a string for db writing (insert/update)
 removeItemFromDesktops ($a_id)
 removes object from all user's desktops public
 extractParameterString ($a_parstr)
 extracts parameter value pairs from a string into an array
 assembleParameterString ($a_par_arr)
 dumpString ($a_str)
 dumps ord values of every character of string $a_str
 yn2tf ($a_yn)
 convert "y"/"n" to true/false
 tf2yn ($a_tf)
 convert true/false to "y"/"n"
 sort_func ($a, $b)
 sub-function to sort an array
 sort_func_numeric ($a, $b)
 sub-function to sort an array
 sortArray ($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false)
 sortArray
 unique_multi_array ($array, $sub_key)
 Make a multi-dimensional array to have only DISTINCT values for a certain "column".
 getGDSupportedImageType ($a_desired_type)
 returns the best supported image type by this PHP build
 deducibleSize ($a_mime)
 checks if mime type is provided by getimagesize()
 redirect ($a_script)
 http redirect to other script
 insertInstIntoID ($a_value)
 inserts installation id into ILIAS id
 groupNameExists ($a_group_name, $a_id=0)
 checks if group name already exists.
 searchGroups ($a_search_str)
 getMemString ()
 get current memory usage as string
 isWindows ()
 check wether the current client system is a windows system
 escapeShellArg ($a_arg)
 excelTime ($year="", $month="", $day="", $hour="", $minute="", $second="")
 renameExecutables ($a_dir)
 Rename uploaded executables for security reasons.
 rRenameSuffix ($a_dir, $a_old_suffix, $a_new_suffix)
 Renames all files with certain suffix and gives them a new suffix.
 isAPICall ()
 KT_replaceParam ($qstring, $paramName, $paramValue)
 replaceUrlParameterString ($url, $parametersArray)
 generatePasswords ($a_number)
 removeTrailingPathSeparators ($path)
 array_php2js ($data)
 convert php arrays to javascript arrays
 virusHandling ($a_file, $a_orig_name="", $a_clean=true)
 scan file for viruses and clean files if possible
 moveUploadedFile ($a_file, $a_name, $a_target, $a_raise_errors=true)
 move uploaded file
 date_mysql2time ($mysql_date_time)
 make time object from mysql_date_time
processCSVRow (&$row, $quoteAll=FALSE, $separator=";", $outUTF8=FALSE, $compatibleWithMSExcel=TRUE)
 Convertes an array for CSV usage.
 isDN ($a_str)
 isIPv4 ($a_str)
 _getObjectsByOperations ($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
 Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
 insertLatexImages ($a_text, $a_start="\[tex\]", $a_end="\[\/tex\]", $a_cgi=URL_TO_LATEX)
 replace [text]...[/tex] tags with formula image code //////// added additional parameters to make this method usable for other start and end tags as well
 buildLatexImages ($a_text, $a_dir, $a_start="\[tex\]", $a_end="\[\/tex\]", $a_cgi=URL_TO_LATEX)
 replace [text]...[/tex] tags with formula image code //////// added additional parameters to make this method usable for other start and end tags as well
 int2array ($seconds, $periods=null)
 Return an array of date segments.
 timearray2string ($duration)
 getFileSizeInfo ()
 __extractRefId ($role_title)
 extract ref id from role title, e.g.
 __extractId ($ilias_id, $inst_id)
 extract ref id from role title, e.g.
 _sortIds ($a_ids, $a_table, $a_field, $a_id_name)
 Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
 getMySQLTimestamp ($a_ts)
 Get MySQL timestamp in 4.1.x or higher format (yyyy-mm-dd hh:mm:ss) This function converts a timestamp, if MySQL 4.0 is used.

Detailed Description

util class various functions, usage as namespace

Author:
Sascha Hofmann <saschahofmann@gmx.de>
Alex Killing <alex.killing@gmx.de>
Version:
Id:
class.ilUtil.php 15956 2008-02-11 13:37:09Z smeyer

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


Member Function Documentation

ilUtil::__extractId ( ilias_id,
inst_id 
)

extract ref id from role title, e.g.

893 from 'il_122_role_893'

Parameters:
ilias id with format like il_<instid>_<objTyp>_ID
int inst_id Installation ID must match inst id in param ilias_id
Returns:
id or false

Definition at line 3236 of file class.ilUtil.php.

Referenced by ilUserImportParser::extractRolesBeginTag(), ilUserImportParser::importBeginTag(), ilSoapUserAdministration::importUsers(), and ilUserImportParser::verifyBeginTag().

        {

                $test_str = explode('_',$ilias_id);

                if ($test_str[0] == 'il' && $test_str[1] == $inst_id && count($test_str) == 4)
                {
                        $test2 = (int) $test_str[3];
                        return is_numeric ($test2) ? (int) $test2 : false;
                }
                return false;
        }

Here is the caller graph for this function:

ilUtil::__extractRefId ( role_title  ) 

extract ref id from role title, e.g.

893 from 'il_crs_member_893'

Parameters:
role_title with format like il_crs_member_893
Returns:
ref id or false

Definition at line 3214 of file class.ilUtil.php.

Referenced by ilSoapRoleObjectXMLWriter::start().

        {

                $test_str = explode('_',$role_title);

                if ($test_str[0] == 'il')
                {
                        $test2 = (int) $test_str[3];
                        return is_numeric ($test2) ? (int) $test2 : false;
                }
                return false;
        }

Here is the caller graph for this function:

ilUtil::_getObjectsByOperations ( a_obj_type,
a_operation,
a_usr_id = 0,
limit = 0 
)

Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.

Get all objects of a specific type where access is granted for the given operation. This function does a checkAccess call for all objects in the object hierarchy and return only the objects of the given type. Please note if access is not granted to any object in the hierarchy the function skips all objects under it. Example: You want a list of all Courses that are visible and readable for the user. The function call would be: $your_list = IlUtil::getObjectsByOperation ("crs", "visible"); Lets say there is a course A where the user would have access to according to his role assignments. Course A lies within a group object which is not readable for the user. Therefore course A won't appear in the result list although the queried operations 'read' would actually permit the user to access course A.

public

Parameters:
string/array object type 'lm' or array('lm','sahs')
string permission to check e.g. 'visible' or 'read'
int id of user in question
int limit of results. if not given it defaults to search max hits.If limit is -1 limit is unlimited
Returns:
array of obj_ids

Definition at line 2959 of file class.ilUtil.php.

References $counter, $ilias, $ops_id, $query, $rbacreview, $res, $row, and ilRbacReview::_getOperationIdsByName().

Referenced by ilLPFilter::__getAllObjects(), ilMainMenuGUI::_checkAdministrationPermission(), ilCronWebResourceCheck::check(), ilChatRoom::getAllRooms(), and ilObjCourseGroupingGUI::selectCourse().

        {
                global $ilDB,$rbacreview,$ilAccess,$ilUser,$ilias;

                if(!is_array($a_obj_type))
                {
                        $where = "WHERE type = '".$a_obj_type."' ";
                }
                else
                {
                        $where = "WHERE type IN('";
                        $where .= implode("','",$a_obj_type);
                        $where .= "') ";
                }


                // limit number of results default is search result limit
                if(!$limit)
                {
                        $limit = $ilias->getSetting('search_max_hits',100);
                }
                if($limit = -1)
                {
                        $limit = 10000;
                }

                // default to logged in usr
                $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
                $a_roles = $rbacreview->assignedRoles($a_usr_id);

                // Since no rbac_pa entries are available for the system role. This function returns !all! ref_ids in the case the user
                // is assigned to the system role
                if($rbacreview->isAssigned($a_usr_id,SYSTEM_ROLE_ID))
                {
                        $query = "SELECT ref_id FROM object_reference AS obr LEFT JOIN object_data AS obd USING(obj_id) ".
                                "LEFT JOIN tree ON obr.ref_id = tree.child ".
                                $where.
                                "AND tree = 1";

                        $res = $ilDB->query($query);
                        $counter = 0;
                        while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                        {
                                if(++$counter == $limit)
                                {
                                        break;
                                }
                                $ref_ids[] = $row->ref_id;
                        }
                        return $ref_ids ? $ref_ids : array();
                }

                $ops_ids = ilRbacReview::_getOperationIdsByName(array($a_operation));
                $ops_id = $ops_ids[0];

                $query = "SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM rbac_pa ".
                        "LEFT JOIN object_reference AS obr  ON obr.ref_id = rbac_pa.ref_id ".
                        "LEFT JOIN object_data AS obd ON obd.obj_id = obr.obj_id ".
                        $where.
                        "AND ops_id LIKE '%i:".$ops_id."%'";
                $res = $ilDB->query($query);
                $counter = 0;
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($counter >= $limit)
                        {
                                break;
                        }
                        // Check deleted, hierarchical access ...
                        if($ilAccess->checkAccessOfUser($a_usr_id,$a_operation,'',$row->ref_id,$row->type,$row->obj_id))
                        {
                                $counter++;
                                $ref_ids[] = $row->ref_id;
                        }
                }
                return $ref_ids ? $ref_ids : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::_sortIds ( a_ids,
a_table,
a_field,
a_id_name 
)

Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.

Parameters:
array Array of ids
string table name
string table field
string id name
Returns:
array sorted ids

protected

Definition at line 3261 of file class.ilUtil.php.

References $query, $res, and $row.

Referenced by ilEventAdministrationGUI::editMembers(), ilEventAdministrationGUI::printViewMembers(), and ilEventAdministrationGUI::updateMembers().

        {
                global $ilDB;

                if(!$a_ids)
                {
                        return array();
                }

                // use database to sort user array
                $where = "WHERE ".$a_id_name." IN ('";
                $where .= implode("','",$a_ids);
                $where .= "') ";

                $query = "SELECT ".$a_id_name." FROM ".$a_table." ".
                        $where.
                        "ORDER BY ".$a_field;

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $ids[] = $row->$a_id_name;
                }
                return $ids ? $ids : array();
        }

Here is the caller graph for this function:

ilUtil::addSlashes ( a_str  ) 

add slashes if magic qoutes is disabled don't use that for db inserts/updates! use prepareDBString instead

Definition at line 2049 of file class.ilUtil.php.

Referenced by createNewOperation(), ilObjUserTrackingGUI::getSearchTermsCondition(), ilObjUser::saveAsNew(), and updateObjectValue().

        {
                if (ini_get("magic_quotes_gpc"))
                {
                        return $a_str;
                }
                else
                {
                        return addslashes($a_str);
                }
        }

Here is the caller graph for this function:

ilUtil::appendUrlParameterString ( a_url,
a_par 
)
ilUtil::array_php2js ( data  ) 

convert php arrays to javascript arrays

Author:
gigi@orsone.com public
Parameters:
array 
Returns:
string

Definition at line 2741 of file class.ilUtil.php.

References $data.

Referenced by ilObjRoleGUI::__showAssignedUsersTable(), ilObjExerciseGUI::__showMembersSelect(), ilObjiLincCourseGUI::__showMembersTable(), ilObjGroupGUI::__showMembersTable(), ilObjUserGUI::__showRolesTable(), ilObjRoleFolderGUI::__showRolesTable(), ilLMStatisticsGUI::__showSearchGroupTable(), ilObjiLincCourseGUI::__showSearchGroupTable(), ilObjCourseGUI::__showSearchGroupTable(), ilObjRoleGUI::__showSearchGroupTable(), ilObjGroupGUI::__showSearchGroupTable(), ilLMStatisticsGUI::__showSearchRoleTable(), ilObjiLincCourseGUI::__showSearchRoleTable(), ilObjCourseGUI::__showSearchRoleTable(), ilObjRoleGUI::__showSearchRoleTable(), ilObjGroupGUI::__showSearchRoleTable(), ilLMStatisticsGUI::__showSearchUserTable(), ilObjiLincCourseGUI::__showSearchUserTable(), ilObjCourseGUI::__showSearchUserTable(), ilObjRoleGUI::__showSearchUserTable(), ilObjGroupGUI::__showSearchUserTable(), ilObjCourseGUI::__showSubscribersTable(), ilObjCourseGUI::__showWaitingListTable(), ilObjContentObjectGUI::editPublicSection(), ilFeedbackGUI::fbList(), ilPublicSectionSelector::formatObject(), ilObjExerciseGUI::membersObject(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), and ilObjectGUI::showActions().

        {
                if (empty($data))
                {
                        $data = array();
                }

                foreach($data as $k=>$datum)
                {
                        if(is_null($datum)) $data[$k] = 'null';
                        if(is_string($datum)) $data[$k] = "'" . $datum . "'";
                        if(is_array($datum)) $data[$k] = array_php2js($datum);
                }

                return "[" . implode(', ', $data) . "]";
        }

Here is the caller graph for this function:

ilUtil::assembleParameterString ( a_par_arr  ) 

Definition at line 2186 of file class.ilUtil.php.

References $target_arr.

Referenced by ilMediaItem::getParameterString().

        {
                if (is_array($a_par_arr))
                {
                        $target_arr = array();
                        foreach ($a_par_arr as $par => $val)
                        {
                                $target_arr[] = "$par=\"$val\"";
                        }
                        $target_str = implode(", ", $target_arr);
                }

                return $target_str;
        }

Here is the caller graph for this function:

ilUtil::attribsToArray ( a_str  ) 

converts a string of format var1 = "val1" var2 = "val2" ...

into an array

Parameters:
string $a_str string in format: var1 = "val1" var2 = "val2" ...
Returns:
array array of variable value pairs

Definition at line 1063 of file class.ilUtil.php.

Referenced by ilPCParagraph::input2xml(), and ilPCParagraph::xml2output().

        {
                $attribs = array();
                while (is_int(strpos($a_str, "=")))
                {
                        $eq_pos = strpos($a_str, "=");
                        $qu1_pos = strpos($a_str, "\"");
                        $qu2_pos = strpos(substr($a_str, $qu1_pos + 1), "\"") + $qu1_pos + 1;
                        if (is_int($eq_pos) && is_int($qu1_pos) && is_int($qu2_pos))
                        {
                                $var = trim(substr($a_str, 0, $eq_pos));
                                $val = trim(substr($a_str, $qu1_pos + 1, ($qu2_pos - $qu1_pos) - 1));
                                $attribs[$var] = $val;
                                $a_str = substr($a_str, $qu2_pos + 1);
                        }
                        else
                        {
                                $a_str = "";
                        }
                }
                return $attribs;
        }

Here is the caller graph for this function:

ilUtil::buildLatexImages ( a_text,
a_dir,
a_start = "\[tex\]",
a_end = "\[\/tex\]",
a_cgi = URL_TO_LATEX 
)

replace [text]...[/tex] tags with formula image code //////// added additional parameters to make this method usable for other start and end tags as well

Definition at line 3058 of file class.ilUtil.php.

References $GLOBALS.

Referenced by ilGlossaryPresentationGUI::listTermByGiven(), and ilPageObjectGUI::showPage().

        {
                $result_text = $a_text;
        
                if ($a_cgi != "")
                {
                        while (preg_match('/' . $a_start . '(.*?)' . $a_end . '/ie', $result_text, $found))
                        {
                                $cnt = (int) $GLOBALS["teximgcnt"]++;
                                // get image from cgi and write it to file
                                $fpr = fopen($a_cgi."?".rawurlencode($found[1]), "r");
                                $lcnt = 0;
                                while(!feof($fpr))
                                {
                                        $buf = fread($fpr, 1024);
                                        if ($lcnt == 0)
                                        {
                                                if (is_int(strpos(strtoupper(substr($buf, 0, 5)), "GIF")))
                                                {
                                                        $suffix = "gif";
                                                }
                                                else
                                                {
                                                        $suffix = "png";
                                                }
                                                $fpw = fopen($a_dir."/teximg/img".$cnt.".".$suffix, "w");
                                        }
                                        $lcnt++;
                                        fwrite($fpw, $buf);
                                }
                                fclose($fpw);
                                fclose($fpr);
        
                                // replace tex-tag
                                $img_str = "./teximg/img".$cnt.".".$suffix;
                                $result_text = str_replace($found[0],
                                        '<img alt="'.$found[1].'" src="'.$img_str.'" />', $result_text);
        
                        }
                }

                return $result_text;
        }

Here is the caller graph for this function:

ilUtil::checkFormEmpty ( emptyFields  ) 

??? public

Parameters:
array 
Returns:
string

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

References $key.

        {

                $feedback = "";

                foreach ($emptyFields as $key => $val)
                {
                        if ($val == "") {
                                if ($feedback != "") $feedback .= ", ";
                                $feedback .= $key;
                        }
                }

                return $feedback;
        }

ilUtil::checkInput ( vars  ) 

???

Parameters:
string 

Definition at line 500 of file class.ilUtil.php.

        {
                // TO DO:
                // Diese Funktion soll Formfeldeingaben berprfen (empty und required)
        }

ilUtil::convertImage ( a_from,
a_to,
a_target_format = "",
a_geometry = "" 
)

convert image

Parameters:
string $a_from source file
string $a_to target file
string $a_target_format target image file format

Definition at line 1450 of file class.ilUtil.php.

References escapeShellArg(), and getConvertCmd().

Referenced by assSingleChoice::fromXML(), assOrderingQuestion::fromXML(), assMultipleChoice::fromXML(), assMatchingQuestion::fromXML(), ilMediaItem::getThumbnailTarget(), ilMediaItem::makeMapWorkCopy(), assSingleChoice::setImageFile(), assOrderingQuestion::setImageFile(), assMultipleChoice::setImageFile(), and assMatchingQuestion::setImageFile().

        {
                $format_str = ($a_target_format != "")
                ? strtoupper($a_target_format).":"
                : "";
                $geometry = ($a_geometry != "")
                ? " -geometry ".$a_geometry."x".$a_geometry." "
                : "";
                $convert_cmd = ilUtil::getConvertCmd()." ".
                ilUtil::escapeShellArg($a_from)." ".$geometry.ilUtil::escapeShellArg($format_str.$a_to);
                system($convert_cmd);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::createDirectory ( a_dir,
a_mod = 0755 
)

create directory

deprecated use makeDir() instead!

Definition at line 1318 of file class.ilUtil.php.

References makeDir().

Referenced by ilObjCategoryGUI::_importCategories(), ilMediaItem::createWorkDirectory(), ilTempnam(), ilSetup::unzip(), and unzip().

        {
                ilUtil::makeDir($a_dir);
                //@mkdir($a_dir);
                //@chmod($a_dir, $a_mod);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::date_mysql2time ( mysql_date_time  ) 

make time object from mysql_date_time

Definition at line 2849 of file class.ilUtil.php.

Referenced by ilObjTestGUI::outPrintUserResults(), ilTestOutputGUI::outShowAnswersDetails(), and ilObjTestGUI::outShowAnswersDetails().

                                                    {
                list($datum, $uhrzeit) = explode (" ",$mysql_date_time);
                list($jahr, $monat, $tag) = explode("-", $datum);
                list($std, $min, $sec) = explode(":", $uhrzeit);
                return mktime ((int) $std, (int) $min, (int) $sec, (int) $monat, (int) $tag, (int) $jahr);
         }

Here is the caller graph for this function:

ilUtil::deducibleSize ( a_mime  ) 

checks if mime type is provided by getimagesize()

Parameters:
string $a_mime mime format
Returns:
boolean returns true if size is deducible by getimagesize()

Definition at line 2398 of file class.ilUtil.php.

Referenced by ilObjMediaObject::_saveTempFileAsMediaObject(), ilPCMediaObjectGUI::create(), ilObjMediaObjectGUI::editObject(), ilMediaItem::getOriginalSize(), and ilObjMediaObjectGUI::saveObject().

        {
                if (($a_mime == "image/gif") || ($a_mime == "image/jpeg") ||
                ($a_mime == "image/png") || ($a_mime == "application/x-shockwave-flash") ||
                ($a_mime == "image/tiff") || ($a_mime == "image/x-ms-bmp") ||
                ($a_mime == "image/psd") || ($a_mime == "image/iff"))
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

Here is the caller graph for this function:

ilUtil::delDir ( a_dir  ) 

removes a dir and all its content (subdirs and files) recursively

public

Parameters:
string dir to delete
Author:
Unknown <flexer@cutephp.com> (source: http://www.php.net/rmdir)

Definition at line 1844 of file class.ilUtil.php.

References $file, and $files.

Referenced by ilFileDataChat::__deleteOld(), ilFileDataGroup::_deleteAll(), ilCourseFile::_deleteByCourse(), ilEventFile::_deleteByEvent(), ilFileDataChat::_ilFileDataChat(), ilObjFile::clearDataDirectory(), SurveyQuestion::delete(), ilClient::delete(), ilObjSAHSLearningModule::delete(), ilObjFileBasedLM::delete(), ilObjContentObject::delete(), ilObjAICCLearningModule::delete(), ilObjMediaObject::delete(), ilObjFile::delete(), ilFileDataExercise::delete(), assQuestion::delete(), ilObjSurveyQuestionPool::deleteAllData(), ilFileDataCourse::deleteDirectory(), ilFileDataGroup::deleteDirectory(), ilObjGlossaryGUI::deleteExportFile(), ilObjContentObjectGUI::deleteExportFile(), ilObjSurveyQuestionPoolGUI::deleteExportFileObject(), ilObjSurveyGUI::deleteExportFileObject(), ilObjTestGUI::deleteExportFileObject(), ilObjQuestionPoolGUI::deleteExportFileObject(), ilFileSystemGUI::deleteFile(), ilObjMediaObjectGUI::deleteFileObject(), ilObjQuestionPool::deleteQuestionpool(), ilObjSurvey::deleteSurveyRecord(), ilObjTest::deleteTest(), ilObjGlossary::exportHTML(), ilObjContentObject::exportHTML(), ilObjContentObject::exportSCORM(), ilFileDataChat::ilFileDataChat(), ilObjUserFolderGUI::importCancelledObject(), ilObjGlossaryGUI::importFileObject(), ilObjContentObjectGUI::importFileObject(), ilObjSurvey::importObject(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilObjUserFolderGUI::importUsersObject(), ilObjTestGUI::importVerifiedFileObject(), ilObjQuestionPoolGUI::importVerifiedFileObject(), ilFileDataImportMail::unlinkLast(), ilFileDataImportGroup::unlinkLast(), ilFileDataImportForum::unlinkLast(), ilSetup::updateNewClient(), ilObjQuestionPoolGUI::uploadQplObject(), and ilObjTestGUI::uploadTstObject().

        {
                if (!is_dir($a_dir) || is_int(strpos($a_dir, "..")))
                {
                        return;
                }

                $current_dir = opendir($a_dir);

                $files = array();

                // this extra loop has been necessary because of a strange bug
                // at least on MacOS X. A looped readdir() didn't work
                // correctly with larger directories
                // when an unlink happened inside the loop. Getting all files
                // into the memory first solved the problem.
                while($entryname = readdir($current_dir))
                {
                        $files[] = $entryname;
                }

                foreach($files as $file)
                {
                        if(is_dir($a_dir."/".$file) and ($file != "." and $file!=".."))
                        {
                                ilUtil::delDir(${a_dir}."/".${file});
                        }
                        elseif ($file != "." and $file != "..")
                        {
                                unlink(${a_dir}."/".${file});
                        }
                }

                closedir($current_dir);
                rmdir(${a_dir});
        }

Here is the caller graph for this function:

ilUtil::deliverData ( a_data,
a_filename,
mime = "application/octet-stream",
charset = "" 
)

deliver data for download via browser.

We need to set the following headers to make downloads work using IE in HTTPS mode.

Definition at line 1519 of file class.ilUtil.php.

References exit, and getASCIIFilename().

Referenced by ilPDFPresentation::__convert(), ilPDFPresentation::__toPDF(), ilObjUserGUI::deliverVCardObject(), ilTestEvaluationGUI::evalSelectedUsers(), ilSurveyEvaluationGUI::evaluationuser(), ilBookmarkAdministrationGUI::export(), ilObjChatGUI::export(), ilLMPresentationGUI::exportbibinfo(), ilSurveyEvaluationGUI::exportCumulatedResults(), ilNoteGUI::exportNotesHTML(), ilObjChatGUI::exportRecordingObject(), ilObjStyleSheetGUI::exportStyleObject(), ilObjAssessmentFolderGUI::logsObject(), and ilPageObject::send_paragraph().

        {
                $disposition = "attachment"; // "inline" to view file in browser or "attachment" to download to hard disk
                //              $mime = "application/octet-stream"; // or whatever the mime type is

                if (isset($_SERVER["HTTPS"])) {

                        // Added different handling for IE and HTTPS => send pragma after content informations
                        #header("Pragma: ");
                        #header("Cache-Control: ");
                        #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                        #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                        #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
                        #header("Cache-Control: post-check=0, pre-check=0", false);
                }
                else if ($disposition == "attachment")
                {
                        header("Cache-control: private");
                }
                else
                {
                        header("Cache-Control: no-cache, must-revalidate");
                        header("Pragma: no-cache");
                }

                $ascii_filename = ilUtil::getASCIIFilename($a_filename);

                if (strlen($charset))
                {
                        $charset = "; charset=$charset";
                }
                header("Content-Type: $mime$charset");
                header("Content-Disposition:$disposition; filename=\"".$ascii_filename."\"");
                header("Content-Description: ".$ascii_filename);
                header("Content-Length: ".(string)(strlen($a_data)));

                if($_SERVER['HTTPS'])
                {
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
                }

                header("Connection: close");
                echo $a_data;
                exit;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::deliverFile ( a_file,
a_filename,
a_mime = '' 
)

deliver file for download via browser.

We need to set the following headers to make downloads work using IE in HTTPS mode.

Definition at line 1572 of file class.ilUtil.php.

References exit, getASCIIFilename(), and readFile().

Referenced by ilObjChatGUI::__exportRooms(), ilCourseArchivesGUI::downloadArchives(), ilObjCourseGUI::downloadArchivesObject(), ilObjGlossaryGUI::downloadExportFile(), ilObjContentObjectGUI::downloadExportFile(), ilLMPresentationGUI::downloadExportFile(), ilGlossaryPresentationGUI::downloadExportFile(), ilObjGroup::downloadExportFile(), ilObjSurveyQuestionPoolGUI::downloadExportFileObject(), ilObjSurveyGUI::downloadExportFileObject(), ilObjUserFolderGUI::downloadExportFileObject(), ilObjTestGUI::downloadExportFileObject(), ilObjQuestionPoolGUI::downloadExportFileObject(), ilFileSystemGUI::downloadFile(), ilObjExerciseGUI::downloadFileObject(), ilExerciseMembers::downloadMultipleFiles(), ilObjContentObjectGUI::downloadPDFFile(), ilExerciseMembers::downloadSingleFile(), ilTestEvaluationGUI::evalSelectedUsers(), ilSurveyEvaluationGUI::evaluationuser(), ilObjDlBook::export(), ilSurveyEvaluationGUI::exportCumulatedResults(), ilObjQuestionPoolGUI::exportQuestionObject(), ilLMPresentationGUI::offlineexport(), ilEventAdministrationGUI::sendFile(), ilObjFile::sendFile(), and ilObjCourseGUI::sendFileObject().

        {
                $disposition = "attachment"; // "inline" to view file in browser or "attachment" to download to hard disk

                if(strlen($a_mime))
                {
                        $mime = $a_mime;
                }
                else
                {
                        $mime = "application/octet-stream"; // or whatever the mime type is
                }
                if (isset($_SERVER["HTTPS"]))
                {
                        // Added different handling for IE and HTTPS => send pragma after content informations

                        #header("Pragma: ");
                        #header("Pragma: no-cache");
                        #header("Cache-Control: ");
                        #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                        #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
                        #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
                        ##header("Cache-Control: post-check=0, pre-check=0", false);
                }
                else if ($disposition == "attachment")
                {
                        header("Cache-control: private");
                }
                else
                {
                        header("Cache-Control: no-cache, must-revalidate");
                        header("Pragma: no-cache");
                }

                $ascii_filename = ilUtil::getASCIIFilename($a_filename);

                header("Content-Type: $mime");
                header("Content-Disposition:$disposition; filename=\"".$ascii_filename."\"");
                header("Content-Description: ".$ascii_filename);
                header("Content-Length: ".(string)(filesize($a_file)));

                if($_SERVER['HTTPS'])
                {
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
                }

                header("Connection: close");
                ilUtil::readFile( $a_file );
                exit;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::dumpString ( a_str  ) 

dumps ord values of every character of string $a_str

Definition at line 2204 of file class.ilUtil.php.

        {
                $ret = $a_str.": ";
                for($i=0; $i<strlen($a_str); $i++)
                {
                        $ret.= ord(substr($a_str,$i,1))." ";
                }
                return $ret;
        }

ilUtil::escapeShellArg ( a_arg  ) 

Definition at line 2534 of file class.ilUtil.php.

References isWindows().

Referenced by convertImage(), ilFileDataExercise::downloadAllDeliveredFiles(), ilExerciseMembers::downloadMultipleFiles(), ilObjFile::getXMLZip(), html2pdf(), resizeImage(), ilContainer::saveIcons(), ilSetup::unzip(), unzip(), ilPersonalProfileGUI::uploadUserPicture(), ilObjSCORMValidator::validateXML(), and zip().

        {
                global $PHP_OS;

                if (ini_get("safe_mode") == 1 || ilUtil::isWindows())
                {
                        return $a_arg;
                }
                else
                {
                        return escapeshellarg($a_arg);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::excelTime ( year = "",
month = "",
day = "",
hour = "",
minute = "",
second = "" 
)

Definition at line 2568 of file class.ilUtil.php.

Referenced by ilObjUserFolder::createExcelExport(), and ilTestEvaluationGUI::evalSelectedUsers().

        {
                $starting_time = mktime(0, 0, 0, 1, 2, 1970);
                if (strcmp("$year$month$day$hour$minute$second", "") == 0)
                {
                        $target_time = time();
                }
                else
                {
                        if ($year < 1970)
                        {
                                return 0;
                        }
                }
                $target_time = mktime($hour, $minute, $second, $month, $day, $year);
                $difference = $target_time - $starting_time;
                $days = (($difference - ($difference % 86400)) / 86400);
                $difference = $difference - ($days * 86400) + 3600;
                return ($days + 25570 + ($difference / 86400));
        }

Here is the caller graph for this function:

ilUtil::extractParameterString ( a_parstr  ) 

extracts parameter value pairs from a string into an array

Parameters:
string $a_parstr parameter string (format: par1="value1", par2="value2", ...)
Returns:
array array of parameter value pairs

Definition at line 2139 of file class.ilUtil.php.

References $ok.

Referenced by ilPCMediaObjectGUI::saveAliasProperties(), and ilMediaItem::setParameters().

        {
                // parse parameters in array
                $par = array();
                $ok=true;
                while(($spos=strpos($a_parstr,"=")) && $ok)
                {
                        // extract parameter
                        $cpar = substr($a_parstr,0,$spos);
                        $a_parstr = substr($a_parstr,$spos,strlen($a_parstr)-$spos);
                        while(substr($cpar,0,1)=="," ||substr($cpar,0,1)==" " || substr($cpar,0,1)==chr(13) || substr($cpar,0,1)==chr(10))
                        $cpar = substr($cpar,1,strlen($cpar)-1);
                        while(substr($cpar,strlen($cpar)-1,1)==" " || substr($cpar,strlen($cpar)-1,1)==chr(13) || substr($cpar,strlen($cpar)-1,1)==chr(10))
                        $cpar = substr($cpar,0,strlen($cpar)-1);

                        // parameter name should only
                        $cpar_old = "";
                        while($cpar != $cpar_old)
                        {
                                $cpar_old = $cpar;
                                $cpar = eregi_replace("[^a-zA-Z0-9_]", "", $cpar);
                        }
                        
                        // extract value
                        if ($cpar != "")
                        {
                                if($spos=strpos($a_parstr,"\""))
                                {
                                        $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos);
                                        $spos=strpos($a_parstr,"\"");
                                        if(is_int($spos))
                                        {
                                                $cval = substr($a_parstr,0,$spos);
                                                $par[$cpar]=$cval;
                                                $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos-1);
                                        }
                                        else
                                        $ok=false;
                                }
                                else
                                $ok=false;
                        }
                }

                if($ok) return $par; else return false;
        }

Here is the caller graph for this function:

ilUtil::formCheckbox ( checked,
varname,
value,
disabled = false 
)

??? public

Parameters:
string 
string 
string 
boolean disabled checked checkboxes (default: false)
Returns:
string

Definition at line 403 of file class.ilUtil.php.

Referenced by ilRepositorySearchGUI::__fillGroupTable(), ilRepositorySearchGUI::__fillRoleTable(), ilRepositorySearchGUI::__fillUserTable(), ilSearchGUI::__formatDigiLibResult(), ilSearchGUI::__formatGroupResult(), ilSearchGUI::__formatLearningModuleResult(), ilSearchGUI::__formatUserResult(), ilLPListOfSettingsGUI::__showCollectionTable(), ilLPListOfObjectsGUI::__showEditUser(), ilSearchAdministrationGUI::__showFolders(), ilLPListOfSettingsGUI::__showSCOTable(), ilObjUserFolderGUI::__showSelectTable(), ilObjCourseGUI::__showSubscribers(), ilObjUserFolderGUI::__showTextTable(), ilObjCourseGUI::__showWaitingList(), ilObjCategoryGUI::_importCategoriesForm(), ilConditionHandlerInterface::add(), ilSearchResultPresentationGUI::addStandardRow(), ilObjUserFolderGUI::appliedUsersObject(), ilCourseObjectivesGUI::assignChapterSelect(), ilCourseObjectivesGUI::assignLMSelect(), ilCourseObjectivesGUI::assignQuestionSelect(), ilObjCategoryGUI::assignRolesObject(), ilObjChatGUI::blockedUsersObject(), ilObjiLincCourseGUI::createObject(), ilObjUserGUI::createObject(), ilObjForumGUI::createObject(), ilObjiLincCourseGUI::displayEditForm(), ilRegistrationGUI::displayForm(), ilCourseItemAdministrationGUI::edit(), ilConditionHandlerInterface::edit(), ilObjUserFolderGUI::editAppliedUsersObject(), ilRegistrationSettingsGUI::editEmailAssignments(), ilObjLinkResourceGUI::editItemObject(), ilObjLinkResourceGUI::editItemsObject(), ilObjCourseGUI::editMemberObject(), ilObjCourseGUI::editObject(), ilObjUserGUI::editObject(), ilObjForumGUI::editObject(), ilObjExerciseGUI::editObject(), ilCourseObjectivesGUI::editQuestionAssignment(), ilRegistrationSettingsGUI::editRoles(), ilFeedbackGUI::fbList(), ilObjContentObjectGUI::linkChecker(), ilObjLinkResourceGUI::linkCheckerObject(), ilCourseObjectivesGUI::listAssignedLM(), ilCourseObjectivesGUI::listAssignedQuestions(), ilConditionHandlerInterface::listConditions(), ilObjCourseGroupingGUI::listGroupings(), ilCourseObjectivesGUI::listObjectives(), ilObjUserFolderGUI::listUserDefinedFieldsObject(), ilLMStatisticsGUI::listUsersGroup(), ilObjiLincCourseGUI::listUsersGroupObject(), ilObjCourseGUI::listUsersGroupObject(), ilObjRoleGUI::listUsersGroupObject(), ilObjGroupGUI::listUsersGroupObject(), ilObjCategoryGUI::listUsersObject(), ilLMStatisticsGUI::listUsersRole(), ilObjiLincCourseGUI::listUsersRoleObject(), ilObjCourseGUI::listUsersRoleObject(), ilObjRoleGUI::listUsersRoleObject(), ilObjGroupGUI::listUsersRoleObject(), ilObjiLincCourseGUI::mailMembersObject(), ilObjCourseGUI::mailMembersObject(), ilObjGroupGUI::mailMembersObject(), ilEventAdministrationGUI::materials(), ilObjExerciseGUI::membersObject(), ilObjPaymentSettingsGUI::payMethodsObject(), ilPaymentTrusteeGUI::performSearch(), ilObjChatGUI::recordingsObject(), ilLMStatisticsGUI::search(), ilObjPaymentSettingsGUI::searchObject(), ilObjiLincCourseGUI::searchObject(), ilObjCourseGUI::searchObject(), ilObjRoleGUI::searchObject(), ilObjGroupGUI::searchObject(), ilObjCourseGroupingGUI::selectCourse(), ilObjCourseGUI::selectStarterObject(), ilObjUserFolderGUI::settingsObject(), ilSearchresultGUI::showResults(), ilSearchGUI::showSearch(), ilPaymentTrusteeGUI::showTrustees(), ilStartUpGUI::showUserAgreement(), ilObjPaymentSettingsGUI::vendorsObject(), ilRegistrationSettingsGUI::view(), ilCourseArchivesGUI::view(), and ilObjChatGUI::viewObject().

        {
                $str = "<input type=\"checkbox\" name=\"".$varname."\"";

                if ($checked == 1)
                {
                        $str .= " checked=\"checked\"";
                }

                if ($disabled)
                {
                        $str .= " disabled=\"disabled\"";
                }

                $array_var = false;

                if (substr($varname,-2) == "[]")
                {
                        $array_var = true;
                }

                // if varname ends with [], use varname[-2] + _ + value as id tag (e.g. "user_id[]" => "user_id_15")
                if ($array_var)
                {
                        $varname_id = substr($varname,0,-2)."_".$value;
                }
                else
                {
                        $varname_id = $varname;
                }

                // dirty removal of other "[]" in string
                $varname_id = ereg_replace("\[","_",$varname_id);
                $varname_id = ereg_replace("\]","",$varname_id);

                $str .= " value=\"".$value."\" id=\"".$varname_id."\" />\n";

                return $str;
        }

Here is the caller graph for this function:

ilUtil::formDisabledRadioButton ( checked,
varname,
value,
disabled 
)

???

Parameters:
string 

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

          {
            if ($disabled) {
              $str = "<input disabled type=\"radio\" name=\"".$varname."\"";
            }
            else {
              $str = "<input type=\"radio\" name=\"".$varname."\"";
            }
            if ($checked == 1)
              {
                $str .= " checked=\"checked\"";
              }

            $str .= " value=\"".$value."\"";
            $str .= " id=\"".$value."\" />\n";

            return $str;

          }

ilUtil::formRadioButton ( checked,
varname,
value 
)
ilUtil::formSelect ( selected,
varname,
options,
multiple = false,
direct_text = false,
size = "0",
style_class = "" 
)

Builds a select form field with options and shows the selected option first.

public

Parameters:
string/array value to be selected
string variable name in formular
array array with $options (key = lang_key, value = long name)
boolean multiple selection list true/false
boolean if true, the option values are displayed directly, otherwise they are handled as language variable keys and the corresponding language variable is displayed
int size

Definition at line 319 of file class.ilUtil.php.

References $key, and $lng.

Referenced by ilMDEditorGUI::__fillSubelements(), ilRepositorySearchGUI::__fillUserSearch(), ilSearchGUI::__show(), ilRegistrationGUI::__showRoleSelection(), ilObjCourseGUI::__showSubscribersTable(), ilPersonalProfileGUI::__showUserDefinedFields(), ilObjUserGUI::__showUserDefinedFields(), ilObjPaymentSettingsGUI::__showVendorsTable(), ilObjCourseGUI::__showWaitingListTable(), ilConditionHandlerInterface::add(), ilFeedbackGUI::addBarometer(), ilObjSystemFolderGUI::benchmarkObject(), ilObjAdvancedEditingGUI::categoryObject(), ilObjGroupGUI::changeMemberObject(), ilObjCourseGroupingGUI::create(), ilFeedbackGUI::edit(), ilObjCourseGroupingGUI::edit(), ilConditionHandlerInterface::edit(), ilObjStyleSettingsGUI::editContentStylesObject(), ilObjLinkResourceGUI::editItemObject(), ilPaymentStatisticGUI::editStatistic(), ilObjPaymentSettingsGUI::editStatisticObject(), ilLPFilterGUI::getHTML(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilObjCourseGUI::membersObject(), ilObjExerciseGUI::membersObject(), ilCourseArchivesGUI::selectArchiveLanguage(), ilObjSearchSettingsGUI::settingsObject(), ilLPListOfSettingsGUI::show(), ilObjLinkResourceGUI::showAddItemObject(), ilInfoScreenGUI::showLearningProgress(), ilInternalLinkGUI::showLinkHelp(), ilPageObjectGUI::showPage(), ilBookmarkAdministrationGUI::showPossibleSubObjects(), and ilRegistrationGUI::showUserDefinedFields().

        {
                global $lng;

                if ($multiple == true)
                {
                        $multiple = " multiple=\"multiple\"";
                }
                else
                {
                        $multiple = "";
                        $size = 0;
                }
                
                if ($style_class != "")
                {
                        $class = " class=\"".$style_class."\"";
                }
                else
                {
                        $class = "";
                }

                $str = "<select name=\"".$varname ."\"".$multiple." $class size=\"".$size."\">\n";

                foreach ($options as $key => $val)
                {
                        if ($direct_text)
                        {
                                $str .= " <option value=\"".$key."\"";
                        }
                        else
                        {
                                $str .= " <option value=\"".$val."\"";
                        }
                        if (is_array($selected) )
                        {
                                if (in_array($key,$selected))
                                {
                                        $str .= " selected=\"selected\"";
                                }
                        }
                        else if ($selected == $key)
                        {
                                $str .= " selected=\"selected\"";
                        }

                        if ($direct_text)
                        {
                                $str .= ">".$val."</option>\n";
                        }
                        else
                        {
                                $str .= ">".$lng->txt($val)."</option>\n";
                        }
                }

                $str .= "</select>\n";

                return $str;
        }

Here is the caller graph for this function:

ilUtil::generatePasswords ( a_number  ) 

Definition at line 2691 of file class.ilUtil.php.

Referenced by ShibAuth::generateLogin(), ilSOAPAuth::login(), ShibAuth::login(), ilRegistrationGUI::saveForm(), and ilPersonalProfileGUI::showProfile().

    {
        $ret = array();
        srand((double) microtime()*1000000);

        for ($i=1; $i<=$a_number; $i++)
        {
            $length  = rand(6,10);
            $next  = rand(1,2);
            //$chars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            $vowels = "aeiou";
            $consonants = "bcdfghjklmnpqrstvwxyz";
            $pw = "";

            for ($j=0; $j < $length; $j++)
            {
                switch ($next)
                {
                    case 1:
                                        $pw.= $consonants[rand(0,strlen($consonants)-1)];
                                        $next = 2;
                    break;

                    case 2:
                                        $pw.= $vowels[rand(0,strlen($vowels)-1)];
                                        $next = 1;
                                break;
                }
             }

             $ret[] = $pw;
         }

         return $ret;
    }

Here is the caller graph for this function:

ilUtil::getASCIIFilename ( a_filename  ) 

convert utf8 to ascii filename

Parameters:
string $a_filename utf8 filename

Implementation note: /// The proper way to convert charsets is mb_convert_encoding. /// Unfortunately Multibyte String functions are not an /// installation requirement for ILIAS 3. /// Codelines behind three slashes '///' show how we would do /// it using mb_convert_encoding. /// Note that mb_convert_encoding has the bad habit of /// substituting unconvertable characters with HTML /// entitities. Thats why we need a regular expression which /// replaces HTML entities with their first character. /// e.g. ä => a

$ascii_filename = mb_convert_encoding($a_filename, 'ISO_8859-1','UTF-8'); ///$ascii_filename = preg_replace('/&(.)[^;]*;/","\1', $ascii_filename);

$ascii_filename = mb_convert_encoding($a_filename,'US-ASCII','UTF-8'); ///$ascii_filename = preg_replace('/&(.)[^;]*;/','\1', $ascii_filename);

Definition at line 1656 of file class.ilUtil.php.

Referenced by deliverData(), deliverFile(), ilTestEvaluationGUI::evalSelectedUsers(), ilSurveyEvaluationGUI::evaluationuser(), and ilSurveyEvaluationGUI::exportCumulatedResults().

        {
                // The filename must be converted to ASCII, as of RFC 2183,
                // section 2.3.
                // Despite the RFC, Internet Explorer on Windows supports
                // ISO 8895-1 encoding for the file name. We use this fact, to
                // produce a better result, if the user uses IE.


                $user_agent = strtolower($_SERVER["HTTP_USER_AGENT"]);
                if ((is_integer(strpos($user_agent, "msie"))) && is_integer(strpos($user_agent, "win")))
                {

                        $ascii_filename = utf8_decode($a_filename);
                }
                else
                {

                        $ascii_filename = htmlentities($a_filename,ENT_NOQUOTES,'UTF-8');
                        $ascii_filename = preg_replace('/\&(.)[^;]*;/','\\1', $ascii_filename);
                        $ascii_filename = preg_replace('/[\x7f-\xff]/','_', $ascii_filename);
                }

                // Windows does not allow the following characters in filenames:
                // \/:*?"<>|
                if (is_integer(strpos($user_agent, "win")))
                {
                        $ascii_filename = preg_replace('/[:\x5c\/\*\?\"<>\|]/','_', $ascii_filename);
                }

                return $ascii_filename;
        }

Here is the caller graph for this function:

ilUtil::getAssociatedUsersOnline ( a_user_id  ) 

reads all active sessions from db and returns users that are online and who have a local role in a group or a course for which the the current user has also a local role.

Parameters:
integer user_id User ID of the current user.
Returns:
array

Definition at line 1225 of file class.ilUtil.php.

References $ilias, $q, $row, $user, and $users.

Referenced by ilPersonalDesktopGUI::displayUsersOnline().

        {
                global $ilias;

                // The difference between active time and session time
                $time_diff = 0;

                // Get a list of object id's of all courses and groups for which
                // the current user has local roles.
                // Note: we have to use DISTINCT here, because a user may assume
                // multiple roles in a group or a course.
                $q = "SELECT DISTINCT dat.obj_id as obj_id ".
                "FROM rbac_ua AS ua ".
                "JOIN rbac_fa AS fa ON fa.rol_id = ua.rol_id ".
                "JOIN object_reference AS r1 ON r1.ref_id = fa.parent ".
                "JOIN tree ON tree.child = r1.ref_id ".
                "JOIN object_reference AS r2 ON r2.ref_id = tree.parent ".
                "JOIN object_data AS dat ON dat.obj_id = r2.obj_id ".
                "WHERE ua.usr_id = ".$a_user_id." ".
                "AND fa.assign = 'y' ".
                "AND dat.type IN ('grp','crs')";
                $r = $ilias->db->query($q);
                while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $groups_and_courses_of_user[] = $row["obj_id"];
                }

                // If the user is not in a course or a group, he has no associated users.
                if (count($groups_and_courses_of_user) == 0)
                {
                        $q = "SELECT count(user_id) as num,user_id,data,firstname,lastname,title,login,last_login ".
                        "FROM usr_session ".
                        "JOIN usr_data ON user_id=usr_id ".
                        "WHERE user_id = ".$a_user_id." ".
                        "AND expires > UNIX_TIMESTAMP() - ".$time_diff." ".
                        "GROUP BY user_id";
                }
                else
                {
                        $q = "SELECT count(user_id) as num,s.user_id,s.data,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login ".
                        "FROM usr_session AS s ".
                        "JOIN usr_data AS ud ON ud.usr_id = s.user_id ".
                        "JOIN rbac_ua AS ua ON ua.usr_id = s.user_id ".
                        "JOIN rbac_fa AS fa ON fa.rol_id = ua.rol_id ".
                        "JOIN tree ON tree.child = fa.parent ".
                        "JOIN object_reference AS or1 ON or1.ref_id = tree.parent ".
                        "JOIN object_data AS od ON od.obj_id = or1.obj_id ".
                        "WHERE s.user_id != 0 ".
                        "AND s.expires > UNIX_TIMESTAMP() - ".$time_diff." ".
                        "AND fa.assign = 'y' ".
                        "AND od.obj_id IN (".implode(",",$groups_and_courses_of_user).") ".
                        "GROUP BY s.user_id ".
                        "ORDER BY ud.lastname, ud.firstname";
                }
                $r = $ilias->db->query($q);

                while ($user = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $users[$user["user_id"]] = $user;
                }

                return $users ? $users : array();
        }

Here is the caller graph for this function:

ilUtil::getConvertCmd (  ) 

get convert command

Definition at line 1435 of file class.ilUtil.php.

Referenced by ilObjUser::_uploadPersonalPicture(), convertImage(), ilImagemapPreview::createPreview(), resizeImage(), ilContainer::saveIcons(), and ilPersonalProfileGUI::uploadUserPicture().

        {
                return PATH_TO_CONVERT;
                //global $ilias;

                //return $ilias->getSetting("convert_path");
        }

Here is the caller graph for this function:

ilUtil::getDataDir (  ) 

get data directory (outside webspace)

Definition at line 1174 of file class.ilUtil.php.

Referenced by ilEventFile::__getDirectory(), ilCourseFile::__getDirectory(), ilLuceneIndexer::__indexFiles(), ilChatServerConfig::__writeConfigFile(), ilObjTest::_createImportDirectory(), ilObjQuestionPool::_createImportDirectory(), ilCourseFile::_deleteByCourse(), ilEventFile::_deleteByEvent(), ilObjCategoryGUI::_getImportDir(), ilObjTest::_getImportDirectory(), ilObjQuestionPool::_getImportDirectory(), ilObjFileAccess::_lookupFileSize(), ilObjFileAccess::_lookupSuffix(), ilContObjParser::copyFileItems(), ilObjSurveyQuestionPool::createExportDirectory(), ilObjSurvey::createExportDirectory(), ilObjGlossary::createExportDirectory(), ilObjContentObject::createExportDirectory(), ilObjUserFolder::createExportDirectory(), ilObjTest::createExportDirectory(), ilObjQuestionPool::createExportDirectory(), ilObjSurveyQuestionPool::createImportDirectory(), ilObjSurvey::createImportDirectory(), ilObjGlossary::createImportDirectory(), ilObjContentObject::createImportDirectory(), ilObjTest::createImportDirectory(), ilMediaItem::createWorkDirectory(), ilObjSurveyQuestionPool::deleteAllData(), ilObjQuestionPool::deleteQuestionpool(), ilObjSurvey::deleteSurveyRecord(), ilObjTest::deleteTest(), ilObjContentObject::getDataDirectory(), ilObjFile::getDirectory(), ilObjSurveyQuestionPool::getExportDirectory(), ilObjSurvey::getExportDirectory(), ilObjGlossary::getExportDirectory(), ilObjContentObject::getExportDirectory(), ilObjUserFolder::getExportDirectory(), ilObjTest::getExportDirectory(), ilObjQuestionPool::getExportDirectory(), ilObjUserFolderGUI::getImportDir(), ilObjSurveyQuestionPool::getImportDirectory(), ilObjSurvey::getImportDirectory(), ilObjGlossary::getImportDirectory(), ilObjContentObject::getImportDirectory(), ilObjTest::getImportDirectory(), ilObjQuestionPool::getImportDirectory(), ilMediaItem::getWorkDirectory(), and ilTempnam().

        {
                return CLIENT_DATA_DIR;
                //global $ilias;

                //return $ilias->ini->readVariable("server", "data_dir");
        }

Here is the caller graph for this function:

ilUtil::getDir ( a_dir  ) 

get directory

Definition at line 1885 of file class.ilUtil.php.

References $files.

Referenced by ilObjMediaObjectGUI::editFilesObject(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), and ilFileSystemGUI::listFiles().

        {
                $current_dir = opendir($a_dir);

                $dirs = array();
                $files = array();
                while($entry = readdir($current_dir))
                {
                        if(is_dir($a_dir."/".$entry))
                        {
                                $dirs[$entry] = array("type" => "dir", "entry" => $entry);
                        }
                        else
                        {
                                $size = filesize($a_dir."/".$entry);
                                $files[$entry] = array("type" => "file", "entry" => $entry,
                                "size" => $size);
                        }
                }
                ksort($dirs);
                ksort($files);

                return array_merge($dirs, $files);
        }

Here is the caller graph for this function:

ilUtil::getFileSizeInfo (  ) 

Definition at line 3192 of file class.ilUtil.php.

References $lng.

Referenced by ilEventAdministrationGUI::addEvent(), ilEventAdministrationGUI::edit(), and ilObjCourseGUI::editInfoObject().

        {
                global $lng;

                // get the value for the maximal uploadable filesize from the php.ini (if available)
                $umf=get_cfg_var("upload_max_filesize");
                // get the value for the maximal post data from the php.ini (if available)
                $pms=get_cfg_var("post_max_size");

                // use the smaller one as limit
                $max_filesize=min($umf, $pms);
                if (!$max_filesize) $max_filesize=max($umf, $pms);

                return $lng->txt("file_notice")." $max_filesize.";
         }

Here is the caller graph for this function:

ilUtil::getGDSupportedImageType ( a_desired_type  ) 

returns the best supported image type by this PHP build

Parameters:
string $desired_type desired image type ("jpg" | "gif" | "png")
Returns:
string supported image type ("jpg" | "gif" | "png" | "")

Definition at line 2361 of file class.ilUtil.php.

Referenced by ilMediaItem::getMapWorkCopyType().

        {
                $a_desired_type = strtolower($a_desired_type);
                // get supported Image Types
                $im_types = ImageTypes();

                switch($a_desired_type)
                {
                        case "jpg":
                        if ($im_types & IMG_JPG) return "jpg";
                        if ($im_types & IMG_GIF) return "gif";
                        if ($im_types & IMG_PNG) return "png";
                        break;

                        case "gif":
                        if ($im_types & IMG_GIF) return "gif";
                        if ($im_types & IMG_JPG) return "jpg";
                        if ($im_types & IMG_PNG) return "png";
                        break;

                        case "png":
                        if ($im_types & IMG_PNG) return "png";
                        if ($im_types & IMG_JPG) return "jpg";
                        if ($im_types & IMG_GIF) return "gif";
                        break;
                }

                return "";
        }

Here is the caller graph for this function:

ilUtil::getGroupId ( a_parent_ref  ) 

get the tree_id of a group where an object with the passed ref_id belongs to.

DEPRECATED

Parameters:
string ref_id of an object that is in a group public
Returns:
integer the ref_id of the group or boolean false if no group was found

Definition at line 1918 of file class.ilUtil.php.

References $ilias, $q, and $row.

        {
                return false;

                global $ilias;

                $q = "SELECT DISTINCT tree FROM grp_tree WHERE child='".$a_parent_ref."'";
                $r = $ilias->db->query($q);
                $row = $r->fetchRow();

                return $row[0] ? $row[0] : false;
        }

ilUtil::getHtmlPath ( relative_path  ) 

get url of path

Author:
Brandon Blackmoor <brandon.blackmoor@jfcom.mil> public
Parameters:
$relative_path string complete path to file, relative to web root (e.g. /data/pfplms103/mobs/mm_732/athena_standing.jpg)

Definition at line 144 of file class.ilUtil.php.

    {
        if (substr($relative_path, 0, 2) == './')
        {
            $relative_path = (substr($relative_path, 1));
        }
        if (substr($relative_path, 0, 1) != '/')
        {
            $relative_path = '/' . $relative_path;
        }
        $htmlpath = ILIAS_HTTP_PATH . $relative_path;
        return $htmlpath;
    }

ilUtil::getImagePath ( img,
in_module = false,
mode = "output",
offline = false 
)

get image path (for images located in a template directory)

public

Parameters:
string full image filename (e.g. myimage.gif)
boolean should be set to true, if the image is within a module template directory (e.g. content/templates/default/images/test.gif)

Definition at line 68 of file class.ilUtil.php.

References $_GET, $dir, $ilCtrl, $ilias, and $img.

Referenced by ilSearchGUI::__addAction(), ilLearningProgressBaseGUI::__buildHeader(), ilCourseContentGUI::__editAdvancedUserTimings(), ilCourseContentGUI::__editUserTimings(), ilSearchresultGUI::__formatTitle(), ilSearchAdministrationGUI::__formatTitle(), ilLearningProgressBaseGUI::__getLegendHTML(), ilCourseContentGUI::__getOptions(), ilLPListOfObjectsGUI::__listObjects(), ilObjExerciseGUIAdapter::__prepareOutput(), ilLPListOfProgressGUI::__renderContainerRow(), ilLPListOfObjectsGUI::__renderContainerRow(), ilCourseContentGUI::__renderEvent(), ilCourseContentGUI::__renderItem(), ilCourseContentGUI::__renderUserItem(), ilObjLinkResourceGUI::__setHeader(), ilObjRoleGUI::__setHeader(), ilObjChatGUI::__setHeader(), ilObjChatGUI::__showActiveUsers(), ilObjUserFolderGUI::__showAppliedUsersTable(), ilObjRoleGUI::__showAssignedUsersTable(), ilObjectGUI::__showClipboardTable(), ilLPListOfSettingsGUI::__showCollectionTable(), ilLPListOfProgressGUI::__showContainerList(), ilObjCourseGUI::__showDeleteMembersTable(), ilObjCourseGUI::__showDeleteSubscriberTable(), ilObjCourseGUI::__showEditMemberTable(), ilCourseContentGUI::__showEvents(), ilSearchAdministrationGUI::__showFolders(), ilSearchAdministrationGUI::__showHeader(), ilCourseObjectivePresentationGUI::__showHideLinks(), ilCourseContentInterface::__showHideLinks(), ilLearningProgressBaseGUI::__showImageByStatus(), ilPaymentShoppingCartGUI::__showItemsTable(), ilCourseContentGUI::__showMaterial(), ilCourseContentGUI::__showMaterials(), ilObjiLincCourseGUI::__showMembersTable(), ilObjGroupGUI::__showMembersTable(), ilCourseObjectivePresentationGUI::__showObjectives(), ilCourseContentInterface::__showObjectives(), ilObjectStatusGUI::__showObjectSummaryTable(), ilObjChatGUI::__showOnlineUsers(), ilCourseObjectivePresentationGUI::__showOtherResources(), ilCourseContentInterface::__showOtherResources(), ilLPListOfProgressGUI::__showProgressList(), ilObjCourseGUI::__showRemoveFromWaitingListTable(), ilObjUserGUI::__showRolesTable(), ilObjRoleFolderGUI::__showRolesTable(), ilObjCategoryGUI::__showRolesTable(), ilLPListOfSettingsGUI::__showSCOTable(), ilRepositorySearchGUI::__showSearch(), ilLMStatisticsGUI::__showSearchGroupTable(), ilRepositorySearchGUI::__showSearchGroupTable(), ilObjiLincCourseGUI::__showSearchGroupTable(), ilObjCourseGUI::__showSearchGroupTable(), ilObjRoleGUI::__showSearchGroupTable(), ilObjGroupGUI::__showSearchGroupTable(), ilAdvancedSearchGUI::__showSearchInResults(), ilSearchGUI::__showSearchInResults(), ilLMStatisticsGUI::__showSearchRoleTable(), ilRepositorySearchGUI::__showSearchRoleTable(), ilObjiLincCourseGUI::__showSearchRoleTable(), ilObjCourseGUI::__showSearchRoleTable(), ilObjRoleGUI::__showSearchRoleTable(), ilObjGroupGUI::__showSearchRoleTable(), ilObjPaymentSettingsGUI::__showSearchUserSPTable(), ilLMStatisticsGUI::__showSearchUserTable(), ilRepositorySearchGUI::__showSearchUserTable(), ilPaymentTrusteeGUI::__showSearchUserTable(), ilPaymentStatisticGUI::__showSearchUserTable(), ilObjPaymentSettingsGUI::__showSearchUserTable(), ilObjiLincCourseGUI::__showSearchUserTable(), ilObjCourseGUI::__showSearchUserTable(), ilObjRoleGUI::__showSearchUserTable(), ilObjGroupGUI::__showSearchUserTable(), ilObjCourseGUI::__showSubscribersTable(), ilPaymentTrusteeGUI::__showTrusteesTable(), ilLPListOfObjectsGUI::__showUsersList(), ilObjCategoryGUI::__showUsersTable(), ilObjPaymentSettingsGUI::__showVendorsTable(), ilObjCourseGUI::__showWaitingListTable(), ilObjUser::_getPersonalPicturePath(), ilConditionHandlerInterface::add(), ilFeedbackGUI::addBarometer(), ilPaymentStatisticGUI::addCustomer(), ilObjPaymentSettingsGUI::addCustomerObject(), ilGlossaryTermGUI::addDefinition(), ilSearchResultPresentationGUI::addHeaderRow(), ilPersonalDesktopGUI::addHeaderRow(), ilContainerGUI::addHeaderRow(), ilPersonalDesktopGUI::addParentRow(), ilPaymentObjectGUI::addPrice(), ilPersonalDesktopGUI::addStandardRow(), ilContainerGUI::addStandardRow(), ilObjRoleGUI::askDeleteDesktopItemObject(), ilObjLinkResourceGUI::askDeleteItemsObject(), ilCourseObjectivesGUI::askDeleteLM(), ilCourseObjectivesGUI::askDeleteObjective(), ilObjChatGUI::askDeleteRecordingsObject(), ilCourseObjectivesGUI::assignChapterSelect(), ilCourseObjectivesGUI::assignLMSelect(), ilCourseObjectivesGUI::assignQuestionSelect(), ilCourseObjectivesGUI::assignTestSelect(), ilObjChatGUI::blockedUsersObject(), ilObjSurveyGUI::browseForQuestionsObject(), ilPaymentBaseGUI::buildHeader(), SurveyOrdinalQuestionGUI::categories(), SurveyNominalQuestionGUI::categories(), ilCourseContentInterface::cci_start_objects(), ilCourseContentInterface::cci_view(), ilObjiLincCourseGUI::changeMemberObject(), ilObjGroupGUI::changeMemberObject(), ilObjContentObjectGUI::chapters(), ilObjiLincCourseGUI::confirmationObject(), ilObjGroupGUI::confirmationObject(), ilGlossaryTermGUI::confirmDefinitionDeletion(), ilObjGlossaryGUI::confirmDeleteExportFile(), ilObjContentObjectGUI::confirmDeleteExportFile(), ilObjSurveyQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjSurveyGUI::confirmDeleteExportFileObject(), ilObjUserFolderGUI::confirmDeleteExportFileObject(), ilObjTestGUI::confirmDeleteExportFileObject(), ilObjQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjMediaPoolGUI::confirmRemove(), ilObjGlossaryGUI::confirmTermDeletion(), ilObjSurveyGUI::constraintsObject(), ilGlossaryTermGUI::create(), ilObjSurveyQuestionPoolGUI::createObject(), ilObjSurveyGUI::createObject(), ilObjCourseGUI::createObject(), ilObjGlossaryGUI::createObject(), ilObjFileBasedLMGUI::createObject(), ilObjContentObjectGUI::createObject(), ilObjGroupGUI::createObject(), ilObjForumGUI::createObject(), ilObjFileGUI::createObject(), ilObjectGUI::createObject(), ilObjCategoryGUI::createObject(), ilObjTestGUI::createObject(), ilObjQuestionPoolGUI::createObject(), ilObjContentObjectGUI::delete(), ilBookmarkAdministrationGUI::delete(), ilObjStyleSheetGUI::deleteObject(), ilObjectGUI::deleteObject(), ilObjTestGUI::deleteSingleUserResultsObject(), ilObjStyleSheetFolderGUI::deleteStyleObject(), ilObjStyleSettingsGUI::deleteStyleObject(), ilObjExerciseGUI::deliverObject(), ilRegistrationGUI::displayForm(), ilPDNotesGUI::displayHeader(), ilBookmarkAdministrationGUI::displayHeader(), ilFeedbackGUI::edit(), ilCourseItemAdministrationGUI::edit(), ilPCTableGUI::edit(), ilConditionHandlerInterface::edit(), ilObjUserFolderGUI::editAppliedUsersObject(), ilPaymentObjectGUI::editDetails(), ilRegistrationSettingsGUI::editEmailAssignments(), ilObjMediaObjectGUI::editFilesObject(), ilObjLinkResourceGUI::editItemObject(), ilObjLinkResourceGUI::editItemsObject(), ilObjMediaObjectGUI::editMapAreasObject(), ilEventAdministrationGUI::editMembers(), ilObjTypeDefinitionGUI::editObject(), ilObjForumGUI::editObject(), ilPaymentObjectGUI::editPrices(), assTextSubsetGUI::editQuestion(), assSingleChoiceGUI::editQuestion(), assMultipleChoiceGUI::editQuestion(), assMatchingQuestionGUI::editQuestion(), assImagemapQuestionGUI::editQuestion(), ilCourseObjectivesGUI::editQuestionAssignment(), ilRegistrationSettingsGUI::editRoles(), ilPaymentStatisticGUI::editStatistic(), ilObjPaymentSettingsGUI::editStatisticObject(), ilGlossaryTermGUI::editTerm(), ilCourseContentGUI::editTimings(), ilEventAdministrationGUI::editUser(), ilObjPaymentSettingsGUI::editVendor(), ilPageEditorGUI::executeCommand(), ilTermDefinitionEditorGUI::executeCommand(), ilPersonalDesktopGUI::executeCommand(), exercise(), ilObjMediaPoolGUI::explorer(), ilObjContentObjectGUI::explorer(), ilObjGlossary::exportHTML(), ilObjContentObject::exportHTML(), ilObjGlossaryGUI::exportList(), ilObjContentObjectGUI::exportList(), ilObjSurveyQuestionPoolGUI::exportObject(), ilObjSurveyGUI::exportObject(), ilObjUserFolderGUI::exportObject(), ilObjTestGUI::exportObject(), ilObjQuestionPoolGUI::exportObject(), ilFeedbackGUI::fbList(), ilSCORMPresentationGUI::finishSahs(), ilSAHSPresentationGUI::finishSahs(), ilMediaPoolExplorer::formatHeader(), ilLMExplorer::formatHeader(), ilLMEditorExplorer::formatHeader(), ilIntLinkRepItemExplorer::formatHeader(), ilStyleScopeExplorer::formatHeader(), ilRepositoryExplorer::formatHeader(), ilForumExplorer::formatHeader(), ilAdministrationExplorer::formatHeader(), ilSCORMExplorer::formatObject(), ilHACPExplorer::formatObject(), ilPublicSectionSelector::formatObject(), ilAICCExplorer::formatObject(), ilForumExplorer::formatObject(), ilFileExplorer::formatObject(), ilObjPaymentSettingsGUI::generalSettingsObject(), ilHistoryGUI::getHistoryTable(), ilLPFilterGUI::getHTML(), ilLMTOCExplorer::getImage(), ilTableOfContentsExplorer::getImage(), ilExplorer::getImage(), ilNoteGUI::getNoteListHTML(), ilSCORMExplorer::getOutputIcons(), ilBookmarkAdministrationGUI::getPDBookmarkListHTMLFlat(), ilNoteGUI::getPDOverviewNoteListHTML(), ilObjUserGUI::getPublicProfile(), ilObjSurvey::getQuestionblocksTable(), ilObjSurveyQuestionPool::getQuestionsTable(), ilObjSurvey::getQuestionsTable(), ilObjQuestionPool::getQuestionsTable(), assTextSubsetGUI::getSolutionOutput(), assTextQuestionGUI::getSolutionOutput(), assSingleChoiceGUI::getSolutionOutput(), assOrderingQuestionGUI::getSolutionOutput(), assNumericGUI::getSolutionOutput(), assMultipleChoiceGUI::getSolutionOutput(), assMatchingQuestionGUI::getSolutionOutput(), assJavaAppletGUI::getSolutionOutput(), assImagemapQuestionGUI::getSolutionOutput(), assClozeTestGUI::getSolutionOutput(), ilObjGlossaryGUI::getTemplate(), assOrderingQuestionGUI::getTestOutput(), assMatchingQuestionGUI::getTestOutput(), ilLMPresentationGUI::ilLMNavigation(), ilLMPresentationGUI::ilMedia(), ilLMPresentationGUI::ilTOC(), ilObjSAHSLearningModuleGUI::importObject(), ilObjectListGUI::insertPayment(), ilSCORMPresentationGUI::launchSahs(), ilHACPPresentationGUI::launchSahs(), ilSAHSPresentationGUI::launchSahs(), ilAICCPresentationGUI::launchSahs(), ilObjContentObjectGUI::linkChecker(), ilObjLinkResourceGUI::linkCheckerObject(), ilCourseObjectivesGUI::listAssignedLM(), ilCourseObjectivesGUI::listAssignedQuestions(), ilConditionHandlerInterface::listConditions(), ilGlossaryTermGUI::listDefinitions(), ilGlossaryPresentationGUI::listDefinitions(), ilObjRoleGUI::listDesktopItemsObject(), ilObjGroupGUI::listExportFilesObject(), ilFileSystemGUI::listFiles(), ilObjCourseGroupingGUI::listGroupings(), ilObjMediaPoolGUI::listMedia(), ilCourseObjectivesGUI::listObjectives(), ilObjCourseGUI::listStructureObject(), ilRegistrationGUI::login(), ilObjAssessmentFolderGUI::logsObject(), ilObjiLincCourseGUI::mailMembersObject(), ilObjCourseGUI::mailMembersObject(), ilObjGroupGUI::mailMembersObject(), ilObjSurveyGUI::maintenanceObject(), ilObjTestGUI::maintenanceObject(), ilObjTestGUI::marksObject(), ilEventAdministrationGUI::materials(), ilGlossaryPresentationGUI::media(), ilObjCourseGUI::membersObject(), ilObjExerciseGUI::membersObject(), ilObjUserFolderGUI::newAccountMailObject(), ilTestEvaluationGUI::outEvalSearchResultTable(), ilSAHSPresentationGUI::outputInfoScreen(), ilLMPresentationGUI::outputInfoScreen(), ilTestOutputGUI::outQuestionSummary(), ilTestOutputGUI::outShowAnswersDetails(), ilObjTestGUI::outShowAnswersDetails(), ilSurveyExecutionGUI::outSurveyPage(), ilTestOutputGUI::outTestResults(), ilTestOutputGUI::outTestSummary(), ilObjSurveyGUI::outUserGroupTable(), ilObjTestGUI::outUserGroupTable(), ilTestOutputGUI::outWorkingForm(), ilPermissionGUI::owner(), ilObjContentObjectGUI::pages(), ilTestEvaluationGUI::passDetails(), ilObjPaymentSettingsGUI::payMethodsObject(), ilObjPaymentSettingsGUI::paypalSettingsObject(), ilPermissionGUI::perm(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjSurveyQuestionPoolGUI::phrasesObject(), ilSearchresultGUI::prepareOutput(), ilAdvancedSearchGUI::prepareOutput(), ilGlossaryPresentationGUI::prepareOutput(), ilSearchGUI::prepareOutput(), ilObjCourseGUI::printMembersObject(), ilObjContentObjectGUI::properties(), ilObjSurveyGUI::propertiesObject(), ilObjTestGUI::propertiesObject(), ilObjTestGUI::questionBrowser(), ilObjSurveyQuestionPoolGUI::questionsObject(), ilObjSurveyGUI::questionsObject(), ilObjTestGUI::questionsObject(), ilObjQuestionPoolGUI::questionsObject(), ilObjGlossaryGUI::quickList(), ilObjChatGUI::recordingsObject(), ilObjiLincClassroomGUI::removeClassroom(), ilTableGUI::render(), ilLPSAHSItemListGUI::renderTypeImage(), ilLPObjectiveItemListGUI::renderTypeImage(), ilLPItemListGUI::renderTypeImage(), ilLPEventListGUI::renderTypeImage(), ilObjSurveyGUI::searchQuestionsObject(), ilObjCourseGroupingGUI::selectCourse(), ilObjCourseGUI::selectStarterObject(), ilObjMediaObjectGUI::setAdminTabs(), ilObjectGUIAdapter::setAdminTabs(), ilStructureObjectGUI::setTabs(), ilObjSAHSLearningModuleGUI::setTabs(), ilObjFileBasedLMGUI::setTabs(), ilObjContentObjectGUI::setTabs(), ilLMPageObjectGUI::setTabs(), ilEditClipboardGUI::setTabs(), ilMainMenuGUI::setTemplateVars(), ilObjUserTrackingGUI::settingsObject(), ilObjRootFolderGUI::setTitleAndDescription(), ilObjectGUI::setTitleAndDescription(), ilContainerGUI::setTitleAndDescription(), ilObjQuestionPoolGUI::setTitleAndDescription(), ilTemplate::setTreeFlatIcon(), ilTemplate::setUpperIcon(), ilLPListOfSettingsGUI::show(), ilPersonalDesktopGUI::show(), ilObjContentObjectGUI::showActions(), ilLMObjectGUI::showActions(), ilObjUserFolderGUI::showActions(), ilObjStyleSheetFolderGUI::showActions(), ilObjStyleSettingsGUI::showActions(), ilObjectGUI::showActions(), ilContainerGUI::showAdministrationPanel(), ilPasswordAssistanceGUI::showAssignPasswordForm(), ilPasswordAssistanceGUI::showAssistanceForm(), ilFeedbackGUI::showBarometerById(), ilPaymentBillAdminGUI::showBillData(), ilPurchaseBMFGUI::showCreditCard(), ilPurchaseBMFGUI::showDebitEntry(), ilPaymentPurchaseGUI::showDetails(), ilLMPresentationGUI::showDownloadList(), ilGlossaryPresentationGUI::showDownloadList(), ilInfoScreenGUI::showLearningProgress(), ilInternalLinkGUI::showLinkHelp(), ilStartUpGUI::showLogin(), ilObjMediaPoolGUI::showMedia(), ilPasswordAssistanceGUI::showMessageForm(), ilObjGroupGUI::showNewRegistrationsObject(), ilPageObjectGUI::showPage(), ilPurchaseBMFGUI::showPaymentType(), ilPurchaseBMFGUI::showPersonalData(), ilLMPresentationGUI::showPrintView(), ilLMPresentationGUI::showPrintViewSelection(), ilPersonalProfileGUI::showProfile(), ilCourseRegisterGUI::showRegistrationForm(), ilRegisterGUI::showRegistrationForm(), ilSearchresultGUI::showResults(), ilPaymentObjectGUI::showSelectedObject(), ilCourseContentGUI::showStartObjects(), ilLMPresentationGUI::showTableOfContents(), ilRepositoryGUI::showTree(), ilAdministrationGUI::showTree(), ilPasswordAssistanceGUI::showUsernameAssistanceForm(), ilPersonalDesktopGUI::showUserProfile(), ilCourseContentGUI::showUserTimings(), ilStructureObjectGUI::subchap(), ilObjectGUI::trashObject(), ilObjQuestionPoolGUI::uploadQplObject(), ilObjTestGUI::uploadTstObject(), ilCourseArchivesGUI::view(), ilStructureObjectGUI::view(), ilEditClipboardGUI::view(), ilBookmarkAdministrationGUI::view(), ilObjExerciseGUI::viewObject(), and ilObjChatGUI::viewObject().

        {
                global $ilias, $styleDefinition, $ilCtrl;

                if(defined("ILIAS_MODULE") and $mode != "filesystem")
                {
                        // added to find path for MODULES like Services/Search
                        $base = '';
                        for($i = 1;$i < count(explode('/',ILIAS_MODULE));$i++)
                        {
                                $base .= "../";
                        }

                        $dir .= ($base.".");
                        // hschottm: added because module images are not working
                        // using ilias.php
//                      if (strlen($base) == 0) $dir = "";
                }
                else
                {
                        $dir = "";
                }
                $base = "./";
                if ($in_module)
                {
                        // if baseClass functionality is used (ilias.php):
                        // get template directory from ilCtrl
                        if (!empty($_GET["baseClass"]))
                        {
                                $base.= $ilCtrl->getModuleDir()."/";
                        }
                        else
                        {
                                if(defined("ILIAS_MODULE"))
                                {
                                        $base.= ILIAS_MODULE."/";
                                }
                        }
                }
                $base .= "templates/";
                if (is_object($styleDefinition))
                {

                        $st_image_dir = $styleDefinition->getImageDirectory($ilias->account->prefs["style"]);
                        #var_dump("<pre>",$st_image_dir,$ilias->account->prefs["style"],"<pre>");

                        $user_skin_and_style = $base.$ilias->account->skin."/".
                        $st_image_dir.
                        "/images/".$img;
                }
                $user_skin = $base.$ilias->account->skin."/images/".$img;
                $default = $base."default/images/".$img;
                if ($offline)
                {
                        return "./images/".$img;
                }
                else if (@file_exists($user_skin_and_style) && $st_image_dir != "")
                {
                        return $dir.$user_skin_and_style;
                }
                else if (file_exists($user_skin))
                {
                        return $dir.$user_skin;
                }

                return $dir.$default;
        }

Here is the caller graph for this function:

ilUtil::getImageTagByType ( a_type,
a_path,
a_big = false 
)

Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Code to your template file public.

Parameters:
string object type
string tpl path

Definition at line 46 of file class.ilUtil.php.

References $lng.

Referenced by ilObjiLincCourseGUI::confirmationObject(), ilObjGroupGUI::confirmationObject(), ilBookmarkAdministrationGUI::delete(), ilObjUserFolderGUI::deleteObject(), ilObjRoleFolderGUI::deleteObject(), ilObjectGUI::deleteObject(), ilObjTypeDefinitionGUI::displayList(), ilObjSystemFolderGUI::displayList(), ilObjectGUI::displayList(), ilObjTypeDefinitionGUI::editObject(), ilObjiLincClassroomGUI::removeClassroom(), and ilObjectGUI::trashObject().

        {
                global $lng;

                if ($a_big)
                {
                        $big = "_b";
                }
                $filename = "icon_".$a_type."$big.gif";

                return "<img src=\"".ilUtil::getImagePath($filename)."\" alt=\"".$lng->txt("obj_".$a_type)."\" title=\"".$lng->txt("obj_".$a_type)."\" border=\"0\" vspace=\"0\"/>";
                //return "<img src=\"".$a_path."/images/"."icon_".$a_type."$big.gif\" alt=\"".$lng->txt("obj_".$a_type)."\" title=\"".$lng->txt("obj_".$a_type)."\" border=\"0\" vspace=\"0\"/>";
        }

Here is the caller graph for this function:

ilUtil::getJavaPath (  ) 

get full java path (dir + java command)

Definition at line 1707 of file class.ilUtil.php.

Referenced by ilObjSCORMValidator::validateXML().

        {
                return PATH_TO_JAVA;
                //global $ilias;

                //return $ilias->getSetting("java_path");
        }

Here is the caller graph for this function:

ilUtil::getJSPath ( a_js  ) 

Get the full JavaScript path for a JavaScript file name.

Get the full JavaScript path for a JavaScript file name This function first tries to find the file in templates/skin/style, then in templates/skin and then in templates/default

public

Definition at line 167 of file class.ilUtil.php.

References $dir, and $ilias.

Referenced by ilPurchaseBMFGUI::__buildStylesheet(), ilPaymentPurchaseGUI::__buildStylesheet(), ilPaymentBaseGUI::__buildStylesheet(), and ilTinyMCE::_getEditorLanguage().

        {
                global $ilias;

                if(defined("ILIAS_MODULE"))
                {
                        $dir = ".";
                }
                else
                {
                        $dir = "";
                }
                $in_style = "./templates/".$ilias->account->skin."/".$ilias->account->prefs["style"]."/".$a_js;
                $in_skin = "./templates/".$ilias->account->skin."/".$a_js;
                $default = "./templates/default/".$a_js;
                if(@is_file($in_style))
                {
                        return $dir.$in_style;
                }
                else
                {
                        if (@is_file($in_skin))
                        {
                                return $dir.$in_skin;
                        }
                        else
                        {
                                return $dir.$default;
                        }
                }
        }

Here is the caller graph for this function:

ilUtil::getMemString (  ) 

get current memory usage as string

Definition at line 2516 of file class.ilUtil.php.

        {
                $my_pid = getmypid();
                return ("MEMORY USAGE (% KB PID ): ".`ps -eo%mem,rss,pid | grep $my_pid`);
        }

ilUtil::getMySQLTimestamp ( a_ts  ) 

Get MySQL timestamp in 4.1.x or higher format (yyyy-mm-dd hh:mm:ss) This function converts a timestamp, if MySQL 4.0 is used.

Parameters:
string MySQL timestamp string
Returns:
string MySQL 4.1.x timestamp string

Definition at line 3294 of file class.ilUtil.php.

References $t.

Referenced by ilObjExercise::_lookupFeedbackTime(), ilObjExercise::_lookupSentTime(), ilObjExercise::_lookupStatusTime(), and ilObjExercise::getLastSubmission().

        {
                global $ilDB;

                if ($ilDB->isMysql4_1OrHigher())
                {
                        return $a_ts;
                }
                else
                {
                        $t = $a_ts;
                        $ts = substr($t, 0, 4)."-".substr($t, 4, 2)."-".substr($t, 6, 2).
                                " ".substr($t, 8, 2).":".substr($t, 10, 2).":".substr($t, 12, 2);
                        return $ts;
                }
        }

Here is the caller graph for this function:

ilUtil::getNewContentStyleSheetLocation ( mode = "output"  ) 

get full style sheet file name (path inclusive) of current user

public

Definition at line 270 of file class.ilUtil.php.

References $ilias.

Referenced by ilTinyMCE::addRTESupport(), doOutput(), and ilTemplate::setContentStyle().

        {
                global $ilias;

                if(defined("ILIAS_MODULE") && $mode != "filesystem")
                {
                        // added to find Stylesheet for MODULES like Services/Search
                        $base = '';
                        for($i = 0;$i < count(explode('/',ILIAS_MODULE));$i++)
                        {
                                $base .= "../";
                        }
                }
                else
                {
                        $base = "./";
                }

                // add version as parameter to force reload for new releases
                if ($mode != "filesystem")
                {
                        $vers = str_replace(" ", "-", $ilias->getSetting("ilias_version"));
                        $vers = "?vers=".str_replace(".", "-", $vers);
                }

                $in_style = "templates/".$ilias->account->skin."/".$ilias->account->prefs["style"]."_cont.css";
                if (is_file("./".$in_style))
                {
                        return $base.$in_style.$vers;
                }
                else
                {
                        return $base."templates/default/delos_cont.css".$vers;
                }
        }

Here is the caller graph for this function:

ilUtil::getP3PLocation (  ) 

Get p3p file path.

(Not in use yet, see class.ilTemplate.php->show())

public

Definition at line 237 of file class.ilUtil.php.

References $ilias.

        {
                global $ilias;

                if (defined("ILIAS_MODULE"))
                {
                        // added to find Stylesheet for MODULES like Services/Search
                        $base = '';
                        for($i = 0;$i < count(explode('/',ILIAS_MODULE));$i++)
                        {
                                $base .= "../Services/Privacy/";
                        }
                }
                else
                {
                        $base = "./Services/Privacy/";
                }

                if (is_file($base."w3c/p3p.xml"))
                {
                        return ILIAS_HTTP_PATH."w3c/p3p.xml";
                }
                else
                {
                        return ILIAS_HTTP_PATH."/w3c/p3p_template.xml";
                }
        }

ilUtil::getSelectName ( selected,
values 
)

???

public

Parameters:
string 
string 

Definition at line 389 of file class.ilUtil.php.

        {
                return($values[$selected]);
        }

ilUtil::getStyleSheetLocation ( mode = "output"  ) 

get full style sheet file name (path inclusive) of current user

public

Definition at line 204 of file class.ilUtil.php.

References $ilias.

Referenced by ilPurchaseBMFGUI::__buildStylesheet(), ilPaymentPurchaseGUI::__buildStylesheet(), ilPaymentBaseGUI::__buildStylesheet(), ilObjChatGUI::__loadStylesheet(), ilObjChatGUIAdapter::__setStyleSheetLocation(), ilInternalLinkGUI::changeTargetObject(), ilPCParagraphGUI::edit(), ilSCORMPresentationGUI::explorer(), ilHACPPresentationGUI::explorer(), ilSAHSPresentationGUI::explorer(), ilObjMediaPoolGUI::explorer(), ilObjFileBasedLMGUI::explorer(), ilObjContentObjectGUI::explorer(), ilAICCPresentationGUI::explorer(), ilLMPresentationGUI::exportbibinfo(), ilObjGlossary::exportHTML(), ilObjContentObject::exportHTML(), ilSCORMPresentationGUI::finishSahs(), ilSAHSPresentationGUI::finishSahs(), ilLMPresentationGUI::glossary(), ilLMPresentationGUI::ilMedia(), ilLMPresentationGUI::ilTOC(), ilInitialisation::initILIAS(), ilPCParagraphGUI::insert(), ilLMPresentationGUI::layout(), ilGlossaryPresentationGUI::media(), ilObjiLincCourseGUI::membersGalleryObject(), ilObjCourseGUI::membersGalleryObject(), ilObjGroupGUI::membersGalleryObject(), ilLMPresentationGUI::offlineexport(), ilLMPresentationGUI::outputInfoScreen(), ilObjCourseGUI::printMembersObject(), ilEventAdministrationGUI::printViewMembers(), ilInternalLinkGUI::selectRepositoryItem(), ilMainMenuGUI::setTemplateVars(), ilFramesetGUI::show(), ilContainerLinkListGUI::show(), ilObjDlBookGUI::showAbstract(), ilObjDlBookGUI::showCitation(), ilLMPresentationGUI::showDownloadList(), ilWysiwygUtil::showFootnote(), ilWysiwygUtil::showItl(), ilInternalLinkGUI::showLinkHelp(), ilObjMediaPoolGUI::showMedia(), ilPageObjectGUI::showMediaFullscreen(), ilWysiwygUtil::showMoveCopyQuestion(), ilLMPresentationGUI::showPrintViewSelection(), ilLMPresentationGUI::showTableOfContents(), ilRepositoryGUI::showTree(), ilWysiwygUtil::showXtl(), ilSCORMPresentationGUI::unloadSahs(), ilSAHSPresentationGUI::unloadSahs(), ilSCORMPresentationGUI::view(), ilSAHSPresentationGUI::view(), and ilAICCPresentationGUI::view().

        {
                global $ilias;

                if(defined("ILIAS_MODULE") && $mode != "filesystem")
                {
                        // added to find Stylesheet for MODULES like Services/Search
                        $base = '';
                        for($i = 0;$i < count(explode('/',ILIAS_MODULE));$i++)
                        {
                                $base .= "../";
                        }
                }
                else
                {
                        $base = "./";
                }

                // add version as parameter to force reload for new releases
                if ($mode != "filesystem")
                {
                        $vers = str_replace(" ", "-", $ilias->getSetting("ilias_version"));
                        $vers = "?vers=".str_replace(".", "-", $vers);
                }

                return $base."templates/".$ilias->account->skin."/".$ilias->account->prefs["style"].".css".$vers;
        }

Here is the caller graph for this function:

ilUtil::getUsersOnline ( a_user_id = 0  ) 

reads all active sessions from db and returns users that are online OR returns only one active user if a user_id is given

Parameters:
integer user_id (optional)
Returns:
array

Definition at line 1189 of file class.ilUtil.php.

References $ilias, $q, $user, and $users.

Referenced by ilObjRole::_updateSessionRoles(), ilObjUserGUI::activeRoleSaveObject(), ilPersonalDesktopGUI::displayUsersOnline(), ilObjUserGUI::editObject(), ilChatRoom::getOnlineUsers(), and ilObjUser::updateActiveRoles().

        {
                global $ilias;

                if ($a_user_id == 0)
                {
                        $where = "WHERE user_id != 0";
                }
                else
                {
                        $where = "WHERE user_id = '".$a_user_id."'";
                }

                $q = "SELECT count(user_id) as num,user_id,data,firstname,lastname,title,login,last_login FROM usr_session ".
                "LEFT JOIN usr_data ON user_id=usr_id ".$where.
                " AND expires>UNIX_TIMESTAMP() ".
                "GROUP BY user_id ".
                "ORDER BY lastname, firstname";
                $r = $ilias->db->query($q);

                while ($user = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $users[$user["user_id"]] = $user;
                }

                return $users ? $users : array();
        }

Here is the caller graph for this function:

ilUtil::getWebspaceDir ( mode = "filesystem"  ) 

get webspace directory

Parameters:
string $mode use "filesystem" for filesystem operations and "output" for output operations, e.g. images

Definition at line 1148 of file class.ilUtil.php.

References $ilias.

Referenced by ilObjMediaObject::_createThumbnailDirectory(), ilContainer::_getContainerDirectory(), ilObjMediaObject::_getDirectory(), ilUserAgreement::_getText(), ilObjMediaObject::_getThumbnailDirectory(), ilObjUser::_uploadPersonalPicture(), ilObjMediaObjectGUI::assignFullscreenObject(), ilObjMediaObjectGUI::assignStandardObject(), ilContObjParser::copyMobFiles(), ilContainer::createContainerDirectory(), ilObjSAHSLearningModule::createDataDirectory(), ilObjMediaObjectGUI::createDirectoryObject(), ilObjUserFolder::createXMLExport(), ilObjStyleSheet::delete(), ilObjMediaObjectGUI::deleteFileObject(), ilObjUserGUI::deliverVCardObject(), ilObjMediaObjectGUI::editFilesObject(), ilObjMediaObjectGUI::editMapArea(), ilObjMediaObjectGUI::editMapAreasObject(), ilObjMediaObject::exportFiles(), ilObjGlossary::exportHTMLMOB(), ilObjContentObject::exportHTMLMOB(), ilObjStyleSheet::getContentStylePath(), ilObjSAHSLearningModule::getDataDirectory(), ilObjFileBasedLM::getDataDirectory(), ilObjMediaObject::getDataDirectory(), ilFileDataCourse::getOnlineLink(), ilObjUserGUI::getPublicProfile(), ilLMPresentationGUI::ilMedia(), ilGlossaryPresentationGUI::media(), ilPersonalProfileGUI::removeUserPicture(), ilObjMediaPoolGUI::showMedia(), ilPageObjectGUI::showMediaFullscreen(), ilPageObjectGUI::showPage(), ilLMPresentationGUI::showPrintView(), ilPersonalProfileGUI::showProfile(), ilObjMediaObjectGUI::uploadFileObject(), ilPersonalProfileGUI::uploadUserPicture(), ilObjLanguageFolderGUI::viewObject(), and ilObjStyleSheet::writeCSSFile().

        {
                global $ilias;

                if ($mode == "filesystem")
                {
                        return "./".ILIAS_WEB_DIR."/".$ilias->client_id;
                }
                else
                {
                        if (defined("ILIAS_MODULE"))
                        {
                                return "../".ILIAS_WEB_DIR."/".$ilias->client_id;
                        }
                        else
                        {
                                return "./".ILIAS_WEB_DIR."/".$ilias->client_id;
                        }
                }

                //return $ilias->ini->readVariable("server","webspace_dir");
        }

Here is the caller graph for this function:

ilUtil::groupNameExists ( a_group_name,
a_id = 0 
)

checks if group name already exists.

Groupnames must be unique for mailing purposes static function public

Parameters:
string groupname
integer obj_id of group to exclude from the check.
Returns:
boolean true if exists

Definition at line 2451 of file class.ilUtil.php.

References $ilErr, and $q.

Referenced by ilSoapObjectAdministration::addObject(), ilMail::checkRecipients(), ilMail::getUserIds(), ilSoapGroupAdministration::groupExists(), ilObjGroup::ilClone(), ilObjGroupGUI::saveObject(), ilObjGroupGUI::updateObject(), and ilSoapObjectAdministration::updateObjects().

        {
                global $ilDB,$ilErr;

                if (empty($a_group_name))
                {
                        $message = get_class($this)."::_NameExists(): No groupname given!";
                        $ilErr->raiseError($message,$ilErr->WARNING);
                }

                $clause = ($a_id) ? " AND obj_id != '".$a_id."'" : "";

                $q = "SELECT obj_id FROM object_data ".
                "WHERE title = '".addslashes($a_group_name)."' ".
                "AND type = 'grp'".
                $clause;

                $r = $ilDB->query($q);

                if ($r->numRows())
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

Here is the caller graph for this function:

ilUtil::html2pdf ( html,
pdf_file 
)

produce pdf out of html with htmldoc

Parameters:
html String HTML-Data given to create pdf-file
pdf_file String Filename to save pdf in

Definition at line 1484 of file class.ilUtil.php.

References escapeShellArg().

Referenced by ilPurchasePaypal::__sendBill(), ilPurchaseBMFGUI::__sendBill(), and ilLMPresentationGUI::offlineexport().

        {
                //global $ilias;

                $html_file = str_replace(".pdf",".html",$pdf_file);

                $fp = fopen( $html_file ,"wb");
                fwrite($fp, $html);
                fclose($fp);

                $htmldoc_path = PATH_TO_HTMLDOC;
                //$htmldoc_path = $ilias->getSetting("htmldoc_path");

                $htmldoc = $htmldoc_path." ";
                $htmldoc .= "--no-toc ";
                $htmldoc .= "--no-jpeg ";
                $htmldoc .= "--webpage ";
                $htmldoc .= "--outfile " . ilUtil::escapeShellArg($pdf_file) . " ";
                $htmldoc .= "--bodyfont Arial ";
                $htmldoc .= "--charset iso-8859-15 ";
                $htmldoc .= "--color ";
                $htmldoc .= "--size A4  ";      // --landscape
                $htmldoc .= "--format pdf ";
                $htmldoc .= "--footer ... ";
                $htmldoc .= "--header ... ";
                $htmldoc .= "--left 60 ";
                // $htmldoc .= "--right 200 ";
                $htmldoc .= $html_file;
                exec($htmldoc);

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::ilTempnam (  ) 

Create a temporary file in an ILIAS writable directory.

Returns:
string File name of the temporary file

Definition at line 1294 of file class.ilUtil.php.

References createDirectory(), and getDataDir().

Referenced by ilFileDataExercise::downloadAllDeliveredFiles(), ilExerciseMembers::downloadMultipleFiles(), ilTestEvaluationGUI::evalSelectedUsers(), ilSurveyEvaluationGUI::evaluationuser(), ilSurveyEvaluationGUI::exportCumulatedResults(), ilImagemapPreview::ilImagemapPreview(), ilUserImportParser::saveTempImage(), and ilBookmarkAdministrationGUI::sendmail().

        {
                $temp_path = ilUtil::getDataDir() . "/temp";
                if (!is_dir($temp_path))
                {
                        ilUtil::createDirectory($temp_path);
                }
                $temp_name = tempnam($temp_path, "tmp");
                // --->
                // added the following line because tempnam creates a backslash on some
                // Windows systems which leads to problems, because the "...\tmp..." can be
                // interpreted as "...{TAB-CHARACTER}...". The normal slash works fine
                // even under windows (Helmut Schottmüller, 2005-08-31)
                $temp_name = str_replace("\\", "/", $temp_name);
                // --->
                unlink($temp_name);
                return $temp_name;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::insertInstIntoID ( a_value  ) 

inserts installation id into ILIAS id

e.g. "il__pg_3" -> "il_43_pg_3"

Definition at line 2433 of file class.ilUtil.php.

Referenced by ilObjMediaObject::modifyExportIdentifier(), ilObjTest::modifyExportIdentifier(), and ilObjQuestionPool::modifyExportIdentifier().

        {
                if (substr($a_value, 0, 4) == "il__")
                {
                        $a_value = "il_".IL_INST_ID."_".substr($a_value, 4, strlen($a_value) - 4);
                }

                return $a_value;
        }

Here is the caller graph for this function:

ilUtil::insertLatexImages ( a_text,
a_start = "\[tex\]",
a_end = "\[\/tex\]",
a_cgi = URL_TO_LATEX 
)

replace [text]...[/tex] tags with formula image code //////// added additional parameters to make this method usable for other start and end tags as well

Definition at line 3043 of file class.ilUtil.php.

Referenced by ilGlossaryPresentationGUI::listTermByGiven(), ilObjGlossaryGUI::listTerms(), ilForum::prepareText(), SurveyQuestion::prepareTextareaOutput(), ilObjSurvey::prepareTextareaOutput(), ilObjTest::prepareTextareaOutput(), assQuestion::prepareTextareaOutput(), and ilPageObjectGUI::showPage().

        {
                // - take care of html exports (-> see buildLatexImages)
                $result_text = preg_replace('/' . $a_start . '(.*?)' . $a_end . '/ie',
                        "'<img alt=\"'.htmlentities('$1').'\" src=\"$a_cgi?'.rawurlencode(str_replace('&amp;', '&', str_replace('&gt;', '>', str_replace('&lt;', '<', '$1')))).'\" ".
                        " />'", $a_text);
                return $result_text;
        }

Here is the caller graph for this function:

ilUtil::int2array ( seconds,
periods = null 
)

Return an array of date segments.

Parameters:
int $seconds Number of seconds to be parsed
Returns:
mixed An array containing named segments

Definition at line 3108 of file class.ilUtil.php.

Referenced by ilObjExerciseAccess::_lookupRemainingWorkingTimeString(), ilObjExerciseGUI::infoScreen(), and ilObjExerciseGUI::viewObject().

        {
                // Define time periods
                if (!is_array($periods))
                {
                        $periods = array (
                        'years' => 31536000,
                        'months' => 2592000,
                        'days'  => 86400,
                        'hours' => 3600,
                        'minutes' => 60,
                        'seconds' => 1
                        );
                }

                // Loop
                $seconds = (float) $seconds;
                foreach ($periods as $period => $value)
                {
                        $count = floor($seconds / $value);

                        if ($count == 0)
                        {
                                continue;
                        }

                        $values[$period] = $count;
                        $seconds = $seconds % $value;
                }
                // Return
                if (empty($values))
                {
                        $values = null;
                }

                return $values;
        }

Here is the caller graph for this function:

ilUtil::is_email ( a_email  ) 

Definition at line 962 of file class.ilUtil.php.

Referenced by ilSoapUserAdministration::__validateUserData(), ilSetup::checkClientContact(), ilMail::checkRecipients(), ilSetupGUI::displayContactData(), ilMail::getEmailOfSender(), ilRegistrationGUI::saveForm(), ilObjUserGUI::saveObject(), ilPersonalProfileGUI::saveProfile(), ilObjSystemFolderGUI::saveSettingsObject(), ilObjUserGUI::updateObject(), and ilObjCourse::validateInfoSettings().

        {
                return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$a_email));
        }

Here is the caller graph for this function:

ilUtil::isAPICall (  ) 

Definition at line 2670 of file class.ilUtil.php.

Referenced by ilAdministrationGUI::ilAdministrationGUI(), and ilRepositoryGUI::ilRepositoryGUI().

                              {
                return  strpos($_SERVER["SCRIPT_FILENAME"],"api") !== false ||
                strpos($_SERVER["SCRIPT_FILENAME"],"dummy") !== false;
        }

Here is the caller graph for this function:

ilUtil::isDN ( a_str  ) 

Definition at line 2920 of file class.ilUtil.php.

Referenced by ilRADIUSAuthentication::_validateServers(), and ilObjExternalToolsSettingsGUI::saveiLincObject().

        {
                return(preg_match("/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/",$a_str));
        }

Here is the caller graph for this function:

ilUtil::isIPv4 ( a_str  ) 

Definition at line 2926 of file class.ilUtil.php.

Referenced by ilRADIUSAuthentication::_validateServers(), and ilObjExternalToolsSettingsGUI::saveiLincObject().

        {
                return(preg_match("/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.".
                                                  "(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/",$a_str));
        }

Here is the caller graph for this function:

ilUtil::isLogin ( a_login  ) 

Definition at line 1001 of file class.ilUtil.php.

Referenced by ilSoapUserAdministration::__validateUserData(), ilRegistrationGUI::saveForm(), ilObjUserGUI::saveObject(), and ilObjUserGUI::updateObject().

        {
                if (empty($a_login))
                {
                        return false;
                }

                if (strlen($a_login) < 3)
                {
                        return false;
                }

                if (!ereg("^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$", $a_login))
                {
                        return false;
                }

                return true;
        }

Here is the caller graph for this function:

ilUtil::isPassword ( a_passwd  ) 

Definition at line 973 of file class.ilUtil.php.

Referenced by ilSoapUserAdministration::__validateUserData(), ilPersonalProfileGUI::changeUserPassword(), ilRegistrationGUI::saveForm(), ilObjUserGUI::saveObject(), ilPasswordAssistanceGUI::submitAssignPasswordForm(), ilObjUserGUI::updateObject(), and ilObjGroupGUI::updateObject().

        {
                if (empty($a_passwd))
                {
                        return false;
                }

                if (strlen($a_passwd) < 6)
                {
                        return false;
                }
                // due to bug in php does not work
                //if (!ereg("^[A-Za-z0-9_\.\+\-\*\@!\$\%\~]+$", $a_passwd))

                if (!preg_match("/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~]+$/", $a_passwd))
                {
                        return false;
                }

                return true;
        }

Here is the caller graph for this function:

ilUtil::isWindows (  ) 

check wether the current client system is a windows system

Definition at line 2525 of file class.ilUtil.php.

Referenced by escapeShellArg().

        {
                if (strtolower(substr(php_uname(), 0, 3)) == "win")
                {
                        return true;
                }
                return false;
        }

Here is the caller graph for this function:

ilUtil::KT_replaceParam ( qstring,
paramName,
paramValue 
)

Definition at line 2675 of file class.ilUtil.php.

Referenced by replaceUrlParameterString().

                                                                    {
                if (preg_match("/&" . $paramName . "=/", $qstring)) {
                        return preg_replace("/&" . $paramName . "=[^&]+/", "&" . $paramName . "=" . urlencode($paramValue), $qstring);
                } else {
                        return $qstring . "&" . $paramName . "=" . urlencode($paramValue);
                }
        }

Here is the caller graph for this function:

ilUtil::Linkbar ( AScript,
AHits,
ALimit,
AOffset,
AParams = array(),
ALayout = array() 
)

Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und den entsprechenden Seitenzahlen.

die komplette LinkBar wird zur?ckgegeben der Variablenname f?r den offset ist "offset"

Author:
Sascha Hofmann <shofmann@databay.de>

public

Parameters:
integer Name der Skriptdatei (z.B. test.php)
integer Anzahl der Elemente insgesamt
integer Anzahl der Elemente pro Seite
integer Das aktuelle erste Element in der Liste
array Die zu ?bergebenen Parameter in der Form $AParams["Varname"] = "Varwert" (optional)
array layout options (all optional) link => css name for -tag prev => value for 'previous page' (default: '<<') next => value for 'next page' (default: '>>')
Returns:
array linkbar or false on error

Definition at line 645 of file class.ilUtil.php.

References $key.

Referenced by ilLPListOfObjectsGUI::__showUsersList(), ilTableGUI::render(), and ilObjForumGUI::showThreadsObject().

        {
                $LinkBar = "";

                $layout_link = "";
                $layout_prev = "&lt;&lt;";
                $layout_next = "&gt;&gt;";

                // layout options
                if (count($ALayout > 0))
                {
                        if ($ALayout["link"])
                        {
                                $layout_link = " class=\"".$ALayout["link"]."\"";
                        }

                        if ($ALayout["prev"])
                        {
                                $layout_prev = $ALayout["prev"];
                        }

                        if ($ALayout["next"])
                        {
                                $layout_next = $ALayout["next"];
                        }
                }

                // Wenn Hits gr?sser Limit, zeige Links an
                if ($AHits > $ALimit)
                {
                        if (!empty($AParams))
                        {
                                foreach ($AParams as $key => $value)
                                {
                                        $params.= $key."=".$value."&";
                                }
                        }
                        // if ($params) $params = substr($params,0,-1);
                        if(strpos($AScript,'&'))
                        {
                                $link = $AScript."&".$params."offset=";
                        }
                        else
                        {
                                $link = $AScript."?".$params."offset=";
                        }

                        // ?bergehe "zurck"-link, wenn offset 0 ist.
                        if ($AOffset >= 1)
                        {
                                $prevoffset = $AOffset - $ALimit;
                                $LinkBar .= "<a".$layout_link." href=\"".$link.$prevoffset."\">".$layout_prev."&nbsp;</a>";
                        }

                        // Ben?tigte Seitenzahl kalkulieren
                        $pages=intval($AHits/$ALimit);

                        // Wenn ein Rest bleibt, addiere eine Seite
                        if (($AHits % $ALimit))
                        $pages++;

                        // Bei Offset = 0 keine Seitenzahlen anzeigen : DEAKTIVIERT
                        //                      if ($AOffset != 0) {

                        // ansonsten zeige Links zu den anderen Seiten an
                        for ($i = 1 ;$i <= $pages ; $i++)
                        {
                                $newoffset=$ALimit*($i-1);

                                if ($newoffset == $AOffset)
                                {
                                        $LinkBar .= "[".$i."] ";
                                }
                                else
                                {
                                        $LinkBar .= '<a '.$layout_link.' href="'.
                                                $link.$newoffset.'">['.$i.']</a> ';
                                }
                        }
                        //                      }

                        // Checken, ob letze Seite erreicht ist
                        // Wenn nicht, gebe einen "Weiter"-Link aus
                        if (! ( ($AOffset/$ALimit)==($pages-1) ) && ($pages!=1) )
                        {
                                $newoffset=$AOffset+$ALimit;
                                $LinkBar .= "<a".$layout_link." href=\"".$link.$newoffset."\">&nbsp;".$layout_next."</a>";
                        }

                        return $LinkBar;
                }
                else
                {
                        return false;
                }
        }

Here is the caller graph for this function:

ilUtil::makeClickable ( a_text  ) 

makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen

public

Parameters:
string $text: Der Text
Returns:
string clickable link

Definition at line 750 of file class.ilUtil.php.

        {
                // URL mit ://-Angabe
                $ret = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=-])",
                "<a href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a>", $a_text);

                // www-URL ohne ://-Angabe
                $ret = eregi_replace("([[:space:]]+)(www\.)([[:alnum:]#?/&=\.-]+)",
                "\\1<a href=\"http://\\2\\3\" target=\"_blank\">\\2\\3</a>", $ret);

                // ftp-URL ohne ://-Angabe
                $ret = eregi_replace("([[:space:]]+)(ftp\.)([[:alnum:]#?/&=\.-]+)",
                "\\1<a href=\"ftp://\\2\\3\" target=\"_blank\">\\2\\3</a>", $ret);

                // E-Mail
                $ret = eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))",
                "<a  href=\"mailto:\\1\">\\1</a>", $ret);

                return($ret);
        }

ilUtil::makeDateSelect ( prefix,
year = "",
month = "",
day = "",
startyear = "",
a_long_month = true 
)

Creates a combination of HTML selects for date inputs.

Creates a combination of HTML selects for date inputs The select names are $prefix[y] for years, $prefix[m] for months and $prefix[d] for days.

public

Parameters:
string $prefix Prefix of the select name
integer $year Default value for year select
integer $month Default value for month select
integer $day Default value for day select
Returns:
string HTML select boxes
Author:
Aresch Yavari <ay@databay.de>
Helmut Schottmüller <hschottm@tzi.de>

Definition at line 816 of file class.ilUtil.php.

References $lng.

Referenced by ilCourseContentGUI::__renderItem(), ilEventAdministrationGUI::addEvent(), ilEventAdministrationGUI::edit(), ilCourseItemAdministrationGUI::edit(), ilObjCourseGUI::editObject(), ilCourseContentGUI::editTimings(), ilObjAssessmentFolderGUI::logsObject(), ilObjSurveyGUI::propertiesObject(), and ilObjTestGUI::propertiesObject().

        {
                global $lng;

                $now = getdate();
                if (!strlen($year)) $year = $now["year"];
                if (!strlen($month)) $month = $now["mon"];
                if (!strlen($day)) $day = $now["mday"];

                $year = (int) $year;
                $month = (int) $month;
                $day = (int) $day;

                // build day select
                $sel_day .= "<select name=\"".$prefix."[d]\" id=\"".$prefix."_d\">\n";

                for ($i = 1; $i <= 31; $i++)
                {
                        $sel_day .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
                }
                $sel_day .= "</select>\n";
                $sel_day = preg_replace("/(value\=\"$day\")/", "$1 selected=\"selected\"", $sel_day);

                // build month select
                $sel_month .= "<select name=\"".$prefix."[m]\" id=\"".$prefix."_m\">\n";

                for ($i = 1; $i <= 12; $i++)
                {
                        if($a_long_month)
                        {
                                $sel_month .= "<option value=\"$i\">" . $lng->txt("month_" . sprintf("%02d", $i) . "_long") . "</option>\n";
                        }
                        else
                        {
                                $sel_month .= "<option value=\"$i\">" . $i  . "</option>\n";
                        }
                }
                $sel_month .= "</select>\n";
                $sel_month = preg_replace("/(value\=\"$month\")/", "$1 selected=\"selected\"", $sel_month);

                // build year select
                $sel_year .= "<select name=\"".$prefix."[y]\" id=\"".$prefix."_y\">\n";
                if ((strlen($startyear) == 0) || ($startyear > $year))
                {
                        $startyear = $year;
                }
                for ($i = $startyear; $i <= $year + 3; $i++)
                {
                        $sel_year .= "<option value=\"$i\">" . sprintf("%04d", $i) . "</option>\n";
                }
                $sel_year .= "</select>\n";
                $sel_year = preg_replace("/(value\=\"$year\")/", "$1 selected=\"selected\"", $sel_year);

                $dateformat = $lng->text["lang_dateformat"];
                $dateformat = strtolower(preg_replace("/\W/", "", $dateformat));
                $dateformat = strtolower(preg_replace("/(\w)/", "%%$1", $dateformat));
                $dateformat = preg_replace("/%%d/", $sel_day, $dateformat);
                $dateformat = preg_replace("/%%m/", $sel_month, $dateformat);
                $dateformat = preg_replace("/%%y/", $sel_year, $dateformat);
                return $dateformat;
        }

Here is the caller graph for this function:

ilUtil::makeDir ( a_dir  ) 

creates a new directory and inherits all filesystem permissions of the parent directory You may pass only the name of your new directory or with the entire path or relative path information.

examples: a_dir = /tmp/test/your_dir a_dir = ../test/your_dir a_dir = your_dir (--> creates your_dir in current directory)

public

Parameters:
string [path] + directory name
Returns:
boolean

Definition at line 1742 of file class.ilUtil.php.

Referenced by ilFileDataCourse::__checkImportPath(), ilFileDataCourse::__checkPath(), ilFileDataChat::__createDirectory(), ilFileDataCourse::__initDirectory(), ilFileDataGroup::__initDirectory(), ilFileDataExercise::__initDirectory(), ilPurchasePaypal::__sendBill(), ilPurchaseBMFGUI::__sendBill(), ilChatServerConfig::__writeConfigFile(), ilObjTest::_createImportDirectory(), ilObjQuestionPool::_createImportDirectory(), ilFileDataImportMail::_initDirectory(), ilFileDataImportGroup::_initDirectory(), ilFileDataImportForum::_initDirectory(), ilFileDataImport::_initDirectory(), ilFileDataCourse::addDirectory(), ilFileDataGroup::addDirectory(), ilFileDataGroup::addGroupDirectory(), ilFileDataGroup::addImportDirectory(), ilGlossaryExport::buildExportFileXML(), ilContObjectExport::buildExportFileXML(), ilTestExport::buildExportFileXML(), ilQuestionpoolExport::buildExportFileXML(), ilTestExport::buildExportResultFile(), ilContObjParser::copyFileItems(), ilContObjParser::copyMobFiles(), ilClient::create(), ilContainer::createContainerDirectory(), ilObjSAHSLearningModule::createDataDirectory(), ilObjFileBasedLM::createDataDirectory(), createDirectory(), ilObjFile::createDirectory(), ilFileSystemGUI::createDirectory(), ilObjMediaObjectGUI::createDirectoryObject(), ilObjSurveyQuestionPool::createExportDirectory(), ilObjSurvey::createExportDirectory(), ilObjGlossary::createExportDirectory(), ilObjContentObject::createExportDirectory(), ilObjUserFolder::createExportDirectory(), ilObjTest::createExportDirectory(), ilObjQuestionPool::createExportDirectory(), ilObjSurveyQuestionPool::createImportDirectory(), ilObjSurvey::createImportDirectory(), ilObjGlossary::createImportDirectory(), ilObjContentObject::createImportDirectory(), ilObjTest::createImportDirectory(), ilFileDataCourse::createImportFile(), ilFileDataCourse::createOnlineVersion(), ilFileDataExercise::deliverFile(), ilObjFile::export(), ilObjMediaObject::exportFiles(), ilObjGlossary::exportHTML(), ilObjContentObject::exportHTML(), ilObjGlossary::exportHTMLFile(), ilObjContentObject::exportHTMLFile(), ilObjGlossary::exportHTMLMOB(), ilObjContentObject::exportHTMLMOB(), ilObjContentObject::exportSCORM(), ilObjFile::getUploadFile(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), rCopy(), and ilSetup::saveMasterSetup().

        {
                $a_dir = trim($a_dir);

                // remove trailing slash (bugfix for php 4.2.x)
                if (substr($a_dir,-1) == "/")
                {
                        $a_dir = substr($a_dir,0,-1);
                }

                // check if a_dir comes with a path
                if (!($path = substr($a_dir,0, strrpos($a_dir,"/") - strlen($a_dir))))
                {
                        $path = ".";
                }

                // create directory with file permissions of parent directory
                umask(0000);
                return @mkdir($a_dir,fileperms($path));
        }

Here is the caller graph for this function:

ilUtil::makeDirParents ( a_dir  ) 

Create a new directory and all parent directories.

Creates a new directory and inherits all filesystem permissions of the parent directory If the parent directories doesn't exist, they will be created recursively. The directory name NEEDS TO BE an absolute path, because it seems that relative paths are not working with PHP's file_exists function.

Author:
Helmut Schottmüller <hschottm@tzi.de>
Parameters:
string $a_dir The directory name to be created public

Definition at line 1776 of file class.ilUtil.php.

References $dir, and $key.

Referenced by assJavaApplet::copyApplet(), assImagemapQuestion::copyImage(), assSingleChoice::copyImages(), assOrderingQuestion::copyImages(), assMultipleChoice::copyImages(), assMatchingQuestion::copyImages(), ilEventFile::create(), ilCourseFile::create(), assJavaApplet::duplicateApplet(), assImagemapQuestion::duplicateImage(), assSingleChoice::duplicateImages(), assOrderingQuestion::duplicateImages(), assMultipleChoice::duplicateImages(), assMatchingQuestion::duplicateImages(), SurveyQuestion::duplicateMaterials(), assSingleChoice::fromXML(), assOrderingQuestion::fromXML(), assMultipleChoice::fromXML(), assMatchingQuestion::fromXML(), assJavaApplet::fromXML(), assImagemapQuestion::fromXML(), ilObjUserFolderGUI::getImportDir(), ilObjSurvey::getImportDirectory(), ilLMPresentationGUI::handleCodeParagraph(), ilObjQuestionPool::pasteFromClipboard(), assSingleChoice::setImageFile(), assOrderingQuestion::setImageFile(), assMultipleChoice::setImageFile(), assMatchingQuestion::setImageFile(), assImagemapQuestion::setImageFilename(), assJavaApplet::setJavaAppletFilename(), and SurveyQuestion::setMaterialsfile().

        {
                $dirs = array($a_dir);
                $a_dir = dirname($a_dir);
                $last_dirname = '';
                while($last_dirname != $a_dir)
                {
                        array_unshift($dirs, $a_dir);
                        $last_dirname = $a_dir;
                        $a_dir = dirname($a_dir);
                }

                // find the first existing dir
                $reverse_paths = array_reverse($dirs, TRUE);
                $found_index = -1;
                foreach ($reverse_paths as $key => $value)
                {
                        if ($found_index == -1)
                        {
                                if (is_dir($value))
                                {
                                        $found_index = $key;
                                }
                        }
                }

                umask(0000);
                foreach ($dirs as $dirindex => $dir)
                {
                        // starting with the longest existing path
                        if ($dirindex >= $found_index)
                        {
                                if (! file_exists($dir))
                                {
                                        if (strcmp(substr($dir,strlen($dir)-1,1),"/") == 0)
                                        {
                                                // on some systems there is an error when there is a slash
                                                // at the end of a directory in mkdir, see Mantis #2554
                                                $dir = substr($dir,0,strlen($dir)-1);
                                        }
                                        if (! mkdir($dir, $umask))
                                        {
                                                error_log("Can't make directory: $dir");
                                                return false;
                                        }
                                }
                                elseif (! is_dir($dir))
                                {
                                        error_log("$dir is not a directory");
                                        return false;
                                }
                                else
                                {
                                        // get umask of the last existing parent directory
                                        $umask = fileperms($dir);
                                }
                        }
                }
                return true;
        }

Here is the caller graph for this function:

ilUtil::makeTimeSelect ( prefix,
short = true,
hour = "",
minute = "",
second = "",
a_use_default = true 
)

Creates a combination of HTML selects for time inputs.

Creates a combination of HTML selects for time inputs. The select names are $prefix[h] for hours, $prefix[m] for minutes and $prefix[s] for seconds.

public

Parameters:
string $prefix Prefix of the select name
boolean $short Set TRUE for a short time input (only hours and minutes). Default is TRUE
integer $hour Default hour value
integer $minute Default minute value
integer $second Default second value
Returns:
string HTML select boxes
Author:
Helmut Schottmüller <hschottm@tzi.de>

Definition at line 894 of file class.ilUtil.php.

References $lng.

Referenced by ilEventAdministrationGUI::addEvent(), ilEventAdministrationGUI::edit(), ilCourseItemAdministrationGUI::edit(), ilObjCourseGUI::editObject(), assTextSubsetGUI::editQuestion(), ilMDEditorGUI::listEducational(), ilMDEditorGUI::listQuickEdit(), ilObjAssessmentFolderGUI::logsObject(), assQuestionGUI::outOtherQuestionData(), and ilObjTestGUI::propertiesObject().

        {
                global $lng;
                if ($a_use_default and !strlen("$hour$minute$second")) {
                        $now = localtime();
                        $hour = $now[2];
                        $minute = $now[1];
                        $second = $now[0];
                } else {
                        $hour = (int)$hour;
                        $minute = (int)$minute;
                        $second = (int)$second;
                }
                // build hour select
                $sel_hour .= "<select name=\"".$prefix."[h]\" id=\"".$prefix."_h\">\n";

                for ($i = 0; $i <= 23; $i++)
                {
                        $sel_hour .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
                }
                $sel_hour .= "</select>\n";
                $sel_hour = preg_replace("/(value\=\"$hour\")/", "$1 selected=\"selected\"", $sel_hour);

                // build minutes select
                $sel_minute .= "<select name=\"".$prefix."[m]\" id=\"".$prefix."_m\">\n";

                for ($i = 0; $i <= 59; $i++)
                {
                        $sel_minute .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
                }
                $sel_minute .= "</select>\n";
                $sel_minute = preg_replace("/(value\=\"$minute\")/", "$1 selected=\"selected\"", $sel_minute);

                if (!$short) {
                        // build seconds select
                        $sel_second .= "<select name=\"".$prefix."[s]\" id=\"".$prefix."_s\">\n";

                        for ($i = 0; $i <= 59; $i++)
                        {
                                $sel_second .= "<option value=\"$i\">" . sprintf("%02d", $i) . "</option>\n";
                        }
                        $sel_second .= "</select>\n";
                        $sel_second = preg_replace("/(value\=\"$second\")/", "$1 selected=\"selected\"", $sel_second);
                }
                $timeformat = $lng->text["lang_timeformat"];
                if (strlen($timeformat) == 0) $timeformat = "H:i:s";
                $timeformat = strtolower(preg_replace("/\W/", "", $timeformat));
                $timeformat = preg_replace("/(\w)/", "%%$1", $timeformat);
                $timeformat = preg_replace("/%%h/", $sel_hour, $timeformat);
                $timeformat = preg_replace("/%%i/", $sel_minute, $timeformat);
                if ($short) {
                        $timeformat = preg_replace("/%%s/", "", $timeformat);
                } else {
                        $timeformat = preg_replace("/%%s/", $sel_second, $timeformat);
                }
                return $timeformat;
        }

Here is the caller graph for this function:

ilUtil::moveUploadedFile ( a_file,
a_name,
a_target,
a_raise_errors = true