Skip to content

Commit 94e2121

Browse files
committed
Full review of the module.
1 parent 6d41998 commit 94e2121

23 files changed

+2325
-709
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
__NOTE:__ All versions prior to _1.0_ are beta.
4+
5+
6+
## v0.2 / In Development
7+
- Added "Quick Import" feature to allow import without a Profile
8+
- Added support for JSON source format
9+
- Added support for importing by URL instead of file
10+
- Added support for Streams Core Columns: `id, created, updated, created_by, ordering_count`
11+
12+
## v0.1
13+
Default functionality working
14+
- Importing of CSV files
15+
- Setting up Profiles to map data to Streams

README.md

+33-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
1-
# Stream importer Module
2-
==============
3-
4-
An awesome module to help you to import data in a stream for PyroCMS.
5-
6-
## Installation
7-
8-
Download and install the module as you make it for all the module of PyroCMS ;)
9-
10-
## How to use
11-
12-
### Profiles
13-
14-
First of all, You need to create a profile.
15-
A profile contains information on the Stream you want to feed, wich type of file you are going to send, enclosures, EOL, etc...
16-
The profile also containe the mapping between the CSV and the Fields.
17-
18-
The profiles is very useful if you have to import oftenly different files into one Streams.
19-
20-
21-
## Run an import.
22-
Once your profile is created, you can click on Run.
23-
Run will propose you to select a File you've uploaded in Files Module, and will import it instantly. Because the profiles already know the type of file and the mapping.
24-
25-
## Improve it !
26-
27-
Feel free to improve this Free and awesome module :)
28-
It's in beta for now, but we all need import system in our favorite CMS !
29-
30-
31-
1+
# Streams Import Module
2+
==============
3+
4+
An awesome module to help you to import data into Streams for PyroCMS.
5+
6+
## Installation
7+
8+
Download and install the module through the Admin or Manually
9+
10+
## How to use
11+
12+
### Quick Import
13+
14+
You can choose to run a _Quick Import_ which will act as a one-time import. Simply follow the steps in the Admin to complete.
15+
16+
### Profiles
17+
18+
Profiles can be used to setup a common import you will run multiple times. A Profile will store your destination Stream and field mapping to eliminate these steps in the future.
19+
20+
#### Run an import.
21+
22+
If you have not created a profile, do so now. A Profile will contain all of the "config" type info for future imports.
23+
24+
Once your profile is created, you can click on __Run__ which will propose you to select a File you've uploaded in Files Module, and will import it instantly.
25+
26+
## Improve it !
27+
28+
Feel free to improve this Free and awesome module :)
29+
It's in beta for now, but we all need import system in our favorite CMS !
30+
31+
## Issues
32+
33+
Please submit any issues back to the Github issue tracker: <https://github.com/bergeo-fr/streams_import>

config/routes.php

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
<?php
2-
3-
$route['streams_import/admin/profiles(/:any)?'] = 'admin_profiles$1';
1+
<?php defined('BASEPATH') or exit('No direct script access allowed');
2+
3+
/**
4+
* Streams Import Routes
5+
*
6+
* @package PyroCMS\Addons\Modules\Streams Import\Config
7+
* @author PyroCMS Community
8+
* @website https://github.com/bergeo-fr/streams_import
9+
*/
10+
$route['streams_import/admin/profiles(/:any)?'] = 'admin_profiles$1';
11+
$route['streams_import/admin/logs(/:any)?'] = 'admin_logs$1';
12+
$route['streams_import/admin(/:any)?'] = 'admin_profiles$1';
13+
14+
// Front
15+
$route['streams_import(/:any)?'] = 'import$1';

config/streams_import_c.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/*
4+
* We some security so we can call the importer on the front end
5+
*/
6+
$config['streams_import:hash'] = 'a874de040c2439d710d1b8e6c7bd59a0';
7+
$config['streams_import:unzip_folder'] = "uploads/default/files/temp_unzip/";

controllers/admin.php

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
<?php defined('BASEPATH') or exit('No direct script access allowed');
22

3+
/**
4+
* Streams Import Admin Controller
5+
*
6+
* @package PyroCMS\Addons\Modules\Streams Import\Controllers
7+
* @author PyroCMS Community
8+
* @website https://github.com/bergeo-fr/streams_import
9+
*/
310
class Admin extends Admin_Controller
411
{
512

13+
/**
14+
* Constructor!
15+
*
16+
*
17+
*/
618
public function __construct()
719
{
820
parent::__construct();
921

10-
$this->lang->load('streams_import');
22+
$this->load->library('streams_import');
1123
}
1224

1325

26+
/**
27+
* Redirect our home to the Profiles page
28+
*/
1429
public function index()
1530
{
1631
redirect('/admin/streams_import/profiles');
17-
//$this->template->build('admin/dashboard');
1832
}
19-
33+
2034
}
2135

2236
/* EOF */

controllers/admin_logs.php

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php defined('BASEPATH') or exit('No direct script access allowed');
2+
3+
/**
4+
* Streams Import Admin Profiles Controller
5+
*
6+
* @package PyroCMS\Addons\Modules\Streams Import\Controllers
7+
* @author PyroCMS Community
8+
* @website https://github.com/bergeo-fr/streams_import
9+
*/
10+
class Admin_logs extends Admin_Controller
11+
{
12+
13+
/**
14+
* Admin Section var
15+
*
16+
* @var string
17+
*/
18+
protected $section = 'logs';
19+
20+
21+
/**
22+
* Stream Namespace
23+
*
24+
* Auto imported from Streams Import Library
25+
*
26+
* @var string
27+
*/
28+
public $namespace ='streams_import';
29+
30+
31+
32+
/**
33+
* Constructor!
34+
*
35+
* Load the Library which loads all, and set some items automatically.
36+
*/
37+
public function __construct()
38+
{
39+
parent::__construct();
40+
$this->lang->load('streams_import');
41+
42+
}
43+
44+
public function index()
45+
{
46+
$extra =
47+
array(
48+
'title' => lang($this->namespace.':title:'.$this->section.':index'),
49+
'buttons' => array(
50+
array(
51+
'label' => lang('global:delete'),
52+
'url' => 'admin/'.$this->namespace.'/'.$this->section.'/delete/-entry_id-',
53+
'confirm' => true
54+
))
55+
);
56+
echo $this->streams->cp->entries_table($this->section, $this->namespace, $pagination = null, $pagination_uri = null, $view_override = true, $extra);
57+
}
58+
59+
public function create()
60+
{
61+
//we won't create logs manually !
62+
redirect('admin/'.$this->namespace.'/'.$this->section);
63+
}
64+
65+
public function edit ($id)
66+
{
67+
//we won't edit logs manually !
68+
redirect('admin/'.$this->namespace.'/'.$this->section);
69+
}
70+
71+
public function delete($id)
72+
{
73+
if($this->streams->entries->delete_entry($id, $this->section, $this->namespace)){
74+
$this->session->set_flashdata('success', lang($this->namespace.':messages:'.$this->section.':delete:success'));
75+
}else{
76+
$this->session->set_flashdata('error', lang($this->namespace.':messages:'.$this->section.':delete:failure'));
77+
}
78+
redirect('admin/'.$this->namespace.'/'.$this->section);
79+
}
80+
81+
82+
83+
}
84+
/* EOF */

0 commit comments

Comments
 (0)