dokeos-library
[ class tree: dokeos-library ] [ index: dokeos-library ] [ all elements ]

Procedural File: main_api.lib.php

Source Location: /main/inc/lib/main_api.lib.php



Classes:

api_failure
collects and manage failures occuring during script execution The main purpose is allowing to manage the display messages externaly from functions or objects. This strengthens encupsalation principle


Page Details:

This is a code library for Dokeos.

It is included by default in every Dokeos file (through including the global.inc.php)




Tags:

usedby:  get_translation.lib.php - for api_get_path()
filesource:  Source Code for this file





array $api_failureList [line 1080]

Pile the last failure in the failure list



Tags:

return:  false to stay consistent with the main script
author:  Hugues Peeters <peeters@ipm.ucl.ac.be>
Default value:  


[ Top ]





ANONYMOUS [line 56]

ANONYMOUS = 6
global status of a user: human ressource manager


[ Top ]



CONFIGURATION_PATH [line 101]

CONFIGURATION_PATH = 'CONFIGURATION_PATH'

[ Top ]



COURSEMANAGER [line 50]

COURSEMANAGER = 1
global status of a user: course manager


[ Top ]



COURSE_VISIBILITY_CLOSED [line 68]

COURSE_VISIBILITY_CLOSED = 0
only visible for course admin


[ Top ]



COURSE_VISIBILITY_OPEN_PLATFORM [line 72]

COURSE_VISIBILITY_OPEN_PLATFORM = 2
open for all registered users on the platform


[ Top ]



COURSE_VISIBILITY_OPEN_WORLD [line 74]

COURSE_VISIBILITY_OPEN_WORLD = 3
open for the whole world


[ Top ]



COURSE_VISIBILITY_REGISTERED [line 70]

COURSE_VISIBILITY_REGISTERED = 1
only visible for users registered in the course


[ Top ]



DIR_HOTPOTATOES [line 151]

DIR_HOTPOTATOES = '/HotPotatoes_files'

[ Top ]



DRH [line 54]

DRH = 4
global status of a user: human ressource manager


[ Top ]



GARBAGE_PATH [line 94]

GARBAGE_PATH = 'GARBAGE_PATH'

[ Top ]



INCLUDE_PATH [line 99]

INCLUDE_PATH = 'INCLUDE_PATH'

[ Top ]



LIBRARY_PATH [line 100]

LIBRARY_PATH = 'LIBRARY_PATH'

[ Top ]



PLATFORM_AUTH_SOURCE [line 148]

PLATFORM_AUTH_SOURCE = 'platform'

[ Top ]



PLUGIN_PATH [line 96]

PLUGIN_PATH = 'PLUGIN_PATH'

[ Top ]



REL_CODE_PATH [line 88]

REL_CODE_PATH = 'REL_CODE_PATH'

[ Top ]



REL_COURSE_PATH [line 87]

REL_COURSE_PATH = 'REL_COURSE_PATH'

[ Top ]



REL_PATH [line 84]

REL_PATH = 'REL_PATH'

[ Top ]



SECTION_CAMPUS [line 139]

SECTION_CAMPUS = 'mycampus'

[ Top ]



SECTION_COURSES [line 140]

SECTION_COURSES = 'mycourses'

[ Top ]



SECTION_COURSE_ADMIN [line 143]

SECTION_COURSE_ADMIN = 'course_admin'

[ Top ]



SECTION_MYAGENDA [line 142]

SECTION_MYAGENDA = 'myagenda'

[ Top ]



SECTION_MYGRADEBOOK [line 145]

SECTION_MYGRADEBOOK = 'mygradebook'

[ Top ]



SECTION_MYPROFILE [line 141]

SECTION_MYPROFILE = 'myprofile'

[ Top ]



SECTION_PLATFORM_ADMIN [line 144]

SECTION_PLATFORM_ADMIN = 'platform_admin'

[ Top ]



SESSIONADMIN [line 52]

SESSIONADMIN = 3
global status of a user: session admin


[ Top ]



STUDENT [line 48]

STUDENT = 5
global status of a user: student


[ Top ]



SUBSCRIBE_ALLOWED [line 76]

SUBSCRIBE_ALLOWED = 1

[ Top ]



SUBSCRIBE_NOT_ALLOWED [line 77]

SUBSCRIBE_NOT_ALLOWED = 0

[ Top ]



SYS_ARCHIVE_PATH [line 98]

SYS_ARCHIVE_PATH = 'SYS_ARCHIVE_PATH'

[ Top ]



SYS_CODE_PATH [line 90]

SYS_CODE_PATH = 'SYS_CODE_PATH'

[ Top ]



