Stud.IP
6.0
|
Namespaces | |
studip_cores | |
Functions | |
get_object_name ($range_id, $object_type) | |
get_object_by_range_id ($range_id) | |
checkObject () | |
checkObjectModule ($module, $is_plugin_name=false) | |
closeObject () | |
get_object_type ($id, $check_only=[]) | |
select_group ($sem_start_time) | |
my_substr ($what, $start, $end) | |
get_fullname ($user_id="", $format="full", $htmlready=false) | |
get_fullname_from_uname ($uname="", $format="full", $htmlready=false) | |
get_username ($user_id="") | |
get_userid ($username="") | |
check_and_set_date ($tag, $monat, $jahr, $stunde, $minute, &$arr, $field) | |
StringToFloat ($str) | |
archiv_check_perm ($seminar_id) | |
get_users_online ($active_time=5, $name_format='full_rev') | |
get_users_online_count ($active_time=10) | |
get_ticket () | |
check_ticket ($studipticket) | |
format_help_url ($keyword) | |
words ($what) | |
legacy_studip_utf8decode ($data) | |
encode_header_parameter ($name, $value) | |
get_title_for_status ($type, $count, $sem_type=NULL) | |
is_internal_url ($url) | |
studygroup_sem_types () | |
addHiddenFields ($variable, $data, $parent=[]) | |
array_flatten ($ary) | |
reltime ($timestamp, $verbose=true, $displayed_levels=1, $tolerance=5) | |
relsize ($size, $verbose=true, $displayed_levels=1, $glue=', ', $truncate=false) | |
get_route ($route='') | |
match_route ($requested_route, $current_route='') | |
studip_default_exception_handler ($exception) | |
strtocamelcase ($string, $ucfirst=false) | |
strtopascalcase (string $string) | |
strtosnakecase ($string) | |
strtokebabcase ($string) | |
count_table_rows ($table) | |
studip_relative_path ($filepath) | |
array_to_csv ($data, $filename=null, $caption=null, $delimiter=';', $enclosure='"', $eol = "\r\n", $add_bom = true ) | |
rmdirr ($dirname) | |
get_mime_types () | |
get_mime_type ($filename) | |
readfile_chunked ($filename, $start=null, $end=null) | |
get_default_http_stream_context ($url='') | |
encodeURI (string $uri) | |
randomString (int $length=32) | |
xml_escape ($string) | |
studip_interpolate (string $source_string, array $parameters) | |
addHiddenFields | ( | $variable, | |
$data, | |||
$parent = [] |
|||
) |
generates form fields for the submitted multidimensional array
string | $variable | the name of the array, which is filled with the data |
mixed | $data | the data-array |
mixed | $parent | leave this entry as is |
archiv_check_perm | ( | $seminar_id | ) |
check which perms the currently logged in user had in the passed archived seminar
array $perm object $auth array $archiv_perms
string | $seminar_id | the seminar in the archive |
array_flatten | ( | $ary | ) |
Returns a new array that is a one-dimensional flattening of this array (recursively). That is, for every element that is an array, extract its elements into the new array.
array | $ary | the array to be flattened |
array_to_csv | ( | $data, | |
$filename = null , |
|||
$caption = null , |
|||
$delimiter = ';' , |
|||
$enclosure = '"' , |
|||
$eol = "\r\n" , |
|||
$add_bom = true |
|||
) |
converts a given array to a csv format
array | $data | the data to convert, each row should be an array |
string | $filename | full path to a file to write to, if omitted the csv content is returned |
array | $caption | assoc array with captions, is written to the first line, $data is filtered by keys |
string | $delimiter | sets the field delimiter (one character only) |
string | $enclosure | sets the field enclosure (one character only) |
string | $eol | sets the end of line format |
check_and_set_date | ( | $tag, | |
$monat, | |||
$jahr, | |||
$stunde, | |||
$minute, | |||
& | $arr, | ||
$field | |||
) |
check_and_set_date
Checks if given date is valid and sets field in array accordingly. (E.g. $admin_admission_data['admission_enddate'])
mixed | $tag | day or placeholder for day |
mixed | $monat | month or placeholder for month |
mixed | $jahr | year or placeholder for year |
mixed | $stunde | hours or placeholder for hours |
mixed | $minute | minutes or placeholder for minutes |
array | &$arr | Reference to array to update. If NULL, only check is performed |
mixed | $field | Name of field in array to be set |
check_ticket | ( | $studipticket | ) |
check if the passed ticket is valid
string | $studipticket | the ticket-id to check |
checkObject | ( | ) |
This function checks, if there is an open Veranstaltung or Einrichtung
CheckObjectException |
checkObjectModule | ( | $module, | |
$is_plugin_name = false |
|||
) |
This function checks, if given module is allowed for this stud.ip-object.
CheckObjectException |
string | $module | the module to check for |
bool | $is_plugin_name | is the module name old style ( "wiki","scm") or new style (the name of the plugin) |
closeObject | ( | ) |
This function closes a opened Veranstaltung or Einrichtung
count_table_rows | ( | $table | ) |
fetch number of rows for a table for innodb this is not exact, but much faster than count(*)
string | $table | name of database table |
encode_header_parameter | ( | $name, | |
$value | |||
) |
Encode an HTTP header parameter (e.g. filename for 'Content-Disposition').
string | $name | parameter name |
string | $value | parameter value |
encodeURI | ( | string | $uri | ) |
Encodes an uri just like encodeURI() in Javascript would do.
encodeURI() escapes all characters except:
A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
string | $uri |
format_help_url | ( | $keyword | ) |
format_help_url($keyword) returns URL for given help keyword
string | $keyword | the help-keyword |
get_default_http_stream_context | ( | $url = '' | ) |
string | $url |
get_fullname | ( | $user_id = "" , |
|
$format = "full" , |
|||
$htmlready = false |
|||
) |
Retrieves the fullname for a given user_id
string | $user_id | if omitted, current user_id is used |
string | $format | output format |
bool | $htmlready | if true, htmlReady is applied to all output-strings |
get_fullname_from_uname | ( | $uname = "" , |
|
$format = "full" , |
|||
$htmlready = false |
|||
) |
Retrieves the fullname for a given username
string | $uname | if omitted, current user_id is used |
string | $format | output format |
bool | $htmlready | if true, htmlReady is applied to all output-strings |
get_mime_type | ( | $filename | ) |
Determines an appropriate MIME type for a file based on the extension of the file name.
string | $filename | file name to check |
get_mime_types | ( | ) |
Returns the mapping of extensions to supported MIME types.
get_object_by_range_id | ( | $range_id | ) |
Returns a sorm object for a given range_id
string | the range_id |
get_object_name | ( | $range_id, | |
$object_type | |||
) |
returns an array containing name and type of the passed objeact denoted by $range_id
array $SEM_TYPE array $INST_TYPE array $SEM_TYPE_MISC_NAME
string | $range_id | the id of the object |
string | $object_type | the type of the object |
get_object_type | ( | $id, | |
$check_only = [] |
|||
) |
This function determines the type of the passed id
The function recognizes the following types at the moment: Einrichtungen, Veranstaltungen, Statusgruppen and Fakultaeten
array $object_type_cache
string | $id | the id of the object |
array | $check_only | an array to narrow the search, may contain 'sem', 'inst', 'fak', 'group' or 'dokument' (optional) |
get_route | ( | $route = '' | ) |
extracts route
string | $route | route (optional, uses REQUEST_URI otherwise) |
get_ticket | ( | ) |
return a studip-ticket
get_title_for_status | ( | $type, | |
$count, | |||
$sem_type = NULL |
|||
) |
Get the title used for the given status ('dozent', 'tutor' etc.) for the specified SEM_TYPE. Alternative titles can be defined in the config.inc.php.
array $SEM_TYPE array $DEFAULT_TITLE_FOR_STATUS
string | $type | status ('dozent', 'tutor', 'autor', 'user' or 'accepted') |
int | $count | count, this determines singular or plural form of title |
int | $sem_type | sem_type of course (defaults to type of current course) |
get_userid | ( | $username = "" | ) |
Retrieves the userid for a given username
uses global $online array if user is online
object $auth array $cache
string | $username | if omitted, current user_id will be returned |
get_username | ( | $user_id = "" | ) |
Retrieves the username for a given user_id
object $auth array $cache
string | $user_id | if omitted, current username will be returned |
get_users_online | ( | $active_time = 5 , |
|
$name_format = 'full_rev' |
|||
) |
retrieve a list of all online users
object $user array $_fullname_sql
int | $active_time | filter: the time in minutes until last life-sign |
string | $name_format | format the fullname shall have |
get_users_online_count | ( | $active_time = 10 | ) |
get the number of currently online users
int | $active_time | filter: the time in minutes until last life-sign |
is_internal_url | ( | $url | ) |
Test whether the given URL refers to some page or resource of this Stud.IP installation.
string | $url | url to check |
legacy_studip_utf8decode | ( | $data | ) |
Encodes a string or array from UTF-8 to Stud.IP encoding (WINDOWS-1252/ISO-8859-1 with numeric HTML-ENTITIES)
mixed | $data | a string in UTF-8 or an array with all strings encoded in utf-8 |
match_route | ( | $requested_route, | |
$current_route = '' |
|||
) |
compares actual route to requested route
string | $requested_route | requested route (for help content or tour) |
string | $current_route | current route (optional) |
my_substr | ( | $what, | |
$start, | |||
$end | |||
) |
The function shortens a string, but it uses the first 2/3 and the last 1/3
The parts will be divided by a "[...]". The functions is to use like php's mb_substr function.
string | $what | the original string |
integer | $start | start pos, 0 is the first pos |
integer | $end | end pos |
randomString | ( | int | $length = 32 | ) |
readfile_chunked | ( | $filename, | |
$start = null , |
|||
$end = null |
|||
) |
Displays a filesize in a (shortened) human readable form including the according units. For instance, 1234567 would be displayed as "1 MB" or 12345 would be displayed as "12 kB". The function can display the units in a short or a long form ("1 b" vs. "1 Byte"). Optionally, more than one unit part can be displayed. For instance, 1234567 could also be displayed as "1 MB, 234 kB, 567 b".
int | $size | The raw filesize as integer |
bool | $verbose | Use short or long unit names |
int | $displayed_levels | How many unit parts should be displayed |
String | $glue | Text used to glue the different unit parts together |
reltime | ( | $timestamp, | |
$verbose = true , |
|||
$displayed_levels = 1 , |
|||
$tolerance = 5 |
|||
) |
Displays "relative time" - a textual representation between now and a certain timestamp, e.g. "3 hours ago".
int | $timestamp | Timestamp to relate to. |
bool | $verbose | Display long or short texts (optional) |
int | $displayed_levels | How many levels shall be displayed |
int | $tolerance | Defines a tolerance area of seconds around now (How many seconds must have passed until the function won't return "now") |
rmdirr | ( | $dirname | ) |
Delete a file, or a folder and its contents
string | $dirname | The directory to delete |
select_group | ( | $sem_start_time | ) |
This function calculates one of the group colors unique for the semester of the passed timestamp
It calculates a unique color number to create the initial entry for a new user in a seminar. It will create a unique number for every semester and will start over, if the max. number (7) is reached.
integer | $sem_start_time | the timestamp of the start time from the Semester |
StringToFloat | ( | $str | ) |
converts a string to a float, depending on the locale
string | $str | the string to convert to float |
strtocamelcase | ( | $string, | |
$ucfirst = false |
|||
) |
Converts a string to camelCase.
String | $string | The string that should be converted |
bool | $ucfirst | Uppercase the very first character as well (optional, defaults to false) |
strtokebabcase | ( | $string | ) |
Converts a string to kebab-case.
String | $string | The string that should be converted |
strtopascalcase | ( | string | $string | ) |
Converts a string to PascalCase.
String | $string | The string that should be converted |
strtosnakecase | ( | $string | ) |
Converts a string to snake_case.
String | $string | The string that should be converted |
studip_default_exception_handler | ( | $exception | ) |
studip_interpolate | ( | string | $source_string, |
array | $parameters | ||
) |
This function mimics the functionality of the $gettextInterpolate function in JavaScript. This makes it easier to format text in strings, whether they are translatable using gettext or regular strings with named placeholders.
Placeholders must be in the same format as in $gettextInterpolate: %{name} In the parameters array, the replacement of the placeholder must have the same string value as index as the placeholder. If the placeholder in the source string is %{name}, the index in the parameters array must be called "name" so that the placeholder can be replaced.
Note that the behavior of this function is simplified in comparison with $gettextInterpolate:
string | $source_string | The string to be interpolated. |
array | $parameters | The parameters that replace the placeholders in the source string. Array keys are the names of the placeholders while array values are the values that are placed inside the string. |
Exception | In case a placeholder is not present in the parameters array and therefore cannot be replaced. |
studip_relative_path | ( | $filepath | ) |
get the file path relative to the STUDIP_BASE_PATH
string | path of the file |
studygroup_sem_types | ( | ) |
Return the list of SEM_TYPES that represent study groups in this Stud.IP installation.
words | ( | $what | ) |
Splits a string by space characters and returns these words as an array. If an array is given, returns the array itself.
mixed | $what | what to split |
xml_escape | ( | $string | ) |
escapes special characters for xml use
string | $string | the string to escape |