Skip to content
This repository was archived by the owner on Apr 5, 2018. It is now read-only.

Commit 9cbc54c

Browse files
author
Bob Olde Hampsink
committed
Updated docs and coding style
1 parent db61323 commit 9cbc54c

17 files changed

+252
-192
lines changed

ExportPlugin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Plugin that allows you to export data to CSV files.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/

controllers/ExportController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Handles mapping and export requests.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/

migrations/m140924_111621_export_CreateExportMap.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
/**
66
* The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_pluginHandle_migrationName.
7+
*
8+
* @author Bob Olde Hampsink <[email protected]>
9+
* @copyright Copyright (c) 2015, Bob Olde Hampsink
10+
* @license MIT
11+
*
12+
* @link http://github.com/boboldehampsink
713
*/
814
class m140924_111621_export_CreateExportMap extends BaseMigration
915
{
@@ -14,11 +20,10 @@ class m140924_111621_export_CreateExportMap extends BaseMigration
1420
*/
1521
public function safeUp()
1622
{
17-
1823
// Create the craft_export_map table
1924
craft()->db->createCommand()->createTable('export_map', array(
2025
'settings' => array('column' => 'text'),
21-
'map' => array('column' => 'text'),
26+
'map' => array('column' => 'text'),
2227
), null, true);
2328

2429
return true;

models/ExportModel.php

+31-31
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Contains reserved handles.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -18,43 +18,43 @@ class ExportModel extends BaseModel
1818
/**
1919
* Handles.
2020
*/
21-
const HandleId = 'id';
22-
const HandleStatus = 'status';
23-
const HandleParent = 'parent';
24-
const HandleAncestors = 'ancestors';
25-
const HandleTitle = 'title';
26-
const HandleSlug = 'slug';
21+
const HandleId = 'id';
22+
const HandleStatus = 'status';
23+
const HandleParent = 'parent';
24+
const HandleAncestors = 'ancestors';
25+
const HandleTitle = 'title';
26+
const HandleSlug = 'slug';
2727

2828
# Entries
29-
const HandleAuthor = 'authorId';
30-
const HandlePostDate = 'postDate';
31-
const HandleExpiryDate = 'expiryDate';
32-
const HandleEnabled = 'enabled';
29+
const HandleAuthor = 'authorId';
30+
const HandlePostDate = 'postDate';
31+
const HandleExpiryDate = 'expiryDate';
32+
const HandleEnabled = 'enabled';
3333

3434
# Users
35-
const HandleUsername = 'username';
36-
const HandleFirstName = 'firstName';
37-
const HandleLastName = 'lastName';
38-
const HandleEmail = 'email';
39-
const HandlePreferredLocale = 'preferredLocale';
40-
const HandleWeekStartDay = 'weekStartDay';
41-
const HandleLastLoginDate = 'lastLoginDate';
42-
const HandleInvalidLoginCount = 'invalidLoginCount';
35+
const HandleUsername = 'username';
36+
const HandleFirstName = 'firstName';
37+
const HandleLastName = 'lastName';
38+
const HandleEmail = 'email';
39+
const HandlePreferredLocale = 'preferredLocale';
40+
const HandleWeekStartDay = 'weekStartDay';
41+
const HandleLastLoginDate = 'lastLoginDate';
42+
const HandleInvalidLoginCount = 'invalidLoginCount';
4343
const HandleLastInvalidLoginDate = 'lastInvalidLoginDate';
4444

4545
/**
4646
* Fieldtypes.
4747
*/
48-
const FieldTypeEntries = 'Entries';
49-
const FieldTypeCategories = 'Categories';
50-
const FieldTypeAssets = 'Assets';
51-
const FieldTypeUsers = 'Users';
52-
const FieldTypeLightswitch = 'Lightswitch';
53-
const FieldTypeTable = 'Table';
54-
const FieldTypeRichText = 'RichText';
55-
const FieldTypeCheckboxes = 'Checkboxes';
48+
const FieldTypeEntries = 'Entries';
49+
const FieldTypeCategories = 'Categories';
50+
const FieldTypeAssets = 'Assets';
51+
const FieldTypeUsers = 'Users';
52+
const FieldTypeLightswitch = 'Lightswitch';
53+
const FieldTypeTable = 'Table';
54+
const FieldTypeRichText = 'RichText';
55+
const FieldTypeCheckboxes = 'Checkboxes';
5656
const FieldTypeRadioButtons = 'RadioButtons';
57-
const FieldTypeDropdown = 'Dropdown';
58-
const FieldTypeMultiSelect = 'MultiSelect';
59-
const FieldTypeDate = 'Date';
57+
const FieldTypeDropdown = 'Dropdown';
58+
const FieldTypeMultiSelect = 'MultiSelect';
59+
const FieldTypeDate = 'Date';
6060
}

records/Export_MapRecord.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Represents the export_map database table
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -34,7 +34,7 @@ protected function defineAttributes()
3434
{
3535
return array(
3636
'settings' => AttributeType::Mixed,
37-
'map' => AttributeType::Mixed,
37+
'map' => AttributeType::Mixed,
3838
);
3939
}
4040
}

