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

Source for file ScToolStrips.php

Documentation is available at ScToolStrips.php

  1. <?php
  2. /**
  3.  * SCPHP
  4.  *
  5.  * An open source SmartClient library for PHP
  6.  *
  7.  * @package        SCPHP
  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.  */
  21. class ScToolStrips extends ScGeneral 
  22. {
  23.     /**
  24.      * 
  25.      * Creates a toolscrip
  26.      *
  27.      * @param mixed $data If string, it must be the width of the toolstrip. If array, them we will loop through it
  28.      * @param string $height Height of the button
  29.      * @param array $members All members for this ToolStrip
  30.      * @param array $options Additional options
  31.      * @return string 
  32.      * 
  33.      */
  34.     public function create$data $height '' $members '' $options '' )
  35.     {
  36.         $newToolStrip array();
  37.         
  38.         // Check if it is an array
  39.         if is_array$data ) )
  40.         {
  41.             $newToolStrip $data;
  42.         }
  43.         else
  44.         {
  45.             // Add vars to the new toolstrip
  46.             $newToolStrip['width'$data;
  47.             $newToolStrip['height'$height;
  48.             $newToolStrip['members'$members;
  49.             
  50.             // Check if options is array and do the loop
  51.             if is_array$options ) )
  52.             {
  53.                 foreach $options as $name => $value )
  54.                 {
  55.                     $newToolStrip[$name$value;
  56.                 }
  57.             }
  58.         }
  59.         
  60.         // Encode all data
  61.         $dataEncoded json_encode$newToolStrip );
  62.         
  63.         // Remove vars that shouldn't be quoted
  64.         $dataEncoded $this->removeQuotes$dataEncoded );
  65.         
  66.         // Generate js code
  67.         $js '
  68.         <script type="text/javascript">
  69.             isc.ToolStrip.create(
  70.                 '$dataEncoded .'
  71.             );
  72.         </script>
  73.         ';
  74.         
  75.         return $js;
  76.     }
  77. }

Documentation generated on Wed, 29 Jul 2009 22:37:15 -0300 by phpDocumentor 1.4.1