HAWHAW

PHP

Class HAW_deck

HAW_deck

public class HAW_deck

This class is the top level class of all HAWHAW classes. Your page should consist of exactly one HAW_deck object. For WML browsers one deck with one card will be generated. For HDML browsers one deck including as much cards as necessary will generated. HTML browsers will receive a normal HTML page, PDA browsers will receive handheldfriendly HTML etc.

Do not overload HAW_deck objects! Remember that a lot of WAP clients can not handle more than about 1400 byte of compiled data.

Examples:

$myPage = new HAW_deck();
$myPage = new HAW_deck("My WAP page");
$myPage = new HAW_deck("", HAW_ALIGN_CENTER);
$myPage = new HAW_deck("PDA edition", HAW_ALIGN_CENTER, HAW_OUTPUT_PDA);
...
$myPage->set_bgcolor("blue");
...
$myPage->add_text($myText);
...
$myPage->create_page();


Constructor Summary
HAW_deck(var $title, var $alignment, var $output)
          Constructor
 
Method Summary
 void add_banner(var $banner, var $position)
          Adds a HAW_banner object to HAW_deck.
 void add_form(var $form)
          Adds a HAW_form object to HAW_deck.
 void add_image(var $image)
          Adds a HAW_image object to HAW_deck.
 void add_link(var $link)
          Adds a HAW_link object to HAW_deck.
 void add_linkset(var $linkset)
          Adds a HAW_linkset object to HAW_deck.
 void add_phone(var $phone)
          Adds a HAW_phone object to HAW_deck.
 void add_rule(var $rule)
          Adds a HAW_rule object to HAW_deck.
 void add_table(var $table)
          Adds a HAW_table object to HAW_deck.
 void add_text(var $text)
          Adds a HAW_text object to HAW_deck.
 void add_voicerecorder(var $voicerecorder)
          Adds a HAW_voicerecorder object to HAW_deck.
 void create_page()
          Creates the page in the according markup language.
 void disable_cache()
          Disables deck caching in the users client.
 void enable_session()
          Enables mobile specific session support.
 void set_background(var $background)
          Sets a wallpaper for a HTML created page.
 void set_bgcolor(var $bgcolor)
          Sets the background color for a HTML created page.
 void set_border(var $border)
          Sets the thickness of the HTML display frame.
 void set_charset(var $charset, var $unicodemaptab)
          Sets a given character set.
 void set_color(var $color)
          Sets the color for all characters in a HTML created page.
 void set_disp_background(var $background)
          Sets a display wallpaper for a HTML created page.
 void set_disp_bgcolor(var $disp_bgcolor)
          Sets the display background color for a HTML created page.
 void set_face(var $face)
          Sets the font for all characters in a HTML created page.
 void set_height(var $height)
          Sets the display height for a HTML created page.
 void set_link_color(var $link_color)
          Sets the color of links in a HTML created page.
 void set_redirection(var $timeout, var $red_url)
          Redirects automatically after timeout to another URL.
 void set_size(var $size)
          Sets the font size for all characters in a HTML created page.
 void set_vlink_color(var $vlink_color)
          Sets the color of visited links in a HTML created page.
 void set_voice_help(var $text, var $audio_src, var $url)
          Sets help text for voice browsers.
 void set_voice_jingle(var $url)
          Play jingle before link <label>s are spoken.
 void set_voice_noinput(var $text, var $audio_src, var $url)
          Sets noinput text for voice browsers.
 void set_voice_nomatch(var $text, var $audio_src, var $url)
          Sets nomatch text for voice browsers.
 void set_voice_property(var $name, var $value)
          Sets a name/value property pair for VoiceXML decks.
 void set_voice_text(var $text, var $audio_src)
          Sets deck-related text to be spoken by voice browsers.
 void set_waphome(var $waphome)
          Sets the URL of a website, a bigscreen-browsing user is invited to visit via WAP.
 void set_width(var $width)
          Sets the display width for a HTML created page.
 void use_simulator()
          Activates the built-in device simulator on bigscreen browsers.
 

Constructor Detail

HAW_deck

public HAW_deck(var $title,
                var $alignment,
                var $output)
Constructor
Parameters:
title - (optional, default: HAW_NOTITLE)
If a string is provided here, it will be displayed in the HTML title bar, respectively somewhere on the WAP display. Using a title you will normally have to spend one of your few lines on your WAP display. Consider that some WAP phones/SDK's and handheld devices don't display the title at all.
alignment - (optional, default: HAW_ALIGN_LEFT)
You can enter HAW_ALIGN_CENTER or HAW_ALIGN_RIGHT to modify the alignment of the whole page.
output - (optional, default: HAW_OUTPUT_AUTOMATIC)
You can override HAWHAW's automatic browser detection and force a certain output type.
Possible value are:
  • HAW_OUTPUT_AUTOMATIC (default)
  • HAW_OUTPUT_BIGSCREEN
  • HAW_OUTPUT_WAP
  • HAW_OUTPUT_HDML
  • HAW_OUTPUT_PDA
  • HAW_OUTPUT_IMODE
  • HAW_OUTPUT_MML
  • HAW_OUTPUT_VOICEXML

