mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
e_admin batch hook completed. see e107_plugins/_blank/e_admin.php for example.
This commit is contained in:
@@ -3096,13 +3096,23 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
$selected[$i] = preg_replace('/[^\w-:.]/', '', $_sel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(substr($batch_trigger, 0, 6) === 'batch_')
|
||||
{
|
||||
list($tmp,$plugin,$command) = explode("_",$batch_trigger,3);
|
||||
$this->setPosted(array());
|
||||
$this->getRequest()->setAction('batch');
|
||||
$cls = e107::getAddon($plugin,'e_admin',true);
|
||||
e107::callMethod($cls,'process',$this,array('cmd'=>$command,'ids'=>$selected));
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
$this->setTriggersEnabled(false); //disable further triggering
|
||||
|
||||
switch($trigger[0])
|
||||
{
|
||||
case 'delete': //FIXME - confirmation screen
|
||||
case 'delete': //FIXME - confirmation popup
|
||||
//method handleListDeleteBatch(); for custom handling of 'delete' batch
|
||||
// if(empty($selected)) return $this;
|
||||
// don't check selected data - subclass need to check additional post variables(confirm screen)
|
||||
|
@@ -23,7 +23,9 @@ class _blank_admin
|
||||
switch($type)
|
||||
{
|
||||
case "news": // hook into the news admin form.
|
||||
$config['fields']['url'] = array ( 'title' =>"CUstom Field", 'type' => 'url', 'tab'=>1, 'writeParms'=> array('size'=>'xxlarge', 'placeholder'=>'', 'default'=>$defaultValue), 'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left', );
|
||||
$config['fields']['url'] = array ( 'title' =>"Custom Field", 'type' => 'url', 'tab'=>1, 'writeParms'=> array('size'=>'xxlarge', 'placeholder'=>'', 'default'=>$defaultValue), 'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left', );
|
||||
|
||||
$config['batchOptions'] = array('custom' => 'Custom Batch Command');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -37,20 +39,28 @@ class _blank_admin
|
||||
/**
|
||||
* Process Posted Data.
|
||||
* @param object $ui admin-ui
|
||||
* @param int $id - Primary ID of the record being created/edited/deleted
|
||||
* @param int|array $id - Primary ID of the record being created/edited/deleted or array data of a batch process.
|
||||
*/
|
||||
public function process($ui, $id=0)
|
||||
{
|
||||
|
||||
$data = $ui->getPosted();
|
||||
$type = $ui->getEventName();
|
||||
$action = $ui->getAction(); // current mode: create, edit, list
|
||||
$action = $ui->getAction(); // current mode: create, edit, list, batch
|
||||
|
||||
if($action == 'delete')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if($action == 'batch')
|
||||
{
|
||||
$arrayOfRecordIds = $id['ids'];
|
||||
$command = $id['cmd'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!empty($id) )
|
||||
{
|
||||
|
Reference in New Issue
Block a user