Overview

Namespaces

  • GLFramework
    • Cache
    • Controller
    • DaMa
      • Manipulators
    • Database
    • HTTP
    • Mail
    • Middleware
    • Model
    • Module
    • Tests
    • Upload
    • Utils
  • None

Classes

  • GLFramework\Bootstrap
  • GLFramework\Cache\Cache
  • GLFramework\Cache\MemcachedCache
  • GLFramework\Cache\MemoryCache
  • GLFramework\Controller
  • GLFramework\Controller\AdminController
  • GLFramework\Controller\APIController
  • GLFramework\Controller\AuthController
  • GLFramework\Controller\ErrorController
  • GLFramework\Controller\ExceptionController
  • GLFramework\DaMa\Association
  • GLFramework\DaMa\DataManipulation
  • GLFramework\DaMa\Manipulator
  • GLFramework\DaMa\Manipulators\CSVManipulator
  • GLFramework\DaMa\Manipulators\ManipulatorCore
  • GLFramework\DaMa\Manipulators\XLSManipulator
  • GLFramework\DaMa\Manipulators\XLSXManipulator
  • GLFramework\Database\Connection
  • GLFramework\Database\MySQLConnection
  • GLFramework\DatabaseManager
  • GLFramework\DBStructure
  • GLFramework\Events
  • GLFramework\Filesystem
  • GLFramework\HTTP\API
  • GLFramework\Log
  • GLFramework\Mail
  • GLFramework\Mail\Mail
  • GLFramework\Mail\MailSystem
  • GLFramework\Mail\PHPMailer
  • GLFramework\MailView
  • GLFramework\Middleware\APIAuthorizationMiddleware
  • GLFramework\Middleware\ControllerMiddleware
  • GLFramework\Model
  • GLFramework\Model\Page
  • GLFramework\Model\User
  • GLFramework\Model\UserPage
  • GLFramework\ModelResult
  • GLFramework\Module\Module
  • GLFramework\Module\ModuleManager
  • GLFramework\Request
  • GLFramework\Response
  • GLFramework\Tests\DatabaseTestCase
  • GLFramework\Tests\TestCase
  • GLFramework\Upload\Upload
  • GLFramework\Upload\Uploads
  • GLFramework\Utils\DataTablesManager
  • GLFramework\Versions
  • GLFramework\View

Interfaces

  • GLFramework\Middleware

Functions

  • array_merge_recursive_ex
  • e
  • file_get_php_classes
  • fix_date
  • fix_date_format
  • fix_decimal
  • fix_url
  • get
  • get_php_classes
  • http_response_code
  • instance_method
  • is_module_enabled
  • now
  • post
  • print_array
  • print_brief_debug
  • print_debug
  • random_str
  • reArrayFiles
  • reArrayPost
  • today
  • Overview
  • Namespace
  • Class
 1: <?php
 2: /**
 3:  * Created by PhpStorm.
 4:  * User: manus
 5:  * Date: 1/03/16
 6:  * Time: 10:17
 7:  */
 8: 
 9: namespace GLFramework\DaMa;
10: 
11: use GLFramework\DaMa\Manipulators\CSVManipulator;
12: use GLFramework\DaMa\Manipulators\XLSManipulator;
13: use GLFramework\DaMa\Manipulators\XLSXManipulator;
14: 
15: define('DATA_MANIPULATION_CREATE_MODE_AUTO', 0);
16: define('DATA_MANIPULATION_CREATE_MODE_CSV', 1);
17: define('DATA_MANIPULATION_CREATE_MODE_XLS', 2);
18: define('DATA_MANIPULATION_CREATE_MODE_XLSX', 3);
19: define('DATA_MANIPULATION_CREATE_MODE_ODS', 4);
20: 
21: class DataManipulation
22: {
23:     public function rename_extension($file, $original)
24:     {
25:         $name = $file . $this->getFileExtension($original);
26:         rename($file, $name);
27:         return $name;
28: 
29:     }
30: 
31:     public function getFileExtension($file)
32:     {
33:         return substr($file, strrpos($file, "."));
34:     }
35:     public function getModeByFile($file)
36:     {
37:         if(strpos($file, ".") !== FALSE)
38:         {
39:             $ext = substr($file, strrpos($file, "."));
40:             if($ext == ".csv") return DATA_MANIPULATION_CREATE_MODE_CSV;
41:             if($ext == ".xls") return DATA_MANIPULATION_CREATE_MODE_XLS;
42:             if($ext == ".xlsx") return DATA_MANIPULATION_CREATE_MODE_XLSX;
43:             if($ext == ".ods") return DATA_MANIPULATION_CREATE_MODE_ODS;
44:         }
45:     }
46:     /**
47:      * @param $file
48:      * @param int $mode
49:      * @return Manipulator
50:      */
51:     public function createFromFile($file, $mode = DATA_MANIPULATION_CREATE_MODE_AUTO)
52:     {
53:         $manipulator = new Manipulator();
54:         $manipulator->setFilename($file);
55:         if($mode == DATA_MANIPULATION_CREATE_MODE_AUTO)
56:         {
57:             $mode = $this->getModeByFile($file);
58:         }
59:         if($mode == DATA_MANIPULATION_CREATE_MODE_ODS) $manipulator->setCore(new CSVManipulator());
60:         else if($mode == DATA_MANIPULATION_CREATE_MODE_XLS) $manipulator->setCore(new XLSManipulator());
61:         else if($mode == DATA_MANIPULATION_CREATE_MODE_XLSX) $manipulator->setCore(new XLSXManipulator());
62:         else $manipulator->setCore(new CSVManipulator());
63: 
64:         return $manipulator;
65:     }
66: }
API documentation generated by ApiGen