Permalink
Browse files

0.1

  • Loading branch information...
brendo committed Dec 1, 2009
0 parents commit 6eb985de70ef1cd6feb3869bebbcb98b3905ada8
Showing with 501 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +32 −0 README
  3. +50 −0 assets/ee.ajaxify.js
  4. +12 −0 assets/ee.default.css
  5. +64 −0 content/content.ajaxentries.php
  6. +35 −0 content/content.ajaxfields.php
  7. +219 −0 content/content.export.php
  8. +88 −0 extension.driver.php
@@ -0,0 +1 @@
.AppleDouble/
32 README
@@ -0,0 +1,32 @@
Export Entry
-------------------------------------------------------------------------------
Version: 0.1
Author: Brendan Abbott <brendan@bloodbone.ws>
Build Date: 30 November 2009
Github Repository: http://github.com/brendo/export_entry
Requirements: Symphony 2.0.6, ASDC & DatabaseManipulator Extension
Based heavily on the Bulk Importer extension, this extension allows you to
export entries from a particular section, with the option to filter entries
by a linked bilink entry.
Export Entry outputs a csv file of the exported entries for download.
[Bilink Field] http://github.com/rowan-lewis/bilinkfield
[ASDC] http://github.com/pointybeard/asdc
[Database Manipulator] http://github.com/yourheropaul/databasemanipulator
Installation
-------------------------------------------------------------------------------
1. Install the extension to extensions/export_entry
Usage
-------------------------------------------------------------------------------
1. Go to the System -> Export Entry menu
2. Choose the section that contains the entries you want
3. Optionally select a bi-link field to filter on
3.5 Choose your filter handle
4. Export
@@ -0,0 +1,50 @@
(function($) {
$(document).ready(function() {
$("#linked-section, #linked-entry").parent().hide();
});
/*---- Section Box Change ----*/
$("#context").live('change', function() {
var self = $(this);
var sectionID = $('option:selected', self).val();
var linked = $('#linked-section');
linked.attr("disabled",false)
.empty();
linked.parent().slideDown("fast", function() {
$("a.no-section").fadeIn("fast");
$.get("../ajaxfields/", {section: sectionID}, function(data) {
$(data).find('field').each(function() {
linked.prepend($("<option value='" + $(this).attr('id') + "'>" + $(this).text() + "</option>"));
});
linked.prepend($("<option value='' selected='selected'></option>"));
}, "xml");
});
});
/*---- Bilink Field Change ----*/
$("#linked-section").live('change', function() {
var self = $(this);
var bilinkID = $('option:selected', $("#linked-section")).val();
var sectionID = $('option:selected', $('#context')).val();
var entries = $("#linked-entry");
entries.attr("disabled",false)
.empty();
entries.parent().slideDown("fast", function () {
$.get("../ajaxentries/", {section: sectionID, field: bilinkID}, function(data) {
$(data).find('entry').each(function() {
entries.prepend($("<option value='" + $(this).attr('id') + "'>" + $(this).text() + "</option>"));
});
}, "xml");
});
});
})(jQuery);
@@ -0,0 +1,12 @@
.group > label {
margin-bottom: 1.75em
}
.group > label:last-child,
.group > a.no-section {
float: right;
}
label span {
margin-bottom: .5em;
}
@@ -0,0 +1,64 @@
<?php
require_once(TOOLKIT . '/class.administrationpage.php');
require_once(TOOLKIT . '/class.sectionmanager.php');
require_once(TOOLKIT . '/class.entrymanager.php');
class contentExtensionexport_entryAjaxEntries extends AjaxPage {
protected $_driver;
public function view() {
$this->_driver = $this->_Parent->ExtensionManager->create('export_entry');
$this->target = $_GET['section'];
$this->fieldID = $_GET['field'];
if(!$this->validate()) {
$this->_status = self::STATUS_BAD;
$this->generate();
return false;
}
$sectionManager = new SectionManager($this->_Parent);
$entryManager = new EntryManager($this->_Parent);
$section = $sectionManager->fetch($this->target);
$fields = $section->fetchFields();
/* Get all the fields from the target section
** Loop them for the section Link field
*/
foreach($fields as $field) {
if($field->get("id") == $this->fieldID) {
$linked_section_id = $field->get("linked_section_id");
$linked_field_id = $field->get("linked_field_id");
}
}
/* Got the linked field, now get the other end of the
** link. Use the first Visible column as the output handle
*/
$linked_section = $sectionManager->fetch($linked_section_id);
$li_field = current($linked_section->fetchVisibleColumns());
$linked_field_id = $li_field->get('id');
/* Foreach entry in the linked section, display the first
** column to be selected
*/
$entries = $entryManager->fetch(null,$linked_section_id);
foreach($entries as $entry) {
$data = current($entryManager->fetch($entry->get('id'),$linked_section_id));
$values = $data->getData($linked_field_id);
$el = new XMLElement("entry", General::sanitize($values['value']));
$el->setAttribute('id', $entry->get('id'));
$this->_Result->appendChild($el);
}
}
public function validate() {
return (is_numeric($this->target) && is_numeric($this->fieldID));
}
}
?>
@@ -0,0 +1,35 @@
<?php
require_once(TOOLKIT . '/class.administrationpage.php');
require_once(TOOLKIT . '/class.sectionmanager.php');
class contentExtensionexport_entryAjaxFields extends AjaxPage {
protected $_driver;
public function view() {
$this->_driver = $this->_Parent->ExtensionManager->create('export_entry');
$target = $_GET['section'];
$sectionManager = new SectionManager($this->_Parent);
/* Fetch sections & populate a dropdown */
$section = $sectionManager->fetch($target);
$options = array();
foreach($section->fetchFields() as $field) {
if($field->get('type') == "bilink") {
$el = new XMLElement("field", $field->get('label'));
$el->setAttribute('id', $field->get('id'));
$el->setAttribute('type', $field->get('type'));
$this->_Result->appendChild($el);
}
}
}
}
?>
Oops, something went wrong.

0 comments on commit 6eb985d

Please sign in to comment.