Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_ModListAdm class

AMI_ModComponent
   |
   --AMI_ModList
      |
      --AMI_ModListAdm

• Introduction

Module admin list component action controller.

• Class synopsis

AMI_ModListAdm extends AMI_ModList {
/* Constants */
// Action type.
const AMI_ModListAdm::ACTION_ALL =  0x0F;
// Action type.
const AMI_ModListAdm::ACTION_COLUMN =  0x02;
// Action type.
const AMI_ModListAdm::ACTION_COMMON =  0x01;
// Action type.
const AMI_ModListAdm::ACTION_GROUP =  0x08;
// Action type.
const AMI_ModListAdm::ACTION_POSITION =  0x04;
// Action prefix specifying full environment requirement for action processing
const AMI_ModListAdm::REQUIRE_FULL_ENV =  '!';
/* Properties */
// List columns from dependent tables
protected array $aJoinedColumns = array();
// List actions controller resource id
protected string $listActionsResId = 'list/actions';
// List group actions controller resource id
protected string $listGrpActionsResId = 'list/actions/group';
// View for list group actions
protected AMI_ModListGroupActionsView $oGroupActionsView = null;
/* Inherited Properties */
// Default list order
protected AMI_ModList::$aDefaultOrder = array( 'col' => 'id', 'dir' => 'asc' );
// Flag specifying to use model
protected AMI_ModComponent::$useModel = TRUE;
/* Methods */
// Returns component view.
public getView ( ) returns AMI_ModListView;
// Initialization.
public init ( ) returns AMI_ModListAdm;
// Adds actions to the item list.
protected addActions ( $aActions, [ string $column = '' ] ) returns AMI_ModListAdm;
// Adds separate column actions to the item list.
protected addColActions ( $aActions, [ bool $valueDependend = false ] ) returns AMI_ModListAdm;
// Add model supported group actions.
protected addGroupActions ( $aActions ) returns bool;
// Adds hidden action and registers a callback.
protected addHiddenAction ( string $action ) returns AMI_ModListAdm;
// Adds joined columns to the list.
protected addJoinedColumns ( $aColumns, string $alias ) returns AMI_ModListAdm;
// Discards previously added actions.
protected dropActions ( int $type, [ $aActions = null ], [ bool $dropHandler = TRUE ] ) returns AMI_ModListAdm;
/* Inherited Methods */
// Returns component type.
public AMI_ModList::getType ( ) returns string;
// Returns component view.
// Initialization.
public AMI_ModList::init ( ) returns AMI_ModList;
// Returns true if component needs to be started always in full environment.
public AMI_ModComponent::isFullEnv ( ) returns bool;
// Sets module id.
public AMI_ModComponent::setModId ( string $modId ) returns AMI_ModComponent;
// Returns module id.
protected AMI_ModComponent::getModId ( ) returns string;
// Returns serial id.
protected AMI_ModComponent::getSerialId ( ) returns string;
// Initializes model.
protected AMI_ModComponent::initModel ( ) returns AMI_ModTable|null;
}

• Class Details

  Example:
  •  class AmiSample_ListAdm extends AMI_ModListAdm{
  •      public function __construct(){
  •          $this->addActions(array('edit''delete'));
  •      }
  •  }
Tags:
abstract
since 5.12.0

• Class Constants

ACTION_ALL

Action type.

ACTION_COLUMN

Action type.

ACTION_COMMON

Action type.

ACTION_GROUP

Action type.

ACTION_POSITION

Action type.

REQUIRE_FULL_ENV

Action prefix specifying full environment requirement for action processing

• Class Properies

protected array $aJoinedColumns

List columns from dependent tables

protected string $listActionsResId

List actions controller resource id

protected string $listGrpActionsResId

List group actions controller resource id

protected AMI_ModListGroupActionsView $oGroupActionsView

View for list group actions

• Class Methods

// Returns component view.
public getView ( ) returns AMI_ModListView;
// Adds actions to the item list.
protected addActions ( $aActions, [ string $column = '' ] ) returns AMI_ModListAdm;
  • array $aActions
    Array of actions, use prefix self::REQUIRE_FULL_ENV for data modifying actions
  • string $column
    Adds inner action to the column if specified
The are two actions supported by default: edit, delete.

  Example:
  •  // AmiSample_ListAdm::__construct()
  •  public function __construct(){
  •      $this->addActions(array(self::REQUIRE_FULL_ENV 'edit'self::REQUIRE_FULL_ENV 'delete'));
  •  }
// Adds separate column actions to the item list.
protected addColActions ( $aActions, [ bool $valueDependend = false ] ) returns AMI_ModListAdm;
  • array $aActions
    Array of actions, use prefix self::REQUIRE_FULL_ENV for data modifying actions
  • bool $valueDependend
    Flag specifying image dependence on field value
  Example:
  •  // AmiSample_ListAdm::__construct()
  •  public function __construct(){
  •      // ...
  •      // Add separate column action
  •      $this->addColActions(array(self::REQUIRE_FULL_ENV 'public')true);
  •  
  •      // Add separate column action
  •      $this->addColActions(array(self::REQUIRE_FULL_ENV 'rename'));
  •      // ...
  •  }
Tags:
since 5.12.4
// Add model supported group actions.
protected addGroupActions ( $aActions ) returns bool;
  • array $aActions
    Array of actions, use prefix self::REQUIRE_FULL_ENV for data modifying actions
  Example:
  •  // AmiSample_ListAdm::__construct()
  •  public function __construct(){
  •      // ...
  •      // Add group actions with splitters
  •      $this->addGroupActions(
  •          array(
  •              array(self::REQUIRE_FULL_ENV 'public''publish_section'),
  •              array(self::REQUIRE_FULL_ENV 'unpublic''publish_section'),
  •              array(self::REQUIRE_FULL_ENV 'rename''rename_section'),
  •              array(self::REQUIRE_FULL_ENV 'delete''rename.before'),
  •          )
  •      );
  •      // ...
  •  }
// Adds hidden action and registers a callback.
protected addHiddenAction ( string $action ) returns AMI_ModListAdm;
  • string $action
    Action name
Tags:
since 5.14.0
// Adds joined columns to the list.
protected addJoinedColumns ( $aColumns, string $alias ) returns AMI_ModListAdm;
  • array $aColumns
    List of joined columns
  • string $alias
    Dependence alias
  Example:
  •  class MyModule_ListAdm extends AMI_ModListAdm{
  •      public function init(){
  •          // ...
  •          $this->addJoinedColumns(array('joined_field')'alias');
  •          // ...
  •      }
  •  }
  •  
  •  class MyModule_ListViewAdm extends AMI_ModListView_JSON{
  •      public function init(){
  •          // ...
  •          $this->addColumn('alias_joined_field');
  •          // ...
  •      }
  •  }
  •  
  •  class MyModule_TableList extends AMI_ModTableList{
  •      public function __construct(AMI_ModTable $oTableDB_Query $oQuery){
  •          parent::__construct($oTable$oQuery);
  •          // ...
  •          $this->addExpressionColumn('joined_field''...''alias');
  •          // ...
  •      }
  •  }
Tags:
since 5.14.0
// Discards previously added actions.
protected dropActions ( int $type, [ $aActions = null ], [ bool $dropHandler = TRUE ] ) returns AMI_ModListAdm;
  • int $type
    Action type:
    • AMI_ModListAdm::ACTION_COMMON - inner actions or actions placed at last column
    • AMI_ModListAdm::ACTION_COLUMN - separate column actions
    • AMI_ModListAdm::ACTION_POSITION - position actions
    • AMI_ModListAdm::ACTION_GROUP - group actions
    • AMI_ModListAdm::ACTION_ALL
  • array $aActions
    List of actions, all actions having specified type will be discarder if this parameter is not passed
  • bool $dropHandler
    Flag specifying to drop action handler (since 5.14.8)
Exaple:
  •  class MySample_ListAdm extends AmiSample_ListAdm{
  •      public function init(){
  •          parent::init();
  •          // Discard edit action
  •          $this->dropActions(self::ACTION_COMMONarray('edit'));
  •          return $this;
  •      }
  •  }
Tags:
todo Full environment flags cleanup (aFullEnvActions)?
since 5.14.0