mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-11 10:56:58 +01:00
* [ADD] New grid classes to prepare data that is organized on tabs. It makes more flexible the representation of data structures.
This commit is contained in:
@@ -26,6 +26,11 @@
|
||||
namespace SP\Controller;
|
||||
|
||||
use SP\Core\ActionsInterface;
|
||||
use SP\Html\DataGrid\DataGridAction;
|
||||
use SP\Html\DataGrid\DataGridData;
|
||||
use SP\Html\DataGrid\DataGridHeader;
|
||||
use SP\Html\DataGrid\DataGridIcon;
|
||||
use SP\Html\DataGrid\DataGridTab;
|
||||
use SP\Http\Request;
|
||||
use SP\Mgmt\Category;
|
||||
use SP\Mgmt\Customer;
|
||||
@@ -53,6 +58,19 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
* @var int
|
||||
*/
|
||||
private $_module = 0;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconAdd;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconEdit;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconDelete;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -64,7 +82,9 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
parent::__construct($template);
|
||||
|
||||
$this->view->assign('isDemo', Checks::demoIsEnabled());
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey());
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
|
||||
$this->setIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,52 +98,57 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_MGM_CATEGORIES_NEW);
|
||||
$GridActionNew->setName(_('Nueva Categoría'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_MGM_CATEGORIES_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$categoriesTableProp = array(
|
||||
'tblId' => 'tblCategories',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Nombre'), _('Descripción')),
|
||||
'tblRowSrc' => array('category_name', 'category_description'),
|
||||
'tblRowSrcId' => 'category_id',
|
||||
'onCloseAction' => self::ACTION_MGM,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_MGM_CATEGORIES_NEW,
|
||||
'title' => _('Nueva Categoría'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CATEGORIES_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'icon' => 'add',
|
||||
'skip' => true
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_MGM_CATEGORIES_EDIT,
|
||||
'title' => _('Editar Categoría'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CATEGORIES_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_MGM_CATEGORIES_DELETE,
|
||||
'title' => _('Eliminar Categoría'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_MGM_CATEGORIES_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_MGM_CATEGORIES_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Categoría'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_MGM_CATEGORIES_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$categoriesTableProp['cellWidth'] = floor(65 / count($categoriesTableProp['tblHeaders']));
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_MGM_CATEGORIES_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Categoría'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_MGM_CATEGORIES_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs',
|
||||
array(
|
||||
'title' => _('Gestión de Categorías'),
|
||||
'query' => Category::getCategories(),
|
||||
'props' => $categoriesTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
$GridHeaders->addHeader(_('Descripción'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('category_id');
|
||||
$GridData->addDataRowSource('category_name');
|
||||
$GridData->addDataRowSource('category_description');
|
||||
$GridData->setData(Category::getCategories());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblCategories');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Categorías'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,50 +162,57 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_MGM_CUSTOMERS_NEW);
|
||||
$GridActionNew->setName(_('Nuevo Cliente'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$customersTableProp = array(
|
||||
'tblId' => 'tblCustomers',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Nombre'), _('Descripción')),
|
||||
'tblRowSrc' => array('customer_name', 'customer_description'),
|
||||
'tblRowSrcId' => 'customer_id',
|
||||
'onCloseAction' => self::ACTION_MGM,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMERS_NEW,
|
||||
'title' => _('Nuevo Cliente'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CUSTOMERS_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'skip' => true
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMERS_EDIT,
|
||||
'title' => _('Editar Cliente'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CUSTOMERS_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMERS_DELETE,
|
||||
'title' => _('Eliminar Cliente'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_MGM_CUSTOMERS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_MGM_CUSTOMERS_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Cliente'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$customersTableProp['cellWidth'] = floor(65 / count($customersTableProp['tblHeaders']));
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_MGM_CUSTOMERS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Cliente'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_MGM_CUSTOMERS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Clientes'),
|
||||
'query' => Customer::getCustomers(),
|
||||
'props' => $customersTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
$GridHeaders->addHeader(_('Descripción'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('customer_id');
|
||||
$GridData->addDataRowSource('customer_name');
|
||||
$GridData->addDataRowSource('customer_description');
|
||||
$GridData->setData(Customer::getCustomers());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblCustomers');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Clientes'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,9 +220,7 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
*/
|
||||
public function useTabs()
|
||||
{
|
||||
$this->view->addTemplate('tabs-start');
|
||||
$this->view->addTemplate('mgmttabs');
|
||||
$this->view->addTemplate('tabs-end');
|
||||
$this->view->addTemplate('datatabs-grid');
|
||||
|
||||
$this->view->assign('tabs', array());
|
||||
$this->view->assign('activeTab', 0);
|
||||
@@ -265,50 +295,59 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_MGM_CUSTOMFIELDS_NEW);
|
||||
$GridActionNew->setName(_('Nuevo Campo'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$tableProp = array(
|
||||
'tblId' => 'tblCustomFields',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Módulo'), _('Nombre'), _('Tipo')),
|
||||
'tblRowSrc' => array('module', 'name', 'typeName'),
|
||||
'tblRowSrcId' => 'id',
|
||||
'onCloseAction' => self::ACTION_MGM,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMFIELDS_NEW,
|
||||
'title' => _('Nuevo Campo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CUSTOMFIELDS_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'skip' => true
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMFIELDS_EDIT,
|
||||
'title' => _('Editar Campo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_CUSTOMFIELDS_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_MGM_CUSTOMFIELDS_DELETE,
|
||||
'title' => _('Eliminar Campo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_MGM_CUSTOMFIELDS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_MGM_CUSTOMFIELDS_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Campo'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$tableProp['cellWidth'] = floor(65 / count($tableProp['tblHeaders']));
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_MGM_CUSTOMFIELDS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Campo'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_MGM_CUSTOMFIELDS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Campos Personalizados'),
|
||||
'query' => CustomFieldDef::getCustomFields(),
|
||||
'props' => $tableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Módulo'));
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
$GridHeaders->addHeader(_('Tipo'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('id');
|
||||
$GridData->addDataRowSource('module');
|
||||
$GridData->addDataRowSource('name');
|
||||
$GridData->addDataRowSource('typeName');
|
||||
$GridData->setData(CustomFieldDef::getCustomFields());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblCustomFields');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Campos Personalizados'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,9 +358,9 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
$this->view->addTemplate('customfields');
|
||||
|
||||
$customField = CustomFieldDef::getCustomFields($this->view->itemId, true);
|
||||
$field = unserialize($customField->customfielddef_field);
|
||||
$field = (is_object($customField)) ? unserialize($customField->customfielddef_field) : null;
|
||||
|
||||
if (get_class($field) === '__PHP_Incomplete_Class') {
|
||||
if (is_object($field) && get_class($field) === '__PHP_Incomplete_Class') {
|
||||
$field = Util::castToClass('SP\Mgmt\CustomFieldDef', $field);
|
||||
}
|
||||
|
||||
@@ -331,4 +370,14 @@ class AccountsMgmtC extends Controller implements ActionsInterface
|
||||
$this->view->assign('types', CustomFieldDef::getFieldsTypes());
|
||||
$this->view->assign('modules', CustomFieldDef::getFieldsModules());
|
||||
}
|
||||
|
||||
/**
|
||||
* Establecer los iconos utilizados en el DataGrid
|
||||
*/
|
||||
private function setIcons()
|
||||
{
|
||||
$this->_iconAdd = new DataGridIcon('add', 'imgs/new.png', 'fg-blue80');
|
||||
$this->_iconEdit = new DataGridIcon('mode_edit', 'imgs/edit.png', 'fg-orange80');
|
||||
$this->_iconDelete = new DataGridIcon('delete', 'imgs/delete.png', 'fg-red80');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,13 @@ namespace SP\Controller;
|
||||
|
||||
use SP\Api\ApiTokens;
|
||||
use SP\Core\ActionsInterface;
|
||||
use SP\Html\DataGrid\DataGridAction;
|
||||
use SP\Html\DataGrid\DataGridData;
|
||||
use SP\Html\DataGrid\DataGridHeader;
|
||||
use SP\Html\DataGrid\DataGridIcon;
|
||||
use SP\Html\DataGrid\DataGridTab;
|
||||
use SP\Mgmt\PublicLinkUtil;
|
||||
use SP\Mgmt\CustomFields;
|
||||
use SP\Storage\DB;
|
||||
use SP\Mgmt\User\Groups;
|
||||
use SP\Log\Log;
|
||||
use SP\Mgmt\User\Profile;
|
||||
@@ -39,7 +43,6 @@ use SP\Core\Template;
|
||||
use SP\Mgmt\User\UserUtil;
|
||||
use SP\Storage\DBUtil;
|
||||
use SP\Util\Checks;
|
||||
use SP\Util\Util;
|
||||
|
||||
defined('APP_ROOT') || die(_('No es posible acceder directamente a este archivo'));
|
||||
|
||||
@@ -58,6 +61,22 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
* @var int
|
||||
*/
|
||||
private $_module = 0;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconAdd;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconView;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconEdit;
|
||||
/**
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_iconDelete;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -69,7 +88,20 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
parent::__construct($template);
|
||||
|
||||
$this->view->assign('isDemo', Checks::demoIsEnabled());
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey());
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
|
||||
$this->setIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Establecer los iconos utilizados en el DataGrid
|
||||
*/
|
||||
private function setIcons()
|
||||
{
|
||||
$this->_iconAdd = new DataGridIcon('add', 'imgs/new.png', 'fg-blue80');
|
||||
$this->_iconView = new DataGridIcon('visibility', 'imgs/view.png', 'fg-blue80');
|
||||
$this->_iconEdit = new DataGridIcon('mode_edit', 'imgs/edit.png', 'fg-orange80');
|
||||
$this->_iconDelete = new DataGridIcon('delete', 'imgs/delete.png', 'fg-red80');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,98 +111,91 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
{
|
||||
$this->setAction(self::ACTION_USR_USERS);
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
|
||||
if (!$this->checkAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arrUsersTableProp = array(
|
||||
'tblId' => 'tblUsers',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(
|
||||
_('Nombre'),
|
||||
_('Login'),
|
||||
_('Perfil'),
|
||||
_('Grupo'),
|
||||
_('Propiedades')),
|
||||
'tblRowSrc' => array(
|
||||
'user_name',
|
||||
'user_login',
|
||||
'userprofile_name',
|
||||
'usergroup_name',
|
||||
'images' => array(
|
||||
'user_isAdminApp' => array(
|
||||
'img_file' => 'check_blue.png',
|
||||
'img_title' => _('Admin Aplicación'),
|
||||
'icon' => 'star'),
|
||||
'user_isAdminAcc' => array(
|
||||
'img_file' => 'check_orange.png',
|
||||
'img_title' => _('Admin Cuentas'),
|
||||
'icon' => 'star_half'),
|
||||
'user_isLdap' => array(
|
||||
'img_file' => 'ldap.png',
|
||||
'img_title' => _('Usuario de LDAP'),
|
||||
'icon' => 'business'),
|
||||
'user_isDisabled' => array(
|
||||
'img_file' => 'disabled.png',
|
||||
'img_title' => _('Deshabilitado'),
|
||||
'icon' => 'error')
|
||||
)
|
||||
),
|
||||
'tblRowSrcId' => 'user_id',
|
||||
'onCloseAction' => self::ACTION_USR,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_USR_USERS_NEW,
|
||||
'title' => _('Nuevo Usuario'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_USERS_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'icon' => 'add',
|
||||
'skip' => true
|
||||
),
|
||||
'view' => array(
|
||||
'id' => self::ACTION_USR_USERS_VIEW,
|
||||
'title' => _('Ver Detalles de Usuario'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_USERS_VIEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/view.png',
|
||||
'icon' => 'visibility'
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_USR_USERS_EDIT,
|
||||
'title' => _('Editar Usuario'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_USERS_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'pass' => array(
|
||||
'id' => self::ACTION_USR_USERS_EDITPASS,
|
||||
'title' => _('Cambiar Clave de Usuario'),
|
||||
'onclick' => 'sysPassUtil.Common.usrUpdPass(this,' . self::ACTION_USR_USERS_EDITPASS . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/key.png',
|
||||
'icon' => 'lock_outline'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_USR_USERS_DELETE,
|
||||
'title' => _('Eliminar Usuario'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_USR_USERS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
),
|
||||
)
|
||||
);
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_USR_USERS_NEW);
|
||||
$GridActionNew->setName(_('Nuevo Usuario'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_USR_USERS_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$arrUsersTableProp['cellWidth'] = floor(65 / count($arrUsersTableProp['tblHeaders']));
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_USR_USERS_VIEW);
|
||||
$GridActionView->setName(_('Ver Detalles de Usuario'));
|
||||
$GridActionView->setIcon($this->_iconView);
|
||||
$GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionView->setOnClickArgs('this');
|
||||
$GridActionView->setOnClickArgs(self::ACTION_USR_USERS_VIEW);
|
||||
$GridActionView->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Usuarios'),
|
||||
'query' => UserUtil::getUsers(),
|
||||
'props' => $arrUsersTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_USR_USERS_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Usuario'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_USR_USERS_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_USR_USERS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Usuario'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_USR_USERS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridActionEditPass = new DataGridAction();
|
||||
$GridActionEditPass->setId(self::ACTION_USR_USERS_EDITPASS);
|
||||
$GridActionEditPass->setName(_('Cambiar Clave de Usuario'));
|
||||
$GridActionEditPass->setIcon(new DataGridIcon('lock_outline', 'imgs/pass.png', 'fg-orange80'));
|
||||
$GridActionEditPass->setOnClickFunction('sysPassUtil.Common.usrUpdPass');
|
||||
$GridActionEditPass->setOnClickArgs('this');
|
||||
$GridActionEditPass->setOnClickArgs(self::ACTION_USR_USERS_EDITPASS);
|
||||
$GridActionEditPass->setOnClickArgs($this->view->sk);
|
||||
$GridActionEditPass->setFilterRowSource('user_isLdap');
|
||||
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
$GridHeaders->addHeader(_('Login'));
|
||||
$GridHeaders->addHeader(_('Perfil'));
|
||||
$GridHeaders->addHeader(_('Grupo'));
|
||||
$GridHeaders->addHeader(_('Propiedades'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('user_id');
|
||||
$GridData->addDataRowSource('user_name');
|
||||
$GridData->addDataRowSource('user_login');
|
||||
$GridData->addDataRowSource('userprofile_name');
|
||||
$GridData->addDataRowSource('usergroup_name');
|
||||
$GridData->addDataRowSourceWithIcon('user_isAdminApp', new DataGridIcon('star', 'check_blue.png', null, _('Admin Cuentas')));
|
||||
$GridData->addDataRowSourceWithIcon('user_isAdminAcc', new DataGridIcon('star_half', 'check_orange.png', null, _('Admin Cuentas')));
|
||||
$GridData->addDataRowSourceWithIcon('user_isLdap', new DataGridIcon('business', 'ldap.png', null, _('Usuario de LDAP')));
|
||||
$GridData->addDataRowSourceWithIcon('user_isDisabled', new DataGridIcon('error', 'disabled.png', null, _('Deshabilitado')));
|
||||
$GridData->setData(UserUtil::getUsers());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblUsers');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionView);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionEditPass);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Usuarios'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,55 +205,61 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
{
|
||||
$this->setAction(self::ACTION_USR_GROUPS);
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
|
||||
if (!$this->checkAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arrGroupsTableProp = array(
|
||||
'tblId' => 'tblGroups',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Nombre'), _('Descripción')),
|
||||
'tblRowSrc' => array('usergroup_name', 'usergroup_description'),
|
||||
'tblRowSrcId' => 'usergroup_id',
|
||||
'onCloseAction' => self::ACTION_USR,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_USR_GROUPS_NEW,
|
||||
'title' => _('Nuevo Grupo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_GROUPS_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'icon' => 'add',
|
||||
'skip' => true
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_USR_GROUPS_EDIT,
|
||||
'title' => _('Editar Grupo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_GROUPS_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_USR_GROUPS_DELETE,
|
||||
'title' => _('Eliminar Grupo'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_USR_GROUPS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_USR_GROUPS_NEW);
|
||||
$GridActionNew->setName(_('Nuevo Grupo'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_USR_GROUPS_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$arrGroupsTableProp['cellWidth'] = floor(65 / count($arrGroupsTableProp['tblHeaders']));
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_USR_GROUPS_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Grupo'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_USR_GROUPS_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Grupos'),
|
||||
'query' => Groups::getGroups(),
|
||||
'props' => $arrGroupsTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_USR_GROUPS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Grupo'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_USR_GROUPS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
$GridHeaders->addHeader(_('Descripción'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('usergroup_id');
|
||||
$GridData->addDataRowSource('usergroup_name');
|
||||
$GridData->addDataRowSource('usergroup_description');
|
||||
$GridData->setData(Groups::getGroups());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblGroups');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Grupos'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,63 +269,69 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
{
|
||||
$this->setAction(self::ACTION_USR_PROFILES);
|
||||
|
||||
$this->view->assign('sk', SessionUtil::getSessionKey(true));
|
||||
|
||||
if (!$this->checkAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$arrProfilesTableProp = array(
|
||||
'tblId' => 'tblProfiles',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Nombre')),
|
||||
'tblRowSrc' => array('userprofile_name'),
|
||||
'tblRowSrcId' => 'userprofile_id',
|
||||
'onCloseAction' => self::ACTION_USR,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_USR_PROFILES_NEW,
|
||||
'title' => _('Nuevo Perfil'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_PROFILES_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'icon' => 'add',
|
||||
'skip' => true
|
||||
),
|
||||
'view' => array(
|
||||
'id' => self::ACTION_USR_PROFILES_VIEW,
|
||||
'title' => _('Ver Detalles de Perfil'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_PROFILES_VIEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/view.png',
|
||||
'icon' => 'visibility'
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_USR_PROFILES_EDIT,
|
||||
'title' => _('Editar Perfil'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_USR_PROFILES_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_USR_PROFILES_DELETE,
|
||||
'title' => _('Eliminar Perfil'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_USR_PROFILES_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_USR_PROFILES_NEW);
|
||||
$GridActionNew->setName(_('Nuevo Perfil'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_USR_PROFILES_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$arrProfilesTableProp['cellWidth'] = floor(65 / count($arrProfilesTableProp['tblHeaders']));
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_USR_PROFILES_VIEW);
|
||||
$GridActionView->setName(_('Ver Detalles de Perfil'));
|
||||
$GridActionView->setIcon($this->_iconView);
|
||||
$GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionView->setOnClickArgs('this');
|
||||
$GridActionView->setOnClickArgs(self::ACTION_USR_PROFILES_VIEW);
|
||||
$GridActionView->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Perfiles'),
|
||||
'query' => Profile::getProfiles(),
|
||||
'props' => $arrProfilesTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5)
|
||||
)
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_USR_PROFILES_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Perfil'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_USR_PROFILES_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_USR_PROFILES_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Perfil'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_USR_PROFILES_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Nombre'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('userprofile_id');
|
||||
$GridData->addDataRowSource('userprofile_name');
|
||||
$GridData->setData(Profile::getProfiles());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblProfiles');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionView);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Perfiles'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,9 +339,7 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
*/
|
||||
public function useTabs()
|
||||
{
|
||||
$this->view->addTemplate('tabs-start');
|
||||
$this->view->addTemplate('mgmttabs');
|
||||
$this->view->addTemplate('tabs-end');
|
||||
$this->view->addTemplate('datatabs-grid');
|
||||
|
||||
$this->view->assign('tabs', array());
|
||||
$this->view->assign('activeTab', 0);
|
||||
@@ -328,6 +363,19 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
$this->getCustomFieldsForItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener la lista de campos personalizados y sus valores
|
||||
*/
|
||||
private function getCustomFieldsForItem()
|
||||
{
|
||||
// Se comprueba que hayan campos con valores para el elemento actual
|
||||
if ($this->view->itemId && CustomFields::checkCustomFieldExists($this->_module, $this->view->itemId)) {
|
||||
$this->view->assign('customFields', CustomFields::getCustomFieldsData($this->_module, $this->view->itemId));
|
||||
} else {
|
||||
$this->view->assign('customFields', CustomFields::getCustomFieldsForModule($this->_module));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener los datos para la ficha de grupo
|
||||
*/
|
||||
@@ -391,56 +439,67 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$tokensTableProp = array(
|
||||
'tblId' => 'tblTokens',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Usuario'), _('Acción')),
|
||||
'tblRowSrc' => array('user_login', 'authtoken_actionId'),
|
||||
'tblRowSrcId' => 'authtoken_id',
|
||||
'onCloseAction' => self::ACTION_MGM_APITOKENS,
|
||||
'actions' => array(
|
||||
'new' => array(
|
||||
'id' => self::ACTION_MGM_APITOKENS_NEW,
|
||||
'title' => _('Nueva Autorización'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_APITOKENS_NEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/new.png',
|
||||
'icon' => 'add',
|
||||
'skip' => true
|
||||
),
|
||||
'view' => array(
|
||||
'id' => self::ACTION_MGM_APITOKENS_VIEW,
|
||||
'title' => _('Ver token de Autorización'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_APITOKENS_VIEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/view.png',
|
||||
'icon' => 'visibility'
|
||||
),
|
||||
'edit' => array(
|
||||
'id' => self::ACTION_MGM_APITOKENS_EDIT,
|
||||
'title' => _('Editar Autorización'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_APITOKENS_EDIT . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/edit.png',
|
||||
'icon' => 'mode_edit'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_MGM_APITOKENS_DELETE,
|
||||
'title' => _('Eliminar Autorización'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_MGM_APITOKENS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_MGM_APITOKENS_NEW);
|
||||
$GridActionNew->setName(_('Nueva Autorización'));
|
||||
$GridActionNew->setIcon($this->_iconAdd);
|
||||
$GridActionNew->setSkip(true);
|
||||
$GridActionNew->setIsNew(true);
|
||||
$GridActionNew->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionNew->setOnClickArgs('this');
|
||||
$GridActionNew->setOnClickArgs(self::ACTION_MGM_APITOKENS_NEW);
|
||||
$GridActionNew->setOnClickArgs($this->view->sk);
|
||||
|
||||
$tokensTableProp['cellWidth'] = floor(65 / count($tokensTableProp['tblHeaders']));
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_MGM_APITOKENS_VIEW);
|
||||
$GridActionView->setName(_('Ver token de Autorización'));
|
||||
$GridActionView->setIcon($this->_iconView);
|
||||
$GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionView->setOnClickArgs('this');
|
||||
$GridActionView->setOnClickArgs(self::ACTION_MGM_APITOKENS_VIEW);
|
||||
$GridActionView->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Autorizaciones API'),
|
||||
'query' => ApiTokens::getTokens(),
|
||||
'props' => $tokensTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridActionEdit = new DataGridAction();
|
||||
$GridActionEdit->setId(self::ACTION_MGM_APITOKENS_EDIT);
|
||||
$GridActionEdit->setName(_('Editar Autorización'));
|
||||
$GridActionEdit->setIcon($this->_iconEdit);
|
||||
$GridActionEdit->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionEdit->setOnClickArgs('this');
|
||||
$GridActionEdit->setOnClickArgs(self::ACTION_MGM_APITOKENS_EDIT);
|
||||
$GridActionEdit->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_MGM_APITOKENS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Autorización'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_MGM_APITOKENS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Usuario'));
|
||||
$GridHeaders->addHeader(_('Acción'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('authtoken_id');
|
||||
$GridData->addDataRowSource('user_login');
|
||||
$GridData->addDataRowSource('authtoken_actionId');
|
||||
$GridData->setData(ApiTokens::getTokens());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblTokens');
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionView);
|
||||
$Grid->setDataActions($GridActionEdit);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Autorizaciones API'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -463,19 +522,6 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener la lista de campos personalizados y sus valores
|
||||
*/
|
||||
private function getCustomFieldsForItem()
|
||||
{
|
||||
// Se comprueba que hayan campos con valores para el elemento actual
|
||||
if ($this->view->itemId && CustomFields::checkCustomFieldExists($this->_module, $this->view->itemId)) {
|
||||
$this->view->assign('customFields', CustomFields::getCustomFieldsData($this->_module, $this->view->itemId));
|
||||
} else {
|
||||
$this->view->assign('customFields', CustomFields::getCustomFieldsForModule($this->_module));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener los datos para la pestaña de tokens de API
|
||||
*/
|
||||
@@ -487,48 +533,63 @@ class UsersMgmtC extends Controller implements ActionsInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$linksTableProp = array(
|
||||
'tblId' => 'tblLinks',
|
||||
'header' => '',
|
||||
'tblHeaders' => array(_('Cuenta'), _('Fecha Creación'), _('Fecha Caducidad'), _('Usuario'), _('Notificar'), _('Visitas')),
|
||||
'tblRowSrc' => array('publicLink_account', 'publicLink_dateAdd', 'publicLink_dateExpire', 'publicLink_user', 'publicLink_notify', 'publicLink_views'),
|
||||
'tblRowSrcId' => 'publicLink_id',
|
||||
'onCloseAction' => self::ACTION_MGM_PUBLICLINKS,
|
||||
'actions' => array(
|
||||
'view' => array(
|
||||
'id' => self::ACTION_MGM_PUBLICLINKS_VIEW,
|
||||
'title' => _('Ver Enlace'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtData(this,' . self::ACTION_MGM_PUBLICLINKS_VIEW . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/view.png',
|
||||
'icon' => 'visibility'
|
||||
),
|
||||
'refresh' => array(
|
||||
'id' => self::ACTION_MGM_PUBLICLINKS_VIEW,
|
||||
'title' => _('Renovar Enlace'),
|
||||
'onclick' => 'sysPassUtil.Common.linksMgmtRefresh(this,' . self::ACTION_MGM_PUBLICLINKS_REFRESH . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/view.png',
|
||||
'icon' => 'refresh'
|
||||
),
|
||||
'del' => array(
|
||||
'id' => self::ACTION_MGM_PUBLICLINKS_DELETE,
|
||||
'title' => _('Eliminar Enlace'),
|
||||
'onclick' => 'sysPassUtil.Common.appMgmtDelete(this,' . self::ACTION_MGM_PUBLICLINKS_DELETE . ',\'' . $this->view->sk . '\')',
|
||||
'img' => 'imgs/delete.png',
|
||||
'icon' => 'delete',
|
||||
'isdelete' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_MGM_PUBLICLINKS_VIEW);
|
||||
$GridActionView->setName(_('Ver Enlace'));
|
||||
$GridActionView->setIcon($this->_iconView);
|
||||
$GridActionView->setOnClickFunction('sysPassUtil.Common.appMgmtData');
|
||||
$GridActionView->setOnClickArgs('this');
|
||||
$GridActionView->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_VIEW);
|
||||
$GridActionView->setOnClickArgs($this->view->sk);
|
||||
|
||||
$linksTableProp['cellWidth'] = floor(65 / count($linksTableProp['tblHeaders']));
|
||||
$GridActionRefresh = new DataGridAction();
|
||||
$GridActionRefresh->setId(self::ACTION_MGM_PUBLICLINKS_REFRESH);
|
||||
$GridActionRefresh->setName(_('Renovar Enlace'));
|
||||
$GridActionRefresh->setIcon(new DataGridIcon('refresh', 'imgs/view.png', 'fg-green80'));
|
||||
$GridActionRefresh->setOnClickFunction('sysPassUtil.Common.linksMgmtRefresh');
|
||||
$GridActionRefresh->setOnClickArgs('this');
|
||||
$GridActionRefresh->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_REFRESH);
|
||||
$GridActionRefresh->setOnClickArgs($this->view->sk);
|
||||
|
||||
$this->view->append(
|
||||
'tabs', array(
|
||||
'title' => _('Gestión de Enlaces'),
|
||||
'query' => PublicLinkUtil::getLinks(),
|
||||
'props' => $linksTableProp,
|
||||
'time' => round(microtime() - $this->view->queryTimeStart, 5))
|
||||
);
|
||||
$GridActionDel = new DataGridAction();
|
||||
$GridActionDel->setId(self::ACTION_MGM_PUBLICLINKS_DELETE);
|
||||
$GridActionDel->setName(_('Eliminar Enlace'));
|
||||
$GridActionDel->setIcon($this->_iconDelete);
|
||||
$GridActionDel->setIsDelete(true);
|
||||
$GridActionDel->setOnClickFunction('sysPassUtil.Common.appMgmtDelete');
|
||||
$GridActionDel->setOnClickArgs('this');
|
||||
$GridActionDel->setOnClickArgs(self::ACTION_MGM_PUBLICLINKS_DELETE);
|
||||
$GridActionDel->setOnClickArgs($this->view->sk);
|
||||
|
||||
$GridHeaders = new DataGridHeader();
|
||||
$GridHeaders->addHeader(_('Cuenta'));
|
||||
$GridHeaders->addHeader(_('Fecha Creación'));
|
||||
$GridHeaders->addHeader(_('Fecha Caducidad'));
|
||||
$GridHeaders->addHeader(_('Usuario'));
|
||||
$GridHeaders->addHeader(_('Notificar'));
|
||||
$GridHeaders->addHeader(_('Visitas'));
|
||||
|
||||
$GridData = new DataGridData();
|
||||
$GridData->setDataRowSourceId('publicLink_id');
|
||||
$GridData->addDataRowSource('publicLink_account');
|
||||
$GridData->addDataRowSource('publicLink_dateAdd');
|
||||
$GridData->addDataRowSource('publicLink_dateExpire');
|
||||
$GridData->addDataRowSource('publicLink_user');
|
||||
$GridData->addDataRowSource('publicLink_notify');
|
||||
$GridData->addDataRowSource('publicLink_views');
|
||||
$GridData->setData(PublicLinkUtil::getLinks());
|
||||
|
||||
$Grid = new DataGridTab();
|
||||
$Grid->setId('tblLinks');
|
||||
$Grid->setDataActions($GridActionView);
|
||||
$Grid->setDataActions($GridActionRefresh);
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
$Grid->setHeader($GridHeaders);
|
||||
$Grid->setData($GridData);
|
||||
$Grid->setTitle(_('Gestión de Enlaces'));
|
||||
$Grid->setTime(round(microtime() - $this->view->queryTimeStart, 5));
|
||||
|
||||
$this->view->append('tabs', $Grid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
36
inc/SP/Html/DataGrid/DataGrid.class.php
Normal file
36
inc/SP/Html/DataGrid/DataGrid.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGrid para crear una matriz de datos
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGrid extends DataGridBase
|
||||
{
|
||||
|
||||
}
|
||||
36
inc/SP/Html/DataGrid/DataGridAction.class.php
Normal file
36
inc/SP/Html/DataGrid/DataGridAction.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridAction para crear una acción para cada elemento de la matriz de datos
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGridAction extends DataGridActionBase
|
||||
{
|
||||
|
||||
}
|
||||
252
inc/SP/Html/DataGrid/DataGridActionBase.class.php
Normal file
252
inc/SP/Html/DataGrid/DataGridActionBase.class.php
Normal file
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridAction para crear una acción para cada elemento de la matriz de datos
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
abstract class DataGridActionBase implements DataGridActionInterface
|
||||
{
|
||||
/**
|
||||
* El nombre de la acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_name = '';
|
||||
/**
|
||||
* El título de la acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_title = '';
|
||||
/**
|
||||
* El id de la acción
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_id = 0;
|
||||
/**
|
||||
* La función javascript del evento OnClick
|
||||
* @var string
|
||||
*/
|
||||
private $_onClickFunction = '';
|
||||
/**
|
||||
* Los argumentos de la función OnClick
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_onClickArgs = array();
|
||||
/**
|
||||
* El icono de la acción
|
||||
*
|
||||
* @var DataGridIcon
|
||||
*/
|
||||
private $_icon = null;
|
||||
/**
|
||||
* Si es una acción de eliminar elementos
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_isDelete = false;
|
||||
/**
|
||||
* Si se debe de omitir para los elementos del listado
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_isSkip = false;
|
||||
/**
|
||||
* Si es una acción para crear elementos
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $_isNew = false;
|
||||
/**
|
||||
* La columna de origen de datos que condiciona esta acción
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_filterRowSource = '';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name string
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->_id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title string
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $function string
|
||||
*/
|
||||
public function setOnClickFunction($function)
|
||||
{
|
||||
$this->_onClickFunction = $function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $args string
|
||||
*/
|
||||
public function setOnClickArgs($args)
|
||||
{
|
||||
$this->_onClickArgs[] = $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOnClick()
|
||||
{
|
||||
$args = array();
|
||||
|
||||
foreach ($this->_onClickArgs as $arg) {
|
||||
$args[] = (!is_numeric($arg) && $arg !== 'this') ? '\'' . $arg . '\'' : $arg;
|
||||
}
|
||||
|
||||
return $this->_onClickFunction . '(' . implode(',', $args) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataGridIcon
|
||||
*/
|
||||
public function getIcon()
|
||||
{
|
||||
return $this->_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $icon DataGridIcon
|
||||
*/
|
||||
public function setIcon($icon)
|
||||
{
|
||||
$this->_icon = $icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $skip bool
|
||||
*/
|
||||
public function setSkip($skip)
|
||||
{
|
||||
$this->_isSkip = $skip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isSkip()
|
||||
{
|
||||
return $this->_isSkip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $delete bool
|
||||
*/
|
||||
public function setIsDelete($delete)
|
||||
{
|
||||
$this->_isDelete = $delete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDelete()
|
||||
{
|
||||
return $this->_isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $new
|
||||
*/
|
||||
public function setIsNew($new)
|
||||
{
|
||||
$this->_isNew = $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNew()
|
||||
{
|
||||
return $this->_isNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $rowSource string
|
||||
*/
|
||||
public function setFilterRowSource($rowSource)
|
||||
{
|
||||
$this->_filterRowSource = $rowSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFilterRowSource()
|
||||
{
|
||||
return $this->_filterRowSource;
|
||||
}
|
||||
}
|
||||
129
inc/SP/Html/DataGrid/DataGridActionInterface.class.php
Normal file
129
inc/SP/Html/DataGrid/DataGridActionInterface.class.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Interface DataGridActionInterface
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
interface DataGridActionInterface
|
||||
{
|
||||
/**
|
||||
* @param $name string
|
||||
*/
|
||||
public function setName($name);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* @param $title string
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* @param $function string
|
||||
*/
|
||||
public function setOnClickFunction($function);
|
||||
|
||||
/**
|
||||
* @param $args string
|
||||
*/
|
||||
public function setOnClickArgs($args);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOnClick();
|
||||
|
||||
/**
|
||||
* @param $icon string
|
||||
*/
|
||||
public function setIcon($icon);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon();
|
||||
|
||||
/**
|
||||
* @param $skip bool
|
||||
*/
|
||||
public function setSkip($skip);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isSkip();
|
||||
|
||||
/**
|
||||
* @param $delete bool
|
||||
*/
|
||||
public function setIsDelete($delete);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isDelete();
|
||||
|
||||
/**
|
||||
* @param $new bool
|
||||
*/
|
||||
public function setIsNew($new);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isNew();
|
||||
|
||||
/**
|
||||
* @param $rowSource string
|
||||
*/
|
||||
public function setFilterRowSource($rowSource);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFilterRowSource();
|
||||
}
|
||||
160
inc/SP/Html/DataGrid/DataGridBase.class.php
Normal file
160
inc/SP/Html/DataGrid/DataGridBase.class.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
use SP\Core\ActionsInterface;
|
||||
use SplObjectStorage;
|
||||
|
||||
/**
|
||||
* Class DataGridBase para crear una matriz de datos
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
abstract class DataGridBase implements DataGridInterface
|
||||
{
|
||||
/**
|
||||
* El id de la matriz
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_id = '';
|
||||
/**
|
||||
* La cabecera de la matriz
|
||||
*
|
||||
* @var DataGridHeader
|
||||
*/
|
||||
private $_header;
|
||||
/**
|
||||
* Los datos de la matriz
|
||||
*
|
||||
* @var DataGridData
|
||||
*/
|
||||
private $_data;
|
||||
/**
|
||||
* Las acciones asociadas a los elementos de la matriz
|
||||
*
|
||||
* @var DataGridAction[]
|
||||
*/
|
||||
private $_actions = null;
|
||||
/**
|
||||
* La acción a realizar al cerrar la matriz
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_onCloseAction = 0;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOnCloseAction()
|
||||
{
|
||||
return $this->_onCloseAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActionsInterface $action
|
||||
*/
|
||||
public function setOnCloseAction(ActionsInterface $action)
|
||||
{
|
||||
$this->_onCloseAction = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id string
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->_id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataGridHeader
|
||||
*/
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataGridHeader $header
|
||||
*/
|
||||
public function setHeader(DataGridHeader $header)
|
||||
{
|
||||
$this->_header = $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataGridData
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataGridData $data
|
||||
*/
|
||||
public function setData(DataGridData $data)
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataGridAction $action
|
||||
*/
|
||||
public function setDataActions(DataGridAction $action)
|
||||
{
|
||||
if (is_null($this->_actions)) {
|
||||
$this->_actions = new SplObjectStorage();
|
||||
}
|
||||
|
||||
$this->_actions->attach($action);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataGridAction[]
|
||||
*/
|
||||
public function getDataActions()
|
||||
{
|
||||
return $this->_actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGrid()
|
||||
{
|
||||
// TODO: Implement getGrid() method.
|
||||
}
|
||||
}
|
||||
36
inc/SP/Html/DataGrid/DataGridData.class.php
Normal file
36
inc/SP/Html/DataGrid/DataGridData.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridData para establecer el origen de datos de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGridData extends DataGridDataBase
|
||||
{
|
||||
|
||||
}
|
||||
110
inc/SP/Html/DataGrid/DataGridDataBase.class.php
Normal file
110
inc/SP/Html/DataGrid/DataGridDataBase.class.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridDataBase para establecer el origen de datos de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
abstract class DataGridDataBase implements DataGridDataInterface
|
||||
{
|
||||
/**
|
||||
* Los datos de la matriz
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_data = array();
|
||||
/**
|
||||
* Las columnas a mostrar de los datos obtenidos
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_sources = array();
|
||||
/**
|
||||
* La columna que identifica cada elemento de los datos de la matriz
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_sourceId = 0;
|
||||
|
||||
/**
|
||||
* @param $source string
|
||||
*/
|
||||
public function addDataRowSource($source)
|
||||
{
|
||||
$this->_sources[] = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id string
|
||||
*/
|
||||
public function setDataRowSourceId($id)
|
||||
{
|
||||
$this->_sourceId = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDataRowSources()
|
||||
{
|
||||
return $this->_sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDataRowSourceId()
|
||||
{
|
||||
return $this->_sourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data array
|
||||
*/
|
||||
public function setData(array $data)
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
* @param DatagridIcon $icon
|
||||
*/
|
||||
public function addDataRowSourceWithIcon($source, $icon)
|
||||
{
|
||||
$this->_sources[] = array($source, $icon);
|
||||
}
|
||||
}
|
||||
71
inc/SP/Html/DataGrid/DataGridDataInterface.class.php
Normal file
71
inc/SP/Html/DataGrid/DataGridDataInterface.class.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Interface DataGridDataInterface
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
interface DataGridDataInterface
|
||||
{
|
||||
/**
|
||||
* @param $source string
|
||||
*/
|
||||
public function addDataRowSource($source);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDataRowSources();
|
||||
|
||||
/**
|
||||
* @param $id string
|
||||
*/
|
||||
public function setDataRowSourceId($id);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDataRowSourceId();
|
||||
|
||||
/**
|
||||
* @param $data array
|
||||
*/
|
||||
public function setData(array $data);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData();
|
||||
|
||||
/**
|
||||
* @param $source string
|
||||
* @param $icon DatagridIcon
|
||||
* @return
|
||||
*/
|
||||
public function addDataRowSourceWithIcon($source, $icon);
|
||||
}
|
||||
36
inc/SP/Html/DataGrid/DataGridHeader.class.php
Normal file
36
inc/SP/Html/DataGrid/DataGridHeader.class.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridHeader para establecer las cabeceras de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGridHeader extends DataGridHeaderBase
|
||||
{
|
||||
|
||||
}
|
||||
74
inc/SP/Html/DataGrid/DataGridHeaderBase.class.php
Normal file
74
inc/SP/Html/DataGrid/DataGridHeaderBase.class.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridHeaderBase para establecer las cabeceras de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
abstract class DataGridHeaderBase implements DataGridHeaderInterface
|
||||
{
|
||||
/**
|
||||
* Las cabeceras que identifican las columnas de datos
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_headers = array();
|
||||
/**
|
||||
* El ancho de las columnas
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_width = 0;
|
||||
|
||||
/**
|
||||
* @param $header string
|
||||
*/
|
||||
public function addHeader($header)
|
||||
{
|
||||
$this->_headers[] = $header;
|
||||
|
||||
$numHeaders = count($this->_headers);
|
||||
$this->_width = ($numHeaders > 0) ? floor(65 / $numHeaders) : 65;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
return $this->_headers;
|
||||
}
|
||||
}
|
||||
44
inc/SP/Html/DataGrid/DataGridHeaderInterface.class.php
Normal file
44
inc/SP/Html/DataGrid/DataGridHeaderInterface.class.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Interface DataGridHeader
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
interface DataGridHeaderInterface
|
||||
{
|
||||
/**
|
||||
* @param $header string
|
||||
*/
|
||||
public function addHeader($header);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders();
|
||||
}
|
||||
48
inc/SP/Html/DataGrid/DataGridIcon.class.php
Normal file
48
inc/SP/Html/DataGrid/DataGridIcon.class.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridIcon para crear los iconos de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGridIcon extends DataGridIconBase
|
||||
{
|
||||
/**
|
||||
* @param string $icon
|
||||
* @param string $image
|
||||
* @param string $class
|
||||
* @param string $title
|
||||
*/
|
||||
public function __construct($icon, $image, $class = null, $title = null)
|
||||
{
|
||||
$this->setIcon($icon);
|
||||
$this->setImage($image);
|
||||
$this->setClass($class);
|
||||
$this->setTitle($title);
|
||||
}
|
||||
}
|
||||
123
inc/SP/Html/DataGrid/DataGridIconBase.class.php
Normal file
123
inc/SP/Html/DataGrid/DataGridIconBase.class.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridIconBase para crear los iconos de la matriz
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
abstract class DataGridIconBase implements DataGridIconInterface
|
||||
{
|
||||
/**
|
||||
* El icono a utilizar en la etiqueta <i> (según tema visual)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_icon = '';
|
||||
/**
|
||||
* Imagen a utilizar en el icono (según tema visual)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_image = '';
|
||||
/**
|
||||
* Título del icono
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_title = '';
|
||||
/**
|
||||
* Clase CSS del icono
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_class = '';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon()
|
||||
{
|
||||
return $this->_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $icon
|
||||
*/
|
||||
public function setIcon($icon)
|
||||
{
|
||||
$this->_icon = $icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
return $this->_image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $image
|
||||
*/
|
||||
public function setImage($image)
|
||||
{
|
||||
$this->_image = $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*/
|
||||
public function setClass($class)
|
||||
{
|
||||
$this->_class = $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return $this->_class;
|
||||
}
|
||||
}
|
||||
74
inc/SP/Html/DataGrid/DataGridIconInterface.class.php
Normal file
74
inc/SP/Html/DataGrid/DataGridIconInterface.class.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Interface DataGridIconInterface
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
interface DataGridIconInterface
|
||||
{
|
||||
/**
|
||||
* @param $icon
|
||||
*/
|
||||
public function setIcon($icon);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIcon();
|
||||
|
||||
/**
|
||||
* @param $image
|
||||
*/
|
||||
public function setImage($image);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getImage();
|
||||
|
||||
/**
|
||||
* @param $title
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* @param $class
|
||||
*/
|
||||
public function setClass($class);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClass();
|
||||
}
|
||||
86
inc/SP/Html/DataGrid/DataGridInterface.class.php
Normal file
86
inc/SP/Html/DataGrid/DataGridInterface.class.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
use SP\Core\ActionsInterface;
|
||||
|
||||
/**
|
||||
* Interface DataGridInterface
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
interface DataGridInterface
|
||||
{
|
||||
/**
|
||||
* @param $id string
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* @param DataGridHeader $header
|
||||
*/
|
||||
public function setHeader(DataGridHeader $header);
|
||||
|
||||
/**
|
||||
* @return DataGridHeader
|
||||
*/
|
||||
public function getHeader();
|
||||
|
||||
/**
|
||||
* @param DataGridData $data
|
||||
*/
|
||||
public function setData(DataGridData $data);
|
||||
|
||||
/**
|
||||
* @return DataGridData
|
||||
*/
|
||||
public function getData();
|
||||
|
||||
/**
|
||||
* @param DataGridAction $action
|
||||
*/
|
||||
public function setDataActions(DataGridAction $action);
|
||||
|
||||
/**
|
||||
* @return DataGridAction
|
||||
*/
|
||||
public function getDataActions();
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGrid();
|
||||
|
||||
/**
|
||||
* @param ActionsInterface $action
|
||||
*/
|
||||
public function setOnCloseAction(ActionsInterface $action);
|
||||
}
|
||||
80
inc/SP/Html/DataGrid/DataGridTab.class.php
Normal file
80
inc/SP/Html/DataGrid/DataGridTab.class.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link http://syspass.org
|
||||
* @copyright 2012-2015 Rubén Domínguez nuxsmin@syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace SP\Html\DataGrid;
|
||||
|
||||
/**
|
||||
* Class DataGridTab para crear una matriz de datos a usar en pestañas
|
||||
*
|
||||
* @package SP\Html\DataGrid
|
||||
*/
|
||||
class DataGridTab extends DataGridBase
|
||||
{
|
||||
/**
|
||||
* Título de la pestaña
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_title = '';
|
||||
/**
|
||||
* Tiempo de ejecución
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_time = 0;
|
||||
|
||||
/**
|
||||
* @param $title string
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTime()
|
||||
{
|
||||
return $this->_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $time
|
||||
*/
|
||||
public function setTime($time)
|
||||
{
|
||||
$this->_time = $time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class Html
|
||||
}
|
||||
|
||||
if (is_array($data)) {
|
||||
array_walk_recursive($data, '\SP\Html::sanitize');
|
||||
array_walk_recursive($data, '\SP\Html\Html::sanitize');
|
||||
} else {
|
||||
$data = strip_tags($data);
|
||||
|
||||
|
||||
113
inc/themes/material-blue/datatabs-grid.inc
Normal file
113
inc/themes/material-blue/datatabs-grid.inc
Normal file
@@ -0,0 +1,113 @@
|
||||
<!-- Start Tabs-->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<?php foreach ($tabs as $index => $tab):
|
||||
/**
|
||||
* @var $tab SP\Html\DataGrid\DataGridTab
|
||||
*/
|
||||
?>
|
||||
<li>
|
||||
<a href="#tabs-<?php echo $index; ?>"
|
||||
title="<?php echo $tab->getTitle(); ?>"><?php echo $tab->getTitle(); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php foreach ($tabs as $index => $tab):
|
||||
/**
|
||||
* @var $tab SP\Html\DataGrid\DataGridTab
|
||||
*/
|
||||
?>
|
||||
<div id="tabs-<?php echo $index; ?>">
|
||||
<div class="action fullWidth">
|
||||
<ul>
|
||||
<?php foreach ($tab->getDataActions() as $action): ?>
|
||||
<?php if ($action->isNew()): ?>
|
||||
<li>
|
||||
<button
|
||||
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored mdl-js-ripple-effect"
|
||||
data-itemid="0" data-activetab="<?php echo $index; ?>"
|
||||
data-nextactionid="<?php echo $tab->getOnCloseAction(); ?>"
|
||||
OnClick="<?php echo $action->getOnClick(); ?>">
|
||||
<i class="material-icons"
|
||||
title="<?php echo $action->getTitle(); ?>"><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
</button>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<li>
|
||||
<button id="btnBack" type="button"
|
||||
class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored"
|
||||
OnClick="sysPassUtil.Common.doAction(<?php echo $lastAction; ?>, <?php echo $actionId; ?>, <?php echo $lastAccountId; ?>)"
|
||||
title="<?php echo _('Atrás'); ?>">
|
||||
<i class="material-icons">arrow_back</i>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="<?php echo $tab->getId(); ?>" class="data-header">
|
||||
<ul class="round5 header-grey">
|
||||
<?php foreach ($tab->getHeader()->getHeaders() as $header): ?>
|
||||
<li style="width: <?php echo $tab->getHeader()->getWidth(); ?>%;"><?php echo $header; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="data-rows">
|
||||
<?php foreach ($tab->getData()->getData() as $item): ?>
|
||||
<ul>
|
||||
<?php foreach ($tab->getData()->getDataRowSources() as $rowSrc): ?>
|
||||
<?php if (is_array($rowSrc)): ?>
|
||||
<?php if ($item->$rowSrc[0] == 1): ?>
|
||||
<li class="cell-nodata"
|
||||
style="width: <?php echo $tab->getHeader()->getWidth(); ?>%;">
|
||||
<i class="material-icons" title="<?php echo $rowSrc[1]->getTitle(); ?>">
|
||||
<?php echo $rowSrc[1]->getIcon(); ?>
|
||||
</i>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<li class="cell-data" style="width: <?php echo $tab->getHeader()->getWidth(); ?>%;">
|
||||
<?php echo (!is_null($item->$rowSrc)) ? $item->$rowSrc : ' '; // Fix height ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<li class="cell-actions round">
|
||||
<?php foreach ($tab->getDataActions() as $action): ?>
|
||||
<?php if (!$action->isSkip()): ?>
|
||||
<?php if ($action->getFilterRowSource() && $item->{$action->getFilterRowSource()} == 1): continue; endif; ?>
|
||||
<i class="material-icons <?php echo $action->getIcon()->getClass(); ?>"
|
||||
title="<?php echo $action->getTitle(); ?>"
|
||||
data-itemid="<?php echo $item->{$tab->getData()->getDataRowSourceId()}; ?>"
|
||||
data-activetab="<?php echo $index; ?>"
|
||||
data-nextactionid="<?php echo $actionId; ?>"
|
||||
Onclick="<?php echo $action->getOnClick(); ?>"><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div id="pageNav" class="round shadow">
|
||||
<div id="pageNavLeft">
|
||||
<?php echo count($tab->getData()->getData()); ?> @ <?php echo $tab->getTime(); ?>s
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div> <!-- End Tabs-->
|
||||
|
||||
<script>
|
||||
$("#tabs").tabs({
|
||||
active: <?php echo $activeTabId; ?>,
|
||||
create: function (event, ui) {
|
||||
$("input:visible:first").focus();
|
||||
},
|
||||
activate: function (event, ui) {
|
||||
sysPassUtil.Common.setContentSize();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<div id="actions" class="upgrade" align="center">
|
||||
<div id="logo">
|
||||
<div id="pageDesc">
|
||||
<h1><?php echo _('Actualización') . ' ' . $version; ?></h1>
|
||||
<h1><?php echo _('Actualización') . ' ' . $appVersion; ?></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user