With this parameter you can offer dedicated links for PC users, WAP users, PDA users etc.
Method Detail

add_text

public void add_text(var $text)
Adds a HAW_text object to HAW_deck.
Parameters:
text - Some HAW_text object.
See Also:
HAW_text

add_image

public void add_image(var $image)
Adds a HAW_image object to HAW_deck.
Parameters:
image - Some HAW_image object.
See Also:
HAW_image

add_table

public void add_table(var $table)
Adds a HAW_table object to HAW_deck.
Parameters:
table - Some HAW_table object.
See Also:
HAW_table

add_form

public void add_form(var $form)
Adds a HAW_form object to HAW_deck.
Parameters:
form - Some HAW_form object.
See Also:
HAW_form

add_link

public void add_link(var $link)
Adds a HAW_link object to HAW_deck.
Parameters:
link - Some HAW_link object.
See Also:
HAW_link

add_phone

public void add_phone(var $phone)
Adds a HAW_phone object to HAW_deck.
Parameters:
phone - Some HAW_phone object.
See Also:
HAW_phone

add_linkset

public void add_linkset(var $linkset)
Adds a HAW_linkset object to HAW_deck.
Parameters:
linkset - Some HAW_linkset object.
See Also:
HAW_linkset

add_banner

public void add_banner(var $banner,
                       var $position)
Adds a HAW_banner object to HAW_deck.
Note: Has no effect on WML/handheld pages.
Parameters:
banner - Some HAW_banner object.
position - (optional)
HAW_TOP: above HAW_deck
HAW_BOTTOM: beneath HAW_deck (default)
See Also:
HAW_banner

add_rule

public void add_rule(var $rule)
Adds a HAW_rule object to HAW_deck.
Parameters:
rule - Some HAW_rule object.
See Also:
HAW_rule

add_voicerecorder

public void add_voicerecorder(var $voicerecorder)
Adds a HAW_voicerecorder object to HAW_deck.
Parameters:
voicerecorder - Some HAW_voicerecorder object.
See Also:
HAW_voicerecorder

set_redirection

public void set_redirection(var $timeout,
                            var $red_url)
Redirects automatically after timeout to another URL.
Note: This feature can not be supported for HDML browsers, due to HDML's missing timer functionality. If you intend to serve HDML users, you should consider this by creating an additional link to red_url.
Parameters:
timeout - Some timeout value in seconds.
red_url - Some URL string.

disable_cache

public void disable_cache()
Disables deck caching in the users client.
Note: Use this object function, if you intend to provide changing content under the same URL.

enable_session

public void enable_session()
Enables mobile specific session support.
Note: Applications for mobile devices require special session handling: As cookies are often not supported, URL rewriting has to be done. As XML does not allow unescaped '&' characters, the arg-separator has to be modified. And as WML/VoiceXML defines tags which are not defined in HTML, the PHP predefined url_rewriter tags have to be adapted.
Important: This function has be called before any session handling is done! Due to some bugs in previous PHP versions, it is highly recommended to use PHP version 4.1.1 or higher.

set_charset

public void set_charset(var $charset,
                        var $unicodemaptab)
Sets a given character set.
Note: For the iso-8859-1 character set all characters with value greater 127 are automatically transformed into a "&#dec;" sequence (unicode). For all other character sets a specific cross mapping table is required for the conversion into unicode. Usage of unicode cross mapping tables is optional for non-iso-8859-1 character sets. Mapping tables are available at: http://www.unicode.org/Public/MAPPINGS/
Parameters:
charset - Character set that is used in your country.
Default: iso-8859-1
unicodemaptab - (optional)
Cross mapping table from country specific character coding to unicode (default: no mapping to unicode activated).
With this parameter you specify where HAWHAW will find the conversion table with the mapping rules. It is recommended to store the cross mapping table in the same directory where hawhaw.inc is located.
format: [PATH][Filename].[EXT] e.g. "../GB2312.TXT"

set_bgcolor

public void set_bgcolor(var $bgcolor)
Sets the background color for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
bgcolor - See HTML specification for possible values (e.g. "#CCFFFF", "red", ...).

set_background

public void set_background(var $background)
Sets a wallpaper for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
background - e.g. "backgrnd.gif"

set_border

public void set_border(var $border)
Sets the thickness of the HTML display frame. Has no effect on WML/handheld pages.
Parameters:
border - Thickness is pixels (default: 8)

set_disp_bgcolor