SYS_COURSE_PATH [line 86]

SYS_COURSE_PATH = 'SYS_COURSE_PATH'

[ Top ]



SYS_LANG_PATH [line 91]

SYS_LANG_PATH = 'SYS_LANG_PATH'

[ Top ]



SYS_PATH [line 83]

SYS_PATH = 'SYS_PATH'

[ Top ]



SYS_PLUGIN_PATH [line 95]

SYS_PLUGIN_PATH = 'SYS_PLUGIN_PATH'

[ Top ]



TOOL_ANNOUNCEMENT [line 111]

TOOL_ANNOUNCEMENT = 'announcement'

[ Top ]



TOOL_BACKUP [line 126]

TOOL_BACKUP = 'backup'

[ Top ]



TOOL_BLOGS [line 119]

TOOL_BLOGS = 'blog_management'

[ Top ]



TOOL_CALENDAR_EVENT [line 107]

TOOL_CALENDAR_EVENT = 'calendar_event'

[ Top ]



TOOL_CHAT [line 120]

TOOL_CHAT = 'chat'

[ Top ]



TOOL_CONFERENCE [line 121]

TOOL_CONFERENCE = 'conference'

[ Top ]



TOOL_COPY_COURSE_CONTENT [line 127]

TOOL_COPY_COURSE_CONTENT = 'copy_course_content'

[ Top ]



TOOL_COURSE_DESCRIPTION [line 109]

TOOL_COURSE_DESCRIPTION = 'course_description'

[ Top ]



TOOL_COURSE_HOMEPAGE [line 129]

TOOL_COURSE_HOMEPAGE = 'course_homepage'

[ Top ]



TOOL_COURSE_MAINTENANCE [line 132]

TOOL_COURSE_MAINTENANCE = 'course_maintenance'

[ Top ]



TOOL_COURSE_RIGHTS_OVERVIEW [line 130]

TOOL_COURSE_RIGHTS_OVERVIEW = 'course_rights'

[ Top ]



TOOL_COURSE_SETTING [line 125]

TOOL_COURSE_SETTING = 'course_setting'

[ Top ]



TOOL_DOCUMENT [line 105]

TOOL_DOCUMENT = 'document'

[ Top ]



TOOL_DROPBOX [line 115]

TOOL_DROPBOX = 'dropbox'

[ Top ]



TOOL_FORUM [line 112]

TOOL_FORUM = 'forum'

[ Top ]



TOOL_GROUP [line 118]

TOOL_GROUP = 'group'

[ Top ]



TOOL_HOMEPAGE_LINK [line 124]

TOOL_HOMEPAGE_LINK = 'homepage_link'

[ Top ]



TOOL_HOTPOTATOES [line 106]

TOOL_HOTPOTATOES = 'hotpotatoes'

[ Top ]



TOOL_LEARNPATH [line 110]

TOOL_LEARNPATH = 'learnpath'

[ Top ]



TOOL_LINK [line 108]

TOOL_LINK = 'link'

[ Top ]



TOOL_POST [line 114]

TOOL_POST = 'post'

[ Top ]



TOOL_QUIZ [line 116]

TOOL_QUIZ = 'quiz'

[ Top ]



TOOL_RECYCLE_COURSE [line 128]

TOOL_RECYCLE_COURSE = 'recycle_course'

[ Top ]



TOOL_STUDENTPUBLICATION [line 122]

TOOL_STUDENTPUBLICATION = 'student_publication'

[ Top ]



TOOL_SURVEY [line 136]

TOOL_SURVEY = 'survey'

[ Top ]



TOOL_THREAD [line 113]

TOOL_THREAD = 'thread'

[ Top ]



TOOL_TRACKING [line 123]

TOOL_TRACKING = 'tracking'

[ Top ]



TOOL_UPLOAD [line 131]

TOOL_UPLOAD = 'file_upload'

[ Top ]



TOOL_USER [line 117]

TOOL_USER = 'user'

[ Top ]



TOOL_VISIO [line 133]

TOOL_VISIO = 'visio'

[ Top ]



TOOL_VISIO_CLASSROOM [line 135]

TOOL_VISIO_CLASSROOM = 'visio_classroom'

[ Top ]



TOOL_VISIO_CONFERENCE [line 134]

TOOL_VISIO_CONFERENCE = 'visio_conference'

[ Top ]



UNSUBSCRIBE_ALLOWED [line 78]

UNSUBSCRIBE_ALLOWED = 1

[ Top ]



UNSUBSCRIBE_NOT_ALLOWED [line 79]

UNSUBSCRIBE_NOT_ALLOWED = 0

[ Top ]



WEB_CODE_PATH [line 89]

WEB_CODE_PATH = 'WEB_CODE_PATH'

[ Top ]



WEB_COURSE_PATH [line 85]

WEB_COURSE_PATH = 'WEB_COURSE_PATH'

[ Top ]



WEB_CSS_PATH [line 93]

WEB_CSS_PATH = 'WEB_CSS_PATH'

[ Top ]



WEB_IMG_PATH [line 92]

WEB_IMG_PATH = 'WEB_IMG_PATH'

[ Top ]



WEB_LIBRARY_PATH [line 102]

WEB_LIBRARY_PATH = 'WEB_LIBRARY_PATH'

[ Top ]



WEB_PATH [line 82]

WEB_PATH = 'WEB_PATH'

[ Top ]



WEB_PLUGIN_PATH [line 97]

WEB_PLUGIN_PATH = 'WEB_PLUGIN_PATH'

[ Top ]




api_add_access_url [line 2485]

int api_add_access_url( string $u, [string $d = ''], [int $a = 1])

Adds an access URL into the database



Tags:

return:  The new database id, or the existing database id if this url already exists


Parameters

string   $u   URL
string   $d   Description
int   $a   Active (1= active, 0=disabled)
[ Top ]



api_add_setting [line 2634]

boolean api_add_setting( string $val, string $var, [string $sk = null], [string $type = 'textfield'], [string $c = null], [string $title = ''], [string $com = ''], [string $sc = null], [string $skt = null], [int $a = 1], [int $v = 0])

Sets a platform configuration setting to a given value



Tags:

return:  true on success, false on failure


Parameters

string   $val   The value we want to record
string   $var   The variable name we want to insert
string   $sk   The subkey for the variable we want to insert
string   $type   The type for the variable we want to insert
string   $c   The category for the variable we want to insert
string   $title   The title
string   $com   The comment
string   $sc   The scope
string   $skt   The subkey text
int   $a   The access_url for which this parameter is valid
int   $v   The changeability of this setting for non-master urls
[ Top ]



api_add_url_param [line 796]

void api_add_url_param( $url, $param)



Parameters

   $url  
   $param  
[ Top ]



api_block_anonymous_users [line 205]

void api_block_anonymous_users( )

Function used to prevent anonymous users from accessing a script.



Tags:

author:  Roan Embrechts


[ Top ]



api_check_password [line 859]

true api_check_password( string $password)

Checks a password to see wether it is OK to use.



Tags:

return:  if the password is acceptable, false otherwise


Parameters

string   $password  
[ Top ]



api_chmod_R [line 2257]

void api_chmod_R( $path, $filemode)



Parameters

   $path  
   $filemode  
[ Top ]



api_clear_anonymous [line 910]

bool api_clear_anonymous( [bool $db_check = false])

Clear the user ID from the session if it was the anonymous user. Generally used on out-of-tools pages to remove a user ID that could otherwise be used in the wrong context.

This function is to be used in conjunction with the api_set_anonymous() function to simulate the user existence in case of an anonymous visit.




Tags:

return:  true if succesfully unregistered, false if not anonymous.


Parameters

bool   $db_check   database check switch - passed to api_is_anonymous()
[ Top ]



api_delete_category_settings [line 2608]

boolean api_delete_category_settings( string $c, [int $a = 1])

Delete all the settings from one category



Tags:

return:  False on failure, true on success


Parameters

string   $c   Category
int   $a   Access URL
[ Top ]



api_delete_setting [line 2581]

boolean api_delete_setting( string $v, [string $s = NULL], [int $a = 1])

Delete setting



Tags:

return:  False on failure, true on success


Parameters

string   $v   Variable
string   $s   Subkey
int   $a   Access URL
[ Top ]



api_display_array [line 1464]

void api_display_array( array $info_array)

Displays the contents of an array in a messagebox.



Parameters

array   $info_array   An array with the messages to show
[ Top ]



api_display_debug_info [line 1478]

void api_display_debug_info( string $debug_info)

Displays debug info



Tags:

author:  Roan Embrechts
version:  1.1, March 2004


Parameters

string   $debug_info   The message to display
[ Top ]



api_display_language_form [line 1884]

void api_display_language_form( )

Displays a form (drop down menu) so the user can select his/her preferred language.

The form works with or without javascript




[ Top ]



api_display_tool_title [line 1340]

void api_display_tool_title( mixed $titleElement)

Displays the title of a tool.

Normal use: parameter is a string: api_display_tool_title("My Tool")

Optionally, there can be a subtitle below the normal title, and / or a supra title above the normal title.

e.g. supra title: group GROUP PROPERTIES

e.g. subtitle: AGENDA calender & events tool




Tags:

