PhpExt : [ class tree ] [ index ] [ all elements ]

Source for file DataView.php

Documentation is available at DataView.php

  1. <?php
  2. /**
  3.  * PHP-Ext Library
  4.  * http://php-ext.googlecode.com
  5.  * @author Sergei Walter <sergeiw[at]gmail[dot]com>
  6.  * @copyright 2008 Sergei Walter
  7.  * @license http://www.gnu.org/licenses/lgpl.html
  8.  * @link http://php-ext.googlecode.com
  9.  * 
  10.  *  Reference for Ext JS: http://extjs.com
  11.  * 
  12.  */
  13. /**
  14.  * @see PhpExt_BoxComponent
  15.  */
  16. include_once 'PhpExt/BoxComponent.php';
  17.  
  18. /**
  19.  * A mechanism for displaying data using custom layout templates and formatting.
  20.  * DataView uses an {@link PhpExt_XTemplate} as its internal templating mechanisma, and is bound to an {@link PhpExt_Data_Store} so that as the data in the store changes the view is automatically updated to reflect the changes.
  21.  * The view also provides built-in behavior for many common events that can occur for its contained items including click, doubleclick, mouseover, mouseout, etc. as well as a built-in selection model.
  22.  * <b>In order to use these features, an itemSelector config must be provided for the DataView to determine what nodes it will be working with.</b>
  23.  * 
  24.  * @package PhpExt
  25.  */
  26. {
  27.     // EmptyText
  28.     /**
  29.      * The text to display in the view when there is no data to display (defaults to '').
  30.      * @param string $value 
  31.      * @return PhpExt_DataView 
  32.      */
  33.     public function setEmptyText($value{
  34.         $this->setExtConfigProperty("emptyText"$value);
  35.         return $this;
  36.     }    
  37.     /**
  38.      * The text to display in the view when there is no data to display (defaults to '').
  39.      * @return string 
  40.      */
  41.     public function getEmptyText({
  42.         return $this->getExtConfigProperty("emptyText");
  43.     }
  44.     
  45.     // ItemCssSelector
  46.     /**
  47.      * <b>This is a required setting.</b> A CSS selector in any format supported by Ext.DomQuery that will be used to determine what nodes this DataView will be working with.
  48.      * @param string $value 
  49.      * @return PhpExt_DataView 
  50.      */
  51.     public function setItemCssSelector($value{
  52.         $this->setExtConfigProperty("itemSelector"$value);
  53.         return $this;
  54.     }    
  55.     /**
  56.      * <b>This is a required setting.</b> A CSS selector in any format supported by Ext.DomQuery that will be used to determine what nodes this DataView will be working with.
  57.      * @return string 
  58.      */
  59.     public function getItemCssSelector({
  60.         return $this->getExtConfigProperty("itemSelector");
  61.     }
  62.     
  63.     // LoadingText
  64.     /**
  65.      * A string to display during data load operations (defaults to undefined). If specified, this text will be displayed in a loading div and the view's contents will be cleared while loading, otherwise the view's contents will continue to display normally until the new data is loaded and the contents are replaced.
  66.      * @param string $value 
  67.      * @return PhpExt_DataView 
  68.      */
  69.     public function setLoadingText($value{
  70.         $this->setExtConfigProperty("loadingText"$value);
  71.         return $this;
  72.     }    
  73.     /**
  74.      * A string to display during data load operations (defaults to undefined). If specified, this text will be displayed in a loading div and the view's contents will be cleared while loading, otherwise the view's contents will continue to display normally until the new data is loaded and the contents are replaced.
  75.      * @return string 
  76.      */
  77.     public function getLoadingText({
  78.         return $this->getExtConfigProperty("loadingText");
  79.     }
  80.     
  81.     // MultiSelect
  82.     /**
  83.      * True to allow selection of more than one item at a time, false to allow selection of only a single item at a time or no selection at all, depending on the value of singleSelect (defaults to false).
  84.      * @param boolean $value 
  85.      * @return PhpExt_DataView 
  86.      */
  87.     public function setMultiSelect($value{
  88.         $this->setExtConfigProperty("multiSelect"$value);
  89.         return $this;
  90.     }    
  91.     /**
  92.      * True to allow selection of more than one item at a time, false to allow selection of only a single item at a time or no selection at all, depending on the value of singleSelect (defaults to false).
  93.      * @return boolean 
  94.      */
  95.     public function getMultiSelect({
  96.         return $this->getExtConfigProperty("multiSelect");
  97.     }
  98.     
  99.     // OverCssClass
  100.     /**
  101.      * A CSS class to apply to each item in the view on mouseover (defaults to undefined).
  102.      * @param string $value 
  103.      * @return PhpExt_DataView 
  104.      */
  105.     public function setOverCssClass($value{
  106.         $this->setExtConfigProperty("overClass"$value);
  107.         return $this;
  108.     }    
  109.     /**
  110.      * A CSS class to apply to each item in the view on mouseover (defaults to undefined).
  111.      * @return string 
  112.      */
  113.     public function getOverCssClass({
  114.         return $this->getExtConfigProperty("overClass");
  115.     }
  116.     
  117.     // SelectedCssClass
  118.     /**
  119.      * A CSS class to apply to each selected item in the view (defaults to 'x-view-selected').
  120.      * @param string $value 
  121.      * @return PhpExt_DataView 
  122.      */
  123.     public function setSelectedCssClass($value{
  124.         $this->setExtConfigProperty("selectedClass"$value);
  125.         return $this;
  126.     }    
  127.     /**
  128.      * A CSS class to apply to each selected item in the view (defaults to 'x-view-selected').
  129.      * @return string 
  130.      */
  131.     public function getSelectedCssClass({
  132.         return $this->getExtConfigProperty("selectedClass");
  133.     }
  134.     
  135.     // SimpleSelect
  136.     /**
  137.      * True to enable multiselection by clicking on multiple items without requiring the user to hold Shift or Ctrl, false to force the user to hold Ctrl or Shift to select more than on item (defaults to false).
  138.      * @param boolean $value 
  139.      * @return PhpExt_DataView 
  140.      */
  141.     public function setSimpleSelect($value{
  142.         $this->setExtConfigProperty("simpleSelect"$value);
  143.         return $this;
  144.     }    
  145.     /**
  146.      * True to enable multiselection by clicking on multiple items without requiring the user to hold Shift or Ctrl, false to force the user to hold Ctrl or Shift to select more than on item (defaults to false).
  147.      * @return boolean 
  148.      */
  149.     public function getSimpleSelect({
  150.         return $this->getExtConfigProperty("simpleSelect");
  151.     }
  152.     
  153.     // SingleSelect
  154.     /**
  155.      * True to allow selection of exactly one item at a time, false to allow no selection at all (defaults to false). Note that if multiSelect = true, this value will be ignored
  156.      * @param boolean $value 
  157.      * @return PhpExt_DataView 
  158.      */
  159.     public function setSingleSelect($value{
  160.         $this->setExtConfigProperty("singleSelect"$value);
  161.         return $this;
  162.     }    
  163.     /**
  164.      * True to allow selection of exactly one item at a time, false to allow no selection at all (defaults to false). Note that if multiSelect = true, this value will be ignored
  165.      * @return boolean 
  166.      */
  167.     public function getSingleSelect({
  168.         return $this->getExtConfigProperty("singleSelect");
  169.     }
  170.  
  171.     // Store
  172.     /**
  173.      * The PhpExt_Data_Store or any of its children to bind this DataView to.
  174.      * @param PhpExt_Data_Store $value Descendats of {@link PhpExt_Data_Store}
  175.      * @return PhpExt_DataView 
  176.      */
  177.     public function setStore(PhpExt_Data_Store $value{
  178.         $this->setExtConfigProperty("store"$value);
  179.         return $this;
  180.     }    
  181.     /**
  182.      * The PhpExt_Data_Store or any of its children to bind this DataView to.
  183.      * @return PhpExt_Data_Store 
  184.      */
  185.     public function getStore({
  186.         return $this->getExtConfigProperty("store");
  187.     }
  188.     
  189.     // Template
  190.     /**
  191.      * The template used to render the DataView
  192.      * @param PhpExt_XTemplate $value 
  193.      * @return PhpExt_DataView 
  194.      */
  195.     public function setTemplate(PhpExt_XTemplate $value{
  196.         $this->setExtConfigProperty("tpl"$value);
  197.         return $this;
  198.     }    
  199.     /**
  200.      * The template used to render the DataView
  201.      * @return PhpExt_XTemplate 
  202.      */
  203.     public function getTemplate({
  204.         return $this->getExtConfigProperty("tpl");
  205.     }    
  206.     
  207.     /**
  208.      * @param string $itemSelector A CSS selector in any format supported by Ext.DomQuery that will be used to determine what nodes this DataView will be working with.
  209.      */
  210.     public function __construct($itemSelector{
  211.         parent::__construct();
  212.         $this->setExtClassInfo("Ext.DataView","dataview");
  213.  
  214.         $validProps array(
  215.             "emptyText",
  216.             "itemSelector",
  217.             "loadingText",
  218.             "multiSelect",
  219.             "overClass",
  220.             "selectedClass",
  221.             "simpleSelect",
  222.             "singleSelect",
  223.             "store",
  224.             "tpl"
  225.         );
  226.         $this->addValidConfigProperties($validProps);
  227.         
  228.         $this->setItemCssSelector($itemSelector);
  229.     }
  230.         
  231. }

Documentation generated on Fri, 08 Aug 2008 15:52:36 -0500 by phpDocumentor 1.4.0