Source for file anchorlist.php

Documentation is available at anchorlist.php

  1. <?php
  2. /**
  3. * anchor list (<li><a href="$href">$name</a></li>) for a ChoiceList
  4. *
  5. @author    Stuart Prescott
  6. @copyright  Copyright Stuart Prescott
  7. @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  8. @version    $Id$
  9. @package    Bumblebee
  10. @subpackage FormsLibrary
  11. */
  12.  
  13. /** Load ancillary functions */
  14. require_once 'inc/typeinfo.php';
  15.  
  16. /** choicelist parent object */
  17. require_once 'choicelist.php';
  18.  
  19. /**
  20. * anchor list (<li><a href="$href">$name</a></li>) for a ChoiceList
  21. @package    Bumblebee
  22. @subpackage FormsLibrary
  23. */
  24. class AnchorList extends ChoiceList {
  25.   /** @var string  prepended to all hrefs genereated here  */
  26.   var $hrefbase;
  27.   /** @var string  html/css class used for the entire unordered list  */
  28.   var $ulclass = 'selectlist';
  29.   /** @var string  html/css class used for each list item  */
  30.   var $liclass = 'item';
  31.   /** @var string  html/css class used for each anchor  */
  32.   var $aclass  = 'itemanchor';
  33.  
  34.   /**
  35.   *  Create a new AnchorList
  36.   *
  37.   * @param string $name   the name of the field (db name, and html field name
  38.   * @param string $description  used in the html title of the list
  39.   */
  40.   function AnchorList($name$description=''{
  41.     $this->ChoiceList($name$description);
  42.   }
  43.  
  44.   /**
  45.   * format an individual element in the list
  46.   *
  47.   * @param array $data the data to format using the OutputFormatter
  48.   * @return string  formatted entry
  49.   */
  50.   function format($data{
  51.     $aclass  (isset($this->aclass" class='$this->aclass''');
  52.     $t .= "<a href='$this->hrefbase".$data[$this->formatid]."'$aclass>"
  53.          .$this->formatter[0]->format($data)
  54.          .'</a>'
  55.          .$this->formatter[1]->format($data);
  56.     return $t;
  57.   }
  58.  
  59.   /**
  60.   * create the html list
  61.   *
  62.   * @return string  formatted list
  63.   */
  64.   function display({
  65.     $ulclass (isset($this->ulclass" class='$this->ulclass''');
  66.     $liclass (isset($this->liclass" class='$this->liclass''');
  67.     $t  "<ul title='$this->description'$ulclass>\n";
  68.     if (is_array($this->list->choicelist)) {
  69.       foreach ($this->list->choicelist as $v{
  70.         $t .= "<li$liclass>";
  71.         #$t .= print_r($v, true);
  72.         $t .= $this->format($v);
  73.         $t .= "</li>\n";
  74.       }
  75.     }
  76.     $t .= "</ul>\n";
  77.     return $t;
  78.   }
  79.  
  80. // class AnchorList
  81.  
  82.  
  83. ?>

Documentation generated on Tue, 06 Mar 2007 10:00:31 +0000 by phpDocumentor 1.3.0