Public Member Functions

ilUtil Class Reference

Public Member Functions

 getImageTagByType ($a_type, $a_path)
 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)
 getStyleSheetLocation ($mode="output")
 get full style sheet file name (path inclusive) of current user
 formSelect ($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0")
 Builds a select form field with options and shows the selected option first.
 getSelectName ($selected, $values)
 ???
 formCheckbox ($checked, $varname, $value, $disabled=false)
 ??? public
 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
 getObjectsByOperations ($a_type, $a_operation, $a_checkpath=true)
 Get all objects of a specific type and check access.
 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="")
 Creates a combination of HTML selects for date inputs.
 makeTimeSelect ($prefix, $short=true, $hour="", $minute="", $second="")
 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")
 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
 ilTempnam ()
 Create a temporary file in an ILIAS writable directory.
 createDirectory ($a_dir, $a_mod=0755)
 create directory
 unzip ($a_file)
 unzip file
 zip ($a_dir, $a_file)
 zips given directory into given zip.file
 getConvertCmd ()
 get convert command
 convertImage ($a_from, $a_to, $a_target_format="", $a_geometry="")
 html2pdf ($html, $pdf_file)
 produce pdf out of html with htmldoc
 deliverData ($a_data, $a_filename, $mime="application/octet-stream")
 deliver data for download via browser.
 deliverFile ($a_file, $a_filename)
 deliver file for download via browser.
 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 ()
 isWindows ()
 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)
 Copies content of a directory $a_sdir recursively to a directory $a_tdir.
 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

Detailed Description

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


Member Function Documentation

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 1718 of file class.ilUtil.php.

Referenced by createNewOperation(), 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 
)

append URL parameter string ("par1=value1&par2=value2...") to given URL string

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

Referenced by ilCtrl::appendTransitClasses(), ilInternalLinkGUI::changeTargetObject(), ilCtrl::getUrlParameters(), ilEditClipboardGUI::insert(), ilCtrl::returnToParent(), ilObjSAHSLearningModuleGUI::saveMetaObject(), ilObjGlossaryGUI::saveMetaObject(), ilObjFileBasedLMGUI::saveMetaObject(), ilObjectGUI::setLocator(), and ilInternalLinkGUI::showLinkHelp().

        {
                $url = (is_int(strpos($a_url, "?")))
                ? $a_url."&".$a_par
                : $a_url."?".$a_par;

                return $url;
        }

Here is the caller graph for this function:

ilUtil::array_php2js ( data  ) 

convert php arrays to javascript arrays

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

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

References $data.

Referenced by ilObjContentObjectGUI::editPublicSection(), and ilPublicSectionSelector::formatObject().

        {
                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 1835 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 946 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::checkFormEmpty ( emptyFields  ) 

??? public

Parameters:
array 
Returns:
string

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

        {

                $feedback = "";

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

                return $feedback;
        }

ilUtil::checkInput ( vars  ) 

???

Parameters:
string 

Definition at line 300 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 = "" 
)
Parameters:
string $a_from source file
string $a_to target file
string $a_target_format target image file format

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

References escapeShellArg(), and getConvertCmd().

Referenced by ASS_OrderingQuestion::from_xml(), ASS_MatchingQuestion::from_xml(), ilMediaItem::makeMapWorkCopy(), ASS_OrderingQuestion::set_image_file(), and ASS_MatchingQuestion::set_image_file().

        {
                $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 1120 of file class.ilUtil.php.

References makeDir().

Referenced by ilObjCategoryGUI::_importCategories(), ilMediaItem::createWorkDirectory(), ilTempnam(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), 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::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 2047 of file class.ilUtil.php.

Referenced by ilPCMediaObjectGUI::create(), ilObjMediaObjectGUI::editObject(), 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 1549 of file class.ilUtil.php.

References $file.

Referenced by ilFileDataChat::__deleteOld(), ilFileDataChat::_ilFileDataChat(), ilObjFile::clearDataDirectory(), ilClient::delete(), ilObjSAHSLearningModule::delete(), ilObjFileBasedLM::delete(), ilObjContentObject::delete(), ilObjAICCLearningModule::delete(), ilObjMediaObject::delete(), ilObjFile::delete(), ilFileDataCourse::deleteDirectory(), ilObjGlossaryGUI::deleteExportFile(), ilObjContentObjectGUI::deleteExportFile(), ilObjSurveyQuestionPoolGUI::deleteExportFileObject(), ilObjSurveyGUI::deleteExportFileObject(), ilObjTestGUI::deleteExportFileObject(), ilObjQuestionPoolGUI::deleteExportFileObject(), ilFileSystemGUI::deleteFile(), ilObjMediaObjectGUI::deleteFileObject(), ilObjContentObject::exportHTML(), ilFileDataChat::ilFileDataChat(), ilFileDataImportMail::unlinkLast(), ilFileDataImportGroup::unlinkLast(), ilFileDataImportForum::unlinkLast(), and ilSetup::updateNewClient().

        {
                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" 
)

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 1284 of file class.ilUtil.php.

References exit, and getASCIIFilename().

Referenced by ilObjTestGUI::evalSelectedUsersObject(), ilObjSurveyGUI::evaluationObject(), ilObjSurveyGUI::evaluationuserObject(), ilObjChatGUI::export(), ilLMPresentationGUI::exportbibinfo(), ilObjUserGUI::insertPublicProfile(), 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"])) {
                        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);

                header("Content-Type: $mime");
                header("Content-Disposition:$disposition; filename=\"".$ascii_filename."\"");
                header("Content-Description: ".$ascii_filename);
                header("Content-Length: ".(string)(strlen($a_data)));
                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 
)

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 1325 of file class.ilUtil.php.

References exit, and getASCIIFilename().

