📄 display.lib.php
字号:
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(); } /** * Displays a normal message. It is recommended to use this function * to display any normal information messages. * * @author Roan Embrechts * @param string $message - include any additional html * tags if you need them * @param bool Filter (true) or not (false) * @return void */ function display_normal_message($message,$filter=true) { global $charset; if($filter) { //filter message $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>'; } /** * Displays an warning message. Use this if you want to draw attention to something * This can also be used for instance with the hint in the exercises * * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @param string $message * @param bool Filter (true) or not (false) * @return void */ function display_warning_message($message,$filter=true) { global $charset; if($filter){ //filter message $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>'; } /** * Displays an confirmation message. Use this if something has been done successfully * * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @param string $message * @param bool Filter (true) or not (false) * @return void */ function display_confirmation_message($message,$filter=true) { global $charset; if($filter){ //filter message $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>'; } /** * Displays an error message. It is recommended to use this function if an error occurs * * @author Hugues Peeters * @author Roan Embrechts * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @param string $message - include any additional html * tags if you need them * @param bool Filter (true) or not (false) * @return void */ function display_error_message($message,$filter=true) { global $charset; if($filter){ //filter message $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>'; } /** * Return an encrypted mailto hyperlink * * @param - $email (string) - e-mail * @param - $text (string) - clickable text * @param - $style_class (string) - optional, class from stylesheet * @return - encrypted mailto hyperlink */ function encrypted_mailto_link($email, $clickable_text = null, $style_class = '') { global $charset; if (is_null($clickable_text)) { $clickable_text = $email; } //mailto already present? if (substr($email, 0, 7) != 'mailto:') $email = 'mailto:'.$email; //class (stylesheet) defined? if ($style_class != '') $style_class = ' class="'.$style_class.'"'; //encrypt email $hmail = ''; for ($i = 0; $i < strlen($email); $i ++) $hmail .= '&#'.ord($email { $i }).';'; //encrypt clickable text if @ is present 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 encrypted mailto hyperlink return '<a href="'.$hmail.'"'.$style_class.' name="clickable_email_link">'.$hclickable_text.'</a>'; } /** * Create a hyperlink to the platform homepage. * @param string $name, the visible name of the hyperlink, default is sitename * @return string with html code for hyperlink */ 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>"; } /** * Display the page header * @param string The name of the page (will be showed in the page title) * @param string Optional help file name */ 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"); } /** * Display the page footer */ function display_footer() { global $dokeos_version; //necessary to have the value accessible in the footer global $_plugins; include (api_get_path(INCLUDE_PATH)."footer.inc.php"); } /** * Print an <option>-list with all letters (A-Z). * @param char $selected_letter The letter that should be selected */ 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; } /** * Show the so-called "left" menu for navigating */ function show_course_navigation_menu($isHidden = false) { global $output_string_menu; global $_setting; // check if the $_SERVER['REQUEST_URI'] contains already url parameters (thus a questionmark) 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>"; } } } /** * This function displays an icon * @param string $image the filename of the file (in the main/img/ folder * @param string $alt_text the alt text (probably a language variable) * @param array additional attributes (for instance height, width, onclick, ...) */ function display_icon($image, $alt_text = '', $additional_attributes = array ()) { echo Display::return_icon($image,$alt_text,$additional_attributes); } /** * This function returns the htmlcode for an icon * * @param string $image the filename of the file (in the main/img/ folder * @param string $alt_text the alt text (probably a language variable) * @param array additional attributes (for instance height, width, onclick, ...) * * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @version October 2006 */ function return_icon($image,$alt_text='',$additional_attributes=array()) { $attribute_list = ''; // alt text = the image if there is none provided (for XHTML compliance) if ($alt_text=='') { $alt_text=$image; } // managing the additional attributes 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.' />'; }} //end class Display?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -