2010-11-29 22:41:08 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides OSB exporting capabilities.
|
|
|
|
*
|
2013-03-19 22:35:19 +00:00
|
|
|
* @package Export
|
2010-11-29 22:41:08 +00:00
|
|
|
* @category Controllers/Admin
|
|
|
|
* @author Deon George
|
2013-03-19 22:35:19 +00:00
|
|
|
* @copyright (c) 2009-2013 Open Source Billing
|
2010-11-29 22:41:08 +00:00
|
|
|
* @license http://dev.osbill.net/license.html
|
|
|
|
*/
|
2011-08-26 01:16:48 +00:00
|
|
|
class Controller_Admin_Export extends Controller_TemplateDefault_Admin {
|
2010-11-29 22:41:08 +00:00
|
|
|
protected $control_title = 'Export';
|
2011-08-26 01:16:48 +00:00
|
|
|
protected $secure_actions = array(
|
2011-10-14 05:44:12 +00:00
|
|
|
'add'=>TRUE,
|
|
|
|
'edit'=>TRUE,
|
2010-11-29 22:41:08 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2011-10-14 05:44:12 +00:00
|
|
|
* Add Export Maping items
|
2010-11-29 22:41:08 +00:00
|
|
|
*/
|
2011-10-14 05:44:12 +00:00
|
|
|
public function action_add() {
|
2012-11-09 23:13:57 +00:00
|
|
|
$eo = ORM::factory('Export');
|
2011-10-14 05:44:12 +00:00
|
|
|
$output = '';
|
2010-11-29 22:41:08 +00:00
|
|
|
|
2011-10-14 05:44:12 +00:00
|
|
|
if ($_POST AND $eo->values($_POST)->check()) {
|
2012-11-09 23:13:57 +00:00
|
|
|
$eo->module_id = ORM::factory('Module',array('name'=>'product'))->id; // @todo This probably should be in the form.
|
2011-10-14 05:44:12 +00:00
|
|
|
$eo->plugin_name = 'quicken'; // @todo This should be in the form.
|
|
|
|
// Entry updated
|
|
|
|
if (! $eo->save())
|
|
|
|
throw new Kohana_Exception('Unable to save data :post',array(':post'=>serialize($_POST)));
|
2010-11-29 22:41:08 +00:00
|
|
|
|
|
|
|
SystemMessage::add(array(
|
2011-10-14 05:44:12 +00:00
|
|
|
'title'=>_('Record add'),
|
2010-11-29 22:41:08 +00:00
|
|
|
'type'=>'info',
|
2011-10-14 05:44:12 +00:00
|
|
|
'body'=>_('Export Map entry added.')
|
2010-11-29 22:41:08 +00:00
|
|
|
));
|
|
|
|
}
|
2011-10-14 05:44:12 +00:00
|
|
|
|
|
|
|
$output .= Form::open();
|
2011-12-21 01:39:21 +00:00
|
|
|
$output .= View::factory($this->viewpath())
|
2011-10-14 05:44:12 +00:00
|
|
|
->set('eo',$eo);
|
|
|
|
|
|
|
|
$output .= '<div>'.Form::submit('submit',_('Add'),array('class'=>'form_button')).'</div>';
|
|
|
|
$output .= Form::close();
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>_('Add Export Map'),
|
|
|
|
'body'=>$output,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Edit Export Maping items
|
|
|
|
*/
|
|
|
|
public function action_edit() {
|
2010-11-29 22:41:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|