mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
e_admin batch hook completed. see e107_plugins/_blank/e_admin.php for example.
This commit is contained in:
@@ -3097,12 +3097,22 @@ class e_admin_controller_ui extends e_admin_controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
$this->setTriggersEnabled(false); //disable further triggering
|
||||||
|
|
||||||
switch($trigger[0])
|
switch($trigger[0])
|
||||||
{
|
{
|
||||||
case 'delete': //FIXME - confirmation screen
|
case 'delete': //FIXME - confirmation popup
|
||||||
//method handleListDeleteBatch(); for custom handling of 'delete' batch
|
//method handleListDeleteBatch(); for custom handling of 'delete' batch
|
||||||
// if(empty($selected)) return $this;
|
// if(empty($selected)) return $this;
|
||||||
// don't check selected data - subclass need to check additional post variables(confirm screen)
|
// don't check selected data - subclass need to check additional post variables(confirm screen)
|
||||||
|
@@ -23,7 +23,9 @@ class _blank_admin
|
|||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
case "news": // hook into the news admin form.
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,20 +39,28 @@ class _blank_admin
|
|||||||
/**
|
/**
|
||||||
* Process Posted Data.
|
* Process Posted Data.
|
||||||
* @param object $ui admin-ui
|
* @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)
|
public function process($ui, $id=0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$data = $ui->getPosted();
|
$data = $ui->getPosted();
|
||||||
$type = $ui->getEventName();
|
$type = $ui->getEventName();
|
||||||
$action = $ui->getAction(); // current mode: create, edit, list
|
$action = $ui->getAction(); // current mode: create, edit, list, batch
|
||||||
|
|
||||||
if($action == 'delete')
|
if($action == 'delete')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($action == 'batch')
|
||||||
|
{
|
||||||
|
$arrayOfRecordIds = $id['ids'];
|
||||||
|
$command = $id['cmd'];
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!empty($id) )
|
if(!empty($id) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user