cvs: peardoc /en/package/html html-quickform-advmultiselect.xml /en/package/html/html-quickform-advmultiselect whatsnew.xml /en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect getpersistantoptions.xml setpersistantoptions.xml

[email protected] ("Laurent Laville")
Newsgroups php.pear.doc
Message-ID <cvsfarell1233942384@cvsserver>
farell		Fri Feb  6 17:46:24 2009 UTC

  Added files:                 
    /peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect	
                                                                                        	getpersistantoptions.xml 
                                                                                        	setpersistantoptions.xml 

  Modified files:              
    /peardoc/en/package/html	html-quickform-advmultiselect.xml 
    /peardoc/en/package/html/html-quickform-advmultiselect	whatsnew.xml 
  Log:
  add/update page of Manual related to persistant options (new feature of version 1.5.0) with a usage example
farell-20090206174624.txt (text/plain, 10.4 KB)
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect.xml?r1=1.22&r2=1.23&diff_format=u
Index: peardoc/en/package/html/html-quickform-advmultiselect.xml
diff -u peardoc/en/package/html/html-quickform-advmultiselect.xml:1.22 peardoc/en/package/html/html-quickform-advmultiselect.xml:1.23
--- peardoc/en/package/html/html-quickform-advmultiselect.xml:1.22	Thu Feb  5 18:01:24 2009
+++ peardoc/en/package/html/html-quickform-advmultiselect.xml	Fri Feb  6 17:46:23 2009
@@ -94,6 +94,12 @@
        Available since version 1.5.0
       </simpara>
      </listitem>
+     <listitem>
+      <simpara>
+       add or remove persistant options (disabled attribute) at run-time.
+       Available since version 1.5.0
+      </simpara>
+     </listitem>
     </itemizedlist>
    </para>
   </section>
@@ -304,6 +310,8 @@
    &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;
+   &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getpersistantoptions;
+   &package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions;
   </section>
 
   <section xml:id="package.html.html-quickform-advmultiselect.ref.buttons">
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml?r1=1.3&r2=1.4&diff_format=u
Index: peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml
diff -u peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml:1.3 peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml:1.4
--- peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml:1.3	Sun Feb  1 15:18:58 2009
+++ peardoc/en/package/html/html-quickform-advmultiselect/whatsnew.xml	Fri Feb  6 17:46:24 2009
@@ -150,6 +150,14 @@
      allow to use only one instance of javascript code
     </para>
    </listitem>
+   <listitem>
+    <para>
+     add or remove persistant options (disabled attribute) at run-time, with
+     <link linkend="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions">
+      <function>HTML_QuickForm_advmultiselect::setPersistantOptions</function>
+     </link>.
+    </para>
+   </listitem>
   </itemizedlist>
   </para>
  </refsection>

http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getpersistantoptions.xml?view=markup&rev=1.1
Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getpersistantoptions.xml
+++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/getpersistantoptions.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.getpersistantoptions">
 <refnamediv>
  <refname><function>HTML_QuickForm_advmultiselect::getPersistantOptions</function></refname>
  <refpurpose>Returns list of persistant options</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <funcsynopsis>
   <funcsynopsisinfo>
    require_once &apos;HTML/QuickForm/advmultiselect.php&apos;;
   </funcsynopsisinfo>
   <funcprototype>
    <funcdef>array <function>HTML_QuickForm_advmultiselect::getPersistantOptions</function></funcdef>
    <paramdef />
   </funcprototype>
  </funcsynopsis>
 </refsynopsisdiv>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getpersistantoptions.desc">
  &title.desc;
  <para>
   Returns list of persistant options (key-values) that could not be selected or unselected.
  </para>
 </refsection>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getpersistantoptions.throws">
  &title.throws;
  <para>
   <emphasis>throws</emphasis> no exceptions thrown
  </para>
 </refsection>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.getpersistantoptions.note">
  &title.note;
  <para>
    <emphasis>since</emphasis>
    version 1.5.0 (2009-02-15)
  </para>
  &note.notstatic;
 </refsection>

