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

Source for file ScToolStrips.php

Documentation is available at ScToolStrips.php

  1. <?php
  2. /**
  3.  * SCZF
  4.  *
  5.  * An open source SmartClient View Helper for Zend Framework
  6.  *
  7.  * @package        SCZF
  8.  * @author        Fernando Marcelo Morgenstern <fernando@consultorpc.com>
  9.  * @copyright    Copyright (c) 2009, ConsultorPC
  10.  * @license        http://www.gnu.org/licenses/lgpl-3.0-standalone.html
  11.  * @link        http://smartclientphp.com/
  12.  * @since        Version 0.1b
  13.  * @filesource
  14.  */
  15.  
  16.  
  17. /**
  18.  * Smart Client ToolStrips Helper
  19.  *
  20.  * @uses viewHelper SmartClient
  21.  */
  22. {
  23.  
  24.     /**
  25.      * @var Zend_View_Interface 
  26.      */
  27.     public $view;
  28.     
  29.     /**
  30.      * 
  31.      * Return instance
  32.      * 
  33.      */
  34.     public function ScToolStrips()
  35.     {
  36.         return $this;
  37.     }
  38.  
  39.     /**
  40.      * 
  41.      * Sets the view field
  42.      * @param $view Zend_View_Interface
  43.      * 
  44.      */
  45.     public function setViewZend_View_Interface $view )
  46.     {
  47.         $this->view = $view;
  48.     }
  49.  
  50.     /**
  51.      * 
  52.      * Creates a toolscrip
  53.      *
  54.      * @param mixed $data If string, it must be the width of the toolstrip. If array, them we will loop through it
  55.      * @param string $height Height of the button
  56.      * @param array $members All members for this ToolStrip
  57.      * @param array $options Additional options
  58.      * @return string 
  59.      * 
  60.      */
  61.     public function create$data $height '' $members '' $options '' )
  62.     {
  63.         $newToolStrip array();
  64.         
  65.         // Check if it is an array
  66.         if is_array$data ) )
  67.         {
  68.             $newToolStrip $data;
  69.         }
  70.         else
  71.         {
  72.             // Add vars to the new toolstrip
  73.             $newToolStrip['width'$data;
  74.             $newToolStrip['height'$height;
  75.             $newToolStrip['members'$members;
  76.             
  77.             // Check if options is array and do the loop
  78.             if is_array$options ) )
  79.             {
  80.                 foreach $options as $name => $value )
  81.                 {
  82.                     $newToolStrip[$name$value;
  83.                 }
  84.             }
  85.         }
  86.         
  87.         // Encode all data
  88.         $dataEncoded Zend_Json::encode$newToolStrip );
  89.         
  90.         // Remove vars that shouldn't be quoted
  91.         $dataEncoded $this->removeQuotes$dataEncoded );
  92.         
  93.         // Generate js code
  94.         $js '
  95.         <script type="text/javascript">
  96.             isc.ToolStrip.create(
  97.                 '$dataEncoded .'
  98.             );
  99.         </script>
  100.         ';
  101.         
  102.         return $js;
  103.     }
  104. }

Documentation generated on Mon, 20 Jul 2009 16:51:57 -0300 by phpDocumentor 1.4.1