Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
functions.php File Reference

Namespaces

namespace  studip_core

Functions

 getHeaderLine ($id, $object_name=null)
 get_object_name ($range_id, $object_type)
 selectSem ($sem_id)
 selectInst ($inst_id)
 openSem ($sem_id)
 openInst ($inst_id)
 checkObject ()
 checkObjectModule ($module)
 closeObject ()
 lastActivity ($sem_id)
 get_object_type ($id, $check_only=array())
 select_group ($sem_start_time, $user_id='')
 my_substr ($what, $start, $end)
 have_sem_write_perm ()
 get_global_perm ($user_id="")
 get_perm ($range_id, $user_id="")
 get_fullname ($user_id="", $format="full", $htmlready=false)
 get_fullname_from_uname ($uname="", $format="full", $htmlready=false)
 get_vorname ($user_id="")
 get_nachname ($user_id="")
 get_username ($user_id="")
 get_userid ($username="")
 TrackAccess ($id, $object_type=null)
 get_sem_tree_path ($seminar_id, $depth=false, $delimeter=">")
 get_range_tree_path ($institut_id, $depth=false, $delimeter=">")
 check_and_set_date ($tag, $monat, $jahr, $stunde, $minute, &$arr, $field)
 write_config ($key, $val, $arr=null)
 get_config ($key)
 get_seminar_dozent ($seminar_id)
 re_sort_dozenten ($s_id, $position)
 re_sort_tutoren ($s_id, $position)
 get_next_position ($status, $seminar_id)
 get_seminar_tutor ($seminar_id)
 get_seminar_sem_tree_entries ($seminar_id)
 get_seminars_user ($user_id)
 StringToFloat ($str)
 archiv_check_perm ($seminar_id)
 get_users_online ($active_time=5, $name_format= 'full_rev')
 get_users_online_count ($active_time=5)
 get_ticket ()
 check_ticket ($studipticket)
 search_range ($search_str=false, $search_user=false, $show_sem=true)
 format_help_url ($keyword)
 remove_magic_quotes ($mixed)
 unregister_globals ()
 text_excerpt ($text, $phrase, $radius=100, $length=200, $excerpt_string= '...')
 words ($string)
 studip_utf8encode ($string)
 studip_utf8decode ($string)
 mark_public_course ($course=NULL)
 get_title_for_status ($type, $count, $sem_type=NULL)
 studip_substr ($string, $offset, $length=false)
 studip_strlen ($string)
 is_internal_url ($url)
 studygroup_sem_types ()
 addHiddenFields ($variable, $data, $parent=array())

Function Documentation

addHiddenFields (   $variable,
  $data,
  $parent = array() 
)

generates form fields for the submitted multidimensional array

Parameters
string$variablethe name of the array, which is filled with the data
mixed$datathe data-array
mixed$parentleave this entry as is
Returns
string the inputs of type hidden as html
archiv_check_perm (   $seminar_id)
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'])

Parameters
mixedday or placeholder for day
mixedmonth or placeholder for month
mixedyear or placeholder for year
mixedhours or placeholder for hours
mixedminutes or placeholder for minutes
arrayReference to array to update. If NULL, only check is performed
mixedName of field in array to be set
Returns
bool true if date was valid, false else
check_ticket (   $studipticket)

Here is the call graph for this function:

Here is the caller graph for this function:

checkObject ( )

This function checks, if there is an open Veranstaltung or Einrichtung

checkObjectModule (   $module)

This function checks, if given module is allowed in this stud-ip object

closeObject ( )

This function closes a opened Veranstaltung or Einrichtung

Here is the caller graph for this function:

format_help_url (   $keyword)

Here is the call graph for this function:

Here is the caller graph for this function:

get_config (   $key)

get_config

gets an entry from the studip configuration table

Parameters
stringthe key for the config entry
Returns
string the value

Here is the call graph for this function:

get_fullname (   $user_id = "",
  $format = "full",
  $htmlready = false 
)

Retrieves the fullname for a given user_id

Parameters
stringif omitted, current user_id is used
stringoutput format
Returns
string

Here is the call graph for this function:

Here is the caller graph for this function:

get_fullname_from_uname (   $uname = "",
  $format = "full",
  $htmlready = false 
)

Retrieves the fullname for a given username

Parameters
stringif omitted, current user_id is used
stringoutput format
Returns
string

Here is the call graph for this function:

Here is the caller graph for this function:

get_global_perm (   $user_id = "")

The function gives the global perm of an user

It ist recommended to use $auth->auth["perm"] for this query, but the function is useful, if you want to query an user_id from another user (which ist not the current user)

Deprecated:
use $GLOBALS['perm']->get_perm($user_id)
Parameters
stringif omitted, current user_id is used
Returns
string the perm level or an error msg

Here is the caller graph for this function:

get_nachname (   $user_id = "")

Retrieves the Nachname for a given user_id

Parameters
stringif omitted, current user_id is used
Returns
string

Here is the caller graph for this function:

get_next_position (   $status,
  $seminar_id 
)