</refentry>
http://cvs.php.net/viewvc.cgi/peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setpersistantoptions.xml?view=markup&rev=1.1
Index: peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setpersistantoptions.xml
+++ peardoc/en/package/html/html-quickform-advmultiselect/html-quickform-advmultiselect/setpersistantoptions.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.setpersistantoptions">
 <refnamediv>
  <refname><function>HTML_QuickForm_advmultiselect::setPersistantOptions</function></refname>
  <refpurpose>Sets which items should be persistant</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <funcsynopsis>
   <funcsynopsisinfo>
    require_once &apos;HTML/QuickForm/advmultiselect.php&apos;;
   </funcsynopsisinfo>
   <funcprototype>
    <funcdef>mixed <function>HTML_QuickForm_advmultiselect::setPersistantOptions</function></funcdef>
    <paramdef choice="req">
     mixed
     <parameter>$optionValues</parameter>
    </paramdef>
    <paramdef choice="opt">
     boolean
     <parameter>$persistant</parameter>
     <initializer>true</initializer>
    </paramdef>
   </funcprototype>
  </funcsynopsis>
 </refsynopsisdiv>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions.desc">
  &title.desc;
  <para>
   Sets which items should have the disabled attribute to keep it persistant
  </para>
 </refsection>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions.param">
  &title.param;
  <para>
   <variablelist>
    <varlistentry>
     <term>
      &type.mixed;
      <parameter>$optionValues</parameter>
     </term>
     <listitem>
      <para>
       Options (key-values) that should be persistant
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term>
      &type.bool;
      <parameter>$persistant</parameter>
     </term>
     <listitem>
      <para>
       (optional) TRUE if persistant, FALSE otherwise
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsection>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions.throws">
  &title.throws;
  <para>
    <emphasis>throws</emphasis> PEAR_Error
  </para>
 </refsection>

 <refsection xml:id="package.html.html-quickform-advmultiselect.html-quickform-advmultiselect.setpersistantoptions.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.setpersistantoptions.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',
    'tangerine' =>  'Tangerine'
);

$ams =& $form->createElement('advmultiselect', 'fruit', null, null,
                             array('class' => 'pool', 'style' => 'width:200px;')
);
$ams->setLabel(array('Fruit:', 'Available', 'Selected'));

$ams->setButtonAttributes('add'       , 'class=inputCommand');
$ams->setButtonAttributes('remove'    , 'class=inputCommand');
$ams->setButtonAttributes('all'       , 'class=inputCommand');
$ams->setButtonAttributes('none'      , 'class=inputCommand');
$ams->setButtonAttributes('toggle'    , 'class=inputCommand');
$ams->setButtonAttributes('moveup'    , 'class=inputCommand');
$ams->setButtonAttributes('movedown'  , 'class=inputCommand');
$ams->setButtonAttributes('movetop'   , 'class=inputCommand');
$ams->setButtonAttributes('movebottom', 'class=inputCommand');

$templateDual = '
<table{class}>
<!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 -->
<!-- BEGIN label_3 --><th>&nbsp;</th><th>{label_3}</th></tr><!-- END label_3 -->
<tr>
  <td>{unselected}</td>
  <td align="center">
    {add}<br />{remove}<br /><br />
    {all}<br />{none}<br />{toggle}<br /><br />
    {moveup}<br />{movedown}<br />{movetop}<br />{movebottom}
  </td>
  <td>{selected}</td>
</tr>
</table>
';

$ams->load($fruit_array, 'pear');

$ams->setPersistantOptions(array('pear', 'tangerine'));

$ams->setElementTemplate($templateDual);

$form->addElement($ams);

$buttons[] =& $form->createElement('submit', null, 'Submit');
$buttons[] =& $form->createElement('reset',  null, 'Reset');
$form->addGroup($buttons, null, '&nbsp;');
?>
<!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 persistant options example</title>
<style type="text/css">
<!--
body {
  background-color: #FFF;
  font-family: Verdana, Arial, helvetica;
  font-size: 10pt;
}

table.pool {
  border: 0;
  background-color: #787878;
}
table.pool td {
  padding-left: 1em;
}
table.pool th {
  font-size: 80%;
  font-style: italic;
  text-align: center;
}
table.pool select {
  color: #242424;
  background-color: #eee;
}
.inputCommand {
  width: 120px;
}
<?php echo $ams->getElementCss(); ?>
 -->
</style>
<?php echo $ams->getElementJs(false, true); ?>
</head>
<body>
<?php
if ($form->validate()) {
    $clean = $form->getSubmitValues();

    var_dump($clean);

    // if apple fruit is selected, then pear may be remove from next selection
    if (in_array('apple', $clean['fruit'])) {
        $ams->setPersistantOptions('pear', false);
    } else {
        $ams->setPersistantOptions('pear', true);
        $selection = $ams->getSelected();
        if (!in_array('pear', $selection)) {
            array_push($selection, 'pear');
            $ams->setSelected($selection);
        }
    }
}
$form->display();
?>
</body>
</html>
    ]]>
   </programlisting>
  </para>
 </refsection>

</refentry>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.