Source for file FileProxyFactory.php

Documentation is available at FileProxyFactory.php

  1. <?php
  2. /**
  3. * Build the right type of file proxy based on the request
  4. *
  5. * PHP versions 5
  6. @category  PHP
  7. @package   GeoPrisma
  8. @author    Julien-Samuel Lacroix
  9. @copyright Mapgears
  10. @license   http://www.geoprisma.org/license BSD License
  11. @link      http://www.geoprisma.org
  12. */
  13.  
  14. /**
  15. * Construit le bon type de file proxy selon le type de requete
  16. @category   PHP
  17. @package    GeoPrisma
  18. @subpackage Proxy
  19. @author     Julien-Samuel Lacroix
  20. */  
  21. {
  22.     /**
  23.     * Return the good file proxy
  24.     * 
  25.     * @param org_geoprisma_service_FileService $pobjService Service
  26.     * 
  27.     * @return org_geoprisma_proxy_file_FileProxy 
  28.     */
  29.     public static function getFileProxy(org_geoprisma_service_FileService $pobjService)
  30.     {
  31.         // Set default to get
  32.         $objFileProxy new org_geoprisma_proxy_file_FileGetProxy($pobjService);
  33.  
  34.         if (self::isDownload()) 
  35.         {    
  36.             $objFileProxy new org_geoprisma_proxy_file_FileDownloadProxy($pobjService);
  37.         }
  38.         else if (self::isView()) 
  39.         {
  40.             $objFileProxy new org_geoprisma_proxy_file_FileViewProxy($pobjService);
  41.         }
  42.         else if (self::isUpload()) 
  43.         {
  44.             $objFileProxy new org_geoprisma_proxy_file_FileUploadProxy($pobjService);
  45.         }
  46.         else if (self::isNewDir()) 
  47.         {
  48.             $objFileProxy new org_geoprisma_proxy_file_FileNewDirProxy($pobjService);
  49.         }
  50.    
  51.         return $objFileProxy;
  52.     }
  53.     
  54.     /**
  55.     * Check if query is the type of download | cmd = download
  56.     * 
  57.     * @return bool 
  58.     */
  59.     private static function isDownload()
  60.     {
  61.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'download' && 
  62.                 isset($_REQUEST['path']&& $_REQUEST['path'!= '');
  63.     }
  64.     
  65.     /**
  66.     * Check if query is the type of view | cmd = view
  67.     * 
  68.     * @return bool 
  69.     */
  70.     private static function isView()
  71.     {
  72.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'view' && 
  73.                 isset($_REQUEST['path']&& $_REQUEST['path'!= '');
  74.     }
  75.  
  76.     /**
  77.     * Check if query is the type of upload | cmd = upload
  78.     * 
  79.     * @return bool 
  80.     */
  81.     private static function isUpload()
  82.     {
  83.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'upload' && 
  84.                 isset($_REQUEST['path']&& $_REQUEST['path'!= '' &&
  85.                 isset($_FILES&& isset($_FILES['x-filename']&&
  86.                 isset($_REQUEST['dir']&& $_REQUEST['dir'!= '');
  87.     }
  88.  
  89.     /**
  90.     * Check if query is the type of new directory | cmd = newdir
  91.     * 
  92.     * @return bool 
  93.     */
  94.     private static function isNewDir()
  95.     {
  96.         return (isset($_REQUEST['cmd']&& $_REQUEST['cmd'== 'newdir' && 
  97.                 isset($_REQUEST['dir']&& $_REQUEST['dir'!= '');
  98.     }
  99. }
  100. ?>

Documentation generated on Mon, 20 Feb 2012 13:46:17 -0500 by phpDocumentor 1.4.1