Here is the call graph for this function:

get_object_name (   $range_id,
  $object_type 
)

Here is the caller graph for this function:

get_object_type (   $id,
  $check_only = array() 
)

This function determines, from which type an id is from.

The function recognizes the following types at this moment: Einrichtungen, Veranstaltungen, Statusgruppen and Fakultaeten

Parameters
stringid the id of the object
Returns
string return "inst" (Einrichtung), "sem" (Veranstaltung), "fak" (Fakultaeten), "group" (Statusgruppe), "dokument" (Dateien)

Here is the caller graph for this function:

get_perm (   $range_id,
  $user_id = "" 
)

Returns permission for given range_id and user_id

Function works for Veranstaltungen, Einrichtungen, Fakultaeten. admins get status 'admin' if range_id is a seminar

Deprecated:
use $GLOBALS['perm']->get_studip_perm($range_id, $user_id)
Parameters
stringan id a Veranstaltung, Einrichtung or Fakultaet
stringif omitted,current user_id is used
Returns
string the perm level

Here is the caller graph for this function:

get_range_tree_path (   $institut_id,
  $depth = false,
  $delimeter = ">" 
)

Here is the call graph for this function:

get_sem_tree_path (   $seminar_id,
  $depth = false,
  $delimeter = ">" 
)

Here is the call graph for this function:

Here is the caller graph for this function:

get_seminar_dozent (   $seminar_id)
get_seminar_sem_tree_entries (   $seminar_id)
get_seminar_tutor (   $seminar_id)
get_seminars_user (   $user_id)
get_ticket ( )

Here is the call graph for this function:

Here is the caller graph for this function:

get_title_for_status (   $type,
  $count,
  $sem_type = NULL 
)

Here is the caller graph for this function:

get_userid (   $username = "")

Retrieves the userid for a given username

uses global $online array if user is online

Parameters
stringif omitted, current user_id will be returned
Returns
string

Here is the caller graph for this function:

get_username (   $user_id = "")

Retrieves the username for a given user_id

Parameters
stringif omitted, current username will be returned
Returns
string

Here is the caller graph for this function:

get_users_online (   $active_time = 5,
  $name_format = 'full_rev' 
)

Here is the call graph for this function:

get_users_online_count (   $active_time = 5)

Here is the call graph for this function:

Here is the caller graph for this function:

get_vorname (   $user_id = "")

Retrieves the Vorname for a given user_id

Parameters
stringif omitted, current user_id is used
Returns
string

Here is the caller graph for this function:

getHeaderLine (   $id,
  $object_name = null 
)

This function creates the header line for studip-objects

you will get a line like this "Veranstaltung: Name..."

Parameters
stringthe id of the Veranstaltung
Returns
string the header-line

Here is the call graph for this function:

Here is the caller graph for this function:

have_sem_write_perm ( )

The function determines, if the current user have write perm in a Veranstaltung or Einrichtung

It uses the Variables $SemSecLevelWrite, $SemUserStatus and $rechte, which are created in the modul check_sem_entry.inc.php and $perm from PHP-lib

Returns
string the error msg. If no msg is returned, the user has write permission

Here is the caller graph for this function:

is_internal_url (   $url)

Test whether the given URL refers to some page or resource of this Stud.IP installation.

Parameters
stringurl to check
lastActivity (   $sem_id)

This function returns the last activity in the Veranstaltung

Parameters
stringthe id of the Veranstaltung
Returns
integer unix timestamp

Here is the call graph for this function:

mark_public_course (   $course = NULL)

Here is the call graph for this function:

Here is the caller graph for this function:

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 substr function.

Parameters
stringthe original string
integerstart pos, 0 is the first pos
integerend pos
Returns
string

Here is the call graph for this function:

Here is the caller graph for this function:

openInst (   $inst_id)

This function "opens" an institute to work with it. Does the same as selectInst() but also sets the visit date.

Parameters
stringthe id of the institute
Returns
boolean true if successful

Here is the call graph for this function:

openSem (   $sem_id)

This function "opens" a course to work with it. Does the same as selectSem() but also sets the visit date.

Parameters
stringthe id of the course
Returns
boolean true if successful

Here is the call graph for this function:

re_sort_dozenten (   $s_id,
  $position 
)

Here is the caller graph for this function:

re_sort_tutoren (   $s_id,
  $position 
)

Here is the caller graph for this function:

remove_magic_quotes (   $mixed)

Remove slashes if magic quotes are enabled

Parameters
mixedstring or array to strip slashes from
Returns
mixed cleaned string or array

Here is the caller graph for this function:

search_range (   $search_str = false,
  $search_user = false,
  $show_sem = true 
)

Here is the call graph for this function:

Here is the caller graph for this function:

select_group (   $sem_start_time,
  $user_id = '' 
)

The function calculate one of the group colors unique for the Semester of the Veranstaltung

It calculate a unique color number to create the initial entry for a new user in a Veranstaltung. It will create a unique number for every Semester and will start over, if the max. number (7) is reached.

