claroline/claroline/inc/lib/claro_main.lib.php File Reference

Go to the source code of this file.

Data Structures

class  claro_failure

Namespaces

namespace  kernel
namespace  failure

Functions

 claro_get_course_data ($courseId=NULL, $force=false)
 claro_get_main_group_properties ($courseId)
 claro_get_course_db_name ($cid=NULL)
 claro_get_course_db_name_glued ($cid=NULL)
 claro_get_course_path ($cid=NULL)
 claro_get_group_data ($context, $force=false)
 claro_get_course_group_path ($context)
 claro_get_tool_name_list ()
 claro_get_module_name_list ($active=true)
 claro_get_main_course_tool_list ($force=false)
 claro_get_course_tool_list ($courseIdReq, $profileIdReq, $force=false, $active=true, $courseActive=true)
 claro_get_course_external_link_list ($courseIdReq=null, $force=false)
 claro_get_tool_name ($identifier)
 claro_get_module_name ($identifier)
 claro_enable_tool_view_option ()
 claro_set_tool_view_mode ($viewMode)
 claro_disp_tool_view_option ($viewModeRequested=false)
 claro_html_tool_view_option ($viewModeRequested=false)
 claro_get_tool_view_mode ()
 claro_is_allowed_to_edit ()
 claro_is_display_mode_available ()
 claro_set_display_mode_available ($mode)
 claro_date ($format, $timestamp=-1)
 claro_time ()
 claro_mktime ()
 claro_is_javascript_enabled ()
 claro_get_language_list ()
 claro_get_conf_repository ($context=array())
 get_conf ($param, $default=null)
 claro_die ($message)
 http_response_splitting_workaround ($str)
 claro_unquote_gpc ()
 claro_get_current_context ($contextKeys=null)
 pushClaroMessage ($message, $errorClass='error')
 getClaroMessageList ($errorClass=null)
 claro_get_user_tool_list ($activeOnly=true)
 claro_redirect ($location)
 claro_form_relay_context ($context=null)
 claro_url_relay_context ($prepend='', $context=null)
 claro_disp_debug_banner ()
 php_self ()
 page_uri ($html=true)
 claro_debug_mode ()
 claro_is_course_tool_activated ($courseId, $toolId)
 claro_get_tool_id_from_course_tid ($tid, $courseId=null, $profileId=null)
 load_kernel_config ($name)

Variables

 $claro_failureList = array()

Function Documentation

claro_date ( format,
timestamp = -1 
)

Compose currentdate with server time shift

Parameters:
string $format date() format
integer $timestamp timestamp or default -1 for "now()"
Returns:
date()
Author:
Christophe Gesche <moosh@claroline.net>

Definition at line 1148 of file claro_main.lib.php.

claro_debug_mode (  ) 
Returns:
bool, true if the platform is in debug mode, false else

Definition at line 1659 of file claro_main.lib.php.

claro_die ( message  ) 

SECTION : security Terminate the script and display message

Parameters:
string message

Definition at line 1340 of file claro_main.lib.php.

claro_disp_debug_banner (  ) 

Get (and not display !) the debug banner html code

Returns:
string

Definition at line 1589 of file claro_main.lib.php.

claro_disp_tool_view_option ( viewModeRequested = false  ) 

Display options to switch between student view and course manager view This function is mainly used by the claro_init_banner.inc.php file The display mode command will only be displayed if claro_set_tool_view_mode(true) has been previously called. This will affect the return value of claro_is_allowed_to_edit() function. It will ten return false as the user is a simple student.

Author:
Roan Embrechts
Hugues Peeters
Parameters:
string - $viewModeRequested. For now it can be 'STUDENT' or 'COURSE_ADMIN'
See also:
claro_is_allowed_to_edit()
claro_is_display_mode_available()
claro_set_display_mode_available()
claro_get_tool_view_mode()
claro_set_tool_view_mode()
Returns:
true;

Definition at line 940 of file claro_main.lib.php.

claro_enable_tool_view_option (  ) 

SECTION : "view AS" Set if the access level switcher is aivailable

boolean claro_toolViewOptionEnabled

Returns:
true
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 887 of file claro_main.lib.php.

claro_form_relay_context ( context = null  ) 

Generate some informations in HTML format over the execution context.
Informations are placed into hidden inputs.

Definition at line 1523 of file claro_main.lib.php.

claro_get_conf_repository ( context = array()  ) 

Return the config ropisitory for a given context

All platform config are stored in platform/conf/ But a course or a group can overide some config values

This function return the repository ignoring if it's existing or empty

Parameters:
array $context
Returns:
string

Definition at line 1277 of file claro_main.lib.php.

claro_get_course_data ( courseId = NULL,
force = false 
)

SECTION : Function to access the sql datas SECTION : Class & function to prepare a normalised html output. SECTION : Class & function to prepare a normalised html output. SECTION : File handling functions SECTION : PHP COMPAT For PHP backward compatibility SECTION : Class & function to prepare a normalised html output. SECTION : Class & function to get text zone contents. SECTION : Modules functions SECTION : Icon functions depends on module.lib.php SECTION : Get kernel SUBSECTION datas for courses Get unique keys of a course.

Parameters:
string $courseId (optionnal) If not set, it use the current course will be taken.
Returns:
array list of unique keys (sys, db & path) of a course
Author:
Christophe Gesche <moosh@claroline.net>
Frederic Minne <zefredz@claroline.net>
Since:
1.7

Definition at line 89 of file claro_main.lib.php.

claro_get_course_db_name ( cid = NULL  ) 

Get the db name of a course.

Parameters:
string $course_id (optionnal) If not set, it use the current course will be taken.
Returns:
string db_name
Author:
Christophe Gesche <moosh@claroline.net>
Since:
1.7

Definition at line 248 of file claro_main.lib.php.

claro_get_course_db_name_glued ( cid = NULL  ) 

Get the glued db name of a course. Ready to be use in claro_get_course_table_name.

Parameters:
string $course_id (optionnal) If not set, it use the current course will be taken.
Returns:
string db_name glued
Author:
Christophe Gesche <moosh@claroline.net>
Since:
1.7

Definition at line 265 of file claro_main.lib.php.

claro_get_course_external_link_list ( courseIdReq = null,
force = false 
)

Return the tool list for a course according a certain access level

Parameters:
boolean $force (optionnal) - reset the result cache, default is false
Returns:
array the main course list array ( $id => 'name','url','icon','visibility' )

Definition at line 664 of file claro_main.lib.php.

claro_get_course_group_path ( context  ) 

Definition at line 366 of file claro_main.lib.php.

claro_get_course_path ( cid = NULL  ) 

Get the path of a course.

Parameters:
string $course_id (optionnal) If not set, it use the current course will be taken.
Returns:
string path
Author:
Christophe Gesche <moosh@claroline.net>
Since:
1.7

Definition at line 281 of file claro_main.lib.php.

claro_get_course_tool_list ( courseIdReq,
profileIdReq,
force = false,
active = true,
courseActive = true 
)

Return the tool list for a course according a certain access level

Parameters:
string $courseIdReq - the requested course id
boolean $force (optionnal) - reset the result cache, default is false
boolean $active (optionnal) - get the list of active tool only if set to true (default behaviour)
mixed $courseActive (optional) - set to true (default behaviour) to get only activated course tools, set to false to get all course tools
Returns:
array the course list

Definition at line 556 of file claro_main.lib.php.

claro_get_current_context ( contextKeys = null  ) 
Parameters:
$contextKeys array or null

array can contain course, group, user and/or toolInstance

return array of context requested containing current id fors these context.

Definition at line 1429 of file claro_main.lib.php.

claro_get_group_data ( context,
force = false 
)

SECTION : Get kernel SUBSECTION datas for groups Get unique keys of a course.

Parameters:
string $course_id (optionnal) If not set, it use the current course will be taken.
Returns:
array list of unique keys (sys, db & path) of a course
Author:
Christophe Gesche <moosh@claroline.net>
Since:
1.7

Definition at line 303 of file claro_main.lib.php.

claro_get_language_list (  ) 

get the list of aivailable languages on the platform

Author:
Christophe Gesche <moosh@claroline.net>
Returns:
array( langCode => langLabel) with aivailable languages

Definition at line 1233 of file claro_main.lib.php.

claro_get_main_course_tool_list ( force = false  ) 

SECTION : Get kernel SUBSECTION datas for rel tool courses Return the list of tool installed on the platform

Parameters:
boolean $force (optionnal) - reset the result cache, default is false
Returns:
array the main course list array ( $tid => 'label','name','url','icon','activation' )

Definition at line 473 of file claro_main.lib.php.

claro_get_main_group_properties ( courseId  ) 

This function return properties for groups in a given course context.

Parameters:
string $courseId sysCode of the course.
Returns:
array ('registrationAllowed' , 'self_registration', 'private', 'nbGroupPerUser', 'tools' => array ('CLFRM', 'CLDOC', 'CLWIKI', 'CLCHT') )

The 4th first properties are course properties dedicated to groups as default value. The 'tool' array is like course.tool_list.

Definition at line 197 of file claro_main.lib.php.

claro_get_module_name ( identifier  ) 

Return the name of a given module

Parameters:
mixed $identifier interger for a module id string for a claro label
Returns:
string translated tool name;

Definition at line 732 of file claro_main.lib.php.

claro_get_module_name_list ( active = true  ) 

Get a list of tag names of some tools This is a bad named function because they return only tool type modules

Returned tagname is the "Developpers english name" this tag would be passed to get_lang

Parameters:
boolean $active true filter to keep only tools activated in platform
Returns:
array( `label`=>`tagname`)

Definition at line 403 of file claro_main.lib.php.

claro_get_tool_id_from_course_tid ( tid,
courseId = null,
profileId = null 
)

Get the main tool_id for a given course tool from its tid in the course

Parameters:
int $tid id of the tool instance in the course
string $courseId id (sysCode) of the course (optional, current course used if missing)
int $profileId profile of the user to get the tool list from (optional, current user used if missing)
Returns:
int tool_id, main tool id

Definition at line 1699 of file claro_main.lib.php.

claro_get_tool_name ( identifier  ) 

Get the name of a tool

Parameters:
string identifier is tool_id or tool_label
Returns:
string tool name

Definition at line 719 of file claro_main.lib.php.

claro_get_tool_name_list (  ) 

SECTION : Get kernel SUBSECTION datas for tools Get names of tools in an array where key are Claro_label

Returns:
array list of localised name of tools
Todo:
with plugin, this lis would be read in a dynamic datasource

Definition at line 389 of file claro_main.lib.php.

claro_get_tool_view_mode (  ) 

return the current mode in tool able to handle different view mode

Returns:
string 'COURSE_ADMIN' or 'STUDENT'
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 1049 of file claro_main.lib.php.

claro_get_user_tool_list ( activeOnly = true  ) 

Return the list of tools for a user

in 1.8 only CLCAL are both course tool and user tool. ie : profile is'nt view as module, and other course tool can't work outside a course for a user.

Parameters:
boolean $activeOnly default true
Returns:
array of tools

Definition at line 1481 of file claro_main.lib.php.

claro_html_tool_view_option ( viewModeRequested = false  ) 

Definition at line 951 of file claro_main.lib.php.

claro_is_allowed_to_edit (  ) 

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.

Version:
1.1, February 2004
Returns:
boolean true: the user has the rights to edit, false: he does not
Author:
Roan Embrechts
Patrick Cool

Definition at line 1081 of file claro_main.lib.php.

claro_is_course_tool_activated ( courseId,
toolId 
)

Is the given tool activated in the given course

Parameters:
string $courseId course code
string $toolId tool id in the course, not the main tool id !
Returns:
boolean

Definition at line 1671 of file claro_main.lib.php.

claro_is_display_mode_available (  ) 
Returns:
boolean
Author:
Hugues Peeters <hugues.peeters@claroline.net>

Definition at line 1116 of file claro_main.lib.php.

claro_is_javascript_enabled (  ) 

checks if the javascript is enabled on the client browser Actually a cookies is set on the header by a javascript code. If this cookie isn't set, it means javascript isn't enabled.

Returns:
boolean enabling state of javascript
Author:
Hugues Peeters <hugues.peeters@claroline.net>

Definition at line 1210 of file claro_main.lib.php.

claro_mktime (  ) 

Equivalent to mktime but taking the mainTimeShift into account

Usage : claro_mktime ( [int hour [, int minute [, int second [, int month [ , int day [, int year [, int is_dst]]]]]]] )

See also:
mktime()
Returns:
timestamp corresponding to the given arguments shifted by mainTimeShift config value
Author:
Frederic Minne <zefredz@claroline.net>

Definition at line 1181 of file claro_main.lib.php.

claro_redirect ( location  ) 

Safe redirect Works around IIS Bug

Definition at line 1499 of file claro_main.lib.php.

claro_set_display_mode_available ( mode  ) 
Parameters:
boolean $mode state to set in mode
Returns:
boolean mode
Author:
Hugues Peeters <hugues.peeters@claroline.net>

Definition at line 1131 of file claro_main.lib.php.

claro_set_tool_view_mode ( viewMode  ) 

Set if the access level switcher is aivailable

Parameters:
$viewMode 'STUDENT' or 'COURSE_ADMIN'
Returns:
true if set succeed.
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 904 of file claro_main.lib.php.

claro_time (  ) 

Compose currentdate with server time shift

Returns:
timestamp shifted by mainTimeShift config value
Author:
Christophe Gesche <moosh@claroline.net>

Definition at line 1163 of file claro_main.lib.php.

claro_unquote_gpc (  ) 

Strip the slashes coming from browser request

If the php.ini setting MAGIC_QUOTE_GPC is set to ON, all the variables content comming frome the browser are automatically quoted by adding slashes (default setting before PHP 4.3). claro_unquote_gpc() removes these slashes. It needs to be called just once at the biginning of the script.

Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>
Returns:
void

Definition at line 1380 of file claro_main.lib.php.

claro_url_relay_context ( prepend = '',
context = null 
)

Get the string needed to relay the current context in urls

Parameters:
string $prepend string to prepend to the relayed context
array $context
Returns:
string
Deprecated:
since 1.9 use Url::Contextualize instead

Definition at line 1560 of file claro_main.lib.php.

get_conf ( param,
default = null 
)

Return the value of a Claroline configuration parameter

Parameters:
string $param config parameter
mixed $default (optionnal) - set a defaut to return value if no paramater with such a name is found.
Returns:
string param value
Todo:
http://www.claroline.net/forum/viewtopic.php?t=4579

Definition at line 1307 of file claro_main.lib.php.

getClaroMessageList ( errorClass = null  ) 

get stack of devel message

Definition at line 1451 of file claro_main.lib.php.

http_response_splitting_workaround ( str  ) 

HTTP response splitting security flaw filter

Author:
Frederic Minne <zefredz@gmail.com>
Returns:
string clean string to filter http_response_splitting attack
See also:
http://www.saintcorporation.com/cgi-bin/demo_tut.pl?tutorial_name=HTTP_Response_Splitting.html

Definition at line 1361 of file claro_main.lib.php.

load_kernel_config ( name  ) 

Load configuration file given its name

Parameters:
string $name

Definition at line 1728 of file claro_main.lib.php.

page_uri ( html = true  ) 

Get the URI of the current page : PHP_SELF + QUERY_STRING, protected against HTTP Response Splitting and XSS

Parameters:
boolean $html if set to true (default) the returned URI is passed through htmlspecialchars before being returned
Returns:
string

Definition at line 1649 of file claro_main.lib.php.

php_self (  ) 

Protect $_SERVER[PHP_SELF] against HTTP response splitting and XSS

Returns:
string

Definition at line 1630 of file claro_main.lib.php.

pushClaroMessage ( message,
errorClass = 'error' 
)

Definition at line 1441 of file claro_main.lib.php.


Variable Documentation

$claro_failureList = array()

SECTION : CLAROLINE FAILURE MANGEMENT

Definition at line 794 of file claro_main.lib.php.

Generated on Tue Jun 8 12:28:37 2010 for Claroline API by  doxygen 1.6.3