public void set_disp_bgcolor(var $disp_bgcolor)
Sets the display background color for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
disp_bgcolor - See HTML specification for possible values (e.g. "#CCFFFF", "red", ...).

set_disp_background

public void set_disp_background(var $background)
Sets a display wallpaper for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
background - e.g. "backgrnd.gif"

set_width

public void set_width(var $width)
Sets the display width for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
width - See HTML specification for possible values (e.g. "200", "50%", ...).

set_height

public void set_height(var $height)
Sets the display height for a HTML created page. Has no effect on WML/handheld pages.
Parameters:
height - See HTML specification for possible values (e.g. "200", "50%", ...).

set_size

public void set_size(var $size)
Sets the font size for all characters in a HTML created page. Has no effect on WML/handheld pages.
Parameters:
size - See HTML specification for possible values (e.g. "4", "+2", ...).

set_color

public void set_color(var $color)
Sets the color for all characters in a HTML created page. Has no effect on WML/handheld pages.
Parameters:
color - See HTML specification for possible values (e.g. "#CCFFFF", "red", ...).

set_link_color

public void set_link_color(var $link_color)
Sets the color of links in a HTML created page. Has no effect on WML/handheld pages.
Parameters:
link_color - See HTML specification for possible values (e.g. "#CCFFFF", "red", ...).

set_vlink_color

public void set_vlink_color(var $vlink_color)
Sets the color of visited links in a HTML created page. Has no effect on WML/handheld pages.
Parameters:
vlink_color - See HTML specification for possible values (e.g. "#CCFFFF", "red", ...).

set_face

public void set_face(var $face)
Sets the font for all characters in a HTML created page. Has no effect on WML/handheld pages.
Parameters:
face - See HTML specification for possible values (e.g. "Avalon", "Wide Latin").

set_waphome

public void set_waphome(var $waphome)
Sets the URL of a website, a bigscreen-browsing user is invited to visit via WAP.
Note: On bigscreen browsers a small copyright link to the HAWHAW information page will be created automatically by HAWHAW. The information page invites the user to visit your site with a WAP phone. Therefore by default your hostname and your refering script will be part of this copyright link. You can modify this value, e.g. if your application leads the user across different pages, but you want to make visible the entry page only.
Parameters:
waphome - Some URL string.

use_simulator

public void use_simulator()
Activates the built-in device simulator on bigscreen browsers. The device simulator can be displayed only by Internet Explorer. This is because the layout requires a scrollable table element, which is unfortunately not supported by all browsers. For visitors with other browsers the classic HAWHAW layout will be presented instead.

set_voice_text

public void set_voice_text(var $text,
                           var $audio_src)
Sets deck-related text to be spoken by voice browsers.
Parameters:
text - Some introducing text that will be spoken before any other dialog or text output is started.
audio_src - Some audio file (e.g. *.wav file) to play (optional).

set_voice_jingle

public void set_voice_jingle(var $url)
Play jingle before link <label>s are spoken.
Note: Voice users can not distinguish between plain text and link text. Playing a short jingle before each link will make voice navigation easier.
Parameters:
url - Some wav-file.

set_voice_help

public void set_voice_help(var $text,
                           var $audio_src,
                           var $url)
Sets help text for voice browsers.
Parameters:
text - Some helpful information concerning this deck.
audio_src - Some audio file (e.g. *.wav file) to play (optional).
url - Some other voice deck to go to (optional).

set_voice_noinput

public void set_voice_noinput(var $text,
                              var $audio_src,
                              var $url)
Sets noinput text for voice browsers.
Parameters:
text - Some text to inform the user that no input has been received.
audio_src - Some audio file (e.g. *.wav file) to play (optional).
url - Some other voice deck to go to (optional).

set_voice_nomatch

public void set_voice_nomatch(var $text,
                              var $audio_src,
                              var $url)
Sets nomatch text for voice browsers.
Parameters:
text - Some text to complain that user input was not recognized.
audio_src - Some audio file (e.g. *.wav file) to play (optional).
url - Some other voice deck to go to (optional).

set_voice_property

public void set_voice_property(var $name,
                               var $value)
Sets a name/value property pair for VoiceXML decks.
Attention: This function should be used by experienced VoiceXML developers only! name/value combinations which are not compliant to the VoiceXML standard or are not supported by the voice platform, will throw an semantic error and terminate voice output. Please refer to the W3C VoiceXML Recommendation (chapter 6.3) for detailled info about valid name/value combinations.
Parameters:
name - Name of property (e.g. "bargein", "timeout", etc.)
value - Value of property (e.g. "false", "10s", etc.)

create_page

public void create_page()
Creates the page in the according markup language. Depending on the clients browser type, HTML (pure HTML, handheldfriendly HTML, i-mode cHTML, MML), WML, HDML or VoiceXML is thrown out.

© Norbert Huffschmid
assembled from PHP source
using sed and javadoc