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

Source for file ScGeneral.php

Documentation is available at ScGeneral.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.  * Smart Client General Helper
  18.  *
  19.  */
  20. class ScGeneral 
  21. {
  22.     
  23.     /**
  24.      * @var String 
  25.      */
  26.     public $removeQuotesStr;
  27.     
  28.     /**
  29.      * Set $remove_quotes_str
  30.      */
  31.     public function __construct()
  32.     {
  33.         $this->removeQuotesStr = '{NQ}';
  34.     }
  35.  
  36.     /**
  37.      * 
  38.      * Return instance
  39.      * 
  40.      */
  41.     public function ScGeneral ()
  42.     {
  43.         return $this;
  44.     }
  45.  
  46.     /**
  47.      * Create the scripts for include
  48.      *
  49.      * @param string $sc_path Path where SmartClient is located
  50.      * @param string $theme    SmartClient theme
  51.      * @return string 
  52.      */
  53.     public function includeScripts$scPath 'js/isomorphic/' $theme 'SmartClient' )
  54.     {
  55.         $includeScripts '
  56.         <script type="text/javascript">var isomorphicDir="'$scPath .'";</script>
  57.         <script src='$scPath .'system/modules/ISC_Core.js type="text/javascript"></script>
  58.         <script src='$scPath .'system/modules/ISC_Foundation.js type="text/javascript"></script>
  59.         <script src='$scPath .'system/modules/ISC_Containers.js type="text/javascript"></script>
  60.         <script src='$scPath .'system/modules/ISC_Grids.js type="text/javascript"></script>
  61.         <script src='$scPath .'system/modules/ISC_Forms.js type="text/javascript"></script>
  62.         <script src='$scPath .'system/modules/ISC_DataBinding.js type="text/javascript"></script>
  63.         <script src='$scPath .'skins/'$theme .'/load_skin.js type="text/javascript"></script>
  64.         ';
  65.         
  66.         return $includeScripts;
  67.     }
  68.     
  69.     /**
  70.      *
  71.      * Add QuotesStr to String
  72.      *
  73.      * @param string $str 
  74.      * @return string 
  75.      */
  76.     public function addQuotesStr$str )
  77.     {
  78.         return $this->removeQuotesStr . $str $this->removeQuotesStr;
  79.     }
  80.     
  81.     /**
  82.      * Remove quotes from specific vars that are not supposed to be quoted using
  83.      * the $removeQuotesStr var
  84.      *
  85.      * @param string $json String in json format
  86.      * @return string 
  87.      */
  88.     public function removeQuotes$json )
  89.     {
  90.         $newJson $json;
  91.         
  92.         // Removes quotes replacing remove_quotes_str
  93.         $newJson str_replace$this->removeQuotesStr .'"' '' $newJson );
  94.         $newJson str_replace'"'$this->removeQuotesStr '' $newJson );
  95.         
  96.         return $newJson;
  97.     }
  98. }

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