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

Go to the source code of this file.

Data Structures

class  claro_datagrid

Namespaces

namespace  HTML

Functions

 claro_html_menu_vertical ($itemList, $attrBloc=array(), $attrItem=array())
 claro_html_menu_vertical_br ($itemList, $attrBloc=array())
 claro_html_menu_horizontal ($itemList)
 prepared_section_to_tabs ($section_list, $section_selected='', $url_params=null, $currentClassName='current')
 claro_html_tool_link ($url, $label, $attributeList=array())
 claro_html_cmd_link ($url, $label, $attributeList=array())
 claro_html_link ($url, $label, $attributeList=array())
 claro_html_button ($url, $text, $confirmMessage= '')
 claro_html_title ($title, $level)
 claro_html_tool_title ($titlePart, $helpUrl=false)
 claro_html_message_box ($message)
 claro_html_breadcrumbtrail ($nameList, $urlList, $separator= '> ', $homeImg=null)
 claro_html_progress_bar ($progress, $factor)
 claro_html_msg_list ($msgArrBody, $return=true)
 claro_html_nestedArrayToOptionList ($elementList, $deepness=0)
 claro_html_mailTo ($mail, $mailLabel=null)
 claro_html_textarea_editor ($name, $content= '', $rows=20, $cols=80, $optAttrib='', $type='advanced')
 claro_html_simple_textarea ($name, $content= '')
 claro_html_advanced_textarea ($name, $content= '')
 claro_disp_auth_form ($cidRequired=false)
 claro_build_nested_select_menu ($name, $elementList)
 prepare_option_tags ($elementList, $deepness=0)
 is_htmlspecialcharized ($string)
 clean_str_for_javascript ($str)
 cleanup_mso2007_text ($string)
 claro_parse_user_text ($userText)
 make_spoiler ($text)
 clean_spoilerStart ($match)
 clean_spoilerEnd ($match)
 add_spoiler ($match)
 renderTex ($text)
 renderTexCallback ($matches)
 make_clickable ($text)
 claro_disp_html_area ($name, $content= '', $rows=20, $cols=80, $optAttrib='')
 htmlize ($phrase)
 claro_disp_duration ($duration)
 claro_html_duration ($duration)
 claro_html_breadcrumb ()
 claro_html_tab_bar ($section_list, $section_selected_id=null, $url_params=array(), $section_request_var_name= 'section', $baseUrl=null)

Function Documentation

add_spoiler ( match  ) 

Callback function used by make_spoiler function

Parameters:
array $match
Returns:
string replacement for matched spoiler tags

Definition at line 1332 of file html.lib.php.

claro_build_nested_select_menu ( name,
elementList 
)

function claro_build_nested_select_menu($name, $elementList) Build in a relevant way 'select' menu for an HTML form containing nested data

Parameters:
string $name, name of the select tag
array nested data in a composite way
Returns:
string the HTML flow

$elementList[1]['name' ] = 'level1'; $elementList[1]['value' ] = 'level1';

$elementList[1]['children'][1]['name' ] = 'level2'; $elementList[1]['children'][1]['value'] = 'level2';

$elementList[1]['children'][2]['name' ] = 'level2'; $elementList[1]['children'][2]['value'] = 'level2';

$elementList[2]['name' ] = 'level1'; $elementList[2]['value'] = 'level1';

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

Definition at line 1144 of file html.lib.php.

claro_disp_auth_form ( cidRequired = false  ) 

Route the script to an auhtentication form if user id is missing. Once authenticated, the system get back to the source where the form was trigged

Parameters:
boolean $cidRequired - if the course id is required to leave the form
Author:
Christophe gesché <moosh@claroline.net>
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 1084 of file html.lib.php.

claro_disp_duration ( duration  ) 

convert a duration in seconds to a human readable duration

Author:
Sébastien Piraux <pir@cerdecam.be>
Parameters:
integer duration time in seconds to convert to a human readable duration

Definition at line 1520 of file html.lib.php.

claro_disp_html_area ( name,
content = '',
rows = 20,
cols = 80,
optAttrib = '' 
)

Deprecated functions Some function still present to prevent local developpement

They would be removed after 1.8 Enhance a simple textarea with an inline html editor.

Parameters:
string $name name attribute for <textarea> tag
string $content content to prefill the area
integer $rows count of rows for the displayed editor area
integer $cols count of columns for the displayed editor area
string $optAttrib optional - additionnal tag attributes (wrap, class, ...)
Returns:
string html output for standard textarea or Wysiwyg editor
Deprecated:
would be removed after 1.8
See also:
claro_html_textarea_editor

Definition at line 1490 of file html.lib.php.

claro_html_advanced_textarea ( name,
content = '' 
)

Definition at line 644 of file html.lib.php.

claro_html_breadcrumb (  ) 

Return the breadcrumb to display in the header

string $nameTools array $interbredcrump boolean $noPHP_SELF boolean $noQUERY_STRING

Returns:
string html content

Definition at line 1565 of file html.lib.php.

claro_html_breadcrumbtrail ( nameList,
urlList,
separator = ' &gt; ',
homeImg = null 
)

Allows to easily display a breadcrumb trail

Parameters:
array $nameList bame of each breadcrumb
array $urlList url corresponding to the breadcrumb name above
string $separator (optionnal) element which segregate the breadcrumbs
string $homeImg (optionnal) source url for a home icon at the trail start
Returns:
string : the build breadcrumb trail
Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>

Definition at line 390 of file html.lib.php.

claro_html_button ( url,
text,
confirmMessage = '' 
)

Prepare the display of a clikcable button

This function is needed because claroline buttons rely on javascript. The function return an optionnal behavior fo browser where javascript isn't available.

Author:
Hugues Peeters <hugues.peeters@claroline.net>
Parameters:
string $url url inserted into the 'href' part of the tag
string $text text inserted between the two ... tags (note : it could also be an image ...)
string $confirmMessage (optionnal) introduce a javascript confirmation popup
Returns:
string the button

Definition at line 246 of file html.lib.php.

claro_html_cmd_link ( url,
label,
attributeList = array() 
)

Return the claroline sytled url for a link to a tool

Parameters:
string $url
string $label
array $attributeList array of array(attributeName,attributeValue)
Returns:
string html stream

Definition at line 186 of file html.lib.php.

claro_html_duration ( duration  ) 

Definition at line 1530 of file html.lib.php.

claro_html_link ( url,
label,
attributeList = array() 
)

Return the claroline sytled url for a link to a tool

Parameters:
string $url
string $label
array $attributeList array of array(attributeName,attributeValue)
Returns:
string html stream

Definition at line 210 of file html.lib.php.

claro_html_mailTo ( mail,
mailLabel = null 
)

prepare a mailto link

Parameters:
string $mail
string $mailLabel
Returns:
string : html stream

Definition at line 562 of file html.lib.php.

claro_html_menu_horizontal ( itemList  ) 

display a item list as vertical menu.

Parameters:
array $itemList each item are include in a list.
Returns:
string : list content as an horizontal menu.

Definition at line 94 of file html.lib.php.

claro_html_menu_vertical ( itemList,
attrBloc = array(),
attrItem = array() 
)

Display a item list as vertical menu.

Parameters:
array $itemList each item are include in a list.
Returns:
string html

Definition at line 28 of file html.lib.php.

claro_html_menu_vertical_br ( itemList,
attrBloc = array() 
)

display a item list as vertical menu.

Parameters:
array $itemList each item are include in a list.
Returns:
string html

Definition at line 64 of file html.lib.php.

claro_html_message_box ( message  ) 

Prepare display of the message box appearing on the top of the window, just below the tool title. It is recommended to use this function to display any confirmation or error messages, or to ask to the user to enter simple parameters.

Author:
Hugues Peeters <hugues.peeters@claroline.net>
Parameters:
string $message include your self any additionnal html tag if you need them
Since:
1.8
Returns:
string html string for a message box

Definition at line 361 of file html.lib.php.

claro_html_msg_list ( msgArrBody,
return = true 
)

Display list of messages in substyled boxes in a message_box

In most of cases function message_box() is enough.

Parameters:
array $msgArrBody of array of blocs containing array of messages
Author:
Christophe Gesché <moosh@claroline.net>
Version:
1.0
See also:
message_box()

code for using this in your tools: $msgArrBody["nameOfCssClass"][]="foo"; css class can be defined in script but try to use class from generic css () error success warning ...

Todo:
this must be a message object where code add messages with a priority, and the rendering is set by by priority

Definition at line 490 of file html.lib.php.

claro_html_nestedArrayToOptionList ( elementList,
deepness = 0 
)

prepare the 'option' html tag for the claro_disp_nested_select_menu() function

Author:
Christophe Gesché <moosh@claroline.net>
Hugues Peeters <hugues.peeters@claroline.net>
Parameters:
array $elementList
integer $deepness (optionnal, default is 0)
Returns:
array of option list

Definition at line 536 of file html.lib.php.

claro_html_progress_bar ( progress,
factor 
)

Function used to draw a progression bar

Author:
Piraux Sébastien <pir@cerdecam.be>
Parameters:
integer $progress progression in pourcent
integer $factor will be multiply by 100 to have the full size of the bar (i.e. 1 will give a 100 pixel wide bar)

Definition at line 443 of file html.lib.php.

claro_html_simple_textarea ( name,
content = '' 
)

Definition at line 639 of file html.lib.php.

claro_html_tab_bar ( section_list,
section_selected_id = null,
url_params = array(),
section_request_var_name = 'section',
baseUrl = null 
)

Create a navigation tab bar

Parameters:
array $section_list associative array of tabs tab id => tab label
string $section_selected_id selected tab id
array $url_params associative array of additionnal parameters name => value
string $section_request_var_name name of the HTTP GET variable to store the current tab id
string $baseUrl base url of the navigation tab bar
Returns:
string html navigation tab bar

Definition at line 1705 of file html.lib.php.

claro_html_textarea_editor ( name,
content = '',
rows = 20,
cols = 80,
optAttrib = '',
type = 'advanced' 
)

Insert a Wysiwyg editor inside a form instead of a textarea A standard textarea is displayed if the Wysiwyg editor is disabled or if the user's browser have no activated javascript support

Parameters:
string $name content for name attribute in textarea tag
string $content optional content previously inserted into the area
int $rows optional textarea rows
int $cols optional textarea columns
string $optAttrib optional - additionnal tag attributes (wrap, class, ...)
Returns:
string html output for standard textarea or Wysiwyg editor
Author:
Hugues Peeters <hugues.peeters@claroline.net>
Sébastien Piraux <pir@cerdecam.be>

Definition at line 586 of file html.lib.php.

claro_html_title ( title,
level 
)

Displays a title inc claroline wich can be relooked by css

Author:
Christophe Gesché <moosh@claroline.net>
Parameters:
string $title
string $level 1->7
Returns:
void

Definition at line 276 of file html.lib.php.

claro_html_tool_link ( url,
label,
attributeList = array() 
)

Return the claroline sytled url for a link to a tool

Parameters:
string $url
string $label
array $attributeList array of array(attributeName,attributeValue)
Returns:
string html stream

Definition at line 158 of file html.lib.php.

claro_html_tool_title ( titlePart,
helpUrl = false 
)

Displays the title of a 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

Author:
Hugues Peeters <hugues.peeters@claroline.net>
Parameters:
mixed $titleElement - it could either be a string or an array containing 'supraTitle', 'mainTitle', 'subTitle'
Returns:
void

Definition at line 300 of file html.lib.php.

claro_parse_user_text ( userText  ) 

Parse the user text (e.g. stored in database) before displaying it to the screen For example it change new line charater to
tag etc.

Parameters:
string $userText original user text
Returns:
string : parsed user text
Author:
Hugues Peeters <hugues.peeters@claroline.net>

Definition at line 1261 of file html.lib.php.

clean_spoilerEnd ( match  ) 

Definition at line 1321 of file html.lib.php.

clean_spoilerStart ( match  ) 

Definition at line 1308 of file html.lib.php.

clean_str_for_javascript ( str  ) 

function that cleans php string for javascript

This function is needed to clean strings used in javascript output Newlines are prohibited in the script, specialchar are prohibited quotes must be addslashes

Parameters:
$str string original string
Returns:
string : cleaned string
Author:
Piraux Sébastien <pir@cerdecam.be>

Definition at line 1212 of file html.lib.php.

cleanup_mso2007_text ( string  ) 

Remove comments and noise from MS Office 2007 pasted-text that causes Internet Explorer rendering engine to halt

Parameters:
string original text
Returns:
string clean text

Definition at line 1234 of file html.lib.php.

htmlize ( phrase  ) 

transform content in a html display

Parameters:
- string $string string to htmlize
Returns:
- string htmlized

Definition at line 1508 of file html.lib.php.

is_htmlspecialcharized ( string  ) 

Checks if the string has been written html style (ie é etc)

Author:
Hugues Peeters <peeters@ipm.ucl.ac.be>
Parameters:
string $string
Returns:
boolean true if the string is written in html style, false otherwise

Definition at line 1194 of file html.lib.php.

make_clickable ( text  ) 

Completes url contained in the text with "<a href ...". However the function simply returns the submitted text without any transformation if it already contains some "<a href:" or "<img src=".

Actually this function is taken from the PHP BB 1.4 script

  • Goes through the given string, and replaces xxxx://yyyy with an HTML tag linking to that URL
  • Goes through the given string, and replaces www.xxxx.yyyy[zzzz] with an HTML tag linking to http://www.xxxx.yyyy[/zzzz]
  • Goes through the given string, and replaces xxxx with an HTML mailto: tag linking to that email address
  • Only matches these 2 patterns either after a space, or at the beginning of a line

Notes: the email one might get annoying - it's easy to make it more restrictive, though.. maybe have it require something like xxxx@yyyy.zzzz or such. We'll see.

Parameters:
string $text text to be converted
Returns:
string : text after conversion
Author:
Rewritten by Nathan Codding - Feb 6, 2001.
completed by Hugues Peeters - July 22, 2002

Definition at line 1418 of file html.lib.php.

make_spoiler ( text  ) 

Find all spoiler tags in text and replace them by html

Parameters:
string $text text in which replace spoiler tags
Returns:
string text with spoiler tags replaced by html

Definition at line 1285 of file html.lib.php.

prepare_option_tags ( elementList,
deepness = 0 
)

prepare the 'option' html tag for the claro_disp_nested_select_menu() function

Parameters:
array $elementList
int $deepness (optionnal, default is 0)
Returns:
array of option tag list
Author:
Hugues Peeters <hugues.peeters@claroline.net>

Definition at line 1164 of file html.lib.php.

prepared_section_to_tabs ( section_list,
section_selected = '',
url_params = null,
currentClassName = 'current' 
)

Prepare an array of link following a list of section

Parameters:
array $section_list array('section_name'=> of section array ('label','description','properties','..'.));
string $section_selected section_name
string $url_params query string append
string $currentClassName css class name
Returns:
array

Definition at line 120 of file html.lib.php.

renderTex ( text  ) 

Parse the user text to transform bb code style tex tags to embedded tex plugin or tex generated image depending on campus config

Parameters:
string $text original user text
Returns:
string : parsed user text

Definition at line 1355 of file html.lib.php.

renderTexCallback ( matches  ) 

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

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