author:  Hugues Peeters <hugues.peeters@claroline.net>


Parameters

mixed   $titleElement   - it could either be a string or an array containing 'supraTitle', 'mainTitle', 'subTitle'
[ Top ]



api_display_tool_view_option [line 1386]

void api_display_tool_view_option( )

Display options to switch between student view and course manager view

Changes in version 1.2 (Patrick Cool) Student view switch now behaves as a real switch. It maintains its current state until the state is changed explicitly

Changes in version 1.1 (Patrick Cool) student view now works correctly in subfolders of the document tool student view works correctly in the new links tool

Example code for using this in your tools: //if ( $is_courseAdmin && api_get_setting('student_view_enabled') == 'true' ) //{ // display_tool_view_option($isStudentView); //} //and in later sections, use api_is_allowed_to_edit()




Tags:

author:  Patrick Cool
version:  1.2
todo:  rewrite code so it is easier to understand


[ Top ]



api_disp_html_area [line 2020]

void api_disp_html_area( string $name, [string $content = ''], [int $height = ''], [int $width = '100%'], [string $optAttrib = ''])

Displays the FckEditor WYSIWYG editor for online editing of html



Parameters

string   $name   The name of the form-element
string   $content   The default content of the html-editor
int   $height   The height of the form element
int   $width   The width of the form element
string   $optAttrib   optional attributes for the form element
[ Top ]



api_generate_password [line 840]

string api_generate_password( [ $length = 8], int $length,)

Returns a difficult to guess password.



Tags:

return:  the generated password


Parameters

int   $length,   the length of the password
   $length  
[ Top ]



api_get_access_urls [line 2462]

array api_get_access_urls( [ $from = 0], [ $to = 1000000], [ $order = 'url'], [ $direction = 'ASC'])

Get all available access urls in an array (as in the database)



Tags:

return:  Array of database records


Parameters

   $from  
   $to  
   $order  
   $direction  
[ Top ]



api_get_anonymous_id [line 529]

int api_get_anonymous_id( )

Gets an anonymous user ID

For some tools that need tracking, like the learnpath tool, it is necessary to have a usable user-id to enable some kind of tracking, even if not perfect. An anonymous ID is taken from the users table by looking for a status of "6" (anonymous).




Tags:

return:  User ID of the anonymous user, or O if no anonymous user found


[ Top ]



api_get_cidreq [line 549]

void api_get_cidreq( )

Returns the cidreq parameter name + current course id



[ Top ]



api_get_course_id [line 479]

void api_get_course_id( )

Returns the current course id (integer)



[ Top ]



api_get_course_info [line 577]

void api_get_course_info( [ $course_code = null])

Returns the current course info array.

Note: this array is only defined if the user is inside a course. Array elements: ['name'] ['official_code'] ['sysCode'] ['path'] ['dbName'] ['dbNameGlu'] ['titular'] ['language'] ['extLink']['url' ] ['extLink']['name'] ['categoryCode'] ['categoryName'] Now if the course_code is given, the returned array gives info about that particular course, not specially the current one.




Tags:

todo:  same behaviour as api_get_user_info so that api_get_course_id becomes absolete too


Parameters

   $course_code  
[ Top ]



api_get_course_path [line 491]

string api_get_course_path( [string $course_code = null])

Returns the current course directory

This function relies on api_get_course_info()




Tags:

return:  The directory where the course is located inside the Dokeos "courses" directory
author:  Yannick Warnier <yannick.warnier@dokeos.com>


Parameters

string   $course_code   The course code - optional (takes it from session if not given)
[ Top ]



api_get_course_setting [line 508]

mixed api_get_course_setting( string $setting_name)

Gets a course setting from the current course_setting table. Try always using integer values.



Tags:

return:  The value of that setting in that table. Return -1 if not found.


Parameters

string   $setting_name   The name of the setting we want from the table
[ Top ]



api_get_interface_language [line 1218]

string api_get_interface_language( )

Gets the current interface language



Tags:

return:  The current language of the interface


[ Top ]



api_get_item_visibility [line 1757]

int api_get_item_visibility( array $_course, string $tool, int $id)

Gets item visibility from the item_property table



Tags:

return:  -1 on error, 0 if invisible, 1 if visible


Parameters

array   $_course   Course properties array (result of api_get_course_info())
string   $tool   Tool (learnpath, document, etc)
int   $id   The item ID in the given tool
[ Top ]



api_get_languages [line 1933]

array api_get_languages( )

Return a list of all the languages that are made available by the admin.



Tags:

return:  An array with all languages. Structure of the array is array['name'] = An array with the name of every language array['folder'] = An array with the corresponding dokeos-folder