services/ExportService.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Handles common export logics.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -72,7 +72,9 @@ public function saveMap(array $settings, array $map)
7272

7373
/**
7474
* @codeCoverageIgnore
75+
*
7576
* @param \CDbCriteria $criteria
77+
*
7678
* @return Export_MapRecord|array|null
7779
*/
7880
public function findMap(\CDbCriteria $criteria)
@@ -82,6 +84,7 @@ public function findMap(\CDbCriteria $criteria)
8284

8385
/**
8486
* @codeCoverageIgnore
87+
*
8588
* @return Export_MapRecord
8689
*/
8790
protected function getNewMap()
@@ -93,7 +96,9 @@ protected function getNewMap()
9396
* Download the export csv.
9497
*
9598
* @param array $settings
99+
*
96100
* @return string
101+
*
97102
* @throws Exception
98103
*/
99104
public function download(array $settings)
@@ -449,7 +454,7 @@ public function parseFieldData($handle, $data)
449454
$column = isset($field->settings['columns'][$column]) ? $field->settings['columns'][$column] : (isset($field->settings['columns']['col'.$i]) ? $field->settings['columns']['col'.$i] : array('type' => 'dummy'));
450455

451456
// Keep track of column #
452-
$i++;
457+
++$i;
453458

454459
// Parse
455460
$table[] = $column['type'] == 'checkbox' ? ($value == 1 ? Craft::t('Yes') : Craft::t('No')) : $value;

services/Export_CategoryService.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Handles exporting categories
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -60,10 +60,10 @@ public function getFields(array $settings, $reset)
6060

6161
// Set the static fields for this type
6262
$fields = array(
63-
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
64-
ExportModel::HandleTitle => array('name' => Craft::t('Title'), 'checked' => 1),
65-
ExportModel::HandleSlug => array('name' => Craft::t('Slug'), 'checked' => 0),
66-
ExportModel::HandleParent => array('name' => Craft::t('Parent'), 'checked' => 0),
63+
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
64+
ExportModel::HandleTitle => array('name' => Craft::t('Title'), 'checked' => 1),
65+
ExportModel::HandleSlug => array('name' => Craft::t('Slug'), 'checked' => 0),
66+
ExportModel::HandleParent => array('name' => Craft::t('Parent'), 'checked' => 0),
6767
ExportModel::HandleAncestors => array('name' => Craft::t('Ancestors'), 'checked' => 0),
6868
);
6969

services/Export_EntryService.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Handles exporting entries.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -85,16 +85,16 @@ public function getFields(array $settings, $reset)
8585

8686
// Set the static fields for this type
8787
$layout = array(
88-
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
88+
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
8989
ExportModel::HandleTitle.'_'.$entrytype->id => array('name' => $entrytype->hasTitleField ? $entrytype->titleLabel : Craft::t('Title'), 'checked' => 1, 'entrytype' => $entrytype->id),
90-
ExportModel::HandleSlug => array('name' => Craft::t('Slug'), 'checked' => 0),
91-
ExportModel::HandleParent => array('name' => Craft::t('Parent'), 'checked' => 0),
92-
ExportModel::HandleAncestors => array('name' => Craft::t('Ancestors'), 'checked' => 0),
93-
ExportModel::HandleAuthor => array('name' => Craft::t('Author'), 'checked' => 0),
94-
ExportModel::HandlePostDate => array('name' => Craft::t('Post Date'), 'checked' => 0),
90+
ExportModel::HandleSlug => array('name' => Craft::t('Slug'), 'checked' => 0),
91+
ExportModel::HandleParent => array('name' => Craft::t('Parent'), 'checked' => 0),
92+
ExportModel::HandleAncestors => array('name' => Craft::t('Ancestors'), 'checked' => 0),
93+
ExportModel::HandleAuthor => array('name' => Craft::t('Author'), 'checked' => 0),
94+
ExportModel::HandlePostDate => array('name' => Craft::t('Post Date'), 'checked' => 0),
9595
ExportModel::HandleExpiryDate => array('name' => Craft::t('Expiry Date'), 'checked' => 0),
96-
ExportModel::HandleEnabled => array('name' => Craft::t('Enabled'), 'checked' => 0),
97-
ExportModel::HandleStatus => array('name' => Craft::t('Status'), 'checked' => 0),
96+
ExportModel::HandleEnabled => array('name' => Craft::t('Enabled'), 'checked' => 0),
97+
ExportModel::HandleStatus => array('name' => Craft::t('Status'), 'checked' => 0),
9898
);
9999

100100
// Set the dynamic fields for this type
@@ -140,7 +140,7 @@ public function setCriteria(array $settings)
140140

141141
// Get by section and entrytype
142142
$criteria->sectionId = $settings['elementvars']['section'];
143-
$criteria->type = $settings['elementvars']['entrytype'];
143+
$criteria->type = $settings['elementvars']['entrytype'];
144144

145145
return $criteria;
146146
}

services/Export_UserService.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Handles export users.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/
@@ -71,16 +71,16 @@ public function getFields(array $settings, $reset)
7171

7272
// Set the static fields for this type
7373
$fields = array(
74-
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
75-
ExportModel::HandleUsername => array('name' => Craft::t('Username'), 'checked' => 1),
76-
ExportModel::HandleFirstName => array('name' => Craft::t('First Name'), 'checked' => 1),
77-
ExportModel::HandleLastName => array('name' => Craft::t('Last Name'), 'checked' => 1),
78-
ExportModel::HandleEmail => array('name' => Craft::t('Email'), 'checked' => 1),
79-
ExportModel::HandlePreferredLocale => array('name' => Craft::t('Preferred Locale'), 'checked' => 0),
80-
ExportModel::HandleWeekStartDay => array('name' => Craft::t('Week Start Day'), 'checked' => 0),
81-
ExportModel::HandleStatus => array('name' => Craft::t('Status'), 'checked' => 0),
82-
ExportModel::HandleLastLoginDate => array('name' => Craft::t('Last Login Date'), 'checked' => 0),
83-
ExportModel::HandleInvalidLoginCount => array('name' => Craft::t('Invalid Login Count'), 'checked' => 0),
74+
ExportModel::HandleId => array('name' => Craft::t('ID'), 'checked' => 0),
75+
ExportModel::HandleUsername => array('name' => Craft::t('Username'), 'checked' => 1),
76+
ExportModel::HandleFirstName => array('name' => Craft::t('First Name'), 'checked' => 1),
77+
ExportModel::HandleLastName => array('name' => Craft::t('Last Name'), 'checked' => 1),
78+
ExportModel::HandleEmail => array('name' => Craft::t('Email'), 'checked' => 1),
79+
ExportModel::HandlePreferredLocale => array('name' => Craft::t('Preferred Locale'), 'checked' => 0),
80+
ExportModel::HandleWeekStartDay => array('name' => Craft::t('Week Start Day'), 'checked' => 0),
81+
ExportModel::HandleStatus => array('name' => Craft::t('Status'), 'checked' => 0),
82+
ExportModel::HandleLastLoginDate => array('name' => Craft::t('Last Login Date'), 'checked' => 0),
83+
ExportModel::HandleInvalidLoginCount => array('name' => Craft::t('Invalid Login Count'), 'checked' => 0),
8484
ExportModel::HandleLastInvalidLoginDate => array('name' => Craft::t('Last Invalid Login Date'), 'checked' => 0),
8585
);
8686

services/IExportElementType.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*
88
* Determines Element Type export rules.
99
*
10-
* @author Bob Olde Hampsink <b.oldehampsink@itmundi.nl>
10+
* @author Bob Olde Hampsink <b.oldehampsink@nerds.company>
1111
* @copyright Copyright (c) 2015, Bob Olde Hampsink
12-
* @license http://buildwithcraft.com/license Craft License Agreement
12+
* @license MIT
1313
*
1414
* @link http://github.com/boboldehampsink
1515
*/

0 commit comments

Comments
 (0)