Referenced by ilObjChatGUI::__exportRooms(), ilObjCourseGUI::downloadArchivesObject(), ilObjGlossaryGUI::downloadExportFile(), ilObjContentObjectGUI::downloadExportFile(), ilLMPresentationGUI::downloadExportFile(), ilObjSurveyQuestionPoolGUI::downloadExportFileObject(), ilObjSurveyGUI::downloadExportFileObject(), ilObjTestGUI::downloadExportFileObject(), ilObjQuestionPoolGUI::downloadExportFileObject(), ilFileSystemGUI::downloadFile(), ilObjExerciseGUI::downloadFileObject(), ilExerciseMembers::downloadMultipleFiles(), ilObjContentObjectGUI::downloadPDFFile(), ilExerciseMembers::downloadSingleFile(), ilObjDlBook::export(), ilObjQuestionPoolGUI::exportQuestionObject(), ilLMPresentationGUI::offlineexport(), and ilObjFile::sendFile().

        {
                $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"]))
                {
                        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);

                header("Content-Type: $mime");
                header("Content-Disposition:$disposition; filename=\"".$ascii_filename."\"");
                header("Content-Description: ".$ascii_filename);
                header("Content-Length: ".(string)(filesize($a_file)));
                header("Connection: close");
                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 1853 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 2174 of file class.ilUtil.php.

References isWindows().

Referenced by convertImage(), ilFileDataExercise::delete(), ilFileDataExercise::downloadAllDeliveredFiles(), ilExerciseMembers::downloadMultipleFiles(), ilObjFile::getXMLZip(), html2pdf(), unzip(), 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 2208 of file class.ilUtil.php.

Referenced by ilObjTestGUI::evalSelectedUsersObject().

        {
                $starting_time = mktime(0, 0, 0, 1, 1, 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 + 25569 + ($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 1799 of file class.ilUtil.php.

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);

                        // extract value
                        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 254 of file class.ilUtil.php.

Referenced by ilSearchGUI::__formatDigiLibResult(), ilSearchGUI::__formatGroupResult(), ilSearchGUI::__formatLearningModuleResult(), ilSearchGUI::__formatUserResult(), ilSearchAdministrationGUI::__showFolders(), ilObjUserFolderGUI::appliedUsersObject(), ilObjCourseGUI::archiveAdminObject(), ilObjCourseGUI::archiveObject(), ilObjCategoryGUI::assignRolesObject(), ilCourseContentInterface::cci_edit(), ilConditionHandlerInterface::chi_list(), ilObjUserGUI::createObject(), displayForm(), ilObjUserFolderGUI::editAppliedUsersObject(), ilObjCourseGUI::editMemberObject(), ilObjUserGUI::editObject(), ilObjExerciseGUI::editObject(), ilObjCourseGUI::editObject(), ilObjContentObjectGUI::linkChecker(), ilObjRoleGUI::listUsersGroupObject(), ilObjGroupGUI::listUsersGroupObject(), ilObjCourseGUI::listUsersGroupObject(), ilObjCategoryGUI::listUsersObject(), ilObjRoleGUI::listUsersRoleObject(), ilObjGroupGUI::listUsersRoleObject(), ilObjCourseGUI::listUsersRoleObject(), ilObjExerciseGUI::membersObject(), ilObjCourseGUI::membersObject(), ilObjPaymentSettingsGUI::payMethodsObject(), ilPaymentTrusteeGUI::performSearch(), ilObjPaymentSettingsGUI::searchObject(), ilObjRoleGUI::searchObject(), ilObjGroupGUI::searchObject(), ilObjCourseGUI::searchObject(), ilPaymentTrusteeGUI::showTrustees(), ilObjPaymentSettingsGUI::vendorsObject(), and ilObjChatGUI::viewObject().

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

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

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

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

                return $str;
        }

Here is the caller graph for this function:

ilUtil::formRadioButton ( checked,
varname,
value 
)

??? public

Parameters:
string 
string 
string 
Returns:
string

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

Referenced by ilObjGroupGUI::createObject(), ilObjForumGUI::createObject(), ilObjGroupGUI::editObject(), ilObjForumGUI::editObject(), ilObjCourseGUI::editObject(), ilObjExerciseGUI::newMembersObject(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjRoleGUI::searchUserFormObject(), ilObjGroupGUI::searchUserFormObject(), ilObjCourseGUI::searchUserObject(), ilPaymentBillAdminGUI::showBillData(), ilPaymentPurchaseGUI::showDetails(), and ilObjExerciseGUI::viewObject().

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

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

                return $str;
        }

Here is the caller graph for this function:

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

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 
boolean if true, the option values are displayed directly, otherwise they are handled as language variable keys and the corresponding language variable is displayed

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

References $lng.

Referenced by ilSearchGUI::__show(), ilObjExerciseGUI::__showMembersTable(), ilObjCourseGUI::__showMembersTable(), ilObjCourseGUI::__showSubscribersTable(), ilObjPaymentSettingsGUI::__showVendorsTable(), ilObjSystemFolderGUI::benchmarkObject(), ilConditionHandlerInterface::chi_list(), ilRepositoryGUI::copyChilds(), displayForm(), ilPaymentStatisticGUI::editStatistic(), ilObjPaymentSettingsGUI::editStatisticObject(), ilObjCourseGUI::selectArchiveLanguageObject(), ilRepositoryGUI::showActionSelect(), ilLOListGUI::showActionSelect(), ilInternalLinkGUI::showLinkHelp(), and ilPageObjectGUI::showPage().

        {
                global $lng;

                if ($multiple == true)
                {
                        $multiple = "multiple";
                }
                else
                {
                        $multiple = "";
                        $size = 0;
                }

                $str = "<select name=\"".$varname ."\"".$multiple." 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 2316 of file class.ilUtil.php.

Referenced by saveForm().

    {
        $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 1367 of file class.ilUtil.php.

Referenced by deliverData(), and deliverFile().

        {
                // 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::getConvertCmd (  ) 

get convert command

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

Referenced by convertImage(), ilImagemapPreview::createPreview(), ASS_ImagemapQuestion::set_image_filename(), and upload_file().

        {
                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 1057 of file class.ilUtil.php.

Referenced by ilObjCategoryGUI::_getImportDir(), ilObjFile::_lookupFileSize(), ilContObjParser::copyFileItems(), ilObjSurveyQuestionPool::createExportDirectory(), ilObjSurvey::createExportDirectory(), ilObjGlossary::createExportDirectory(), ilObjContentObject::createExportDirectory(), ilObjTest::createExportDirectory(), ilObjQuestionPool::createExportDirectory(), ilObjSurveyQuestionPool::createImportDirectory(), ilObjSurvey::createImportDirectory(), ilObjGlossary::createImportDirectory(), ilObjContentObject::createImportDirectory(), ilObjTest::createImportDirectory(), ilObjQuestionPool::createImportDirectory(), ilMediaItem::createWorkDirectory(), ilObjSurveyQuestionPool::deleteAllData(), ilObjQuestionPool::deleteQuestionpool(), ilObjSurvey::deleteSurveyRecord(), ilObjTest::deleteTest(), ilObjContentObject::getDataDirectory(), ilObjFile::getDirectory(), ilObjSurveyQuestionPool::getExportDirectory(), ilObjSurvey::getExportDirectory(), ilObjGlossary::getExportDirectory(), ilObjContentObject::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 1590 of file class.ilUtil.php.

Referenced by ilObjMediaObjectGUI::editFilesObject(), 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::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 2010 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 1623 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 110 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 58 of file class.ilUtil.php.

References $ilias, and $styleDefinition.

Referenced by ilSearchGUI::__addAction(), ilSearchAdministrationGUI::__formatTitle(), ilObjUserFolderGUI::__showAppliedUsersTable(), ilObjCourseGUI::__showArchivesAdminTable(), ilObjCourseGUI::__showArchivesTable(), ilObjRoleGUI::__showAssignedUsersTable(), ilObjectGUI::__showClipboardTable(), ilObjCourseGUI::__showDeleteMembersTable(), ilObjCourseGUI::__showDeleteSubscriberTable(), ilObjCourseGUI::__showEditMemberTable(), ilSearchAdministrationGUI::__showFolders(), ilSearchAdministrationGUI::__showHeader(), ilPaymentShoppingCartGUI::__showItemsTable(), ilObjGroupGUI::__showMembersTable(), ilObjExerciseGUI::__showMembersTable(), ilObjCourseGUI::__showMembersTable(), ilObjChatGUI::__showOnlineUsers(), ilObjUserGUI::__showRolesTable(), ilObjRoleFolderGUI::__showRolesTable(), ilObjCategoryGUI::__showRolesTable(), ilObjRoleGUI::__showSearchGroupTable(), ilObjGroupGUI::__showSearchGroupTable(), ilObjCourseGUI::__showSearchGroupTable(), ilObjRoleGUI::__showSearchRoleTable(), ilObjGroupGUI::__showSearchRoleTable(), ilObjCourseGUI::__showSearchRoleTable(), ilPaymentTrusteeGUI::__showSearchUserTable(), ilObjPaymentSettingsGUI::__showSearchUserTable(), ilObjRoleGUI::__showSearchUserTable(), ilObjGroupGUI::__showSearchUserTable(), ilObjCourseGUI::__showSearchUserTable(), ilObjCourseGUI::__showSubscribersTable(), ilPaymentTrusteeGUI::__showTrusteesTable(), ilObjCategoryGUI::__showUsersTable(), ilObjPaymentSettingsGUI::__showVendorsTable(), ilPaymentObjectGUI::addPrice(), ilCourseContentInterface::cci_edit(), ilCourseContentInterface::cci_view(), ilObjGroupGUI::changeMemberObject(), ilObjContentObjectGUI::chapters(), ilConditionHandlerInterface::chi_list(), ilObjGroupGUI::confirmationObject(), ilObjGlossaryGUI::confirmDeleteExportFile(), ilObjContentObjectGUI::confirmDeleteExportFile(), ilObjSurveyQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjSurveyGUI::confirmDeleteExportFileObject(), ilObjTestGUI::confirmDeleteExportFileObject(), ilObjQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjMediaPoolGUI::confirmRemove(), ilObjGlossaryGUI::confirmTermDeletion(), ilRepositoryGUI::copyChilds(), ilObjForumGUI::createObject(), ilObjContentObjectGUI::delete(), ilBookmarkAdministrationGUI::delete(), ilObjectGUI::deleteObject(), ilObjQuestionPoolGUI::deleteQuestionsObject(), ilObjExerciseGUI::deliverObject(), ilObjCourseGUI::detailsObject(), ilPersonalDesktopGUI::displayBookmarks(), ilPersonalDesktopGUI::displayUsersOnline(), ilPCTableGUI::edit(), ilObjUserFolderGUI::editAppliedUsersObject(), ilPaymentObjectGUI::editDetails(), ilObjMediaObjectGUI::editFilesObject(), ilObjMediaObjectGUI::editMapAreasObject(), ilObjTypeDefinitionGUI::editObject(), ilObjForumGUI::editObject(), ilPaymentObjectGUI::editPrices(), ASS_ImagemapQuestionGUI::editQuestion(), ilPaymentStatisticGUI::editStatistic(), ilObjPaymentSettingsGUI::editStatisticObject(), ilObjPaymentSettingsGUI::editVendor(), ilObjSurveyGUI::evaluationObject(), exercise(), ilObjContentObject::exportHTML(), ilObjGlossaryGUI::exportList(), ilObjContentObjectGUI::exportList(), ilObjSurveyQuestionPoolGUI::exportObject(), ilObjSurveyGUI::exportObject(), ilObjTestGUI::exportObject(), ilObjQuestionPoolGUI::exportObject(), ilSCORMPresentationGUI::finishSahs(), ilForumExplorer::formatHeader(), ilSCORMExplorer::formatObject(), ilHACPExplorer::formatObject(), ilPublicSectionSelector::formatObject(), ilAICCExplorer::formatObject(), ilForumExplorer::formatObject(), ilFileExplorer::formatObject(), ilObjPaymentSettingsGUI::generalSettingsObject(), ilLMTOCExplorer::getImage(), ilTableOfContentsExplorer::getImage(), ilExplorer::getImage(), ilSCORMExplorer::getOutputIcons(), ilObjSurvey::getQuestionblocksTable(), ilObjSurveyQuestionPool::getQuestionsTable(), ilObjSurvey::getQuestionsTable(), ilObjQuestionPool::getQuestionsTable(), ilPersonalDesktopGUI::getSelectedItemBlockHTML(), ilLMPresentationGUI::ilLMNavigation(), ilLMPresentationGUI::ilMedia(), ilObjUserGUI::insertPublicProfile(), ilSCORMPresentationGUI::launchSahs(), ilHACPPresentationGUI::launchSahs(), ilAICCPresentationGUI::launchSahs(), ilObjContentObjectGUI::linkChecker(), ilFileSystemGUI::listFiles(), ilObjMediaPoolGUI::listMedia(), ilObjAssessmentFolderGUI::logsObject(), ilObjTestGUI::marksObject(), ilObjTestGUI::outEvalSearchResultTable(), ilObjTestGUI::outIntroductionPage(), ilObjTestGUI::outTestResults(), ilObjSurveyGUI::outUserGroupTable(), ASS_OrderingQuestionGUI::outUserSolution(), ASS_MultipleChoiceGUI::outUserSolution(), ASS_MatchingQuestionGUI::outUserSolution(), ASS_ClozeTestGUI::outUserSolution(), ilObjContentObjectGUI::pages(), ilObjPaymentSettingsGUI::payMethodsObject(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjSurveyQuestionPoolGUI::phrasesObject(), ilObjCourseGUI::printMembersObject(), ilObjContentObjectGUI::properties(), ilObjSurveyGUI::propertiesObject(), ilObjTestGUI::propertiesObject(), ilObjSurveyGUI::questionBrowser(), ilObjTestGUI::questionBrowser(), ilObjSurveyQuestionPoolGUI::questionsObject(), ilObjSurveyGUI::questionsObject(), ilObjTestGUI::questionsObject(), ilObjQuestionPoolGUI::questionsObject(), ilTableGUI::render(), ilObjTestGUI::runObject(), ilObjSurveyGUI::searchQuestionsForm(), ilObjectGUIAdapter::setAdminTabs(), ilObjectGUI::setAdminTabs(), ilRepositoryGUI::setHeader(), ilMainMenuGUI::setTemplateVars(), ilObjContentObjectGUI::showActions(), ilLMObjectGUI::showActions(), ilObjUserFolderGUI::showActions(), ilObjectGUI::showActions(), ilPaymentBillAdminGUI::showBillData(), ilRepositoryGUI::showCategories(), ilRepositoryGUI::showCourses(), ilPurchaseBMFGUI::showCreditCard(), ilPurchaseBMFGUI::showDebitEntry(), ilPaymentPurchaseGUI::showDetails(), ilRepositoryGUI::showFiles(), ilRepositoryGUI::showForums(), ilRepositoryGUI::showLearningResources(), ilInternalLinkGUI::showLinkHelp(), ilObjMediaPoolGUI::showMedia(), ilObjGroupGUI::showNewRegistrationsObject(), ilPageObjectGUI::showPage(), ilPurchaseBMFGUI::showPaymentType(), ilPurchaseBMFGUI::showPersonalData(), ilLMPresentationGUI::showPrintView(), ilLMPresentationGUI::showPrintViewSelection(), ilCourseRegisterGUI::showRegistrationForm(), ilPaymentObjectGUI::showSelectedObject(), ilRepositoryGUI::showSurveys(), ilRepositoryGUI::showTests(), ilStructureObjectGUI::subchap(), ilStructureObjectGUI::view(), ilEditClipboardGUI::view(), ilBookmarkAdministrationGUI::view(), ilObjExerciseGUI::viewObject(), and ilObjChatGUI::viewObject().

        {
                global $ilias, $styleDefinition;

                if(defined("ILIAS_MODULE") and !defined("KEEP_IMAGE_PATH") and $mode != "filesystem")
                {
                        $dir = ".";
                }
                else
                {
                        $dir = "";
                }
                $base = "./";
                if ($in_module)
                {
                        $base.= ILIAS_MODULE."/";
                }
                $base .= "templates/";

                if (is_object($styleDefinition))
                {
                        $st_image_dir = $styleDefinition->getImageDirectory($ilias->account->prefs["style"]);
                        $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 
)

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 43 of file class.ilUtil.php.

References $lng.

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

        {
                global $lng;

                return "<img src=\"".$a_path."/images/"."icon_".$a_type."_b.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 1418 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  ) 

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

References $ilias.

Referenced by ilPurchaseBMFGUI::__buildStylesheet(), ilPaymentPurchaseGUI::__buildStylesheet(), ilPaymentBaseGUI::__buildStylesheet(), ilObjAssessmentFolderGUI::logsObject(), ilObjSurveyGUI::propertiesObject(), ilObjTestGUI::propertiesObject(), and ilMainMenuGUI::setTemplateVars().

        {
                global $ilias;

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

Here is the caller graph for this function:

ilUtil::getMemString (  ) 

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

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

ilUtil::getObjectsByOperations ( a_type,
a_operation,
a_checkpath = true 
)

Get all objects of a specific type and check access.

Get all objects of a specific type where access is granted for the given list of operations. 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::GetObjectsByOperations ("crs", "visible,read"); 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 'visible' and 'read' would actually permit the user to access course A.

public

Parameters:
string object type
string permissions to check e.g. 'visible','read'
boolean if true, access of all parent nodes of each found object are checked too (default is true)
Returns:
array returned objects

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

References $ilDB, $num, $path, $q, $rbacsystem, $row, and $tree.

Referenced by ilMainMenuGUI::_checkAdministrationPermission(), ilLOListGUI::displayList(), and ilChatRoom::getAllRooms().

        {
                global $ilDB, $rbacsystem, $tree;
                
                $objects = array();
                
                // return if root node ist not accessible
                if ($a_checkpath === true and !$rbacsystem->checkAccess('read', ROOT_FOLDER_ID, $a_type))
                {
                        return $objects;
                }

                // get all nodes of a_type that which are not deleted
                $q = "SELECT * FROM tree ".
                     "LEFT JOIN object_reference ON tree.child=object_reference.ref_id ".
                         "LEFT JOIN object_data ON object_reference.obj_id=object_data.obj_id ".
                         "WHERE object_data.type = '".$a_type."' ".
                         "AND tree.tree = 1";

                $r = $ilDB->query($q);
                
                // check the desired operation of all found nodes
                while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if ($rbacsystem->checkAccess($a_operation, $row["ref_id"], $a_type))
                        {
                                $objects[] = $row;
                        }
                }
                
                // check access of nodes up in the tree for all accessible nodes
                if ($a_checkpath === true)
                {
                        $nodes_checked = array(ROOT_FOLDER_ID);
                        $nodes_passed = array(ROOT_FOLDER_ID);

                        foreach ($objects as $key => $node)
                        {
                                $path = $tree->getPathId($node["ref_id"],ROOT_FOLDER_ID);
                                
                                array_push($nodes_checked,$node["ref_id"]);
                                array_push($nodes_passed,$node["ref_id"]);

                                if (($num = count($path)) > 2)
                                {
                                    for ($i = 1; $i <= ($num - 2); $i++)
                                    {
//echo "<br/>i:".$i;
                                                if (in_array($path[$i],$nodes_passed))
                                                {
//echo "<br/>".$i." already passed";
                                                        continue;
                                                }
                                                
                                                if (!in_array($path[$i],$nodes_checked))
                                                {
                                                    array_push($nodes_checked,$path[$i]);
//echo "<br/>".$i." add to checked";
                                                        if ($rbacsystem->checkAccess($a_operation, $path[$i], $a_type))
                                                        {
                                                            array_push($nodes_passed,$path[$i]);
//echo "<br/>".$i." add to passed";
                                                        }
                                                        else
                                                        {
                                                                unset($objects[$key]);
                                                                // break for
                                                                break;
                                                        }
                                                }
                                        } // end for
                                } // end if $num
//var_dump("<pre>",$node["ref_id"],$path,$num,"</pre>");
                        } // end foreach
//var_dump("<pre>",$nodes_checked,$nodes_passed,"</pre>");
                }
                
                unset($nodes_checked);
                unset($nodes_passed);

                return $objects;
        }

Here is the caller graph for this function:

ilUtil::getSelectName ( selected,
values 
)

???

public

Parameters:
string 
string 

Definition at line 240 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 153 of file class.ilUtil.php.

References $ilias.

Referenced by ilPurchaseBMFGUI::__buildStylesheet(), ilPaymentPurchaseGUI::__buildStylesheet(), ilPaymentBaseGUI::__buildStylesheet(), ilObjChatGUI::__loadStylesheet(), ilObjChatGUIAdapter::__setStyleSheetLocation(), ilInternalLinkGUI::changeTargetObject(), ilSCORMPresentationGUI::explorer(), ilHACPPresentationGUI::explorer(), ilObjMediaPoolGUI::explorer(), ilObjFileBasedLMGUI::explorer(), ilObjContentObjectGUI::explorer(), ilAICCPresentationGUI::explorer(), ilLMPresentationGUI::exportbibinfo(), ilObjContentObject::exportHTML(), ilSCORMPresentationGUI::finishSahs(), ilLMPresentationGUI::glossary(), ilLMPresentationGUI::ilMedia(), ilLMPresentationGUI::ilTOC(), ilLMPresentationGUI::layout(), ilLMPresentationGUI::offlineexport(), ilMainMenuGUI::setTemplateVars(), ilObjDlBookGUI::showAbstract(), ilObjDlBookGUI::showCitation(), ilLMPresentationGUI::showDownloadList(), ilWysiwygUtil::showFootnote(), ilWysiwygUtil::showItl(), ilInternalLinkGUI::showLinkHelp(), ilPageObjectGUI::showMediaFullscreen(), ilWysiwygUtil::showMoveCopyQuestion(), ilLMPresentationGUI::showPrintViewSelection(), ilLMPresentationGUI::showTableOfContents(), ilWysiwygUtil::showXtl(), ilSCORMPresentationGUI::unloadSahs(), ilSCORMPresentationGUI::view(), and ilAICCPresentationGUI::view().

        {
                global $ilias;

                if(defined("ILIAS_MODULE") && $mode != "filesystem")
                {
                        $base = "../";
                }
                else
                {
                        $base = "./";
                }
                return $base."templates/".$ilias->account->skin."/".$ilias->account->prefs["style"].".css";
        }

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 1072 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";
                $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 1031 of file class.ilUtil.php.

References $ilias.

Referenced by ilObjMediaObject::_getDirectory(), ilObjMediaObjectGUI::assignFullscreenObject(), ilObjMediaObjectGUI::assignStandardObject(), ilContObjParser::copyMobFiles(), ilObjSAHSLearningModule::createDataDirectory(), ilObjMediaObjectGUI::createDirectoryObject(), ilObjMediaObjectGUI::deleteFileObject(), ilPersonalDesktopGUI::displayUsersOnline(), ilObjMediaObjectGUI::editFilesObject(), ilObjMediaObjectGUI::editMapArea(), ilObjMediaObjectGUI::editMapAreasObject(), ilObjMediaObject::exportFiles(), ilObjContentObject::exportHTMLMOB(), ilObjStyleSheet::getContentStylePath(), ilObjSAHSLearningModule::getDataDirectory(), ilObjFileBasedLM::getDataDirectory(), ilObjMediaObject::getDataDirectory(), ilFileDataCourse::getOnlineLink(), ilLMPresentationGUI::ilMedia(), ilObjUserGUI::insertPublicProfile(), removePicture(), ilObjMediaPoolGUI::showMedia(), ilPageObjectGUI::showMediaFullscreen(), ilPageObjectGUI::showPage(), upload_file(), ilObjMediaObjectGUI::uploadFileObject(), 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 2099 of file class.ilUtil.php.

References $ilDB, $ilErr, and $q.

Referenced by ilMail::checkRecipients(), ilObjGroup::ilClone(), ilObjGroupGUI::saveObject(), and ilObjGroupGUI::updateObject().

        {
                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() == 1)
                {
                        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 1249 of file class.ilUtil.php.

References escapeShellArg().

Referenced by 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 1103 of file class.ilUtil.php.

References createDirectory(), and getDataDir().

Referenced by ilFileDataExercise::downloadAllDeliveredFiles(), ilExerciseMembers::downloadMultipleFiles(), and ilImagemapPreview::ilImagemapPreview().

        {
                $temp_path = ilUtil::getDataDir() . "/temp";
                if (!is_dir($temp_path))
                {
                        ilUtil::createDirectory($temp_path);
                }
                $temp_name = tempnam($temp_path, "tmp");
                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 2081 of file class.ilUtil.php.

Referenced by ilObjContentObject::modifyExportIdentifier(), 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::is_email ( a_email  ) 

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

Referenced by ilSoapUserAdministration::__validateUserData(), ilSetup::checkClientContact(), ilMail::checkRecipients(), ilObjSystemFolderGUI::displayBasicSettings(), ilSetupGUI::displayContactData(), ilMail::getEmailOfSender(), saveForm(), ilObjUserGUI::saveObject(), ilObjUserGUI::updateObject(), and ilObjCourse::validate().

        {
                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|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 2295 of file class.ilUtil.php.

Referenced by ilRepositoryGUI::ilRepositoryGUI().

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

Here is the caller graph for this function:

ilUtil::isLogin ( a_login  ) 

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

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

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

                if (strlen($a_login) < 4)
                {
                        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 865 of file class.ilUtil.php.

Referenced by ilSoapUserAdministration::__validateUserData(), change_password(), saveForm(), ilObjUserGUI::saveObject(), 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 (  ) 

Definition at line 2165 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 2300 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 549 of file class.ilUtil.php.

References $params.

Referenced by 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);
                        $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 .= "<font color='Gray'>[<b>".$i."</b>]</font> ";
                                }
                                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 646 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 = "" 
)

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 712 of file class.ilUtil.php.

References $lng.

Referenced by ilObjAssessmentFolderGUI::logsObject(), ilObjSurveyGUI::propertiesObject(), and ilObjTestGUI::propertiesObject().

        {
                global $lng;

                if (!strlen("$year$month$day")) {
                        $now = getdate();
                        $year = $now["year"];
                        $month = $now["mon"];
                        $day = $now["mday"];
                } else {
                        // delete leading zeros
                        $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++)
                {
                        $sel_month .= "<option value=\"$i\">" . $lng->txt("month_" . sprintf("%02d", $i) . "_long") . "</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 1453 of file class.ilUtil.php.

References $path.

Referenced by ilFileDataCourse::__checkPath(), ilFileDataChat::__createDirectory(), ilFileDataCourse::__initDirectory(), ilFileDataExercise::__initDirectory(), ilPurchaseBMFGUI::__sendBill(), ilFileDataImportMail::_initDirectory(), ilFileDataImportGroup::_initDirectory(), ilFileDataImportForum::_initDirectory(), ilFileDataImport::_initDirectory(), ilFileDataCourse::addDirectory(), ilGlossaryExport::buildExportFile(), ilContObjectExport::buildExportFileXML(), ilTestExport::buildExportFileXML(), ilQuestionpoolExport::buildExportFileXML(), ilContObjParser::copyFileItems(), ilContObjParser::copyMobFiles(), ilClient::create(), ilObjSAHSLearningModule::createDataDirectory(), ilObjFileBasedLM::createDataDirectory(), createDirectory(), ilObjFile::createDirectory(), ilFileSystemGUI::createDirectory(), ilObjMediaObjectGUI::createDirectoryObject(), ilObjSurveyQuestionPool::createExportDirectory(), ilObjSurvey::createExportDirectory(), ilObjGlossary::createExportDirectory(), ilObjContentObject::createExportDirectory(), ilObjTest::createExportDirectory(), ilObjQuestionPool::createExportDirectory(), ilObjSurveyQuestionPool::createImportDirectory(), ilObjSurvey::createImportDirectory(), ilObjGlossary::createImportDirectory(), ilObjContentObject::createImportDirectory(), ilObjTest::createImportDirectory(), ilObjQuestionPool::createImportDirectory(), ilFileDataCourse::createOnlineVersion(), ilFileDataExercise::deliverFile(), ilObjFile::export(), ilObjMediaObject::exportFiles(), ilObjContentObject::exportHTML(), ilObjContentObject::exportHTMLFile(), ilObjContentObject::exportHTMLMOB(), ilObjFile::getUploadFile(), 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 1487 of file class.ilUtil.php.

Referenced by ASS_JavaApplet::duplicateApplet(), ASS_ImagemapQuestion::duplicateImage(), ASS_OrderingQuestion::duplicateImages(), ASS_MatchingQuestion::duplicateImages(), SurveyQuestion::duplicateMaterials(), ASS_OrderingQuestion::from_xml(), ASS_MatchingQuestion::from_xml(), ASS_JavaApplet::from_xml(), ASS_ImagemapQuestion::from_xml(), ilObjSurvey::getImportDirectory(), ASS_OrderingQuestion::set_image_file(), ASS_MatchingQuestion::set_image_file(), ASS_ImagemapQuestion::set_image_filename(), ASS_JavaApplet::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 (! 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 = "" 
)

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 786 of file class.ilUtil.php.

References $lng.

Referenced by ilObjAssessmentFolderGUI::logsObject(), ASS_TextQuestionGUI::outOtherQuestionData(), ASS_OrderingQuestionGUI::outOtherQuestionData(), ASS_MultipleChoiceGUI::outOtherQuestionData(), ASS_MatchingQuestionGUI::outOtherQuestionData(), ASS_JavaAppletGUI::outOtherQuestionData(), ASS_ImagemapQuestionGUI::outOtherQuestionData(), ASS_ClozeTestGUI::outOtherQuestionData(), and ilObjTestGUI::propertiesObject().

        {
                global $lng;

                if (!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"];
                $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 
)

move uploaded file

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

References $ilias, $lng, sendInfo(), and virusHandling().

Referenced by ilObjCategoryGUI::_importCategories(), ilPCMediaObjectGUI::create(), ilFileDataExercise::deliverFile(), ilObjFile::getUploadFile(), ilObjGlossaryGUI::importFileObject(), ilObjContentObjectGUI::importFileObject(), ilObjSurvey::importObject(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilObjMediaObjectGUI::saveObject(), ilObjMediaObjectGUI::savePropertiesObject(), ASS_OrderingQuestion::set_image_file(), ASS_MatchingQuestion::set_image_file(), ASS_ImagemapQuestion::set_image_filename(), ASS_JavaApplet::setJavaAppletFilename(), SurveyQuestion::setMaterialsfile(), ilFileDataMail::storeUploadedFile(), ilFileDataImportMail::storeUploadedFile(), ilFileDataImportGroup::storeUploadedFile(), ilFileDataImportForum::storeUploadedFile(), ilFileDataForum::storeUploadedFile(), ilFileDataExercise::storeUploadedFile(), upload_file(), ilObjMediaObjectGUI::uploadFileObject(), ilObjSAHSLearningModuleGUI::uploadObject(), ilObjTestGUI::uploadObject(), ilObjQuestionPoolGUI::uploadObject(), ilObjQuestionPoolGUI::uploadQplObject(), ilObjSurveyQuestionPoolGUI::uploadQuestionsObject(), and ilObjSurveyQuestionPoolGUI::uploadSplObject().

        {
                global $lng, $ilias;
//echo "<br>ilUtli::moveuploadedFile($a_name)";
                if (!is_file($a_file))
                {
                        $lng->txt("upload_error_file_not_found");
                }

                // virus handling
                $vir = ilUtil::virusHandling($a_file, $a_name);
                if (!$vir[0])
                {
                        unlink($a_file);
                        if ($a_raise_errors)
                        {
                                $ilias->raiseError($lng->txt("file_is_infected")."<br />".
                                        $vir[1],
                                        $ilias->error_obj->MESSAGE);
                        }
                        else
                        {
                                sendInfo($lng->txt("file_is_infected")."<br />".
                                        $vir[1], true);
                        }
                        return false;
                }
                else
                {
                        if ($vir[1] != "")
                        {
                                sendInfo($vir[1], true);
                        }
                        return move_uploaded_file($a_file, $a_target);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::prepareDBString ( a_str  ) 

prepare a string for db writing (insert/update)

Parameters:
string $a_str string
Returns:
string escaped string

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

Referenced by ilForumImportParser::__addTopic(), ilObjSystemFolder::addHeaderTitleTranslation(), ilObjCategory::addTranslation(), ilGlossaryTerm::create(), ilGlossaryDefinition::create(), ilObject::create(), ilPageObject::createFromXML(), db_session_write(), ilForum::generatePost(), ilForum::generateThread(), ilObjForum::ilClone(), ilLMPresentationGUI::lmAccess(), and ilObjUser::saveAsNew().

        {
                return addslashes($a_str);
        }

Here is the caller graph for this function:

ilUtil::prepareFormOutput ( a_str,
a_strip = false 
)

prepares string output for html forms public

Parameters:
string 
boolean true: strip slashes, if magic_quotes is enabled use this if $a_str comes from $_GET or $_POST var, use false, if $a_str comes from database
Returns:
string

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

References stripSlashes().

Referenced by ilObjSurveyGUI::addHeadingObject(), ilObjSystemFolderGUI::changeHeaderTitleObject(), ilObjSurveyQuestionPoolGUI::createObject(), ilObjSurveyGUI::createObject(), ilObjGlossaryGUI::createObject(), ilObjContentObjectGUI::createObject(), ilObjUserGUI::createObject(), ilObjRoleTemplateGUI::createObject(), ilObjRoleGUI::createObject(), ilObjGroupGUI::createObject(), ilObjFolderGUI::createObject(), ilObjFileGUI::createObject(), ilObjectGUI::createObject(), ilObjCategoryGUI::createObject(), ilObjTestGUI::createObject(), ilObjQuestionPoolGUI::createObject(), ilObjSystemFolderGUI::displayBasicSettings(), ilSetupGUI::displayContactData(), displayForm(), ilObjUserGUI::editObject(), ilObjRoleTemplateGUI::editObject(), ilObjRoleGUI::editObject(), ilObjGroupGUI::editObject(), ilObjForumGUI::editObject(), ilObjFileGUI::editObject(), ilObjExerciseGUI::editObject(), ilObjectGUI::editObject(), ilObjCourseGUI::editObject(), ilObjCategoryGUI::editObject(), ilObjPaymentSettingsGUI::editVendor(), ilObjTestGUI::evalSelectedUsersObject(), ilObjTestGUI::evaluationDetailObject(), ilObjSurveyGUI::evaluationuserObject(), ilBibItemGUI::fill(), ilMetaDataGUI::fillAnnotation(), ilMetaDataGUI::fillClassification(), ilMetaDataGUI::fillEducational(), ilMetaDataGUI::fillGeneral(), ilMetaDataGUI::fillLifecycle(), ilMetaDataGUI::fillMetaMetadata(), ilMetaDataGUI::fillRelation(), ilMetaDataGUI::fillTechnical(), ilObjPaymentSettingsGUI::generalSettingsObject(), ilObjAssessmentFolderGUI::logsObject(), ilObjExerciseGUI::membersObject(), ilObjSurveyGUI::propertiesObject(), ilObjTestGUI::propertiesObject(), ilObjCourseGUI::searchUserObject(), ilPaymentBillAdminGUI::showBillData(), ilPurchaseBMFGUI::showCreditCard(), ilPurchaseBMFGUI::showDebitEntry(), ilPurchaseBMFGUI::showPersonalData(), ilPaymentStatisticGUI::showStatistics(), and ilObjPaymentSettingsGUI::statisticObject().

        {
                if($a_strip)
                {
                        $a_str = ilUtil::stripSlashes($a_str);
                }
                return htmlspecialchars($a_str);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::rCopy ( a_sdir,
a_tdir 
)

Copies content of a directory $a_sdir recursively to a directory $a_tdir.

Parameters:
string $a_sdir source directory
string $a_tdir target directory
Returns:
boolean TRUE for sucess, FALSE otherwise public

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

References $file, and makeDir().

Referenced by ilContObjParser::copyFileItems(), ilContObjParser::copyMobFiles(), ilObjDlBook::export(), ilObjFile::export(), ilObjMediaObject::exportFiles(), ilObjContentObject::exportHTMLMOB(), and ilObjFile::ilClone().

        {
                // check if arguments are directories
                if (!@is_dir($a_sdir) or
                !@is_dir($a_tdir))
                {
                        return FALSE;
                }

                // read a_sdir, copy files and copy directories recursively
                $dir = opendir($a_sdir);

                while($file = readdir($dir))
                {
                        if ($file != "." and
                        $file != "..")
                        {
                                // directories
                                if (@is_dir($a_sdir."/".$file))
                                {
                                        if (!@is_dir($a_tdir."/".$file))
                                        {
                                                if (!ilUtil::makeDir($a_tdir."/".$file))
                                                return FALSE;

                                                //chmod($a_tdir."/".$file, 0775);
                                        }

                                        if (!ilUtil::rCopy($a_sdir."/".$file,$a_tdir."/".$file))
                                        {
                                                return FALSE;
                                        }
                                }

                                // files
                                if (@is_file($a_sdir."/".$file))
                                {
                                        if (!copy($a_sdir."/".$file,$a_tdir."/".$file))
                                        {
                                                return FALSE;
                                        }
                                }
                        }
                }
                return TRUE;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::redirect ( a_script  ) 

http redirect to other script

Parameters:
string $a_script target script

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

References $log, and exit.

Referenced by ilObjSurvey::_goto(), ilStructureObject::_goto(), ilObjContentObject::_goto(), ilLMPageObject::_goto(), ilGlossaryTerm::_goto(), ilObjForum::_goto(), ilObjExercise::_goto(), ilObjTest::_goto(), ilObjCategoryGUI::_importCategories(), ilObjUserGUI::activeRoleSaveObject(), ilObjectGUI::addRoleObject(), ilObjCategoryGUI::addTranslationObject(), ilObjGroupGUI::addUserObject(), ilObjRoleTemplateGUI::adoptPermSaveObject(), ilObjRoleGUI::adoptPermSaveObject(), ilObjRoleFolderGUI::adoptPermSaveObject(), ilObjGroupGUI::assignApplicantsObject(), ilObjGroupGUI::assignMemberObject(), ilObjRoleGUI::assignUserObject(), SurveyQuestionGUI::cancel(), ilPurchaseBMFGUI::cancel(), ilLMPageObjectGUI::cancel(), ASS_QuestionGUI::cancel(), ilObjSysUserTrackingGUI::cancelDeleteDataObject(), ilObjSurveyGUI::cancelDeleteExportFileObject(), ilObjTestGUI::cancelDeleteExportFileObject(), ilObjectGUI::cancelDeleteObject(), ilObjGroupGUI::cancelMemberObject(), ilObjCourseGUI::cancelMemberObject(), ilObjUserGUI::cancelObject(), ilObjRoleGUI::cancelObject(), ilObjFileGUI::cancelObject(), ilObjectGUI::cancelObject(), ilObjTestGUI::cancelPropertiesObject(), SurveyQuestionGUI::cancelSync(), ASS_QuestionGUI::cancelSync(), ilSetupGUI::changeAccessMode(), ilSetupGUI::changeDefaultClient(), ilSetupGUI::changeMasterPassword(), ilSetupGUI::changeMasterSettings(), ilObjectGUI::clearObject(), ilObjSurveyGUI::cloneAllObject(), ilObjTestGUI::cloneAllObject(), ilObjectGUI::cloneObject(), ilSetupGUI::cmdClient(), ilObjSurveyGUI::codesObject(), ilObjUserFolderGUI::confirmedDeleteObject(), ilObjRoleFolderGUI::confirmedDeleteObject(), ilObjectGUI::confirmedDeleteObject(), ilObjGroupGUI::confirmedRemoveMemberObject(), ilObjectGUI::copyObject(), ilObjSurveyQuestionPoolGUI::createExportFileObject(), ilObjSurveyGUI::createExportFileObject(), ilObjectGUI::cutObject(), ilObjRoleGUI::deassignUserObject(), ilObjSysUserTrackingGUI::deleteDataObject(), ilObjSurveyGUI::deleteExportFileObject(), ilObjTestGUI::deleteExportFileObject(), ilSetupGUI::displayDeleteConfirmation(), ilSetupGUI::displayLogin(), ilSetupGUI::displayMasterSetup(), ilObjMediaObjectGUI::editImagemapForwardObject(), ilErrorHandling::errorHandler(), ilRepositoryGUI::executeAdminCommand(), ilObjMediaPoolGUI::executeCommand(), ilObjTestGUI::executeCreateQuestionObject(), ilObjSurveyGUI::exportObject(), ilObjTestGUI::exportObject(), ILIAS::ILIAS(), ilObjUserFolderGUI::importCancelledObject(), ilObjRootFolderGUI::importCancelledObject(), ilObjCategoryGUI::importCancelledObject(), ilObjSurveyQuestionPoolGUI::importFileObject(), ilObjSurveyGUI::importFileObject(), ilObjGlossaryGUI::importFileObject(), ilObjContentObjectGUI::importFileObject(), ilObjTestGUI::importFileObject(), ilObjQuestionPoolGUI::importFileObject(), ilObjUserFolderGUI::importUsersObject(), ilEditClipboardGUI::insert(), ilObjSurveyGUI::inviteObject(), ilRepositoryGUI::linkChilds(), ilObjectGUI::linkObject(), ilRepositoryGUI::linkSelector(), ilSetupGUI::loginClient(), ilObjSurveyGUI::maintenanceObject(), ilObjTestGUI::maintenanceObject(), ilObjTestGUI::marksObject(), ilLMPresentationGUI::offlineexport(), ilObjectGUI::pasteObject(), ilRepositoryGUI::performCopy(), ilObjMailGUI::performImportObject(), ilObjGroupGUI::performImportObject(), ilObjForumGUI::performImportObject(), ilObjSurveyQuestionPoolGUI::permSaveObject(), ilObjSurveyGUI::permSaveObject(), ilObjRoleTemplateGUI::permSaveObject(), ilObjRoleGUI::permSaveObject(), ilObjectGUI::permSaveObject(), ilObjTestGUI::permSaveObject(), ilObjSurveyGUI::propertiesObject(), ilObjTestGUI::propertiesObject(), ilObjSurveyGUI::questionsObject(), ilObjTestGUI::questionsObject(), ilObjGroupGUI::refuseApplicantsObject(), ilObjRecoveryFolderGUI::removeFromSystemObject(), ilObjectGUI::removeFromSystemObject(), ilObjCategoryGUI::removeTranslationObject(), ilObjSurveyGUI::runObject(), ilObjTestGUI::runObject(), ilObjSurveyGUI::runShowIntroductionPage(), SurveyQuestionGUI::save(), ilLMPageObjectGUI::save(), ASS_QuestionGUI::save(), ilObjSystemFolderGUI::saveBenchSettingsObject(), ASS_QuestionGUI::saveEdit(), saveForm(), ilObjAuthSettingsGUI::saveLDAPObject(), ilObjSurveyGUI::saveMetaObject(), ilObjSAHSLearningModuleGUI::saveMetaObject(), ilObjGlossaryGUI::saveMetaObject(), ilObjFileBasedLMGUI::saveMetaObject(), ilObjContentObjectGUI::saveMetaObject(), ilObjTestGUI::saveMetaObject(), ilObjQuestionPoolGUI::saveMetaObject(), ilObjSurveyQuestionPoolGUI::saveObject(), ilObjSurveyGUI::saveObject(), ilObjSAHSLearningModuleGUI::saveObject(), ilObjMediaPoolGUI::saveObject(), ilObjGlossaryGUI::saveObject(), ilObjFileBasedLMGUI::saveObject(), ilObjContentObjectGUI::saveObject(), GUI::saveObject(), ilObjUserGUI::saveObject(), ilObjRoleTemplateGUI::saveObject(), ilObjRoleGUI::saveObject(), ilObjRoleFolderGUI::saveObject(), ilObjGroupGUI::saveObject(), ilObjFolderGUI::saveObject(), ilObjFileGUI::saveObject(), ilObjCourseGUI::saveObject(), ilObjCategoryGUI::saveObject(), ilObjAuthSettingsGUI::saveObject(), ilObjChatGUI::saveObject(), ilObjTestGUI::saveObject(), ilObjQuestionPoolGUI::saveObject(), ilObjAuthSettingsGUI::saveScriptObject(), ilObjSysUserTrackingGUI::saveSettingsObject(), ilObjGlossaryGUI::saveTerm(), ilObjGroupGUI::searchCancelledObject(), ilObjAuthSettingsGUI::setAuthModeObject(), ilObjFileBasedLMGUI::showLearningModule(), ilObjForumGUI::showThreadsObject(), ilObjSystemFolderGUI::switchBenchModuleObject(), SurveyQuestionGUI::sync(), ASS_QuestionGUI::sync(), ilSetupGUI::toggleClientList(), ilObjectGUI::undeleteObject(), ilObjGroupGUI::updateMemberStatusObject(), ilObjSurveyGUI::updateObject(), ilObjUserGUI::updateObject(), ilObjRoleTemplateGUI::updateObject(), ilObjRoleGUI::updateObject(), ilObjGroupGUI::updateObject(), ilObjFileGUI::updateObject(), ilObjectGUI::updateObject(), ilObjCategoryGUI::updateObject(), upload_file(), ilObjSurveyGUI::uploadObject(), ilObjMailGUI::uploadObject(), ilObjTestGUI::uploadObject(), ilObjQuestionPoolGUI::uploadQplObject(), and ilObjSurveyQuestionPoolGUI::uploadSplObject().

        {
                global $log;

                header("Location: ".$a_script);
                exit();
        }

Here is the caller graph for this function:

ilUtil::removeItemFromDesktops ( a_id  ) 

removes object from all user's desktops public

Parameters:
integer ref_id
Returns:
array user_ids of all affected users

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

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

Referenced by ilObjectGUI::confirmedDeleteObject(), and ilObjectGUI::pasteObject().

        {
                global $ilias;

                $q = "SELECT user_id FROM desktop_item WHERE item_id = '".$a_id."'";
                $r = $ilias->db->query($q);

                $users = array();

                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $users[] = $row->user_id;
                } // while

                if (count($users) > 0)
                {
                        $q = "DELETE FROM desktop_item WHERE item_id = '".$a_id."'";
                        $ilias->db->query($q);
                }

                return $users;
        }

Here is the caller graph for this function:

ilUtil::removeTrailingPathSeparators ( path  ) 
ilUtil::renameExecutables ( a_dir  ) 

rename uploaded executables for security reasons

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

References rRenameSuffix().

Referenced by ilPCMediaObjectGUI::create(), ilFileSystemGUI::renameFile(), ilObjMediaObjectGUI::saveObject(), ilFileSystemGUI::unzipFile(), ilFileSystemGUI::uploadFile(), ilObjMediaObjectGUI::uploadFileObject(), and ilObjSAHSLearningModuleGUI::uploadObject().

        {
                ilUtil::rRenameSuffix($a_dir, "php", "sec");
                ilUtil::rRenameSuffix($a_dir, "php3", "sec");
                ilUtil::rRenameSuffix($a_dir, "php4", "sec");
                ilUtil::rRenameSuffix($a_dir, "inc", "sec");
                ilUtil::rRenameSuffix($a_dir, "lang", "sec");
                ilUtil::rRenameSuffix($a_dir, "phtml", "sec");
                ilUtil::rRenameSuffix($a_dir, "htaccess", "sec");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::replaceUrlParameterString ( url,
parametersArray 
)

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

References KT_replaceParam().

                                                                    {
                
                foreach ($parametersArray as $paramName => $paramValue ) {
                        $url = ilUtil::KT_replaceParam($url, $paramName, $paramValue);
                }
                return $url;
        }

Here is the call graph for this function:

ilUtil::rRenameSuffix ( a_dir,
a_old_suffix,
a_new_suffix 
)

Copies content of a directory $a_sdir recursively to a directory $a_tdir.

Parameters:
string $a_sdir source directory
string $a_tdir target directory
Returns:
boolean TRUE for sucess, FALSE otherwise public

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

References $file, and $pos.

Referenced by renameExecutables().

        {
                if ($a_dir == "/" || $a_dir == "" || is_int(strpos($a_dir, "..")))
                {
                        return false;
                }

                // check if argument is directory
                if (!@is_dir($a_dir))
                {
                        return false;
                }

                // read a_dir
                $dir = opendir($a_dir);

                while($file = readdir($dir))
                {
                        if ($file != "." and
                        $file != "..")
                        {
                                // directories
                                if (@is_dir($a_dir."/".$file))
                                {
                                        ilUtil::rRenameSuffix($a_dir."/".$file, $a_old_suffix, $a_new_suffix);
                                }

                                // files
                                if (@is_file($a_dir."/".$file))
                                {
                                        $path_info = pathinfo($a_dir."/".$file);
                                        if (strtolower($path_info["extension"]) ==
                                        strtolower($a_old_suffix))
                                        {
                                                $pos = strrpos($a_dir."/".$file, ".");
                                                $new_name = substr($a_dir."/".$file, 0, $pos).".".$a_new_suffix;
                                                rename($a_dir."/".$file, $new_name);
                                        }
                                }
                        }
                }
                return true;
        }

Here is the caller graph for this function:

ilUtil::searchGroups ( a_search_str  ) 

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

References $ilDB, $q, $res, and $row.

Referenced by ilMail::getEmailsOfRecipients(), and ilMail::getUserIds().

        {
                global $ilDB;

                $q = "SELECT * ".
                "FROM object_data ,object_reference ".
                "WHERE (object_data.title LIKE '%".$a_search_str."%' ".
                "OR object_data.description LIKE '%".$a_search_str."%') ".
                "AND object_data.type = 'grp' ".
                "AND object_data.obj_id = object_reference.obj_id";

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

                while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        // STORE DATA IN ARRAY WITH KEY obj_id
                        // SO DUPLICATE ENTRIES ( LINKED OBJECTS ) ARE UNIQUE
                        $ids[$row->obj_id] = array(
                        "ref_id"        => $row->ref_id,
                        "title"         => $row->title,
                        "description"   => $row->description);
                }

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

Here is the caller graph for this function:

ilUtil::setPathStr ( a_path  ) 

??? public

Parameters:
string 

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

        {
                if ("" != $a_path && "/" != substr($a_path, -1))
                {
                        $a_path .= "/";
                        //$a_path = substr($a_path,1);
                }

                //return getcwd().$a_path;
                return $a_path;
        }

ilUtil::shortenText ( a_str,
a_len,
a_dots = "false" 
)

shorten a string to given length.

Adds 3 dots at the end of string (optional) TODO: do not cut within words (->wordwrap function) public

Parameters:
string string to be shortened
integer string length in chars
boolean adding 3 dots (true) or not (false, default)
Returns:
string shortended string

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

Referenced by ilObject::create(), ilPublicSectionSelector::formatHeader(), ilMediaPoolExplorer::formatHeader(), ilLMExplorer::formatHeader(), ilLMEditorExplorer::formatHeader(), ilSCORMExplorer::formatObject(), ilHACPExplorer::formatObject(), ilPublicSectionSelector::formatObject(), ilAICCExplorer::formatObject(), ilExplorer::formatObject(), ilLMPresentationGUI::ilLMNavigation(), ilLMPresentationGUI::ilLocator(), ilObject::setDescription(), ilObject::setTitle(), updateObject(), and ilGlossaryDefinition::updateShortText().

        {
                if (strlen($a_str) > $a_len)
                {

                        $a_str = substr($a_str,0,$a_len);

                        if ($a_dots)
                        {
                                $a_str .= "...";
                        }
                }

                return $a_str;
        }

Here is the caller graph for this function:

ilUtil::showTabs ( a_hl,
a_o 
)

show the tabs in admin section

public

Parameters:
integer column to highlight
array array with templatereplacements

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

References $lng, and $tab.

        {
                global $lng;

                $tpltab = new ilTemplate("tpl.tabs.html", true, true);

                for ($i=1; $i<=4; $i++)
                {
                        $tpltab->setCurrentBlock("tab");
                        if ($a_hl == $i)
                        {
                                $tabtype = "tabactive";
                                $tab = $tabtype;
                        }
                        else
                        {
                                $tabtype = "tabinactive";
                                $tab = "tab";
                        }

                        switch ($i)
                        {
                                case 1:
                                $txt = $lng->txt("view_content");
                                break;
                                case 2:
                                $txt = $lng->txt("edit_properties");
                                break;
                                case 3:
                                $txt = $lng->txt("perm_settings");
                                break;
                                case 4:
                                $txt = $lng->txt("show_owner");
                                break;
                        } // switch
                        $tpltab->setVariable("CONTENT", $txt);
                        $tpltab->setVariable("TABTYPE", $tabtype);
                        $tpltab->setVariable("TAB", $tab);
                        $tpltab->setVariable("LINK", $a_o["LINK".$i]);
                        $tpltab->parseCurrentBlock();
                }

                return $tpltab->get();
        }

ilUtil::sort_func ( a,
b 
)

sub-function to sort an array

Parameters:
array $a
array $b
Returns:
boolean true on success / false on error

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

        {
                global $array_sortby,$array_sortorder;

                if ($array_sortorder == "asc")
                {
                        return strcasecmp($a[$array_sortby], $b[$array_sortby]);
                }

                if ($array_sortorder == "desc")
                {
                        return strcasecmp($b[$array_sortby], $a[$array_sortby]);
                }
        }

ilUtil::sort_func_numeric ( a,
b 
)

sub-function to sort an array

Parameters:
array $a
array $b
Returns:
boolean true on success / false on error

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

        {
                global $array_sortby,$array_sortorder;

                if ($array_sortorder == "asc")
                {
                        return $a["$array_sortby"] > $b["$array_sortby"];
                }

                if ($array_sortorder == "desc")
                {
                        return $a["$array_sortby"] < $b["$array_sortby"];
                }
        }

ilUtil::sortArray ( array,
a_array_sortby,
a_array_sortorder = 0,
a_numeric = false 
)

sortArray

Parameters:
array array to sort
string sort_column
string sort_order (ASC or DESC)
bool sort numeric?
Returns:
array sorted array

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

Referenced by ilCourseItems::__sort(), ilObjGroupGUI::changeMemberObject(), ilSetupGUI::displayClientList(), ilLOListGUI::displayList(), ilObjTypeDefinitionGUI::editObject(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjUserFolderGUI::searchUserObject(), ilObjGroupGUI::showNewRegistrationsObject(), ilTableGUI::sortData(), ilExplorer::sortNodes(), ilEditClipboardGUI::view(), ilObjUserFolderGUI::viewObject(), ilObjTypeDefinitionGUI::viewObject(), ilObjSystemFolderGUI::viewObject(), ilObjObjectFolderGUI::viewObject(), ilObjLanguageFolderGUI::viewObject(), and ilObjectGUI::viewObject().

        {
                global $array_sortby,$array_sortorder;

                $array_sortby = $a_array_sortby;

                if ($a_array_sortorder == "desc")
                {
                        $array_sortorder = "desc";
                }
                else
                {
                        $array_sortorder = "asc";
                }
                if($a_numeric)
                {
                        usort($array, array("ilUtil", "sort_func_numeric"));
                }
                else
                {
                        usort($array, array("ilUtil", "sort_func"));
                }
                //usort($array,"ilUtil::sort_func");

                return $array;
        }

Here is the caller graph for this function:

ilUtil::StopWatch ( begin = -1  ) 

StopWatch benchmark scriptcode.

Usage: $t1 = StopWatch(); // starts the StopWatch // your code you want to benchmark $diff = StopWatch($t1); // stops the StopWatch

$diff contains the time elapsed so far from the point where you set the marker $t1 in microseconds

public

Parameters:
float starttime in microseconds
Returns:
float time in microseconds

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

        {
                $m = explode(" ",microtime());
                $m = $m[0] + $m[1];

                if ($begin != -1)
                {
                        $m = $m - $begin;
                }

                return($m);
        }

ilUtil::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

Parameters:
string $a_str input string
string $a_allow allowed tags, if an empty string is passed a default set of tags is allowed
boolean $a_rm_js remove javascript attributes (onclick...)

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

References $pos.

Referenced by stripSlashes().

        {
                //$a_str = strip_tags($a_str, $a_allow);

                $negativestr = "a,abbr,acronym,address,applet,area,b,base,basefont,".
                        "bdo,big,blockquote,body,br,button,caption,center,cite,code,col,".
                        "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame,".
                        "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd,".
                        "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,".
                        "optgroup,option,p,param,pre,q,s,samp,script,select,small,span,".
                        "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,".
                        "title,tr,tt,u,ul,var";
                $a_allow = strtolower ($a_allow);
                $negatives = split (",",$negativestr);
                foreach ($negatives as $item)
                {
                        $pos = strpos($a_allow, "<$item>");

                        // remove complete tag, if not allowed
                        if ($pos === false)
                        {
                                $a_str = preg_replace("/<\/?\s*$item\s*>/i", "", $a_str);
                                $a_str = preg_replace("/<\/?\s*$item\s+([^>]*)>/i", "", $a_str);
                        }

                        if ($a_rm_js)
                        {
                                // remove all attributes if an "on..." attribute is given
                                $a_str = preg_replace("/<\s*".$item."(\s+[^>]*)?(\s+on[^>]*)>/i", "<$item>", $a_str);

                                // remove all attributes if a "javascript" is within tag
                                $a_str = preg_replace("/<\s*".$item."\s+[^>]*javascript[^>]*>/i", "<$item>", $a_str);
                        }
                }

                return $a_str;
        }

Here is the caller graph for this function:

ilUtil::stripSlashes ( a_str,
a_strip_html = true,
a_allow = "" 
)

strip slashes if magic qoutes is enabled

Parameters:
boolean strip also html tags

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

References stripScriptHTML().

Referenced by ilObjExerciseGUI::__saveStatus(), ilPaymentTrusteeGUI::__search(), ilObjPaymentSettingsGUI::__search(), ilObjRoleGUI::__search(), ilObjGroupGUI::__search(), ilObjExerciseGUI::__searchMembers(), ilObjFile::_lookupFileName(), ilObjFile::_lookupVersion(), ilPageEditorGUI::addChangeComment(), ilObjGlossaryGUI::addDefinition(), ilObjectGUI::addRoleObject(), ilObjChatGUI::addRoomObject(), ASS_ClozeTestGUI::addSelectGap(), ilObjGlossaryGUI::addTerm(), ASS_ClozeTestGUI::addTextGap(), ilObjPaymentSettingsGUI::addVendorObject(), ilObjRole::assignData(), ilObjSystemFolderGUI::changeHeaderTitleObject(), ilSetup::checkDataDirSetup(), ilSetup::checkLogSetup(), ilSetup::checkToolsSetup(), ilPCMediaObjectGUI::create(), ilPCFileListGUI::create(), ilBibItemGUI::create(), ilMetaDataGUI::create(), ilFileSystemGUI::createDirectory(), ilObjGlossaryGUI::createObject(), ilObjContentObjectGUI::createObject(), ilObjRoleTemplateGUI::createObject(), ilObjRoleGUI::createObject(), ilObjGroupGUI::createObject(), ilObjFolderGUI::createObject(), ilObjFileGUI::createObject(), ilObjectGUI::createObject(), ilObjCategoryGUI::createObject(), ilObjTestGUI::createObject(), ilObjRoleFolder::createRole(), ilFileSystemGUI::deleteFile(), ilSetupGUI::displayContactData(), ilFileSystemGUI::downloadFile(), ilObjRoleTemplateGUI::editObject(), ilObjRoleGUI::editObject(), ilObjGroupGUI::editObject(), ilObjForumGUI::editObject(), ilObjFileGUI::editObject(), ilObjectGUI::editObject(), ilObjCategoryGUI::editObject(), ilFileSystemGUI::extCommand(), ilTree::fetchNodeData(), fetchObjectData(), ilMetaDataGUI::fillAnnotation(), ilMetaDataGUI::fillClassification(), ilMetaDataGUI::fillEducational(), ilMetaDataGUI::fillGeneral(), ilMetaDataGUI::fillMetaMetadata(), ilMetaDataGUI::fillRelation(), ilMetaDataGUI::fillRights(), ILIAS::getAllSettings(), ilObjUser::getFullname(), ILIAS::getSetting(), ilPCTable::importHtml(), SurveyQuestionGUI::insertAfterCategory(), SurveyQuestionGUI::insertBeforeCategory(), ilFileSystemGUI::listFiles(), loginPage(), ilObjExerciseGUI::newMembersObject(), ilPaymentTrusteeGUI::performSearch(), prepareFormOutput(), ilObjSurveyGUI::questionsObject(), ilFileSystemGUI::renameFile(), ilFileSystemGUI::renameFileForm(), ilObjChatGUI::renameRoomObject(), ilObjSurveyGUI::runObject(), ilStructureObjectGUI::save(), ilLMPageObjectGUI::save(), ilMetaDataGUI::save(), ilPCMediaObjectGUI::saveAliasProperties(), ilGlossaryTermGUI::saveDefinition(), saveForm(), ilObjSystemFolderGUI::saveHeaderTitleObject(), ilObjTestGUI::saveMarksObject(), ilSetup::saveMasterSetup(), ilObjSurveyGUI::saveMetaObject(), ilObjTestGUI::saveMetaObject(), ilObjMediaObjectGUI::saveObject(), ilObjRoleTemplateGUI::saveObject(), ilObjRoleGUI::saveObject(), ilObjFolderGUI::saveObject(), ilObjFileGUI::saveObject(), ilObjExerciseGUI::saveObject(), ilObjectGUI::saveObject(), ilObjCategoryGUI::saveObject(), ilPCFileListGUI::saveProperties(), ilObjMediaObjectGUI::savePropertiesObject(), ilObjTestGUI::savePropertiesObject(), ilGlossaryTermGUI::saveTerm(), ASS_TextQuestion::saveWorkingData(), ASS_ClozeTest::saveWorkingData(), ilObjPaymentSettingsGUI::searchObject(), ilObjRoleGUI::searchObject(), ilObjGroupGUI::searchObject(), ilObjSurveyGUI::searchQuestionsForm(), ASS_ClozeTestGUI::setGapValues(), ilFileSystemGUI::unzipFile(), ilPaymentBillAdminGUI::update(), ilMetaData::update(), ilObjMediaObjectGUI::updateAreasObject(), ilNestedSetXML::updateDomNode(), ilSetup::updateMasterSettings(), ilObjUserGUI::updateObject(), ilObjRoleTemplateGUI::updateObject(), ilObjRoleGUI::updateObject(), ilObjGroupGUI::updateObject(), ilObjForumGUI::updateObject(), ilObjFileGUI::updateObject(), ilObjExerciseGUI::updateObject(), ilObjectGUI::updateObject(), ilObjCourseGUI::updateObject(), ilObjCategoryGUI::updateObject(), ilObjGlossaryGUI::updateTerm(), ilGlossaryTermGUI::updateTerm(), ilFileSystemGUI::uploadFile(), ASS_QuestionGUI::writeOtherPostData(), SurveyTextQuestionGUI::writePostData(), SurveyOrdinalQuestionGUI::writePostData(), SurveyNominalQuestionGUI::writePostData(), SurveyMetricQuestionGUI::writePostData(), ASS_TextQuestionGUI::writePostData(), ASS_OrderingQuestionGUI::writePostData(), ASS_MultipleChoiceGUI::writePostData(), ASS_MatchingQuestionGUI::writePostData(), ASS_JavaAppletGUI::writePostData(), ASS_ImagemapQuestionGUI::writePostData(), ASS_ClozeTestGUI::writePostData(), and ilObjSurveyGUI::writePropertiesFormData().

        {
                if (ini_get("magic_quotes_gpc"))
                {
                        $a_str = stripslashes($a_str);
                }

                // set default allowed tags
                if ($a_allow == "")
                {
                        $a_allow = "<b><i><strong><em><code><cite><gap><sub><sup><pre><strike>";
                }

                if ($a_strip_html)
                {
                        $a_str = ilUtil::stripScriptHTML($a_str, $a_allow);
                }

                return $a_str;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::switchColor ( a_num,
a_css1,
a_css2 
)

switches style sheets for each even $a_num (used for changing colors of different result rows)

public

Parameters:
integer $a_num the counter
string $a_css1 name of stylesheet 1
string $a_css2 name of stylesheet 2
Returns:
string $a_css1 or $a_css2

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

Referenced by ilObjExerciseGUI::__showMembersTableContent(), ilObjSystemFolderGUI::benchmarkObject(), ilCourseContentInterface::cci_view(), ilObjContentObjectGUI::chapters(), ilConditionHandlerInterface::chi_list(), ilObjGroupGUI::confirmationObject(), ilObjGlossaryGUI::confirmDeleteExportFile(), ilObjContentObjectGUI::confirmDeleteExportFile(), ilObjSurveyQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjSurveyGUI::confirmDeleteExportFileObject(), ilObjTestGUI::confirmDeleteExportFileObject(), ilObjQuestionPoolGUI::confirmDeleteExportFileObject(), ilObjMediaPoolGUI::confirmRemove(), ilObjGlossaryGUI::confirmTermDeletion(), ilObjContentObjectGUI::delete(), ilBookmarkAdministrationGUI::delete(), ilObjUserFolderGUI::deleteObject(), ilObjRoleFolderGUI::deleteObject(), ilObjectGUI::deleteObject(), ilSetupGUI::displayClientList(), ilObjUserFolderGUI::displayList(), ilObjTypeDefinitionGUI::displayList(), ilObjSystemFolderGUI::displayList(), ilObjObjectFolderGUI::displayList(), ilObjLanguageFolderGUI::displayList(), ilObjectGUI::displayList(), ilLOListGUI::displayList(), ilPersonalDesktopGUI::displayUsersOnline(), ilObjMediaObjectGUI::editFilesObject(), ilObjMediaObjectGUI::editMapAreasObject(), ilObjUserGUI::editObject(), ilObjTypeDefinitionGUI::editObject(), ilPaymentObjectGUI::editPrices(), ilObjGlossaryGUI::exportList(), ilObjContentObjectGUI::exportList(), ilObjSurveyQuestionPoolGUI::exportObject(), ilObjSurveyGUI::exportObject(), ilObjTestGUI::exportObject(), ilObjQuestionPoolGUI::exportObject(), ilObjContentObjectGUI::linkChecker(), ilFileSystemGUI::listFiles(), ilObjMediaPoolGUI::listMedia(), ilGlossaryPresentationGUI::listTermByGiven(), ilObjGlossaryGUI::listTerms(), ilObjContentObjectGUI::pages(), ilObjSurveyQuestionPoolGUI::permObject(), ilObjSurveyGUI::permObject(), ilObjRoleTemplateGUI::permObject(), ilObjRoleGUI::permObject(), ilObjectGUI::permObject(), ilObjTestGUI::permObject(), ilTableGUI::render(), ilObjUserFolderGUI::searchUserObject(), ilRepositoryGUI::showCategories(), ilRepositoryGUI::showChats(), ilRepositoryGUI::showCourses(), ilLMPresentationGUI::showDownloadList(), ilRepositoryGUI::showExercises(), ilRepositoryGUI::showFiles(), ilRepositoryGUI::showFolders(), ilRepositoryGUI::showGlossaries(), ilRepositoryGUI::showGroups(), ilRepositoryGUI::showLearningResources(), ilRepositoryGUI::showMediaPools(), ilRepositoryGUI::showQuestionPools(), ilRepositoryGUI::showSurveyquestionpools(), ilRepositoryGUI::showSurveys(), ilRepositoryGUI::showTests(), ilObjForumGUI::showThreadsObject(), ilObjSCORMLearningModuleGUI::showTrackingItem(), ilObjSCORMLearningModuleGUI::showTrackingItemPerUser(), ilObjSCORMLearningModuleGUI::showTrackingItems(), ilObjAICCLearningModuleGUI::showTrackingItems(), ilObjMediaObjectGUI::showUsagesObject(), ilStructureObjectGUI::subchap(), ilObjectGUI::trashObject(), ilStructureObjectGUI::view(), ilEditClipboardGUI::view(), and ilBookmarkAdministrationGUI::view().

        {
                if (!($a_num % 2))
                {
                        return $a_css1;
                }
                else
                {
                        return $a_css2;
                }
        }

Here is the caller graph for this function:

ilUtil::tf2yn ( a_tf  ) 

convert true/false to "y"/"n"

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

Referenced by ilObjSAHSLearningModule::update().

        {
                if($a_tf)
                {
                        return "y";
                }
                else
                {
                        return "f";
                }
        }

Here is the caller graph for this function:

ilUtil::unique_multi_array ( array,
sub_key 
)

Make a multi-dimensional array to have only DISTINCT values for a certain "column".

It's like using the DISTINCT parameter on a SELECT sql statement.

Parameters:
array your multi-dimensional array
string 'column' to filter
Returns:
array filtered array
Author:
Unknown <tru@ascribedata.com> (found in PHP annotated manual)

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

        {
                $target = array();
                $existing_sub_key_values = array();

                foreach ($array as $key=>$sub_array)
                {
                        if (!in_array($sub_array[$sub_key], $existing_sub_key_values))
                        {
                                $existing_sub_key_values[] = $sub_array[$sub_key];
                                $target[$key] = $sub_array;
                        }
                }

                return $target;
        }

ilUtil::unzip ( a_file  ) 

unzip file

Parameters:
string $a_file full path/filename

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

References $file, createDirectory(), and escapeShellArg().

Referenced by ilObjCategoryGUI::_importCategories(), ilObjGlossaryGUI::importFileObject(), ilObjContentObjectGUI::importFileObject(), ilObjUserFolderGUI::importUserRoleAssignmentObject(), ilFileSystemGUI::unzipFile(), ilObjSAHSLearningModuleGUI::uploadObject(), ilObjTestGUI::uploadObject(), ilObjQuestionPoolGUI::uploadObject(), and ilObjQuestionPoolGUI::uploadQplObject().

        {
                //global $ilias;

                $pathinfo = pathinfo($a_file);
                $dir = $pathinfo["dirname"];
                $file = $pathinfo["basename"];

                // unzip
                $cdir = getcwd();
                chdir($dir);
                $unzip = PATH_TO_UNZIP;
                //$unzip = $ilias->getSetting("unzip_path");

                // workaround for unzip problem (unzip of subdirectories fails, so
                // we create the subdirectories ourselves first)
                // get list
                $unzipcmd = $unzip." -Z -1 ".ilUtil::escapeShellArg($file);
                exec($unzipcmd, $arr);
                $zdirs = array();

                foreach($arr as $line)
                {
                        if(is_int(strpos($line, "/")))
                        {
                                $zdir = substr($line, 0, strrpos($line, "/"));
                                $nr = substr_count($zdir, "/");
                                //echo $zdir." ".$nr."<br>";
                                while ($zdir != "")
                                {
                                        $nr = substr_count($zdir, "/");
                                        $zdirs[$zdir] = $nr;                            // collect directories
                                        //echo $dir." ".$nr."<br>";
                                        $zdir = substr($zdir, 0, strrpos($zdir, "/"));
                                }
                        }
                }

                asort($zdirs);

                foreach($zdirs as $zdir => $nr)                         // create directories
                {
                        ilUtil::createDirectory($zdir);
                }

                // real unzip
                $unzipcmd = $unzip." -o ".ilUtil::escapeShellArg($file);
                exec($unzipcmd);

                chdir($cdir);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::virusHandling ( a_file,
a_orig_name = "",
a_clean = true 
)

scan file for viruses and clean files if possible

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

References $lng, and ilVirusScannerFactory::_getInstance().

Referenced by moveUploadedFile().

        {
                global $lng;

                if (IL_VIRUS_SCANNER != "None")
                {
                        require_once("classes/class.ilVirusScannerFactory.php");
                        $vs = ilVirusScannerFactory::_getInstance();
                        if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) != "")
                        {
                                if ($a_clean && (IL_VIRUS_CLEAN_COMMAND != ""))
                                {
                                        $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
                                        if ($vs->fileCleaned())
                                        {
                                                $vs_txt.= "<br />".$lng->txt("cleaned_file").
                                                        "<br />".$clean_txt;
                                                $vs_txt.= "<br />".$lng->txt("repeat_scan");
                                                if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) != "")
                                                {
                                                        return array(false, nl2br($vs_txt)."<br />".$lng->txt("repeat_scan_failed").
                                                                "<br />".nl2br($vs2_txt));
                                                }
                                                else
                                                {
                                                        return array(true, nl2br($vs_txt)."<br />".$lng->txt("repeat_scan_succeded"));
                                                }
                                        }
                                        else
                                        {
                                                return array(false, nl2br($vs_txt)."<br />".$lng->txt("cleaning_failed"));
                                        }
                                }
                                else
                                {
                                        return array(false, nl2br($vs_txt));
                                }
                        }
                }
                return array(true,"");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUtil::yn2tf ( a_yn  ) 
ilUtil::zip ( a_dir,
a_file 
)

zips given directory into given zip.file

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

References $file, and escapeShellArg().

Referenced by ilGlossaryExport::buildExportFile(), ilContObjectExport::buildExportFileXML(), ilTestExport::buildExportFileXML(), ilQuestionpoolExport::buildExportFileXML(), ilObjDlBook::export(), ilObjContentObject::exportHTML(), ilLMPresentationGUI::offlineexport(), and ilFileDataCourse::zipFile().

        {
                //global $ilias;

                $cdir = getcwd();

                $pathinfo = pathinfo($a_file);
                $dir = $pathinfo["dirname"];
                $file = $pathinfo["basename"];

                // unzip
                $cdir = getcwd();
                chdir($dir);

                $zip = PATH_TO_ZIP;
                //$zip = $ilias->getSetting("zip_path");

                $name = basename($a_dir);

                $zipcmd = $zip." -r ".ilUtil::escapeShellArg($a_file)." ".ilUtil::escapeShellArg($name);
                exec($zipcmd);

                chdir($cdir);
        }

Here is the call graph for this function:

Here is the caller graph for this function:


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