123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- <?php
- require_once 'sortabletable.class.php';
- class Display {
-
- function display_introduction_section($tool)
- {
- $is_allowed_to_edit = api_is_allowed_to_edit();
- $moduleId = $tool;
- if (api_get_setting('enable_tool_introduction') == 'true' || $tool==TOOL_COURSE_HOMEPAGE)
- {
- include (api_get_path(INCLUDE_PATH)."introductionSection.inc.php");
- }
- }
-
- function display_localised_html_file($full_file_name)
- {
- global $language_interface;
- $localised_file_name = $full_file_name."_".$language_interface.".html";
- $default_file_name = $full_file_name.".html";
- if (file_exists($localised_file_name))
- {
- include ($localised_file_name);
- }
- else
- {
- include ($default_file_name);
- }
- }
-
- function display_table_header()
- {
- $bgcolor = "bgcolor='white'";
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"85%\"><tbody>";
- return $bgcolor;
- }
-
- function display_complex_table_header($properties, $column_header)
- {
- $width = $properties["width"];
- if (!isset ($width))
- $width = "85%";
- $class = $properties["class"];
- if (!isset ($class))
- $class = "class=\"data_table\"";
- $cellpadding = $properties["cellpadding"];
- if (!isset ($cellpadding))
- $cellpadding = "4";
- $cellspacing = $properties["cellspacing"];
- if (!isset ($cellspacing))
- $cellspacing = "0";
-
-
- $bgcolor = "bgcolor='".DOKEOSLIGHTGREY."'";
- echo "<table $class border=\"0\" cellspacing=\"$cellspacing\" cellpadding=\"$cellpadding\" width=\"$width\">\n";
- echo "<thead><tr $bgcolor>";
- foreach ($column_header as $table_element)
- {
- echo "<th>".$table_element."</th>";
- }
- echo "</tr></thead>\n";
- echo "<tbody>\n";
- $bgcolor = "bgcolor='".HTML_WHITE."'";
- return $bgcolor;
- }
-
- function display_table_row($bgcolor, $table_row, $is_alternating = true)
- {
- echo "<tr $bgcolor>";
- foreach ($table_row as $table_element)
- {
- echo "<td>".$table_element."</td>";
- }
- echo "</tr>\n";
- if ($is_alternating)
- {
- if ($bgcolor == "bgcolor='".HTML_WHITE."'")
- {
- $bgcolor = "bgcolor='".DOKEOSLIGHTGREY."'";
- }
- else
- {
- if ($bgcolor == "bgcolor='".DOKEOSLIGHTGREY."'")
- {
- $bgcolor = "bgcolor='".HTML_WHITE."'";
- }
- }
- }
- return $bgcolor;
- }
-
- function display_complex_table_row($properties, $table_row)
- {
- $bgcolor = $properties["bgcolor"];
- $is_alternating = $properties["is_alternating"];
- $align_row = $properties["align_row"];
- echo "<tr $bgcolor>";
- $number_cells = count($table_row);
- for ($i = 0; $i < $number_cells; $i ++)
- {
- $cell_data = $table_row[$i];
- $cell_align = $align_row[$i];
- echo "<td align=\"$cell_align\">".$cell_data."</td>";
- }
- echo "</tr>\n";
- if ($is_alternating)
- {
- if ($bgcolor == "bgcolor='".HTML_WHITE."'")
- $bgcolor = "bgcolor='".DOKEOSLIGHTGREY."'";
- else
- if ($bgcolor == "bgcolor='".DOKEOSLIGHTGREY."'")
- $bgcolor = "bgcolor='".HTML_WHITE."'";
- }
- return $bgcolor;
- }
-
- function display_table_footer()
- {
- echo "</tbody></table>";
- }
-
- function display_sortable_table($header, $content, $sorting_options = array (), $paging_options = array (), $query_vars = null, $form_actions=array())
- {
- global $origin;
- $column = isset ($sorting_options['column']) ? $sorting_options['column'] : 0;
- $default_items_per_page = isset ($paging_options['per_page']) ? $paging_options['per_page'] : 20;
-
- $table = new SortableTableFromArray($content, $column, $default_items_per_page);
- if (is_array($query_vars)) {
- $table->set_additional_parameters($query_vars);
- }
- foreach ($header as $index => $header_item)
- {
- $table->set_header($index, $header_item[0], $header_item[1], $header_item[2], $header_item[3]);
- }
- $table->set_form_actions($form_actions);
- $table->display();
- }
-
-
-
-
- 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())
- {
- global $origin;
- $column = isset ($sorting_options['column']) ? $sorting_options['column'] : 0;
- $default_items_per_page = isset ($paging_options['per_page']) ? $paging_options['per_page'] : 20;
-
- $table = new SortableTableFromArrayConfig($content, $column, $default_items_per_page,'tablename',$column_show,$column_order);
- if (is_array($query_vars)) {
- $table->set_additional_parameters($query_vars);
- }
-
- if (is_array($column_show) )
- {
- for ($i=0;$i<count($column_show);$i++)
- {
- if ($column_show[$i])
- {
- $table->set_header($i, $header[$i][0], $header[$i][1], $header[$i][2], $header[$i][3]);
- }
- }
- }
- $table->set_form_actions($form_actions);
- $table->display();
- }
-
-
-
- function display_normal_message($message,$filter=true)
- {
- global $charset;
- if($filter)
- {
-
- $message = htmlentities($message,ENT_QUOTES,$charset);
- }
- if (!headers_sent())
- {
- echo '
- <style type="text/css" media="screen, projection">
- /*<![CDATA[*/
- @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
- /*]]>*/
- </style>';
- }
- echo '<div class="normal-message">';
- Display :: display_icon('message_normal.gif', '', array ('style' => 'float:left; margin-right:10px;'));
- echo "<div style='margin-left: 43px'>".$message.'</div></div>';
- }
-
- function display_warning_message($message,$filter=true)
- {
- global $charset;
- if($filter){
-
- $message = htmlentities($message,ENT_QUOTES,$charset);
- }
- if (!headers_sent())
- {
- echo '
- <style type="text/css" media="screen, projection">
- /*<![CDATA[*/
- @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
- /*]]>*/
- </style>';
- }
- echo '<div class="warning-message">';
- Display :: display_icon('message_warning.png', '', array ('style' => 'float:left; margin-right:10px;'));
- echo $message.'</div>';
- }
-
- function display_confirmation_message($message,$filter=true)
- {
- global $charset;
- if($filter){
-
- $message = htmlentities($message,ENT_QUOTES,$charset);
- }
- if (!headers_sent())
- {
- echo '
- <style type="text/css" media="screen, projection">
- /*<![CDATA[*/
- @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
- /*]]>*/
- </style>';
- }
- echo '<div class="confirmation-message">';
- Display :: display_icon('message_confirmation.gif', '', array ('style' => 'float:left; margin-right:10px;margin-left:5px;'));
- echo $message.'</div>';
- }
-
- function display_error_message($message,$filter=true)
- {
- global $charset;
- if($filter){
-
- $message = htmlentities($message,ENT_QUOTES,$charset);
- }
- if (!headers_sent())
- {
- echo '
- <style type="text/css" media="screen, projection">
- /*<![CDATA[*/
- @import "'.api_get_path(WEB_CODE_PATH).'css/default.css";
- /*]]>*/
- </style>';
- }
- echo '<div class="error-message">';
- Display :: display_icon('message_error.png', '', array ('style' => 'float:left; margin-right:10px;'));
- echo $message.'</div>';
- }
-
- function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
- {
- global $charset;
- if (is_null($clickable_text))
- {
- $clickable_text = $email;
- }
-
- if (substr($email, 0, 7) != 'mailto:')
- $email = 'mailto:'.$email;
-
- if ($style_class != '')
- $style_class = ' class="'.$style_class.'"';
-
- $hmail = '';
- for ($i = 0; $i < strlen($email); $i ++)
- $hmail .= '&#'.ord($email {
- $i }).';';
-
- if (strpos($clickable_text, '@'))
- {
- for ($i = 0; $i < strlen($clickable_text); $i ++)
- $hclickable_text .= '&#'.ord($clickable_text {
- $i }).';';
- }
- else
- {
- $hclickable_text = htmlspecialchars($clickable_text,ENT_QUOTES,$charset);
- }
-
- return '<a href="'.$hmail.'"'.$style_class.' name="clickable_email_link">'.$hclickable_text.'</a>';
- }
-
- function get_platform_home_link_html($name = '')
- {
- if ($name == '')
- {
- $name = api_get_setting('siteName');
- }
- return "<a href=\"".api_get_path(WEB_PATH)."index.php\">$name</a>";
- }
-
- function display_header($tool_name, $help = NULL)
- {
- $nameTools = $tool_name;
- global $_plugins,$lp_theme_css,$mycoursetheme,$user_theme,$platform_theme;
- global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $clarolineRepositoryWeb, $text_dir, $plugins, $_user, $rootAdminWeb, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
- global $menu_navigation;
- include (api_get_path(INCLUDE_PATH)."header.inc.php");
- }
-
- function display_footer()
- {
- global $dokeos_version;
- global $_plugins;
- include (api_get_path(INCLUDE_PATH)."footer.inc.php");
- }
-
- function get_alphabet_options($selected_letter = '')
- {
- $result = '';
- for ($i = 65; $i <= 90; $i ++) {
- $letter = chr($i);
- $result .= '<option value="'.$letter.'"';
- if ($selected_letter == $letter) {
- $result .= ' selected="selected"';
- }
- $result .= '>'.$letter.'</option>';
- }
- return $result;
- }
-
- function show_course_navigation_menu($isHidden = false)
- {
- global $output_string_menu;
- global $_setting;
-
- if (!strstr($_SERVER['REQUEST_URI'], "?"))
- {
- $sourceurl = api_get_self()."?";
- }
- else
- {
- $sourceurl = $_SERVER['REQUEST_URI'];
- }
- $output_string_menu = "";
- if ($isHidden == "true" and $_SESSION["hideMenu"]) {
- $_SESSION["hideMenu"] = "hidden";
- $sourceurl = str_replace("&isHidden=true", "", $sourceurl);
- $sourceurl = str_replace("&isHidden=false", "", $sourceurl);
- $output_string_menu .= " <a href='".$sourceurl."&isHidden=false'>"."<img src=../../main/img/expand.gif alt='Show menu1' padding:'2px'/>"."</a>";
- }
- elseif ($isHidden == "false" and $_SESSION["hideMenu"])
- {
- $sourceurl = str_replace("&isHidden=true", "", $sourceurl);
- $sourceurl = str_replace("&isHidden=false", "", $sourceurl);
- $_SESSION["hideMenu"] = "shown";
- $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src=../../main/img/collapse.gif alt='Hide menu2' padding:'2px'/>"."</a></div>";
- }
- elseif ($_SESSION["hideMenu"])
- {
- if ($_SESSION["hideMenu"] == "shown") {
- $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src='../../main/img/collapse.gif' alt='Hide menu3' padding:'2px'/>"."</a></div>";
- }
- if ($_SESSION["hideMenu"] == "hidden") {
- $sourceurl = str_replace("&isHidden=true", "", $sourceurl);
- $output_string_menu .= "<a href='".$sourceurl."&isHidden=false'>"."<img src='../../main/img/expand.gif' alt='Hide menu4' padding:'2px'/>"."</a>";
- }
- }
- elseif (!$_SESSION["hideMenu"])
- {
- $_SESSION["hideMenu"] = "shown";
- if (isset ($_cid))
- {
- $output_string_menu .= "<div id='leftimg'><a href='".$sourceurl."&isHidden=true'>"."<img src='main/img/collapse.gif' alt='Hide menu5' padding:'2px'/>"."</a></div>";
- }
- }
- }
-
- function display_icon($image, $alt_text = '', $additional_attributes = array ()) {
- echo Display::return_icon($image,$alt_text,$additional_attributes);
- }
-
- function return_icon($image,$alt_text='',$additional_attributes=array())
- {
- $attribute_list = '';
-
- if ($alt_text=='')
- {
- $alt_text=$image;
- }
-
- if (!empty($additional_attributes) and is_array($additional_attributes))
- {
- $attribute_list='';
- foreach ($additional_attributes as $key=>$value)
- {
- $attribute_list.=$key.'="'.$value.'" ';
- }
- }
- return '<img src="'.api_get_path(WEB_IMG_PATH).$image.'" alt="'.$alt_text.'" title="'.$alt_text.'" '.$attribute_list.' />';
- }
- }
- ?>
|