oop: use properties for ExportPhparray

This commit is contained in:
Alex Marin 2012-07-18 17:29:23 +03:00
parent 9f53828dca
commit b672d605e2

View File

@ -35,27 +35,37 @@ class ExportPhparray extends ExportPlugin
*/
protected function setProperties()
{
$this->properties = array(
'text' => __('PHP array'),
'extension' => 'php',
'mime_type' => 'text/plain',
'options' => array(),
'options_text' => __('Options')
);
$props = 'libraries/properties/';
require_once "$props/plugins/ExportPluginProperties.class.php";
require_once "$props/options/groups/OptionsPropertyRootGroup.class.php";
require_once "$props/options/groups/OptionsPropertyMainGroup.class.php";
require_once "$props/options/items/HiddenPropertyItem.class.php";
$this->properties['options'] = array(
array(
'type' => 'begin_group',
'name' => 'general_opts'
),
array(
'type' => 'hidden',
'name' => 'structure_or_data',
),
array(
'type' => 'end_group'
)
);
$exportPluginProperties = new ExportPluginProperties();
$exportPluginProperties->setText('PHP array');
$exportPluginProperties->setExtension('php');
$exportPluginProperties->setMimeType('text/plain');
$exportPluginProperties->setOptionsText(__('Options'));
// create the root group that will be the options field for
// $exportPluginProperties
// this will be shown as "Format specific options"
$exportSpecificOptions = new OptionsPropertyRootGroup();
$exportSpecificOptions->setName("Format Specific Options");
// general options main group
$generalOptions = new OptionsPropertyMainGroup();
$generalOptions->setName("general_opts");
// create primary items and add them to the group
$leaf = new HiddenPropertyItem();
$leaf->setName("structure_or_data");
$generalOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($generalOptions);
// set the options for the export plugin property item
$exportPluginProperties->setOptions($exportSpecificOptions);
$this->properties = $exportPluginProperties;
}
/**