Documentation

AddGroupActionTable

void
CAdminList::AddGroupActionTable(
  array $arActions[,
  array $arParams = array()]
)

The AddGroupActionTable method creates a menu of available group actions that can be performed on the list elements. The actions are passes as an array: "action_identifier"=>"action_name".

Parameters

Actions

The actions $arActions can be specified in two ways. The first simple method requires an associated array containing the following pairs: action_identifier => "menu_item_name. In this case, a menu item is a link to the current page with an additional GET parameter: &action=action_identifier which is to be processed when saving changes.

The second method implies that each element of $arActions represents an associated array containing the following keys.

Key Description
action Javascript code to be executed whenever a menu item is selected.
type Specifies the action link appearance. Can be one of the following values:
  • button - action will be displayed as a button;
  • html - a text link as specified in the value parameter.
If the parameters is any other value or not defined, the action will be displayed as an drop-down list item.
value Specifies the action title (menu_item_name for the simple mode).

You can combine the both methods in the same $arActions.

arParams

Action parameters are defined in an associated array with the following keys:

  • disable_action_target - defines the availability of the apply to all checkbox;
  • select_onchange - javascript to be be executed whenever a drop-down list action is selected.

Example (the simple method)

$lAdmin->AddGroupActionTable(Array( "delete" => GetMessage("MAIN_ADMIN_LIST_DELETE"), "activate" => GetMessage("MAIN_ADMIN_LIST_ACTIVATE"), "deactivate"=> GetMessage("MAIN_ADMIN_LIST_DEACTIVATE"), ));

Example (the extended method)


// show the form with buttons
$lAdmin->AddGroupActionTable(
  array(
    "delete" => GetMessage("MAIN_ADMIN_LIST_DELETE"),
    "access" => array(
      "action" => "setAccess('".str_replace("'", "\'", $site)."', '".
                             str_replace("'", "\'", $path)."')", "value" => "access", "name" => GetMessage('FILEMAN_ADMIN_ACCESS_CMD') ), "copy" => GetMessage("FILEMAN_ADM_COPY"), "move" => GetMessage("FILEMAN_ADM_MOVE"), "copy2" => array( "type" => "html", "value" => " ".GetMessage("FILEMAN_ADMIN_IN")." " ), "copy1" => array( "type" => "html", "value" => $strHTML ), ), array("select_onchange"=>"this.form.copy_to_button.disabled=this.form.copy_to.disabled=!(this[this.selectedIndex].value == 'copy' || this[this.selectedIndex].value == 'move')") );
© «Bitrix24», 2001-2024