mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-04 23:54:08 +01:00
* [DEV] Add MDL menu for accounts' actions in search grid
This commit is contained in:
@@ -202,147 +202,135 @@ class AccountSearchController extends ControllerBase implements ActionsInterface
|
||||
* Devuelve la matriz a utilizar en la vista
|
||||
*
|
||||
* @return DataGrid
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function getGrid()
|
||||
{
|
||||
$showOptionalActions = Session::getUserPreferences()->isOptionalActions();
|
||||
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_ACC_VIEW)
|
||||
->setType(DataGridActionType::VIEW_ITEM)
|
||||
->setName(_('Detalles de Cuenta'))
|
||||
->setTitle(_('Detalles de Cuenta'))
|
||||
->setIcon($this->icons->getIconView())
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowView')
|
||||
->addData('action-id', self::ACTION_ACC_VIEW)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/show');
|
||||
$GridActionView->setId(self::ACTION_ACC_VIEW);
|
||||
$GridActionView->setType(DataGridActionType::VIEW_ITEM);
|
||||
$GridActionView->setName(_('Detalles de Cuenta'));
|
||||
$GridActionView->setTitle(_('Detalles de Cuenta'));
|
||||
$GridActionView->setIcon($this->icons->getIconView());
|
||||
$GridActionView->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowView');
|
||||
$GridActionView->addData('action-id', self::ACTION_ACC_VIEW);
|
||||
$GridActionView->addData('action-sk', $this->sk);
|
||||
$GridActionView->addData('onclick', 'account/show');
|
||||
|
||||
$GridActionViewPass = new DataGridAction();
|
||||
$GridActionViewPass->setId(self::ACTION_ACC_VIEW_PASS)
|
||||
->setType(DataGridActionType::VIEW_ITEM)
|
||||
->setName(_('Ver Clave'))
|
||||
->setTitle(_('Ver Clave'))
|
||||
->setIcon($this->icons->getIconViewPass())
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowViewPass')
|
||||
->addData('action-id', self::ACTION_ACC_VIEW_PASS)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/showpass');
|
||||
$GridActionViewPass->setId(self::ACTION_ACC_VIEW_PASS);
|
||||
$GridActionViewPass->setType(DataGridActionType::VIEW_ITEM);
|
||||
$GridActionViewPass->setName(_('Ver Clave'));
|
||||
$GridActionViewPass->setTitle(_('Ver Clave'));
|
||||
$GridActionViewPass->setIcon($this->icons->getIconViewPass());
|
||||
$GridActionViewPass->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowViewPass');
|
||||
$GridActionViewPass->addData('action-id', self::ACTION_ACC_VIEW_PASS);
|
||||
$GridActionViewPass->addData('action-sk', $this->sk);
|
||||
$GridActionViewPass->addData('onclick', 'account/showpass');
|
||||
|
||||
// Añadir la clase para usar el portapapeles
|
||||
$ClipboardIcon = $this->icons->getIconClipboard()->setClass('clip-pass-button');
|
||||
|
||||
$GridActionCopyPass = new DataGridAction();
|
||||
$GridActionCopyPass->setId(self::ACTION_ACC_VIEW_PASS)
|
||||
->setType(DataGridActionType::VIEW_ITEM)
|
||||
->setName(_('Copiar Clave en Portapapeles'))
|
||||
->setTitle(_('Copiar Clave en Portapapeles'))
|
||||
->setIcon($ClipboardIcon)
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopyPass')
|
||||
->addData('action-id', self::ACTION_ACC_VIEW_PASS)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('useclipboard', '1');
|
||||
$GridActionCopyPass->setId(self::ACTION_ACC_VIEW_PASS);
|
||||
$GridActionCopyPass->setType(DataGridActionType::VIEW_ITEM);
|
||||
$GridActionCopyPass->setName(_('Copiar Clave en Portapapeles'));
|
||||
$GridActionCopyPass->setTitle(_('Copiar Clave en Portapapeles'));
|
||||
$GridActionCopyPass->setIcon($ClipboardIcon);
|
||||
$GridActionCopyPass->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopyPass');
|
||||
$GridActionCopyPass->addData('action-id', self::ACTION_ACC_VIEW_PASS);
|
||||
$GridActionCopyPass->addData('action-sk', $this->sk);
|
||||
$GridActionCopyPass->addData('useclipboard', '1');
|
||||
|
||||
$EditIcon = $this->icons->getIconEdit();
|
||||
|
||||
if (!$showOptionalActions) {
|
||||
$EditIcon->setClass('actions-optional');
|
||||
}
|
||||
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_ACC_EDIT)
|
||||
->setType(DataGridActionType::EDIT_ITEM)
|
||||
->setName(_('Editar Cuenta'))
|
||||
->setTitle(_('Editar Cuenta'))
|
||||
->setIcon($EditIcon)
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowEdit')
|
||||
->addData('action-id', self::ACTION_ACC_EDIT)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/edit');
|
||||
$GridActionEdit->setId(self::ACTION_ACC_EDIT);
|
||||
$GridActionEdit->setType(DataGridActionType::EDIT_ITEM);
|
||||
$GridActionEdit->setName(_('Editar Cuenta'));
|
||||
$GridActionEdit->setTitle(_('Editar Cuenta'));
|
||||
$GridActionEdit->setIcon($EditIcon);
|
||||
$GridActionEdit->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowEdit');
|
||||
$GridActionEdit->addData('action-id', self::ACTION_ACC_EDIT);
|
||||
$GridActionEdit->addData('action-sk', $this->sk);
|
||||
$GridActionEdit->addData('onclick', 'account/edit');
|
||||
|
||||
$CopyIcon = $this->icons->getIconCopy();
|
||||
|
||||
if (!$showOptionalActions) {
|
||||
$CopyIcon->setClass('actions-optional');
|
||||
}
|
||||
|
||||
$GridActionCopy = new DataGridAction();
|
||||
$GridActionCopy->setId(self::ACTION_ACC_COPY)
|
||||
->setType(DataGridActionType::NEW_ITEM)
|
||||
->setName(_('Copiar Cuenta'))
|
||||
->setTitle(_('Copiar Cuenta'))
|
||||
->setIcon($CopyIcon)
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopy')
|
||||
->addData('action-id', self::ACTION_ACC_COPY)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/copy');
|
||||
$GridActionCopy->setId(self::ACTION_ACC_COPY);
|
||||
$GridActionCopy->setType(DataGridActionType::NEW_ITEM);
|
||||
$GridActionCopy->setName(_('Copiar Cuenta'));
|
||||
$GridActionCopy->setTitle(_('Copiar Cuenta'));
|
||||
$GridActionCopy->setIcon($CopyIcon);
|
||||
$GridActionCopy->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowCopy');
|
||||
$GridActionCopy->addData('action-id', self::ACTION_ACC_COPY);
|
||||
$GridActionCopy->addData('action-sk', $this->sk);
|
||||
$GridActionCopy->addData('onclick', 'account/copy');
|
||||
|
||||
$DeleteIcon = $this->icons->getIconDelete();
|
||||
|
||||
if (!$showOptionalActions) {
|
||||
$DeleteIcon->setClass('actions-optional');
|
||||
}
|
||||
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_ACC_DELETE)
|
||||
->setType(DataGridActionType::DELETE_ITEM)
|
||||
->setName(_('Eliminar Cuenta'))
|
||||
->setTitle(_('Eliminar Cuenta'))
|
||||
->setIcon($DeleteIcon)
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowDelete')
|
||||
->addData('action-id', self::ACTION_ACC_DELETE)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/delete');
|
||||
$GridActionDel->setId(self::ACTION_ACC_DELETE);
|
||||
$GridActionDel->setType(DataGridActionType::DELETE_ITEM);
|
||||
$GridActionDel->setName(_('Eliminar Cuenta'));
|
||||
$GridActionDel->setTitle(_('Eliminar Cuenta'));
|
||||
$GridActionDel->setIcon($DeleteIcon);
|
||||
$GridActionDel->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowDelete');
|
||||
$GridActionDel->addData('action-id', self::ACTION_ACC_DELETE);
|
||||
$GridActionDel->addData('action-sk', $this->sk);
|
||||
$GridActionDel->addData('onclick', 'account/delete');
|
||||
|
||||
$GridActionRequest = new DataGridAction();
|
||||
$GridActionRequest->setId(self::ACTION_ACC_REQUEST)
|
||||
->setName(_('Solicitar Modificación'))
|
||||
->setTitle(_('Solicitar Modificación'))
|
||||
->setIcon($this->icons->getIconEmail())
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowRequest')
|
||||
->addData('action-id', self::ACTION_ACC_REQUEST)
|
||||
->addData('action-sk', $this->sk)
|
||||
->addData('onclick', 'account/request');
|
||||
$GridActionRequest->setId(self::ACTION_ACC_REQUEST);
|
||||
$GridActionRequest->setName(_('Solicitar Modificación'));
|
||||
$GridActionRequest->setTitle(_('Solicitar Modificación'));
|
||||
$GridActionRequest->setIcon($this->icons->getIconEmail());
|
||||
$GridActionRequest->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowRequest');
|
||||
$GridActionRequest->addData('action-id', self::ACTION_ACC_REQUEST);
|
||||
$GridActionRequest->addData('action-sk', $this->sk);
|
||||
$GridActionRequest->addData('onclick', 'account/request');
|
||||
|
||||
$GridActionOptional = new DataGridAction();
|
||||
$GridActionOptional->setId(0)
|
||||
->setName(_('Más Acciones'))
|
||||
->setTitle(_('Más Acciones'))
|
||||
->setIcon($this->icons->getIconOptional())
|
||||
->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowOptional')
|
||||
->addData('onclick', 'account/menu');
|
||||
$GridActionOptional->setId(0);
|
||||
$GridActionOptional->setName(_('Más Acciones'));
|
||||
$GridActionOptional->setTitle(_('Más Acciones'));
|
||||
$GridActionOptional->setIcon($this->icons->getIconOptional());
|
||||
$GridActionOptional->setReflectionFilter('\\SP\\Account\\AccountsSearchData', 'isShowOptional');
|
||||
$GridActionOptional->addData('onclick', 'account/menu');
|
||||
|
||||
$GridPager = new DataGridPager();
|
||||
$GridPager->setIconPrev($this->icons->getIconNavPrev())
|
||||
->setIconNext($this->icons->getIconNavNext())
|
||||
->setIconFirst($this->icons->getIconNavFirst())
|
||||
->setIconLast($this->icons->getIconNavLast())
|
||||
->setSortKey($this->sortKey)
|
||||
->setSortOrder($this->sortOrder)
|
||||
->setLimitStart($this->limitStart)
|
||||
->setLimitCount($this->limitCount)
|
||||
->setOnClickFunction('account/sort')
|
||||
->setOnClickArgs($this->sortKey)
|
||||
->setOnClickArgs($this->sortOrder)
|
||||
->setFilterOn($this->filterOn)
|
||||
->setSourceAction(new DataGridActionSearch(self::ACTION_ACC_SEARCH));
|
||||
$GridPager->setIconPrev($this->icons->getIconNavPrev());
|
||||
$GridPager->setIconNext($this->icons->getIconNavNext());
|
||||
$GridPager->setIconFirst($this->icons->getIconNavFirst());
|
||||
$GridPager->setIconLast($this->icons->getIconNavLast());
|
||||
$GridPager->setSortKey($this->sortKey);
|
||||
$GridPager->setSortOrder($this->sortOrder);
|
||||
$GridPager->setLimitStart($this->limitStart);
|
||||
$GridPager->setLimitCount($this->limitCount);
|
||||
$GridPager->setOnClickFunction('account/sort');
|
||||
$GridPager->setOnClickArgs($this->sortKey);
|
||||
$GridPager->setOnClickArgs($this->sortOrder);
|
||||
$GridPager->setFilterOn($this->filterOn);
|
||||
$GridPager->setSourceAction(new DataGridActionSearch(self::ACTION_ACC_SEARCH));
|
||||
|
||||
$showOptionalActions = Session::getUserPreferences()->isOptionalActions();
|
||||
|
||||
$Grid = new DataGrid();
|
||||
$Grid->setId('gridSearch')
|
||||
->setDataHeaderTemplate('header', $this->view->getBase())
|
||||
->setDataRowTemplate('rows', $this->view->getBase())
|
||||
->setDataPagerTemplate('datagrid-nav-full', 'grid')
|
||||
->setHeader($this->getHeaderSort())
|
||||
->setDataActions($GridActionView)
|
||||
->setDataActions($GridActionViewPass)
|
||||
->setDataActions($GridActionCopyPass)
|
||||
->setDataActions($GridActionOptional)
|
||||
->setDataActions($GridActionEdit)
|
||||
->setDataActions($GridActionCopy)
|
||||
->setDataActions($GridActionDel)
|
||||
->setDataActions($GridActionRequest)
|
||||
->setPager($GridPager)
|
||||
->setData(new DataGridData());
|
||||
$Grid->setId('gridSearch');
|
||||
$Grid->setDataHeaderTemplate('header', $this->view->getBase());
|
||||
$Grid->setDataRowTemplate('rows', $this->view->getBase());
|
||||
$Grid->setDataPagerTemplate('datagrid-nav-full', 'grid');
|
||||
$Grid->setHeader($this->getHeaderSort());
|
||||
$Grid->setDataActions($GridActionView);
|
||||
$Grid->setDataActions($GridActionViewPass);
|
||||
$Grid->setDataActions($GridActionCopyPass);
|
||||
$Grid->setDataActions($GridActionEdit, !$showOptionalActions);
|
||||
$Grid->setDataActions($GridActionCopy, !$showOptionalActions);
|
||||
$Grid->setDataActions($GridActionDel, !$showOptionalActions);
|
||||
$Grid->setDataActions($GridActionRequest);
|
||||
$Grid->setPager($GridPager);
|
||||
$Grid->setData(new DataGridData());
|
||||
|
||||
return $Grid;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getCategoriesGrid()
|
||||
{
|
||||
@@ -159,6 +160,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getCustomersGrid()
|
||||
{
|
||||
@@ -222,6 +224,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getCustomFieldsGrid()
|
||||
{
|
||||
@@ -287,6 +290,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getFilesGrid()
|
||||
{
|
||||
@@ -344,6 +348,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getAccountsGrid()
|
||||
{
|
||||
@@ -388,6 +393,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getUsersGrid()
|
||||
{
|
||||
@@ -479,6 +485,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getGroupsGrid()
|
||||
{
|
||||
@@ -542,6 +549,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getProfilesGrid()
|
||||
{
|
||||
@@ -615,6 +623,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getTokensGrid()
|
||||
{
|
||||
@@ -687,6 +696,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getPublicLinksGrid()
|
||||
{
|
||||
@@ -756,6 +766,7 @@ class Grids implements ActionsInterface
|
||||
|
||||
/**
|
||||
* @return DataGridTab
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function getTagsGrid()
|
||||
{
|
||||
|
||||
@@ -41,73 +41,73 @@ abstract class DataGridActionBase implements DataGridActionInterface
|
||||
*
|
||||
* @var \ReflectionMethod
|
||||
*/
|
||||
private $_reflectionFilter;
|
||||
protected $_reflectionFilter;
|
||||
/**
|
||||
* El nombre de la acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_name = '';
|
||||
protected $_name = '';
|
||||
/**
|
||||
* El título de la acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_title = '';
|
||||
protected $_title = '';
|
||||
/**
|
||||
* El id de la acción
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_id = 0;
|
||||
protected $_id = 0;
|
||||
/**
|
||||
* La función javascript del evento OnClick
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_onClickFunction = '';
|
||||
protected $_onClickFunction = '';
|
||||
/**
|
||||
* Los argumentos de la función OnClick
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_onClickArgs = array();
|
||||
protected $_onClickArgs = array();
|
||||
/**
|
||||
* El icono de la acción
|
||||
*
|
||||
* @var IconInterface
|
||||
*/
|
||||
private $_icon = null;
|
||||
protected $_icon = null;
|
||||
/**
|
||||
* Si se debe de omitir para los elementos del listado
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_isSkip = false;
|
||||
protected $_isSkip = false;
|
||||
/**
|
||||
* La columna de origen de datos que condiciona esta acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_filterRowSource = '';
|
||||
protected $_filterRowSource = '';
|
||||
/**
|
||||
* Si es una acción de ayuda
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_isHelper;
|
||||
protected $_isHelper;
|
||||
/**
|
||||
* El tipo de acción
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_type = 0;
|
||||
protected $_type = 0;
|
||||
/**
|
||||
* Atributos de datos adicionales
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_data = [];
|
||||
protected $_data = [];
|
||||
|
||||
/**
|
||||
* DataGridActionBase constructor.
|
||||
|
||||
@@ -148,7 +148,7 @@ interface DataGridActionInterface
|
||||
* Añadir nuevo atributo de datos
|
||||
*
|
||||
* @param string $name El nombe del atributo
|
||||
* @param mixed $data Los datos del atributo
|
||||
* @param mixed $data Los datos del atributo
|
||||
*/
|
||||
public function addData($name, $data);
|
||||
}
|
||||
}
|
||||
@@ -51,61 +51,67 @@ abstract class DataGridBase implements DataGridInterface
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_id = '';
|
||||
protected $_id = '';
|
||||
/**
|
||||
* La cabecera de la matriz
|
||||
*
|
||||
* @var DataGridHeaderInterface
|
||||
*/
|
||||
private $_header;
|
||||
protected $_header;
|
||||
/**
|
||||
* Los datos de la matriz
|
||||
*
|
||||
* @var DataGridData
|
||||
*/
|
||||
private $_data;
|
||||
protected $_data;
|
||||
/**
|
||||
* El paginador
|
||||
*
|
||||
* @var DataGridPagerBase
|
||||
*/
|
||||
private $_pager;
|
||||
protected $_pager;
|
||||
/**
|
||||
* Las acciones asociadas a los elementos de la matriz
|
||||
*
|
||||
* @var DataGridActionInterface[]
|
||||
*/
|
||||
private $_actions;
|
||||
protected $_actions;
|
||||
/**
|
||||
* Las acciones asociadas a los elementos de la matriz que se muestran en un menú
|
||||
*
|
||||
* @var DataGridActionInterface[]
|
||||
*/
|
||||
protected $_actionsMenu;
|
||||
/**
|
||||
* La acción a realizar al cerrar la matriz
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_onCloseAction = 0;
|
||||
protected $_onCloseAction = 0;
|
||||
/**
|
||||
* La plantilla a utilizar para presentar la cabecera
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_headerTemplate;
|
||||
protected $_headerTemplate;
|
||||
/**
|
||||
* La plantilla a utilizar para presentar las acciones
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_actionsTemplate;
|
||||
protected $_actionsTemplate;
|
||||
/**
|
||||
* La plantilla a utilizar para presentar el paginador
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_pagerTemplate;
|
||||
protected $_pagerTemplate;
|
||||
/**
|
||||
* La plantilla a utilizar para presentar los datos
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_rowsTemplate;
|
||||
protected $_rowsTemplate;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
@@ -185,15 +191,24 @@ abstract class DataGridBase implements DataGridInterface
|
||||
|
||||
/**
|
||||
* @param DataGridActionInterface $action
|
||||
* @param bool $isMenu Añadir al menu de acciones
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataActions(DataGridActionInterface $action)
|
||||
public function setDataActions(DataGridActionInterface $action, $isMenu = false)
|
||||
{
|
||||
if (null === $this->_actions) {
|
||||
$this->_actions = new SplObjectStorage();
|
||||
}
|
||||
if ($isMenu === false) {
|
||||
if (null === $this->_actions) {
|
||||
$this->_actions = new SplObjectStorage();
|
||||
}
|
||||
|
||||
$this->_actions->attach($action);
|
||||
$this->_actions->attach($action);
|
||||
} else {
|
||||
if (null === $this->_actionsMenu) {
|
||||
$this->_actionsMenu = new SplObjectStorage();
|
||||
}
|
||||
|
||||
$this->_actionsMenu->attach($action);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -218,8 +233,9 @@ abstract class DataGridBase implements DataGridInterface
|
||||
* Establecer la plantilla utilizada para la cabecera
|
||||
*
|
||||
* @param string $template El nombre de la plantilla a utilizar
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setDataHeaderTemplate($template, $base = null)
|
||||
{
|
||||
@@ -286,8 +302,9 @@ abstract class DataGridBase implements DataGridInterface
|
||||
* Establecer la plantilla utilizada para el paginador
|
||||
*
|
||||
* @param string $template El nombre de la plantilla a utilizar
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @return $this
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setDataPagerTemplate($template, $base = null)
|
||||
{
|
||||
@@ -308,8 +325,9 @@ abstract class DataGridBase implements DataGridInterface
|
||||
|
||||
/**
|
||||
* @param string $template El nombre de la plantilla a utilizar
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @param string $base Directorio base para la plantilla
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setDataRowTemplate($template, $base = null)
|
||||
{
|
||||
@@ -377,4 +395,14 @@ abstract class DataGridBase implements DataGridInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver las acciones que se muestran en un menu
|
||||
*
|
||||
* @return DataGridActionInterface[]
|
||||
*/
|
||||
public function getDataActionsMenu()
|
||||
{
|
||||
return $this->_actionsMenu;
|
||||
}
|
||||
}
|
||||
@@ -37,10 +37,10 @@ use SplObjectStorage;
|
||||
class DataGridHeaderSort extends DataGridHeaderBase
|
||||
{
|
||||
/** @var DataGridActionInterface[] */
|
||||
private $_actions = null;
|
||||
private $_actions;
|
||||
|
||||
/** @var DataGridSortInterface[] */
|
||||
private $_sortFields = null;
|
||||
private $_sortFields;
|
||||
|
||||
/**
|
||||
* @return DataGridSortInterface[]
|
||||
@@ -63,7 +63,7 @@ class DataGridHeaderSort extends DataGridHeaderBase
|
||||
*/
|
||||
public function addAction($action)
|
||||
{
|
||||
if (is_null($this->_actions)) {
|
||||
if (null === $this->_actions) {
|
||||
$this->_actions = new SplObjectStorage();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class DataGridHeaderSort extends DataGridHeaderBase
|
||||
*/
|
||||
public function addSortField($field)
|
||||
{
|
||||
if (is_null($this->_sortFields)) {
|
||||
if (null === $this->_sortFields) {
|
||||
$this->_sortFields = new SplObjectStorage();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,10 @@ interface DataGridInterface
|
||||
|
||||
/**
|
||||
* @param DataGridActionInterface $action
|
||||
* @param bool $ismenu Añadir al menu de acciones
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataActions(DataGridActionInterface $action);
|
||||
public function setDataActions(DataGridActionInterface $action, $ismenu = false);
|
||||
|
||||
/**
|
||||
* @return DataGridActionInterface
|
||||
@@ -169,4 +171,11 @@ interface DataGridInterface
|
||||
* @param int $time
|
||||
*/
|
||||
public function setTime($time);
|
||||
|
||||
/**
|
||||
* Devolver las acciones que se muestran en un menu
|
||||
*
|
||||
* @return DataGridActionInterface[]
|
||||
*/
|
||||
public function getDataActionsMenu();
|
||||
}
|
||||
@@ -103,7 +103,8 @@
|
||||
<i class="material-icons"
|
||||
title="<?php echo _('Enlace a Wiki'); ?>">library_books</i>
|
||||
</a>
|
||||
<i class="btn-action material-icons fg-green100" title="<?php echo _('Ver en Wiki'); ?>"
|
||||
<i class="btn-action material-icons fg-green100"
|
||||
title="<?php echo _('Ver en Wiki'); ?>"
|
||||
data-action-id="<?php echo \SP\Core\ActionsInterface::ACTION_WIKI_VIEW; ?>"
|
||||
data-item-id="<?php echo $Account->getName() ?>"
|
||||
data-onclick="wiki/show">library_books</i>
|
||||
@@ -123,9 +124,7 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!$Account->isShow()): ?>
|
||||
<?php else: ?>
|
||||
<div class="account-spacer"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -137,10 +136,33 @@
|
||||
data-item-id="<?php echo $Account->getId(); ?>"
|
||||
<?php foreach ($action->getData() as $name => $actionData): ?>
|
||||
<?php echo 'data-', $name, '=', '"', $actionData, '"'; ?>
|
||||
<?php endforeach; ?>
|
||||
><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
<?php endforeach; ?>><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (count($data->getDataActionsMenu()) > 0): ?>
|
||||
<button id="actions-menu-lower-right-<?php echo $Account->getId(); ?>"
|
||||
class="mdl-button mdl-js-button mdl-button--icon">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</button>
|
||||
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect"
|
||||
for="actions-menu-lower-right-<?php echo $Account->getId(); ?>">
|
||||
|
||||
<?php foreach ($data->getDataActionsMenu() as $actionMenu): ?>
|
||||
<?php if ($actionMenu->getReflectionFilter()->invoke($Account)): ?>
|
||||
<li class="btn-action mdl-menu__item"
|
||||
data-item-id="<?php echo $Account->getId(); ?>"
|
||||
<?php foreach ($actionMenu->getData() as $name => $actionData): ?>
|
||||
<?php echo 'data-', $name, '=', '"', $actionData, '"'; ?>
|
||||
<?php endforeach; ?>>
|
||||
<i class="material-icons <?php echo $actionMenu->getIcon()->getClass(); ?>"
|
||||
title="<?php echo $actionMenu->getTitle(); ?>"><?php echo $actionMenu->getIcon()->getIcon(); ?></i>
|
||||
<?php echo $actionMenu->getName(); ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user