Parameters
integerthe timestamp of the start time from the Semester
stringthis field is no more necessary but only for compatibilty reasons here
Returns
integer the color number

Here is the caller graph for this function:

selectInst (   $inst_id)

This function "selects" an Einrichtung to work with it

Note: Stud.IP treats Einrichtungen like Veranstaltungen, yu can see this especially if you look at the variable names....

The following variables will bet set: $SessionSeminar Einrichtung id
$SessSemName[0] Einrichtung name
$SessSemName[1] Einrichtung id
$SessSemName["art"] Einrichtung type in alphanumeric form
$SessSemName["art_num"] Einrichtung type in numeric form
$SessSemName["art_generic"] Einrichtung generic type in alhanumeric form (self description)
$SessSemName["class"] Einrichtung class (sem or inst, in this function always inst)
$SessSemName["header_line"] the header-line to use on every page of the Einrichtung

Parameters
stringthe id of the Veranstaltung
Returns
boolean true if successful

Here is the call graph for this function:

Here is the caller graph for this function:

selectSem (   $sem_id)

This function "selects" a Veranstaltung to work with it

The following variables will bet set: $SessionSeminar Veranstaltung id
$SessSemName[0] Veranstaltung name
$SessSemName[1] Veranstaltung id
$SessSemName[2] Veranstaltung ort (room)
$SessSemName[3] Veranstaltung Untertitel (subtitle)
$SessSemName[4] Veranstaltung start_time (the Semester start_time)
$SessSemName[5] Veranstaltung institut_id (the home-intitute)
$SessSemName["art"] Veranstaltung type in alphanumeric form
$SessSemName["art_num"] Veranstaltung type in numeric form
$SessSemName["art_generic"] Veranstaltung generic type in alhanumeric form (self description)
$SessSemName["class"] Veranstaltung class (sem or inst, in this function always sem)
$SessSemName["header_line"] the header-line to use on every page of the Veranstaltung

Parameters
stringthe id of the Veranstaltung
Returns
boolean true if successful

Here is the call graph for this function:

Here is the caller graph for this function:

StringToFloat (   $str)

converts a string to a float, depending on the locale

Parameters
string
Returns
float

Here is the caller graph for this function:

studip_strlen (   $string)

Stud.IP encoding aware version of good ol' strlen(), treats numeric HTML-ENTITIES as one character use only if really necessary

Parameters
string
Returns
integer the number of characters in string

Here is the call graph for this function:

Here is the caller graph for this function:

studip_substr (   $string,
  $offset,
  $length = false 
)

Stud.IP encoding aware version of good ol' substr(), treats numeric HTML-ENTITIES as one character use only if really necessary

Parameters
string
integer
integer
Returns
string the part of the string

Here is the call graph for this function:

Here is the caller graph for this function:

studip_utf8decode (   $string)

Encodes a string from UTF-8 to Stud.IP encoding (WINDOWS-1252/ISO-8859-1 with numeric HTML-ENTITIES)

Parameters
stringa string in UTF-8
Returns
string the string in WINDOWS-1252/HTML-ENTITIES

Here is the caller graph for this function:

studip_utf8encode (   $string)

Encodes a string from Stud.IP encoding (WINDOWS-1252/ISO-8859-1 with numeric HTML-ENTITIES) to UTF-8

Parameters
stringa string to encode in WINDOWS-1252/HTML-ENTITIES
Returns
string the string in UTF-8

Here is the caller graph for this function:

studygroup_sem_types ( )

Return the list of SEM_TYPES that represent study groups in this Stud.IP installation.

Returns
array list of SEM_TYPES used for study groups

Here is the caller graph for this function:

text_excerpt (   $text,
  $phrase,
  $radius = 100,
  $length = 200,
  $excerpt_string = '...' 
)

Extracts an excerpt from the 'text' surrounding the 'phrase' with a number of characters on each side determined by 'radius'. If the phrase isn't found, null is returned. Ex: text_excerpt("hello my world", "my", 3) => "...lo my wo..."

Parameters
stringthe text to excerpted
stringthe search phrase
integerthe radius around the phrase
integerthe maximum length of the excerpt string
stringthe excerpt string
Returns
type
TrackAccess (   $id,
  $object_type = null 
)

This function tracks user acces to several Data (only dokuments by now, to be extended)

Parameters
stringthe id of the object to track

Here is the call graph for this function:

Here is the caller graph for this function:

unregister_globals ( )

Unset all variables set by register_globals (if enabled). Note: The session variables 'auth' and 'SessSemName' are preserved.

words (   $string)

Splits a string by space characters and returns these words as an array.

Parameters
stringthe string to split
Returns
array the words of the string as array

Here is the caller graph for this function:

write_config (   $key,
  $val,
  $arr = null 
)

write_config

writes an entry into the studip configuration table

Deprecated:
Parameters
stringthe key for the config entry
stringthe value that should be set
arrayan array with key=>value to write into config
Returns
bool true if date was valid, else false

Here is the call graph for this function:

Here is the caller graph for this function: