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

Source for file display.lib.php

Documentation is available at display.lib.php

  1. <?php
  2.  
  3. /*
  4. ==============================================================================
  5.     Dokeos - elearning and course management software
  6.  
  7.     Copyright (c) 2004-2008 Dokeos S.A.
  8.     Copyright (c) Roan Embrechts, Vrije Universiteit Brussel
  9.     Copyright (c) Wolfgang Schneider
  10.     Copyright (c) Bert Vanderkimpen, Ghent University
  11.     Copyright (c) Bart Mollet, Hogeschool Gent
  12.     Copyright (c) Rene Haentjens, Ghent University
  13.     Copyright (c) Yannick Warnier, Dokeos S.A.
  14.     Copyright (c) Sandra Matthys, Hogeschool Gent
  15.     Copyright (c) Denes Nagy, Dokeos S.A.
  16.  
  17.     For a full list of contributors, see "credits.txt".
  18.     The full license can be read in "license.txt".
  19.  
  20.     This program is free software; you can redistribute it and/or
  21.     modify it under the terms of the GNU General Public License
  22.     as published by the Free Software Foundation; either version 2
  23.     of the License, or (at your option) any later version.
  24.  
  25.     See the GNU General Public License for more details.
  26.  
  27.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  28.     Mail: info@dokeos.com
  29. ==============================================================================
  30. */
  31. /**
  32. ==============================================================================
  33. *    This is a display library for Dokeos.
  34. *
  35. *    Include/require it in your code to use its functionality.
  36. *    There are also several display functions in the main api library.
  37. *
  38. *    All functions static functions inside a class called Display,
  39. *    so you use them like this: e.g.
  40. *    Display::display_normal_message($message)
  41. *
  42. *    @package dokeos.library
  43. ==============================================================================
  44. */
  45. /*
  46. ==============================================================================
  47.        CONSTANTS
  48. ==============================================================================
  49. */
  50. /*
  51. ==============================================================================
  52.        LIBRARIES
  53. ==============================================================================
  54. */
  55. //no other libraries needed at the moment
  56. /*
  57. ==============================================================================
  58.         FUNCTIONS
  59. ==============================================================================
  60. */
  61. //all functions are stored inside the Display class
  62. /*
  63. ==============================================================================
  64.         CLASS Display
  65.  
  66.         functions inside
  67.         ----------------
  68.         Display::display_localised_html_file($full_file_name)
  69.         Display::display_table_header()
  70.         Display::display_complex_table_header($properties, $column_header)
  71.         Display::display_table_row($bgcolor, $table_row, $is_alternating=true)
  72.         Display::display_table_footer()
  73.         Display::display_normal_message($message)
  74.         Display::display_error_message($message)
  75.         Display::encrypted_mailto_link($email, $clickable_text, $style_class='')
  76.         Display::get_platform_home_link_html($name = '')
  77. ==============================================================================
  78. */
  79. /**
  80. *    Display class
  81. *    contains several functions dealing with the display of
  82. *    table data, messages, help topics, ...
  83. *
  84. *    @version 1.0.4
  85. *    @package dokeos.library
  86. */
  87. require_once 'sortabletable.class.php';
  88. class Display {
  89.     /**
  90.     * Displays the tool introduction of a tool.
  91.     *
  92.     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  93.     * @param string $tool These are the constants that are used for indicating the tools
  94.     * @return html code for adding an introduction
  95.     */
  96.     function display_introduction_section($tool)
  97.     {
  98.         $is_allowed_to_edit api_is_allowed_to_edit();
  99.         $moduleId $tool;
  100.         if (api_get_setting('enable_tool_introduction'== 'true' || $tool==TOOL_COURSE_HOMEPAGE)
  101.         {
  102.             include (api_get_path(INCLUDE_PATH)."introductionSection.inc.php");
  103.         }
  104.     }
  105.  
  106.     /*
  107.     *    Displays a localised html file
  108.     *
  109.     *    tries to show the file "$full_file_name"."_".$language_interface.".html"
  110.     *    and if this does not exist, shows the file "$full_file_name".".html"
  111.     *
  112.     *    warning this function defines a global
  113.     *
  114.     *    @param $full_file_name, the (path) name of the file, without .html
  115.     */
  116.     function display_localised_html_file($full_file_name)
  117.     {
  118.         global $language_interface;
  119.         $localised_file_name $full_file_name."_".$language_interface.".html";
  120.         $default_file_name $full_file_name.".html";
  121.         if (file_exists($localised_file_name))
  122.         {
  123.             include ($localised_file_name);
  124.         }
  125.         else
  126.         {
  127.             include ($default_file_name)//default
  128.         }
  129.     }
  130.  
  131.     /**
  132.     *    Display simple html header of table.
  133.     */
  134.     function display_table_header()
  135.     {
  136.         $bgcolor "bgcolor='white'";
  137.         echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"85%\"><tbody>";
  138.         return $bgcolor;
  139.     }
  140.  
  141.     /**
  142.     *    Display html header of table with several options.
  143.     *
  144.     *    @param $properties, array with elements, all of which have defaults
  145.     *     "width" - the table width, e.g. "100%", default is 85%
  146.     *     "class"     - the class to use for the table, e.g. "class=\"data_table\""
  147.     *    "cellpadding"  - the extra border in each cell, e.g. "8",default is 4
  148.     *    "cellspacing"  - the extra space between cells, default = 0
  149.     *
  150.     *    @param column_header, array with the header elements.
  151.     *    @author Roan Embrechts
  152.     *    @version 1.01
  153.     */
  154.     function display_complex_table_header($properties$column_header)
  155.     {
  156.         $width $properties["width"];
  157.         if (!isset ($width))
  158.             $width "85%";
  159.         $class $properties["class"];
  160.         if (!isset ($class))
  161.             $class "class=\"data_table\"";
  162.         $cellpadding $properties["cellpadding"];
  163.         if (!isset ($cellpadding))
  164.             $cellpadding "4";
  165.         $cellspacing $properties["cellspacing"];
  166.         if (!isset ($cellspacing))
  167.             $cellspacing "0";
  168.         //... add more properties as you see fit
  169.         //api_display_debug_info("Dokeos light grey is " . DOKEOSLIGHTGREY);
  170.         $bgcolor "bgcolor='".DOKEOSLIGHTGREY."'";
  171.         echo "<table $class border=\"0\" cellspacing=\"$cellspacing\" cellpadding=\"$cellpadding\" width=\"$width\">\n";
  172.         echo "<thead><tr $bgcolor>";
  173.         foreach ($column_header as $table_element)
  174.         {
  175.             echo "<th>".$table_element."</th>";
  176.         }
  177.         echo "</tr></thead>\n";
  178.         echo "<tbody>\n";
  179.         $bgcolor "bgcolor='".HTML_WHITE."'";
  180.         return $bgcolor;
  181.     }
  182.  
  183.     /**
  184.     *    Displays a table row.
  185.     *
  186.     *    @param $bgcolor the background colour for the table
  187.     *    @param $table_row an array with the row elements
  188.     *    @param $is_alternating true: the row colours alternate, false otherwise
  189.     */
  190.     function display_table_row($bgcolor$table_row$is_alternating true)
  191.     {
  192.         echo "<tr $bgcolor>";
  193.         foreach ($table_row as $table_element)
  194.         {
  195.             echo "<td>".$table_element."</td>";
  196.         }
  197.         echo "</tr>\n";
  198.         if ($is_alternating)
  199.         {
  200.             if ($bgcolor == "bgcolor='".HTML_WHITE."'")
  201.             {
  202.                 $bgcolor "bgcolor='".DOKEOSLIGHTGREY."'";
  203.             }
  204.             else
  205.             {
  206.                 if ($bgcolor == "bgcolor='".DOKEOSLIGHTGREY."'")
  207.                 {
  208.                     $bgcolor "bgcolor='".HTML_WHITE."'";
  209.                 }
  210.             }
  211.         }
  212.         return $bgcolor;
  213.     }
  214.  
  215.     /**
  216.     *    Displays a table row.
  217.     *    This function has more options and is easier to extend than display_table_row()
  218.     *
  219.     *    @param $properties, array with properties:
  220.     *     ["bgcolor"] - the background colour for the table
  221.     *     ["is_alternating"] - true: the row colours alternate, false otherwise
  222.     *     ["align_row"] - an array with, per cell, left|center|right
  223.     *    @todo add valign property
  224.     */
  225.     function display_complex_table_row($properties$table_row)
  226.     {
  227.         $bgcolor $properties["bgcolor"];
  228.         $is_alternating $properties["is_alternating"];
  229.         $align_row $properties["align_row"];
  230.         echo "<tr $bgcolor>";
  231.         $number_cells count($table_row);
  232.         for ($i 0$i $number_cells$i ++)
  233.         {
  234.             $cell_data $table_row[$i];
  235.             $cell_align $align_row[$i];
  236.             echo "<td align=\"$cell_align\">".$cell_data."</td>";
  237.         }
  238.         echo "</tr>\n";
  239.         if ($is_alternating)
  240.         {
  241.             if ($bgcolor == "bgcolor='".HTML_WHITE."'")
  242.                 $bgcolor "bgcolor='".DOKEOSLIGHTGREY."'";
  243.             else
  244.                 if ($bgcolor == "bgcolor='".DOKEOSLIGHTGREY."'")
  245.                     $bgcolor "bgcolor='".HTML_WHITE."'";
  246.         }
  247.         return $bgcolor;
  248.     }
  249.  
  250.     /**
  251.     *    display html footer of table
  252.     */
  253.     function display_table_footer()
  254.     {
  255.         echo "</tbody></table>";
  256.     }
  257.  
  258.     /**
  259.      * Display a table
  260.      * @param array $header Titles for the table header
  261.      *                          each item in this array can contain 3 values
  262.      *                          - 1st element: the column title
  263.      *                          - 2nd element: true or false (column sortable?)
  264.      *                          - 3th element: additional attributes for
  265.      *                           th-tag (eg for column-width)
  266.      *                          - 4the element: additional attributes for the td-tags
  267.      * @param array $content 2D-array with the tables content
  268.      * @param array $sorting_options Keys are:
  269.      *                      'column' = The column to use as sort-key
  270.      *                      'direction' = SORT_ASC or SORT_DESC
  271.      * @param array $paging_options Keys are:
  272.      *                      'per_page_default' = items per page when switching from
  273.      *                                           full-    list to per-page-view
  274.      *                      'per_page' = number of items to show per page
  275.      *                      'page_nr' = The page to display
  276.      * @param array $query_vars Additional variables to add in the query-string
  277.      * @author bart.mollet@hogent.be
  278.      */
  279.     function display_sortable_table($header$content$sorting_options array ()$paging_options array ()$query_vars null$form_actions=array())
  280.     {
  281.         global $origin;
  282.         $column = isset ($sorting_options['column']$sorting_options['column'0;
  283.         $default_items_per_page = isset ($paging_options['per_page']$paging_options['per_page'20;
  284.             
  285.         $table new SortableTableFromArray($content$column$default_items_per_page);
  286.  
  287.         if (is_array($query_vars)) {
  288.             $table->set_additional_parameters($query_vars);
  289.         }
  290.         foreach ($header as $index => $header_item)
  291.         {            
  292.             $table->set_header($index$header_item[0]$header_item[1]$header_item[2]$header_item[3]);
  293.         }
  294.         $table->set_form_actions($form_actions);
  295.         $table->display();
  296.     }
  297.     
  298.     
  299.     /**
  300.      * Display a table with a special configuration
  301.      * @param array $header Titles for the table header
  302.      *                          each item in this array can contain 3 values
  303.      *                          - 1st element: the column title
  304.      *                          - 2nd element: true or false (column sortable?)
  305.      *                          - 3th element: additional attributes for
  306.      *                           th-tag (eg for column-width)
  307.      *                          - 4the element: additional attributes for the td-tags
  308.      * @param array $content 2D-array with the tables content
  309.      * @param array $sorting_options Keys are:
  310.      *                      'column' = The column to use as sort-key
  311.      *                      'direction' = SORT_ASC or SORT_DESC
  312.      * @param array $paging_options Keys are:
  313.      *                      'per_page_default' = items per page when switching from
  314.      *                                           full-    list to per-page-view
  315.      *                      'per_page' = number of items to show per page
  316.      *                      'page_nr' = The page to display
  317.      * @param array $query_vars Additional variables to add in the query-string
  318.      * @param array $column_show Array of binaries 1= show columns 0. hide a column
  319.      * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
  320.      *                                i.e:  $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column
  321.      * @param array $form_actions Set optional forms actions
  322.      * 
  323.      * @author Julio Montoya
  324.      */
  325.      
  326.     function display_sortable_config_table($header$content$sorting_options array ()$paging_options array ()$query_vars null$column_show=array(),$column_order=array(),$form_actions=array())
  327.     {
  328.         global $origin;
  329.         $column = isset ($sorting_options['column']$sorting_options['column'0;
  330.         $default_items_per_page = isset ($paging_options['per_page']$paging_options['per_page'20;
  331.         
  332.         $table new SortableTableFromArrayConfig($content$column$default_items_per_page,'tablename',$column_show,$column_order);
  333.  
  334.         if (is_array($query_vars)) {
  335.             $table->set_additional_parameters($query_vars);
  336.         }
  337.         // show or hide the columns header
  338.         if (is_array($column_show) ) 
  339.         {
  340.             for ($i=0;$i<count($column_show);$i++)
  341.             {
  342.                 if ($column_show[$i])
  343.                 {
  344.                     $table->set_header($i$header[$i][0]$header[$i][1]$header[$i][2]$header[$i][3]);
  345.                 }            
  346.             }
  347.         }        
  348.         $table->set_form_actions($form_actions);
  349.         $table->display();
  350.     }    
  351.     
  352.         
  353.     /**
  354.     * Displays a normal message. It is recommended to use this function
  355.     * to display any normal information messages.
  356.     *
  357.     * @author Roan Embrechts
  358.     * @param string $message - include any additional html
  359.     *                           tags if you need them
  360.     * @param bool    Filter (true) or not (false)
  361.     * @return void 
  362.     */
  363.     function display_normal_message($message,$filter=true)
  364.     {
  365.         global $charset;
  366.         if($filter)
  367.         {
  368.             //filter message
  369.             $message htmlentities($message,ENT_QUOTES,$charset);
  370.         }
  371.         if (!headers_sent())
  372.         {
  373.             echo '
  374.                         <style type="text/css" media="screen, projection">
  375.                         /*<![CDATA[*/
  376.                         @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
  377.                         /*]]>*/
  378.                         </style>';
  379.         }
  380.         echo '<div class="normal-message">';
  381.         Display :: display_icon('message_normal.gif'''array ('style' => 'float:left; margin-right:10px;'));
  382.         echo "<div style='margin-left: 43px'>".$message.'</div></div>';
  383.     }
  384.  
  385.     /**
  386.     * Displays an warning message. Use this if you want to draw attention to something
  387.     * This can also be used for instance with the hint in the exercises
  388.     *
  389.     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  390.     * @param string $message 
  391.     * @param bool    Filter (true) or not (false)
  392.     * @return void 
  393.     */
  394.     function display_warning_message($message,$filter=true)
  395.     {
  396.         global $charset;
  397.         if($filter){
  398.             //filter message
  399.             $message htmlentities($message,ENT_QUOTES,$charset);
  400.         }
  401.         if (!headers_sent())
  402.         {
  403.             echo '
  404.                         <style type="text/css" media="screen, projection">
  405.                         /*<![CDATA[*/
  406.                         @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
  407.                         /*]]>*/
  408.                         </style>';
  409.         }
  410.         echo '<div class="warning-message">';
  411.         Display :: display_icon('message_warning.png'''array ('style' => 'float:left; margin-right:10px;'));
  412.         echo $message.'</div>';
  413.     }
  414.  
  415.     /**
  416.     * Displays an confirmation message. Use this if something has been done successfully
  417.     *
  418.     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  419.     * @param string $message 
  420.     * @param bool    Filter (true) or not (false)
  421.     * @return void 
  422.     */
  423.     function display_confirmation_message($message,$filter=true)
  424.     {
  425.         global $charset;
  426.         if($filter){
  427.             //filter message
  428.             $message htmlentities($message,ENT_QUOTES,$charset);
  429.         }
  430.         if (!headers_sent())
  431.         {
  432.             echo '
  433.                         <style type="text/css" media="screen, projection">
  434.                         /*<![CDATA[*/
  435.                         @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
  436.                         /*]]>*/
  437.                         </style>';
  438.         }
  439.         echo '<div class="confirmation-message">';
  440.         Display :: display_icon('message_confirmation.gif'''array ('style' => 'float:left; margin-right:10px;margin-left:5px;'));
  441.         echo $message.'</div>';
  442.     }
  443.  
  444.     /**
  445.     * Displays an error message. It is recommended to use this function if an error occurs
  446.     *
  447.     * @author Hugues Peeters
  448.     * @author Roan Embrechts
  449.     * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  450.     * @param string $message - include any additional html
  451.     *                           tags if you need them
  452.     * @param bool    Filter (true) or not (false)
  453.     * @return void 
  454.     */
  455.     function display_error_message($message,$filter=true)
  456.     {
  457.         global $charset;
  458.         if($filter){
  459.             //filter message
  460.             $message htmlentities($message,ENT_QUOTES,$charset);
  461.         }
  462.  
  463.         if (!headers_sent())
  464.         {
  465.             echo '
  466.                         <style type="text/css" media="screen, projection">
  467.                         /*<![CDATA[*/
  468.                         @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
  469.                         /*]]>*/
  470.                         </style>';
  471.         }
  472.         echo '<div class="error-message">';
  473.         Display :: display_icon('message_error.png'''array ('style' => 'float:left; margin-right:10px;'));
  474.         echo $message.'</div>';
  475.     }
  476.     /**
  477.      * Return an encrypted mailto hyperlink
  478.      *
  479.      * @param $email (string) - e-mail
  480.      * @param $text (string) - clickable text
  481.      * @param $style_class (string) - optional, class from stylesheet
  482.      * @return encrypted mailto hyperlink
  483.      */
  484.     function encrypted_mailto_link($email$clickable_text null$style_class '')
  485.     {
  486.         global $charset;
  487.         if (is_null($clickable_text))
  488.         {
  489.             $clickable_text $email;
  490.         }
  491.         //mailto already present?
  492.         if (substr($email07!= 'mailto:')
  493.             $email 'mailto:'.$email;
  494.  
  495.         //class (stylesheet) defined?
  496.         if ($style_class != '')
  497.             $style_class ' class="'.$style_class.'"';
  498.  
  499.         //encrypt email
  500.         $hmail '';
  501.         for ($i 0$i strlen($email)$i ++)
  502.             $hmail .= '&#'.ord($email {
  503.             $i }).';';
  504.  
  505.         //encrypt clickable text if @ is present
  506.         if (strpos($clickable_text'@'))
  507.         {
  508.             for ($i 0$i strlen($clickable_text)$i ++)
  509.                 $hclickable_text .= '&#'.ord($clickable_text {
  510.                 $i }).';';
  511.         }
  512.         else
  513.         {
  514.             $hclickable_text htmlspecialchars($clickable_text,ENT_QUOTES,$charset);
  515.         }
  516.  
  517.         //return encrypted mailto hyperlink
  518.         return '<a href="'.$hmail.'"'.$style_class.' name="clickable_email_link">'.$hclickable_text.'</a>';
  519.     }
  520.  
  521.     /**
  522.     *    Create a hyperlink to the platform homepage.
  523.     *    @param string $name, the visible name of the hyperlink, default is sitename
  524.     *    @return string with html code for hyperlink
  525.     */
  526.     function get_platform_home_link_html($name '')
  527.     {
  528.         if ($name == '')
  529.         {
  530.             $name api_get_setting('siteName');
  531.         }
  532.         return "<a href=\"".api_get_path(WEB_PATH)."index.php\">$name</a>";
  533.     }
  534.     /**
  535.      * Display the page header
  536.      * @param string The name of the page (will be showed in the page title)
  537.      * @param string Optional help file name
  538.      */
  539.     function display_header($tool_name$help NULL)
  540.     {
  541.         $nameTools $tool_name;
  542.         global $_plugins,$lp_theme_css,$mycoursetheme,$user_theme,$platform_theme;
  543.         global $httpHeadXtra$htmlHeadXtra$htmlIncHeadXtra$_course$_user$clarolineRepositoryWeb$text_dir$plugins$_user$rootAdminWeb$_cid$interbreadcrumb$charset$language_file$noPHP_SELF;
  544.         global $menu_navigation;
  545.         include (api_get_path(INCLUDE_PATH)."header.inc.php");
  546.     }
  547.     /**
  548.      * Display the page footer
  549.      */
  550.     function display_footer()
  551.     {
  552.         global $dokeos_version//necessary to have the value accessible in the footer
  553.         global $_plugins;
  554.         include (api_get_path(INCLUDE_PATH)."footer.inc.php");
  555.     }
  556.  
  557.     /**
  558.      * Print an <option>-list with all letters (A-Z).
  559.      * @param char $selected_letter The letter that should be selected
  560.      */
  561.     function get_alphabet_options($selected_letter '')
  562.     {
  563.         $result '';
  564.         for ($i 65$i <= 90$i ++{
  565.             $letter chr($i);
  566.             $result .= '<option value="'.$letter.'"';
  567.             if ($selected_letter == $letter{
  568.                 $result .= ' selected="selected"';
  569.             }
  570.             $result .= '>'.$letter.'</option>';
  571.         }
  572.         return $result;
  573.     }
  574.     /**
  575.     * Show the so-called "left" menu for navigating
  576.     */
  577.     function show_course_navigation_menu($isHidden false)
  578.     {
  579.         global $output_string_menu;
  580.         global $_setting;
  581.  
  582.         // check if the $_SERVER['REQUEST_URI'] contains already url parameters (thus a questionmark)
  583.         if (!strstr($_SERVER['REQUEST_URI']"?"))
  584.         {
  585.             $sourceurl api_get_self()."?";
  586.         }
  587.         else
  588.         {
  589.             $sourceurl $_SERVER['REQUEST_URI'];
  590.         }
  591.         $output_string_menu "";
  592.         if ($isHidden == "true" and $_SESSION["hideMenu"]{
  593.  
  594.             $_SESSION["hideMenu""hidden";
  595.  
  596.             $sourceurl str_replace("&isHidden=true"""$sourceurl);
  597.             $sourceurl str_replace("&isHidden=false"""$sourceurl);
  598.  
  599.             $output_string_menu .= " <a href='".$sourceurl."&isHidden=false'>"."<img src=../../main/img/expand.gif alt='Show menu1' padding:'2px'/>"."</a>";
  600.         }
  601.         elseif ($isHidden == "false" and $_SESSION["hideMenu"])
  602.         {
  603.             $sourceurl str_replace("&isHidden=true"""$sourceurl);
  604.             $sourceurl str_replace("&isHidden=false"""$sourceurl);
  605.  
  606.             $_SESSION["hideMenu""shown";
  607.             $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src=../../main/img/collapse.gif alt='Hide menu2' padding:'2px'/>"."</a></div>";
  608.         }
  609.         elseif ($_SESSION["hideMenu"])
  610.         {
  611.             if ($_SESSION["hideMenu"== "shown"{
  612.                 $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src='../../main/img/collapse.gif' alt='Hide menu3' padding:'2px'/>"."</a></div>";
  613.             }
  614.             if ($_SESSION["hideMenu"== "hidden"{
  615.                 $sourceurl str_replace("&isHidden=true"""$sourceurl);
  616.                 $output_string_menu .= "<a href='".$sourceurl."&isHidden=false'>"."<img src='../../main/img/expand.gif' alt='Hide menu4' padding:'2px'/>"."</a>";
  617.  
  618.             }
  619.         }
  620.         elseif (!$_SESSION["hideMenu"])
  621.         {
  622.             $_SESSION["hideMenu""shown";
  623.             if (isset ($_cid))
  624.             {
  625.                 $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src='main/img/collapse.gif' alt='Hide menu5' padding:'2px'/>"."</a></div>";
  626.             }
  627.         }
  628.     }
  629.  
  630.     /**
  631.      * This function displays an icon
  632.      * @param string $image the filename of the file (in the main/img/ folder
  633.      * @param string $alt_text the alt text (probably a language variable)
  634.      * @param array additional attributes (for instance height, width, onclick, ...)
  635.     */
  636.     function display_icon($image$alt_text ''$additional_attributes array ()) {
  637.         echo Display::return_icon($image,$alt_text,$additional_attributes);
  638.     }
  639.  
  640.     /**
  641.      * This function returns the htmlcode for an icon
  642.      *
  643.      * @param string $image the filename of the file (in the main/img/ folder
  644.      * @param string $alt_text the alt text (probably a language variable)
  645.      * @param array additional attributes (for instance height, width, onclick, ...)
  646.      *
  647.      * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  648.      * @version October 2006
  649.     */
  650.     function return_icon($image,$alt_text='',$additional_attributes=array())
  651.     {
  652.         $attribute_list '';
  653.         // alt text = the image if there is none provided (for XHTML compliance)
  654.         if ($alt_text=='')
  655.         {
  656.             $alt_text=$image;
  657.         }
  658.  
  659.         // managing the additional attributes
  660.         if (!empty($additional_attributesand is_array($additional_attributes))
  661.         {
  662.             $attribute_list='';
  663.             foreach ($additional_attributes as $key=>$value)
  664.             {
  665.                 $attribute_list.=$key.'="'.$value.'" ';
  666.             }
  667.         }
  668.         return '<img src="'.api_get_path(WEB_IMG_PATH).$image.'" alt="'.$alt_text.'"  title="'.$alt_text.'" '.$attribute_list.'  />';
  669.     }
  670.  
  671.  
  672. //end class Display
  673. ?>

Documentation generated on Thu, 12 Jun 2008 13:18:54 -0500 by phpDocumentor 1.4.1