cvs: peardoc /en/package/html html-quickform-advmultiselect.xml /en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect
getelementcss.xml getelementjs.xml html-quickform-advmultiselect.xml setbuttonattributes.xml setelementtemplate.xml tohtml.xml
| From: | Laurent Laville | Date: | Thu, 22 Jan 2009 16:32:39 +0000 |
| Subject: | cvs: peardoc /en/package/html html-quickform-advmultiselect.xml /en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect getelementcss.xml getelementjs.xml html-quickform-advmultiselect.xml setbuttonattributes.xml setelementtemplate.xml tohtml.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-11470@lists.php.net to get a copy of this message | ||
farell Thu Jan 22 16:32:39 2009 UTC
Modified files:
/peardoc/en/package/html html-quickform-advmultiselect.xml
/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect
getelementcss.xml
getelementjs.xml
html-quickform-advmultiselect.xml
setbuttonattributes.xml
setelementtemplate.xml
tohtml.xml
Log:
TDG migration phase2: include the reference guide (API doc)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect.xml?r1=1.9&r2=1.10&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect.xml diff -u peardoc/en/package/html/html-quickform-advmultiselect.xml:1.9 peardoc/en/package/html/html-quickform-advmultiselect.xml:1.10 --- peardoc/en/package/html/html-quickform-advmultiselect.xml:1.9 Thu Jan 22 15:28:50 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect.xml Thu Jan 22 16:32:38 2009 @@ -104,4 +104,15 @@ </section> </chapter> + <chapter xml:id="package.html.html-quickform-advmultiselect.ref"> + <info><title>Reference guide</title></info> + + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml; + </chapter> + </book> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml:1.6 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::getElementCss</function></refname> + <refpurpose>Gets default element stylesheet for a single multi-select shape render</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::getElementCss</function></funcdef> + <paramdef choice="opt"> + boolean + <parameter>$raw</parameter> + <initializer>TRUE</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.desc"> + &title.desc; + <para> + If your browser does not support javascript, or for any reasons you have choosen to disable it, + then your only possibility is to use the single checkboxes multi-select shape + of HTML_QuickForm_advmultiselect element. + </para> + <para> + You get a more or less decent result with just the basic settings, + but it is also highly configurable, so you can almost get what you want. + </para> + <para> + The basic settings can be applied with just the placeholder {stylesheet} into your + template element. It can also be applied with <function>getElementCss</function> method. + If you does not have existing style tags in your html page, you must call the method with &false; argument. + Default behavior returns only the raw css data without style tags. Useful when using with template engine. + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.bool; + <parameter>$raw</parameter> + </term> + <listitem> + <para> + (optional) html output with style tags or just raw data + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.example"> + &title.example; + <para> + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine' +); + +// rendering with QF renderer engine and template system +$form->addElement('header', null, 'Advanced Multiple Select: custom layout '); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); + +// template for a single checkboxes multi-select element shape +$template = ' +<table{class}> +<!-- BEGIN label_3 --><tr><th>{label_3}</th></tr><!-- END label_3 --> +<tr> + <td>{selected}</td> +</tr> +</table> +'; +$ams->setElementTemplate($template); + +if ($_SERVER['REQUEST_METHOD'] == 'GET') { + // fruit default values already selected without any end-user actions + $form->setDefaults(array('fruit' => array('kiwi','lime'))); + +} elseif (isset($_POST['fruit'])) { + // fruit end-user selection + $form->setDefaults(array('fruit' => $_POST['fruit'])); +} + +$buttons[] =& $form->createElement('submit', null, 'Submit'); +$buttons[] =& $form->createElement('reset', null, 'Reset'); +$form->addGroup($buttons); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<title>HTML_QuickForm::advMultiSelect custom example 4b</title> +<style type="text/css"> +<!-- +body { + background-color: #FFF; + font-family: Verdana, Arial, helvetica; + font-size: 10pt; +} +<?php echo $ams->getElementCss(); ?> +// --> +</style> +</head> +<body> +<?php +if ($form->validate()) { + $clean = $form->getSubmitValues(); + + echo '<pre>'; + print_r($clean); + echo '</pre>'; +} +$form->display(); +?> +</body> +</html> + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml:1.4 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::getElementJs</function></refname> + <refpurpose>Returns the javascript code generated to handle this element</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::getElementJs</function></funcdef> + <paramdef choice="opt"> + boolean + <parameter>$raw</parameter> + <initializer>TRUE</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.desc"> + &title.desc; + <para> + The basic (and default) settings can be applied with just the placeholder + {javascript} into your template element. + If you does not have existing script tags in your html page, you must call + the method with &false; argument. Default behaviour returns only the raw + js data without script tags. Useful when using with template engine. + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.bool; + <parameter>$raw</parameter> + </term> + <listitem> + <para> + (optional) html output with script tags or just raw data + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml:1.6 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect"> + <refnamediv> + <refname>constructor <function>HTML_QuickForm_advmultiselect::HTML_QuickForm_advmultiselect</function></refname> + <refpurpose>Class constructor</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void constructor <function>HTML_QuickForm_advmultiselect::HTML_QuickForm_advmultiselect</function></funcdef> + <paramdef choice="opt"> + string + <parameter>$elementName</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$elementLabel</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$options</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$attributes</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + integer + <parameter>$sort</parameter> + <initializer>NULL</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.desc"> + &title.desc; + ¬documented; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$elementName</parameter> + </term> + <listitem> + <para> + Dual Select name attribute + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$elementLabel</parameter> + </term> + <listitem> + <para> + Label(s) for the select boxes + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$options</parameter> + </term> + <listitem> + <para> + Data to be used to populate options + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$attributes</parameter> + </term> + <listitem> + <para> + Either a typical HTML attribute string or an associative array + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.int; + <parameter>$sort</parameter> + </term> + <listitem> + <para> + Either SORT_ASC for auto ascending arrange, +SORT_DESC for auto descending arrange, or +NULL for no sort (append at end: default) + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml:1.5 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,296 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::setButtonAttributes</function></refname> + <refpurpose>Sets the button attributes</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void <function>HTML_QuickForm_advmultiselect::setButtonAttributes</function></funcdef> + <paramdef choice="req">string <parameter>$button</parameter></paramdef> + <paramdef choice="opt"> + mixed + <parameter>$attributes</parameter> + <initializer>NULL</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.desc"> + &title.desc; + <para> + The basic settings gave standard form input buttons. You may change the look with some CSS + if you set the <emphasis>class</emphasis> attribute in the <parameter>$attributes</parameter> + hash (second parameter). See example section. + </para> + <para> + Only five attributes may be set, they are: + <variablelist> + <varlistentry> + <term> + <parameter>name</parameter> + </term> + <listitem> + <para> + The form input button name. Default are: + 'add', or 'remove', or, 'all', or 'none', or 'toggle', or 'up', or 'down'. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>value</parameter> + </term> + <listitem> + <para> + The form input button text. Default are ' >> ', or ' << ', + or ' Select All ', or ' Select None ', or ' Toggle Selection ', or ' Up ', or ' Down '. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>type</parameter> + </term> + <listitem> + <para> + The form input button kind. Default is 'button' (Can be either 'button' or 'image'). + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>class</parameter> + </term> + <listitem> + <para> + A CSS class identifier in one of your stylesheets. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>src</parameter> + </term> + <listitem> + <para> + URL of the image file used. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$button</parameter> + </term> + <listitem> + <para> + Button identifier, either 'add', 'remove', + 'all', 'none', 'toggle', + 'moveup' or 'movedown' + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$attributes</parameter> + </term> + <listitem> + <para> + (optional) Either a typical HTML attribute string + or an associative array + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.throws"> + &title.throws; + <para> + <table><title>&title.throws.errortable;</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Error message</entry> + <entry>Reason</entry> + <entry>Solution</entry> + </row> + </thead> + <tbody> + <row> + <entry>Argument 1 of advmultiselect::setButtonAttributes is not a string</entry> + <entry>Tried to give a button identifier of unknown type</entry> + <entry>Check the $button argument data type</entry> + </row> + <row> + <entry>Argument 1 of advmultiselect::setButtonAttributes has unexpected value</entry> + <entry>Tried to give a button identifier of unknown value</entry> + <entry>Check the $button argument data range</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.example"> + &title.example; + <para> + In this example, the 'add' and 'remove' buttons have look set by the css class 'inputCommand'. + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine', +); + +// rendering with QF renderer engine and template system +$form->addElement('header', null, 'Advanced Multiple Select: custom layout '); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); + +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); +$ams->setButtonAttributes('add', array('value' => 'Add >>', + 'class' => 'inputCommand' +)); +$ams->setButtonAttributes('remove', array('value' => '<< Remove', + 'class' => 'inputCommand' +)); +$template = ' +<table{class}> +<!-- BEGIN label_2 --><tr><th align="center">{label_2}</th><!-- END label_2 --> +<!-- BEGIN label_3 --><th align="center">{label_3}</th></tr><!-- END label_3 --> +<tr> + <td>{unselected}</td> + <td>{selected}</td> +</tr> +<tr> + <td>{add}</td> + <td>{remove}</td> +</tr> +</table>'; +$ams->setElementTemplate($template); + +if (isset($_POST['fruit'])) { + $form->setDefaults(array('fruit' => $_POST['fruit'])); +} + +$form->addElement('submit', 'send', 'Send'); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<title>HTML_QuickForm::advMultiSelect example </title> +<style type="text/css"> +<!-- +body { + background-color: #FFF; + font-family: Verdana, Arial, helvetica; + font-size: 10pt; +} + +.inputCommand { + background-color: #d0d0d0; + border: 1px solid #7B7B88; + width: 7em; + margin-bottom: 2px; +} +// --> +</style> +<?php echo $ams->getElementJs(false); ?> +</head> +<body> +<?php +if ($form->validate()) { + $clean = $form->getSubmitValues(); + + echo '<pre>'; + print_r($clean); + echo '</pre>'; +} +$form->display(); +?> +</body> +</html> + ]]> + </programlisting> + </para> + + <para> + You may also use images rather than standard form input button. Replaces lines : + <programlisting role="php"> + <![CDATA[ +$ams->setButtonAttributes('add', array('value' => 'Add >>', + 'class' => 'inputCommand' +)); +$ams->setButtonAttributes('remove', array('value' => '<< Remove', + 'class' => 'inputCommand' +)); + ]]> + </programlisting> + by lines that should like : + <programlisting role="php"> + <![CDATA[ +$ams->setButtonAttributes('add', array('type' => 'image', + 'src' => '/img/add.png' +)); +$ams->setButtonAttributes('remove', array('type' => 'image', + 'src' => '/img/remove.png' +)); + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml:1.4 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::setElementTemplate</function></refname> + <refpurpose>Sets element template</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void <function>HTML_QuickForm_advmultiselect::setElementTemplate</function></funcdef> + <paramdef choice="req">string <parameter>$html</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.desc"> + &title.desc; + <para> + It is so easy to re-arrange select boxes, headers and buttons position. + The template is a bit of html code with reserved placeholders words. They are: + </para> + <para> + <variablelist> + <varlistentry> + <term> + <parameter>stylesheet</parameter> + </term> + <listitem> + <para> + The CSS delimited by the style tags required only + for the single multi-select with checkboxes shape. + Not included in the default template. You can use instead, the <function>getElementCss</function> + method. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>javascript</parameter> + </term> + <listitem> + <para> + The JavaScript delimited by the script tags required to manage item + of both multi-select boxes. + If it is not included, you can use instead, the <function>getElementJs</function> + method. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>class</parameter> + </term> + <listitem> + <para> + A CSS class identifier in one of your stylesheets that is the default + table layout. Default values are: + <programlisting> + <![CDATA[ +<table border="0" cellpadding="10" cellspacing="0"> + ]]> + </programlisting> + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>label_2</parameter> + </term> + <listitem> + <para> + The unselected list header + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>label_3</parameter> + </term> + <listitem> + <para> + The selected list header + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>unselected</parameter> + </term> + <listitem> + <para> + The unselected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>selected</parameter> + </term> + <listitem> + <para> + The selected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>add</parameter> + </term> + <listitem> + <para> + The add button to swap one (or more) item + from the unselected to the selected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>remove</parameter> + </term> + <listitem> + <para> + The remove button to swap one (or more) item back + from the selected to the unselected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>moveup</parameter> + </term> + <listitem> + <para> + The button to move one item of the selected list to the top. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>movedown</parameter> + </term> + <listitem> + <para> + The button to move one item of the selected list to the bottom. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$html</parameter> + </term> + <listitem> + <para> + The HTML surrounding select boxes and buttons + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.example"> + &title.example; + <para> + In this partial example, the fruit list select boxes are set to vertical alignement + with images for the 'add' and 'remove' buttons. + Default presentation are horizontal alignment with input text buttons in the middle side. + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine', +); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); +$ams->setButtonAttributes('add', array('type' => 'image', 'src' => '/img/down.png')); +$ams->setButtonAttributes('remove', array('type' => 'image', 'src' => '/img/up.png')); + +// vertical select box with image buttons as selector +$template = ' +<table{class}> +<!-- BEGIN label_2 --><tr><th align="center">{label_2}</th></tr><!-- END label_2 --> +<tr> + <td>{unselected}</td> +</tr> +<tr> + <td align="center">{add}{remove}</td> +</tr> +<tr> + <td>{selected}</td> +</tr> +<!-- BEGIN label_3 --><tr><th align="center">{label_3}</th></tr><!-- END label_3 --> +</table>'; +$ams->setElementTemplate($template); + +// .... +?> + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml:1.5 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::toHtml</function></refname> + <refpurpose>Returns the HTML generated for the advanced mutliple select component</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::toHtml</function></funcdef> + <paramdef choice="req"/> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.desc"> + &title.desc; + <para> + Returns the advmultiselect element structure as HTML. + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect.xml?r1=1.9&r2=1.10&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect.xml diff -u peardoc/en/package/html/html-quickform-advmultiselect.xml:1.9 peardoc/en/package/html/html-quickform-advmultiselect.xml:1.10 --- peardoc/en/package/html/html-quickform-advmultiselect.xml:1.9 Thu Jan 22 15:28:50 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect.xml Thu Jan 22 16:32:38 2009 @@ -104,4 +104,15 @@ </section> </chapter> + <chapter xml:id="package.html.html-quickform-advmultiselect.ref"> + <info><title>Reference guide</title></info> + + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml; + </chapter> + </book> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml:1.6 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementcss.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::getElementCss</function></refname> + <refpurpose>Gets default element stylesheet for a single multi-select shape render</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::getElementCss</function></funcdef> + <paramdef choice="opt"> + boolean + <parameter>$raw</parameter> + <initializer>TRUE</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.desc"> + &title.desc; + <para> + If your browser does not support javascript, or for any reasons you have choosen to disable it, + then your only possibility is to use the single checkboxes multi-select shape + of HTML_QuickForm_advmultiselect element. + </para> + <para> + You get a more or less decent result with just the basic settings, + but it is also highly configurable, so you can almost get what you want. + </para> + <para> + The basic settings can be applied with just the placeholder {stylesheet} into your + template element. It can also be applied with <function>getElementCss</function> method. + If you does not have existing style tags in your html page, you must call the method with &false; argument. + Default behavior returns only the raw css data without style tags. Useful when using with template engine. + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.bool; + <parameter>$raw</parameter> + </term> + <listitem> + <para> + (optional) html output with style tags or just raw data + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementcss.example"> + &title.example; + <para> + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine' +); + +// rendering with QF renderer engine and template system +$form->addElement('header', null, 'Advanced Multiple Select: custom layout '); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); + +// template for a single checkboxes multi-select element shape +$template = ' +<table{class}> +<!-- BEGIN label_3 --><tr><th>{label_3}</th></tr><!-- END label_3 --> +<tr> + <td>{selected}</td> +</tr> +</table> +'; +$ams->setElementTemplate($template); + +if ($_SERVER['REQUEST_METHOD'] == 'GET') { + // fruit default values already selected without any end-user actions + $form->setDefaults(array('fruit' => array('kiwi','lime'))); + +} elseif (isset($_POST['fruit'])) { + // fruit end-user selection + $form->setDefaults(array('fruit' => $_POST['fruit'])); +} + +$buttons[] =& $form->createElement('submit', null, 'Submit'); +$buttons[] =& $form->createElement('reset', null, 'Reset'); +$form->addGroup($buttons); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<title>HTML_QuickForm::advMultiSelect custom example 4b</title> +<style type="text/css"> +<!-- +body { + background-color: #FFF; + font-family: Verdana, Arial, helvetica; + font-size: 10pt; +} +<?php echo $ams->getElementCss(); ?> +// --> +</style> +</head> +<body> +<?php +if ($form->validate()) { + $clean = $form->getSubmitValues(); + + echo '<pre>'; + print_r($clean); + echo '</pre>'; +} +$form->display(); +?> +</body> +</html> + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml:1.4 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getelementjs.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::getElementJs</function></refname> + <refpurpose>Returns the javascript code generated to handle this element</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::getElementJs</function></funcdef> + <paramdef choice="opt"> + boolean + <parameter>$raw</parameter> + <initializer>TRUE</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.desc"> + &title.desc; + <para> + The basic (and default) settings can be applied with just the placeholder + {javascript} into your template element. + If you does not have existing script tags in your html page, you must call + the method with &false; argument. Default behaviour returns only the raw + js data without script tags. Useful when using with template engine. + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.bool; + <parameter>$raw</parameter> + </term> + <listitem> + <para> + (optional) html output with script tags or just raw data + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getelementjs.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml?r1=1.5&r2=1.6&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml:1.6 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/html-quickform-advmultiselect.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect"> + <refnamediv> + <refname>constructor <function>HTML_QuickForm_advmultiselect::HTML_QuickForm_advmultiselect</function></refname> + <refpurpose>Class constructor</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void constructor <function>HTML_QuickForm_advmultiselect::HTML_QuickForm_advmultiselect</function></funcdef> + <paramdef choice="opt"> + string + <parameter>$elementName</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$elementLabel</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$options</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + mixed + <parameter>$attributes</parameter> + <initializer>NULL</initializer> + </paramdef> + <paramdef choice="opt"> + integer + <parameter>$sort</parameter> + <initializer>NULL</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.desc"> + &title.desc; + ¬documented; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$elementName</parameter> + </term> + <listitem> + <para> + Dual Select name attribute + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$elementLabel</parameter> + </term> + <listitem> + <para> + Label(s) for the select boxes + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$options</parameter> + </term> + <listitem> + <para> + Data to be used to populate options + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$attributes</parameter> + </term> + <listitem> + <para> + Either a typical HTML attribute string or an associative array + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.int; + <parameter>$sort</parameter> + </term> + <listitem> + <para> + Either SORT_ASC for auto ascending arrange, +SORT_DESC for auto descending arrange, or +NULL for no sort (append at end: default) + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml:1.5 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setbuttonattributes.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,296 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::setButtonAttributes</function></refname> + <refpurpose>Sets the button attributes</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void <function>HTML_QuickForm_advmultiselect::setButtonAttributes</function></funcdef> + <paramdef choice="req">string <parameter>$button</parameter></paramdef> + <paramdef choice="opt"> + mixed + <parameter>$attributes</parameter> + <initializer>NULL</initializer> + </paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.desc"> + &title.desc; + <para> + The basic settings gave standard form input buttons. You may change the look with some CSS + if you set the <emphasis>class</emphasis> attribute in the <parameter>$attributes</parameter> + hash (second parameter). See example section. + </para> + <para> + Only five attributes may be set, they are: + <variablelist> + <varlistentry> + <term> + <parameter>name</parameter> + </term> + <listitem> + <para> + The form input button name. Default are: + 'add', or 'remove', or, 'all', or 'none', or 'toggle', or 'up', or 'down'. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>value</parameter> + </term> + <listitem> + <para> + The form input button text. Default are ' >> ', or ' << ', + or ' Select All ', or ' Select None ', or ' Toggle Selection ', or ' Up ', or ' Down '. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>type</parameter> + </term> + <listitem> + <para> + The form input button kind. Default is 'button' (Can be either 'button' or 'image'). + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>class</parameter> + </term> + <listitem> + <para> + A CSS class identifier in one of your stylesheets. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>src</parameter> + </term> + <listitem> + <para> + URL of the image file used. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$button</parameter> + </term> + <listitem> + <para> + Button identifier, either 'add', 'remove', + 'all', 'none', 'toggle', + 'moveup' or 'movedown' + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + &type.mixed; + <parameter>$attributes</parameter> + </term> + <listitem> + <para> + (optional) Either a typical HTML attribute string + or an associative array + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.throws"> + &title.throws; + <para> + <table><title>&title.throws.errortable;</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Error message</entry> + <entry>Reason</entry> + <entry>Solution</entry> + </row> + </thead> + <tbody> + <row> + <entry>Argument 1 of advmultiselect::setButtonAttributes is not a string</entry> + <entry>Tried to give a button identifier of unknown type</entry> + <entry>Check the $button argument data type</entry> + </row> + <row> + <entry>Argument 1 of advmultiselect::setButtonAttributes has unexpected value</entry> + <entry>Tried to give a button identifier of unknown value</entry> + <entry>Check the $button argument data range</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setbuttonattributes.example"> + &title.example; + <para> + In this example, the 'add' and 'remove' buttons have look set by the css class 'inputCommand'. + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine', +); + +// rendering with QF renderer engine and template system +$form->addElement('header', null, 'Advanced Multiple Select: custom layout '); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); + +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); +$ams->setButtonAttributes('add', array('value' => 'Add >>', + 'class' => 'inputCommand' +)); +$ams->setButtonAttributes('remove', array('value' => '<< Remove', + 'class' => 'inputCommand' +)); +$template = ' +<table{class}> +<!-- BEGIN label_2 --><tr><th align="center">{label_2}</th><!-- END label_2 --> +<!-- BEGIN label_3 --><th align="center">{label_3}</th></tr><!-- END label_3 --> +<tr> + <td>{unselected}</td> + <td>{selected}</td> +</tr> +<tr> + <td>{add}</td> + <td>{remove}</td> +</tr> +</table>'; +$ams->setElementTemplate($template); + +if (isset($_POST['fruit'])) { + $form->setDefaults(array('fruit' => $_POST['fruit'])); +} + +$form->addElement('submit', 'send', 'Send'); +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +<title>HTML_QuickForm::advMultiSelect example </title> +<style type="text/css"> +<!-- +body { + background-color: #FFF; + font-family: Verdana, Arial, helvetica; + font-size: 10pt; +} + +.inputCommand { + background-color: #d0d0d0; + border: 1px solid #7B7B88; + width: 7em; + margin-bottom: 2px; +} +// --> +</style> +<?php echo $ams->getElementJs(false); ?> +</head> +<body> +<?php +if ($form->validate()) { + $clean = $form->getSubmitValues(); + + echo '<pre>'; + print_r($clean); + echo '</pre>'; +} +$form->display(); +?> +</body> +</html> + ]]> + </programlisting> + </para> + + <para> + You may also use images rather than standard form input button. Replaces lines : + <programlisting role="php"> + <![CDATA[ +$ams->setButtonAttributes('add', array('value' => 'Add >>', + 'class' => 'inputCommand' +)); +$ams->setButtonAttributes('remove', array('value' => '<< Remove', + 'class' => 'inputCommand' +)); + ]]> + </programlisting> + by lines that should like : + <programlisting role="php"> + <![CDATA[ +$ams->setButtonAttributes('add', array('type' => 'image', + 'src' => '/img/add.png' +)); +$ams->setButtonAttributes('remove', array('type' => 'image', + 'src' => '/img/remove.png' +)); + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml:1.4 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setelementtemplate.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::setElementTemplate</function></refname> + <refpurpose>Sets element template</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>void <function>HTML_QuickForm_advmultiselect::setElementTemplate</function></funcdef> + <paramdef choice="req">string <parameter>$html</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.desc"> + &title.desc; + <para> + It is so easy to re-arrange select boxes, headers and buttons position. + The template is a bit of html code with reserved placeholders words. They are: + </para> + <para> + <variablelist> + <varlistentry> + <term> + <parameter>stylesheet</parameter> + </term> + <listitem> + <para> + The CSS delimited by the style tags required only + for the single multi-select with checkboxes shape. + Not included in the default template. You can use instead, the <function>getElementCss</function> + method. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>javascript</parameter> + </term> + <listitem> + <para> + The JavaScript delimited by the script tags required to manage item + of both multi-select boxes. + If it is not included, you can use instead, the <function>getElementJs</function> + method. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>class</parameter> + </term> + <listitem> + <para> + A CSS class identifier in one of your stylesheets that is the default + table layout. Default values are: + <programlisting> + <![CDATA[ +<table border="0" cellpadding="10" cellspacing="0"> + ]]> + </programlisting> + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>label_2</parameter> + </term> + <listitem> + <para> + The unselected list header + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>label_3</parameter> + </term> + <listitem> + <para> + The selected list header + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>unselected</parameter> + </term> + <listitem> + <para> + The unselected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>selected</parameter> + </term> + <listitem> + <para> + The selected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>add</parameter> + </term> + <listitem> + <para> + The add button to swap one (or more) item + from the unselected to the selected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>remove</parameter> + </term> + <listitem> + <para> + The remove button to swap one (or more) item back + from the selected to the unselected list. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>moveup</parameter> + </term> + <listitem> + <para> + The button to move one item of the selected list to the top. + </para> + </listitem> + </varlistentry> + </variablelist> + <variablelist> + <varlistentry> + <term> + <parameter>movedown</parameter> + </term> + <listitem> + <para> + The button to move one item of the selected list to the bottom. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.param"> + &title.param; + <para> + <variablelist> + <varlistentry> + <term> + &type.string; + <parameter>$html</parameter> + </term> + <listitem> + <para> + The HTML surrounding select boxes and buttons + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setelementtemplate.example"> + &title.example; + <para> + In this partial example, the fruit list select boxes are set to vertical alignement + with images for the 'add' and 'remove' buttons. + Default presentation are horizontal alignment with input text buttons in the middle side. + <programlisting role="php"> + <![CDATA[ +<?php +require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm/advmultiselect.php'; + +$form = new HTML_QuickForm('ams'); +$form->removeAttribute('name'); // XHTML compliance + +$fruit_array = array( + 'apple' => 'Apple', + 'orange' => 'Orange', + 'pear' => 'Pear', + 'banana' => 'Banana', + 'cherry' => 'Cherry', + 'kiwi' => 'Kiwi', + 'lemon' => 'Lemon', + 'lime' => 'Lime', + 'tangerine' => 'Tangerine', +); + +$ams =& $form->addElement('advmultiselect', 'fruit', null, $fruit_array); +$ams->setLabel(array('Fruit:', 'Available', 'Selected')); +$ams->setButtonAttributes('add', array('type' => 'image', 'src' => '/img/down.png')); +$ams->setButtonAttributes('remove', array('type' => 'image', 'src' => '/img/up.png')); + +// vertical select box with image buttons as selector +$template = ' +<table{class}> +<!-- BEGIN label_2 --><tr><th align="center">{label_2}</th></tr><!-- END label_2 --> +<tr> + <td>{unselected}</td> +</tr> +<tr> + <td align="center">{add}{remove}</td> +</tr> +<tr> + <td>{selected}</td> +</tr> +<!-- BEGIN label_3 --><tr><th align="center">{label_3}</th></tr><!-- END label_3 --> +</table>'; +$ams->setElementTemplate($template); + +// .... +?> + ]]> + </programlisting> + </para> + </refsection> + +</refentry> \ No newline at end of file http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml diff -u /dev/null peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml:1.5 --- /dev/null Thu Jan 22 16:32:39 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/tohtml.xml Thu Jan 22 16:32:39 2009 @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml"> + <refnamediv> + <refname><function>HTML_QuickForm_advmultiselect::toHtml</function></refname> + <refpurpose>Returns the HTML generated for the advanced mutliple select component</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo> + require_once 'HTML/QuickForm/advmultiselect.php'; + </funcsynopsisinfo> + <funcprototype> + <funcdef>string <function>HTML_QuickForm_advmultiselect::toHtml</function></funcdef> + <paramdef choice="req"/> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.desc"> + &title.desc; + <para> + Returns the advmultiselect element structure as HTML. + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.throws"> + &title.throws; + <para> + <emphasis>throws</emphasis> no exceptions thrown + </para> + </refsection> + + <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.tohtml.note"> + &title.note; + <para> + <emphasis>since</emphasis> 0.4.0 + </para> + ¬e.notstatic; + </refsection> + +</refentry> \ No newline at end of file