[ Top ]



api_get_language_isocode [line 1949]

string api_get_language_isocode( )

Get language isocode column from the language table, taking the current language as a query



Tags:

return:  The isocode (two-letters code or 5 letters code, fr or fr-BE) or null if error


[ Top ]



api_get_last_failure [line 1047]

string api_get_last_failure( [void 0 = ])

get the last failure stored in $api_failureList;



Tags:

return:  - the last failure stored
author:  Hugues Peeters <hugues.peeters@claroline.net>


Parameters

void   0  
[ Top ]



api_get_navigator [line 226]

an api_get_navigator( )



Tags:

return:  array with the navigator name and version


[ Top ]



api_get_path [line 305]

void api_get_path( one $path_type)

Returns a full path to a certain Dokeos area, which you specify through a parameter.

See $_configuration['course_folder'] in the configuration.php to alter the WEB_COURSE_PATH and SYS_COURSE_PATH parameters.




Tags:

example:  example not found


Parameters

one   $path_type   of the following constants: WEB_PATH, SYS_PATH, REL_PATH, WEB_COURSE_PATH, SYS_COURSE_PATH, REL_COURSE_PATH, REL_CODE_PATH, WEB_CODE_PATH, SYS_CODE_PATH, SYS_LANG_PATH, WEB_IMG_PATH, GARBAGE_PATH, PLUGIN_PATH, SYS_ARCHIVE_PATH, INCLUDE_PATH, LIBRARY_PATH, CONFIGURATION_PATH
[ Top ]



api_get_self [line 1135]

string api_get_self( )

Returns an escaped version of $_SERVER['PHP_SELF'] to avoid XSS injection



Tags:

return:  Escaped version of $_SERVER['PHP_SELF']


[ Top ]



api_get_setting [line 1125]

void api_get_setting( string $variable, [string $key = NULL])

Returns the value of a setting from the web-adjustable admin config settings.

WARNING true/false are stored as string, so when comparing you need to check e.g. if(api_get_setting("show_navigation_menu") == "true") //CORRECT instead of if(api_get_setting("show_navigation_menu") == true) //INCORRECT




Tags:

author:  Rene Haentjens
author:  Bart Mollet


Parameters

string   $variable   The variable name
string   $key   The subkey (sub-variable) if any. Defaults to NULL
[ Top ]



api_get_settings [line 2523]

array api_get_settings( [string $cat = null], [string $ordering = 'list'], [int $access_url = 1])

Gets all the current settings for a specific access url



Tags:

return:  Array of database results for the current settings of the current access URL


Parameters

string   $cat   The category, if any, that we want to get
string   $ordering   Whether we want a simple list (display a catgeory) or a grouped list (group by variable as in settings.php default). Values: 'list' or 'group'
int   $access_url   Access URL's ID. Optional. Uses 1 by default, which is the unique URL
[ Top ]



api_get_settings_categories [line 2555]

array api_get_settings_categories( [array $exceptions = array()], [int $access_url = 1])

Gets the distinct settings categories



Tags:

return:  A list of categories


Parameters

array   $exceptions   Array of strings giving the categories we want to exclude
int   $access_url   Access URL. Optional. Defaults to 1
[ Top ]



api_get_status_langvars [line 2341]

array api_get_status_langvars( )

get the status langvars list



Tags:

return:  the list of status with their translations


[ Top ]



api_get_themes [line 1965]

array api_get_themes( )

Returns a list of CSS themes currently available in the CSS folder



Tags:

return:  List of themes directories from the css folder


[ Top ]



api_get_user_id [line 428]

integer api_get_user_id( )

This function returns the id of the user which is stored in the $_user array.



Tags:

return:  the id of the current user
example:  example not found


[ Top ]



api_get_user_info [line 443]

$user_info api_get_user_info( [$user_id $user_id = ''])

find all the information about a user. If no paramater is passed you find all the information about the current user.



Tags:

return:  (array): user_id, lastname, firstname, username, email, ...
author:  Patrick Cool <patrick.cool@UGent.be>
version:  21 September 2004


Parameters

$user_id   $user_id   (integer): the id of the user
[ Top ]



api_get_version [line 2287]

string api_get_version( )

Get Dokeos version from the configuration files



Tags:

return:  A string of type "1.8.4", or an empty string if the version could not be found


[ Top ]



api_is_allowed [line 1533]

void api_is_allowed( $tool $tool, $action $action, [ $task_id = 0])

this fun



Tags:

author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University
version:  1.0


Parameters

$tool   $tool   the tool we are checking ifthe user has a certain permission
$action   $action   the action we are checking (add, edit, delete, move, visibility)
   $task_id  
[ Top ]



api_is_allowed_to_create_course [line 1251]

boolean api_is_allowed_to_create_course( )

Check if current user is allowed to create courses



Tags:

return:  True if the user has course creation rights, false otherwise.


[ Top ]



api_is_allowed_to_edit [line 1506]

boolean, api_is_allowed_to_edit( [bool $tutor = false], [bool $coach = false])

Function that removes the need to directly use is_courseAdmin global in tool scripts. It returns true or false depending on the user's rights in this particular course.

Optionally checking for tutor and coach roles here allows us to use the student_view feature altogether with these roles as well.




Tags:

return:  true: the user has the rights to edit, false: he does not
author:  Patrick Cool
author:  Roan Embrechts
version:  1.1, February 2004


Parameters

bool   $tutor   Whether to check if the user has the tutor role
bool   $coach   Whether to check if the user has the coach role
[ Top ]



api_is_anonymous [line 1608]

bool api_is_anonymous( [int $user_id = null], [bool $db_check = false])

Tells whether this user is an anonymous user



Tags:

return:  true if this user is anonymous, false otherwise


Parameters

int   $user_id   User ID (optional, will take session ID if not provided)
bool   $db_check   Whether to check in the database (true) or simply in the session (false) to see if the current user is the anonymous user
[ Top ]



api_is_coach [line 1283]

boolean api_is_coach( )

Check if the current user is a course or session coach



Tags:

return:  True if current user is a course or session coach


[ Top ]



api_is_course_admin [line 1259]

boolean api_is_course_admin( )

Check if the current user is a course administrator



Tags:

return:  True if current user is a course administrator


[ Top ]



api_is_course_coach [line 1267]

bool api_is_course_coach( )

Check if the current user is a course coach



Tags:

return:  True if current user is a course coach


[ Top ]



api_is_course_tutor [line 1275]

bool api_is_course_tutor( )

Check if the current user is a course tutor



Tags:

return:  True if current user is a course tutor


[ Top ]



api_is_platform_admin [line 1234]

boolean api_is_platform_admin( [ $allow_sessions_admins = false])

Check if current user is a platform administrator



Tags:

return:  True if the user has platform admin rights, false otherwise.


Parameters

   $allow_sessions_admins  
[ Top ]



api_is_plugin_installed [line 2153]

boolean api_is_plugin_installed( $plugin_list, $plugin_name)

Checks to see wether a certain plugin is installed.



Tags:

return:  true if the plugin is installed, false otherwise.


Parameters

   $plugin_list  
   $plugin_name  
[ Top ]



api_is_self_registration_allowed [line 260]

True api_is_self_registration_allowed( )



Tags:

return:  if user selfregistration is allowed, false otherwise.


[ Top ]



api_item_property_update [line 1789]

boolean api_item_property_update( $_course $_course, $tool $tool, $item_id $item_id, $lastedit_type $lastedit_type, $user_id $user_id, [$to_group_id $to_group_id = 0], [$to_user_id $to_user_id = NULL], [string $start_visible = 0], [unknown_type $end_visible = 0])

update the item_properties table (if entry not exists, insert) of the course



Tags:

return:  False if update fails.
author:  Toon Van Hoecke <Toon.VanHoecke@UGent.be>, Ghent University
version:  January 2005


Parameters

string   $start_visible   0000-00-00 00:00:00 format
unknown_type   $end_visible   0000-00-00 00:00:00 format
$_course   $_course   : array with course properties
$tool   $tool   : tool id, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
$item_id   $item_id   : id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
$lastedit_type   $lastedit_type   : add or update action (1) message to be translated (in trad4all) : e.g. DocumentAdded, DocumentUpdated; (2) "delete"; (3) "visible"; (4) "invisible";
$user_id   $user_id   : id of the editing/adding user
$to_group_id   $to_group_id   : id of the intended group ( 0 = for everybody), only relevant for $type (1)
$to_user_id   $to_user_id   : id of the intended user (always has priority over $to_group_id !), only relevant for $type (1)
[ Top ]



api_max_sort_value [line 2080]

int api_max_sort_value( $user_course_category, $user_id, int $user_course_category:)

Find the largest sort value in a given user_course_category

This function is used when we are moving a course to a different category and also when a user subscribes to a courses (the new courses is added to the end of the main category




Tags:

return:  the value of the highest sort of the user_course_category
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters

int   $user_course_category:   the id of the user_course_category
   $user_course_category  
   $user_id  
[ Top ]



api_not_allowed [line 1655]

void api_not_allowed( [bool $print_headers = false])

Displays message "You are not allowed here..." and exits the entire script.



Tags:

author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University
author:  Roan Embrechts
author:  Yannick Warnier
version:  1.0, February 2004
version:  dokeos 1.8, August 2006


Parameters

bool   $print_headers   Whether or not to print headers (default = false -> does not print them)
[ Top ]



api_number_of_plugins [line 2122]

void api_number_of_plugins( $location)

Determines the number of plugins installed for a given location



Parameters

   $location  
[ Top ]



api_parse_tex [line 2170]

string api_parse_tex( $textext, string $text)

Apply parsing to content to parse tex commandos that are seperated by [tex] [/tex] to make it readable for techexplorer plugin.



Tags:

return:  The text after parsing.
author:  Patrick Cool <patrick.cool@UGent.be>
version:  June 2004


Parameters

string   $text   The text to parse
   $textext  
[ Top ]



api_plugin [line 2136]

void api_plugin( $location)

including the necessary plugins



Tags:

author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters

   $location  
[ Top ]



api_protect_admin_script [line 191]

void api_protect_admin_script( [ $allow_sessions_admins = false])

Function used to protect an admin script.

The function blocks access when the user has no platform admin rights. This is only the first proposal, test and improve!




Tags:

author:  Roan Embrechts


Parameters

   $allow_sessions_admins  
[ Top ]



api_protect_course_script [line 171]

void api_protect_course_script( [boolean $print_headers = false])

Function used to protect a course script.

The function blocks access when

  • there is no $_SESSION["_course"] defined; or
  • $is_allowed_in_course is set to false (this depends on the course
visibility and user status).

This is only the first proposal, test and improve!




Tags:

author:  Roan Embrechts
todo:  replace global variable


Parameters

boolean   $print_headers   Option to print headers when displaying error message. Default: false
[ Top ]



api_return_html_area [line 2036]

void api_return_html_area( $name, [ $content = ''], [ $height = ''], [ $width = '100%'], [ $optAttrib = ''])



Parameters

   $name  
   $content  
   $height  
   $width  
   $optAttrib  
[ Top ]



api_send_mail [line 2066]

void api_send_mail( string $to, string $subject, string $message, [string $additional_headers = null], [string $additional_parameters = null])

Send an email.

Wrapper function for the standard php mail() function. Change this function to your needs. The parameters must follow the same rules as the standard php mail() function. Please look at the documentation on http: //www. php. net/manual/en/function. mail.php




Parameters

string   $to  
string   $subject  
string   $message  
string   $additional_headers  
string   $additional_parameters  
[ Top ]



api_session_clear [line 773]

void api_session_clear( )

Clear the session



Tags:

author:  Olivier Brouckaert


[ Top ]



api_session_destroy [line 784]

void api_session_destroy( )

Destroy the session



Tags:

author:  Olivier Brouckaert


[ Top ]



api_session_register [line 743]

void api_session_register( string $variable)

save a variable into the session

BUG: function works only with global variables




Tags:

author:  Olivier Brouckaert


Parameters

string   $variable   variable - the variable name to save into the session
[ Top ]



api_session_start [line 695]

void api_session_start( [string $already_installed = true])

Start the Dokeos session.

The default lifetime for session is set here. It is not possible to have it as a database setting as it is used before the database connection has been made. It is taken from the configuration file, and if it doesn't exist there, it is set to 360000 seconds




Tags:

author:  Olivier Brouckaert


Parameters

string   $already_installed   variable - the variable name to save into the session
[ Top ]



api_session_unregister [line 755]

void api_session_unregister( string $variable)

Remove a variable from the session.



Tags:

author:  Olivier Brouckaert


Parameters

string   $variable   variable - the variable name to remove from the session
[ Top ]



api_set_anonymous [line 1014]

bool api_set_anonymous( )

Sets the current user as anonymous if it hasn't been identified yet. This

function should be used inside a tool only. The function api_clear_anonymous() acts in the opposite direction by clearing the anonymous user's data every time we get on a course homepage or on a neutral page (index, admin, my space)




Tags:

return:  true if set user as anonymous, false if user was already logged in or anonymous id could not be found


[ Top ]



api_set_failure [line 1000]

bolean api_set_failure( string $failureType)

Fills a global array called $api_failureList

This array collects all the failure occuring during the script runs The main purpose is allowing to manage the display messages externaly from the functions or objects. This strengthens encupsalation principle




Tags:

return:  false to stay consistent with the main script
author:  Hugues Peeters <peeters@ipm.ucl.ac.be>


Parameters

string   $failureType   - the type of failure
[ Top ]



api_set_setting [line 2359]

void api_set_setting( string $var, string $value, [string $subvar = null], [string $cat = null], [int $access_url = 1])

Sets a platform configuration setting to a given value



Parameters

string   $var   The variable we want to update
string   $value   The value we want to record
string   $subvar   The sub-variable if any (in most cases, this will remain null)
string   $cat   The category if any (in most cases, this will remain null)
int   $access_url   The access_url for which this parameter is valid
[ Top ]



api_set_settings_category [line 2435]

void api_set_settings_category( string $category, [string $value = null], [int $access_url = 1])

Sets a whole category of settings to one specific value



Parameters

string   $category   Category
string   $value   Value
int   $access_url   Access URL. Optional. Defaults to 1
[ Top ]



api_sql_query [line 637]

resource api_sql_query( string $query, [string $file = ''], [string $line = 0])

Executes an SQL query You have to use addslashes() on each value that you want to record into the database



Tags:

return:  - the return value of the query
author:  Olivier Brouckaert


Parameters

string   $query   - SQL query
string   $file   - optional, the file path and name of the error (__FILE__)
string   $line   - optional, the line of the error (__LINE__)
[ Top ]



api_status_exists [line 2306]

true api_status_exists( mixed $status_asked)

Check if status given in parameter exists in the platform



Tags:

return:  if the status exists, else returns false


Parameters

mixed   $status_asked   the status (can be either int either string)
[ Top ]



api_status_key [line 2324]

true api_status_key( mixed $status)

Check if status given in parameter exists in the platform



Tags:

return:  if the status exists, else returns false


Parameters

mixed   $status   the status (can be either int either string)
[ Top ]



api_store_result [line 669]

array api_store_result( resource $result)

Store the result of a query into an array



Tags:

return:  - the value returned by the query
author:  Olivier Brouckaert


Parameters

resource   $result   - the return value of the query
[ Top ]



api_time_to_hms [line 2190]

string api_time_to_hms( integer $seconds)

Transform a number of seconds in hh:mm:ss format



Tags:

return:  the formated time
author:  Julian Prud'homme


Parameters

integer   $seconds   the number of seconds
[ Top ]



api_trunc_str [line 934]

void api_trunc_str( string $text, [integer $length = 30], [string $endStr = '...'], [boolean $middle = false])

truncates a string



Tags:

author:  Brouckaert Olivier


Parameters

string   $text   text - text to truncate
integer   $length   length - length of the truncated text
string   $endStr   endStr - suffix
boolean   $middle   middle - if true, truncates on string middle
[ Top ]



convert_mysql_date [line 1741]

unix convert_mysql_date( $last_post_datetime $last_post_datetime)

convert sql date to unix timestamp



Tags:

return:  timestamp
author:  Toon Van Hoecke <Toon.VanHoecke@UGent.be>
version:  October 2003


Parameters

$last_post_datetime   $last_post_datetime   standard output date in a sql query
[ Top ]



copyr [line 2222]

void copyr( the $source, the $dest, [an $exclude = array()], [copied_files $copied_files = array()])

function adapted from a php.net comment

copy recursively a folder




Parameters

the   $source   source folder
the   $dest   dest folder
an   $exclude   array of excluded file_name (without extension)
copied_files   $copied_files   the returned array of copied files
[ Top ]



domesticate [line 966]

void domesticate( string $input)

handling simple and double apostrofe in order that strings be stored properly in database



Tags:

author:  Denes Nagy


Parameters

string   $input   variable - the variable to be revised
[ Top ]



get_lang [line 1156]

language get_lang( $variable, [ $notrans = 'DLTT'])

Whenever the server type in the Dokeos Config settings is set to test/development server you will get an indication that a language variable is not translated and a link to a suggestions form of DLTT.



Tags:

return:  variable '$lang'.$variable or language variable $variable.
author:  Roan Embrechts
author:  Patrick Cool


Parameters

   $variable  
   $notrans  
[ Top ]



get_setting [line 1106]

void get_setting( $variable, [ $key = NULL])

DEPRECATED, use api_get_setting instead



Parameters

   $variable  
   $key  
[ Top ]



is_allowed_to_edit [line 1487]

void is_allowed_to_edit( )



[ Top ]



shorten [line 951]

void shorten( $input, [ $length = 15])



Parameters

   $input  
   $length  
[ Top ]



string_2_boolean [line 2107]

boolean string_2_boolean( string $string)

This function converts the string "true" or "false" to a boolean true or false.

This function is in the first place written for the Dokeos Config Settings (also named AWACS)




Tags:

return:  true or false
author:  Patrick Cool <patrick.cool@UGent.be>, Ghent University


Parameters

string   $string   "true" or "false"
[ Top ]



Documentation generated on Thu, 12 Jun 2008 14:03:52 -0500 by phpDocumentor 1.4.1