cvs: peardoc /en/package/html html-quickform-advmultiselect.xml /en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect load.xml
loadarray.xml

From: Date: Sun, 01 Feb 2009 15:12:40 +0000
Subject: cvs: peardoc /en/package/html html-quickform-advmultiselect.xml /en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect load.xml
loadarray.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11528@lists.php.net to get a copy of this message
farell Sun Feb 1 15:12:40 2009 UTC Added files: /peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect load.xml loadarray.xml Modified files: /peardoc/en/package/html html-quickform-advmultiselect.xml Log: ability to load options with fancy attributes from class constructor or load functions

http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect.xml?r1=1.20&r2=1.21&diff_format=u Index: peardoc/en/package/html/html-quickform-advmultiselect.xml diff -u peardoc/en/package/html/html-quickform-advmultiselect.xml:1.20 peardoc/en/package/html/html-quickform-advmultiselect.xml:1.21 --- peardoc/en/package/html/html-quickform-advmultiselect.xml:1.20 Sun Feb 1 14:23:50 2009 +++ peardoc/en/package/html/html-quickform-advmultiselect.xml Sun Feb 1 15:12:39 2009 @@ -283,9 +283,20 @@ </simpara> </warning> </para> + <para> + You may either load options from the class constructor or with the load or loadArray functions. + <warning> + <simpara> + load and loadArray functions with fancy attributes (disabled, style:color, ...) + support are only available since version 1.5.0 + </simpara> + </warning> + </para> </abstract> </info> &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.html-quickform-advmultiselect; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load; + &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray; </section> <section xml:id="package.html.html-quickform-advmultiselect.ref.buttons"> http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/load.xml?view=markup&rev=1.1 Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/load.xml +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/load.xml <?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.load"> <refnamediv> <refname><function>HTML_QuickForm_advmultiselect::load</function></refname> <refpurpose>Loads options from different types of data sources</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;HTML/QuickForm/advmultiselect.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>PEAR_Error <function>HTML_QuickForm_advmultiselect::load</function></funcdef> <paramdef choice="req">mixed <parameter>&amp;$options</parameter></paramdef> <paramdef choice="opt">mixed <parameter>$param1</parameter> <initializer>null</initializer> </paramdef> <paramdef choice="opt">mixed <parameter>$param2</parameter> <initializer>null</initializer> </paramdef> <paramdef choice="opt">mixed <parameter>$param3</parameter> <initializer>null</initializer> </paramdef> <paramdef choice="opt">mixed <parameter>$param4</parameter> <initializer>null</initializer> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.desc"> &title.desc; <para> This method overloaded parent method of select element, to allow loading options with fancy attributes. </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.mixed; <parameter>&amp;$options</parameter> </term> <listitem> <para> Options source currently supports assoc array or DB_result </para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.mixed; <parameter>$param1</parameter> </term> <listitem> <para> (optional) See function detail </para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.mixed; <parameter>$param2</parameter> </term> <listitem> <para> (optional) See function detail </para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.mixed; <parameter>$param3</parameter> </term> <listitem> <para> (optional) See function detail </para> </listitem> </varlistentry> </variablelist> <variablelist> <varlistentry> <term> &type.mixed; <parameter>$param4</parameter> </term> <listitem> <para> (optional) See function detail </para> </listitem> </varlistentry> </variablelist> </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.returns"> &title.returns; <para> <emphasis>returns</emphasis> &true; on success </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.throws"> &title.throws; <para> <emphasis>throws</emphasis> PEAR_Error </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.see"> &title.see; <para> <emphasis>see</emphasis> <link linkend="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray"> <function>HTML_QuickForm_advmultiselect::loadArray</function> </link>. </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.note"> &title.note; <para> <emphasis>since</emphasis> version 1.5.0 (2009-02-15) </para> &note.notstatic; </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.example"> &title.example; <para> <programlisting role="php"> <![CDATA[ <?php /** * Custom advMultiSelect HTML_QuickForm element * loading values with fancy attributes (disabled, ...) * * @version $Id: load.xml,v 1.1 2009/02/01 15:12:40 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_QuickForm_advmultiselect * @subpackage Examples * @access public * @example examples/qfams_custom_3.php * qfams_custom_3 source code * @link http://www.laurent-laville.org/img/qfams/screenshot/custom3.png * screenshot (Image PNG, 374x275 pixels) 4.96 Kb */ require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/advmultiselect.php'; $form = new HTML_QuickForm('amsCustom3'); $form->removeAttribute('name'); // XHTML compliance // same as default element template but wihtout the label (in first td cell) $withoutLabel = <<<_HTML <tr valign="top"> <td align="right"> &nbsp; </td> <td align="left"> <!-- BEGIN error --><span style="color: #ff0000;">{error}</span><br /><!-- END error -->{element} </td> </tr> _HTML; // more XHTML compliant // replace default element template with label, because submit button have no label $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate($withoutLabel, 'send'); $fruit_array = array( 'apple' => 'Apple', 'orange' => 'Orange', 'pear' => array('Pear', array('disabled' => 'disabled')), '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->createElement('advmultiselect', 'fruit', null, null, array('class' => 'pool') ); $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); $ams->load($fruit_array, 'apple,pear'); $form->addElement($ams); $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 custom example 3</title> <style type="text/css"> <!-- body { background-color: #FFF; font-family: Verdana, Arial, helvetica; font-size: 10pt; } table.pool { border: 0; background-color: lightyellow; } table.pool td { padding-left: 1em; } table.pool th { font-size: 80%; font-style: italic; text-align: center; } table.pool select { background-color: lightblue; } ..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> </refsection> </refentry> http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/loadarray.xml?view=markup&rev=1.1 Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/loadarray.xml +++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/loadarray.xml <?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.loadarray"> <refnamediv> <refname><function>HTML_QuickForm_advmultiselect::loadArray</function></refname> <refpurpose>Loads the options from an associative array</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcsynopsisinfo> require_once &apos;HTML/QuickForm/advmultiselect.php&apos;; </funcsynopsisinfo> <funcprototype> <funcdef>mixed <function>HTML_QuickForm_advmultiselect::loadArray</function></funcdef> <paramdef choice="req">array <parameter>$arr</parameter></paramdef> <paramdef choice="opt">mixed <parameter>$values</parameter> <initializer>null</initializer> </paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.desc"> &title.desc; <para> This method overloaded parent method of select element, to allow to load array of options with fancy attributes. </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.param"> &title.param; <para> <variablelist> <varlistentry> <term> &type.array; <parameter>$arr</parameter> </term> <listitem> <para> Associative array of options </para> </listitem> </varlistentry> <varlistentry> <term> &type.mixed; <parameter>$values</parameter> </term> <listitem> <para> (optional) Array or comma delimited string of selected values </para> </listitem> </varlistentry> </variablelist> </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.returns"> &title.returns; <para> <emphasis>returns</emphasis> &true; on success </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.throws"> &title.throws; <para> <emphasis>throws</emphasis> PEAR_Error </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.see"> &title.see; <para> <emphasis>see</emphasis> <link linkend="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load"> <function>HTML_QuickForm_advmultiselect::load</function> </link> </para> </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.note"> &title.note; <para> <emphasis>since</emphasis> version 1.5.0 (2009-02-15) </para> &note.notstatic; </refsection> <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.loadarray.example"> &title.example; <para> See <link linkend="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.load.example"> <function>HTML_QuickForm_advmultiselect::load</function> </link> example. </para> </refsection> </refentry>
« previous php.pear.doc (#11528) next »