本文整理汇总了PHP中Redaxscript\Db::forTablePrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::forTablePrefix方法的具体用法?PHP Db::forTablePrefix怎么用?PHP Db::forTablePrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redaxscript\Db
的用法示例。
在下文中一共展示了Db::forTablePrefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* process the class
*
* @since 3.0.0
*
* @return string
*/
public function process()
{
$specialFilter = new Filter\Special();
$emailFilter = new Filter\Email();
$emailValidator = new Validator\Email();
$loginValidator = new Validator\Login();
$auth = new Auth($this->_request);
/* process post */
$postArray = ['password' => $specialFilter->sanitize($this->_request->getPost('password')), 'task' => $this->_request->getPost('task'), 'solution' => $this->_request->getPost('solution')];
/* user and email */
$users = Db::forTablePrefix('users');
if ($emailValidator->validate($this->_request->getPost('user')) === Validator\ValidatorInterface::PASSED) {
$postArray['user'] = $emailFilter->sanitize($this->_request->getPost('user'));
$users->where('email', $postArray['user']);
} else {
if ($loginValidator->validate($this->_request->getPost('user')) === Validator\ValidatorInterface::PASSED) {
$postArray['user'] = $specialFilter->sanitize($this->_request->getPost('user'));
$users->where('user', $postArray['user']);
}
}
$user = $users->where('status', 1)->findOne();
/* handle error */
$messageArray = $this->_validate($postArray, $user);
if ($messageArray) {
return $this->_error(['message' => $messageArray]);
}
/* handle success */
if ($auth->login($user->id)) {
return $this->_success();
}
return $this->_error(['message' => $this->_language->get('something_wrong')]);
}
示例2: tearDownAfterClass
/**
* tearDownAfterClass
*
* @since 3.0.0
*/
public static function tearDownAfterClass()
{
Db::setSetting('captcha', 0);
Db::setSetting('notification', 0);
Db::setSetting('moderation', 0);
Db::forTablePrefix('comments')->deleteMany();
}
示例3: testInsertData
/**
* testInsertData
*
* @since 2.4.0
*/
public function testInsertData()
{
/* setup */
$installer = new Installer();
$installer->init($this->_config);
$installer->insertData(array('adminName' => 'Admin', 'adminUser' => 'admin', 'adminPassword' => 'admin', 'adminEmail' => 'admin@localhost'));
/* actual */
$actualArticles = Db::forTablePrefix('articles')->findMany()->count();
$actualCategories = Db::forTablePrefix('categories')->findMany()->count();
$actualExtras = Db::forTablePrefix('extras')->findMany()->count();
$actualGroups = Db::forTablePrefix('groups')->findMany()->count();
$actualSettings = Db::forTablePrefix('settings')->findMany()->count();
if (is_dir('modules/CallHome')) {
$actualModules = Db::forTablePrefix('modules')->findMany()->count();
}
$actualUsers = Db::forTablePrefix('users')->findMany()->count();
/* compare */
$this->assertEquals(1, $actualArticles);
$this->assertEquals(1, $actualCategories);
$this->assertEquals(6, $actualExtras);
$this->assertEquals(2, $actualGroups);
$this->assertEquals(26, $actualSettings);
if (is_dir('modules/CallHome')) {
$this->assertEquals(1, $actualModules);
}
$this->assertEquals(1, $actualUsers);
}
示例4: _autorun
/**
* automate run
*
* @since 2.1.0
*/
protected function _autorun()
{
$dbStatus = $this->_registry->get('dbStatus');
$lastTable = $this->_registry->get('lastTable');
$lastId = $this->_registry->get('lastId');
/* detect language */
$this->_detect(['query' => $this->_request->getQuery('l'), 'session' => $this->_request->getSession('language'), 'contents' => $lastTable ? Db::forTablePrefix($lastTable)->where('id', $lastId)->findOne()->language : null, 'settings' => $dbStatus === 2 ? Db::getSetting('language') : null, 'browser' => substr($this->_request->getServer('HTTP_ACCEPT_LANGUAGE'), 0, 2), 'fallback' => 'en'], 'language', 'languages/' . $this->_filePlaceholder . '.json');
}
示例5: render
/**
* render the view
*
* @since 3.0.0
*
* @param integer $moduleId identifier of the module
*
* @return string
*/
public function render($moduleId = null)
{
$output = Hook::trigger('adminModuleFormStart');
$module = Db::forTablePrefix('modules')->whereIdIs($moduleId)->findOne();
/* html elements */
$titleElement = new Html\Element();
$titleElement->init('h2', ['class' => 'rs-admin-title-content']);
$titleElement->text($module->name);
$linkElement = new Html\Element();
$linkElement->init('a');
$itemElement = new Html\Element();
$itemElement->init('li');
$listElement = new Html\Element();
$listElement->init('ul', ['class' => 'rs-admin-js-list-tab rs-admin-list-tab']);
$formElement = new AdminForm($this->_registry, $this->_language);
$formElement->init(['form' => ['action' => $this->_registry->get('parameterRoute') . ($module->id ? 'admin/process/modules/' . $module->id : 'admin/process/modules'), 'class' => 'rs-admin-js-tab rs-admin-js-validate-form rs-admin-component-tab rs-admin-form-default rs-admin-fn-clearfix'], 'link' => ['cancel' => ['href' => $this->_registry->get('modulesEdit') && $this->_registry->get('modulesUninstall') ? $this->_registry->get('parameterRoute') . 'admin/view/modules' : $this->_registry->get('parameterRoute') . 'admin'], 'uninstall' => ['href' => $module->alias ? $this->_registry->get('parameterRoute') . 'admin/uninstall/modules/' . $module->alias . '/' . $this->_registry->get('token') : null]]]);
/* docs directory */
$docsDirectory = new Directory();
$docsDirectory->init('modules/' . $module->alias . '/docs');
$docsDirectoryArray = $docsDirectory->getArray();
/* collect item output */
$tabCounter = 1;
$tabRoute = $this->_registry->get('parameterRoute') . $this->_registry->get('fullRoute');
$outputItem = $itemElement->copy()->addClass('rs-admin-js-item-active rs-admin-item-active')->html($linkElement->copy()->attr('href', $tabRoute . '#tab-' . $tabCounter++)->text($this->_language->get('module')));
/* process directory */
foreach ($docsDirectoryArray as $value) {
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-' . $tabCounter++)->text(pathinfo($value, PATHINFO_FILENAME)));
}
/* collect item output */
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-' . $tabCounter++)->text($this->_language->get('customize')));
$listElement->append($outputItem);
/* create the form */
$tabCounter = 1;
$formElement->append($listElement)->append('<div class="rs-admin-js-box-tab rs-admin-box-tab rs-admin-box-tab">')->append('<fieldset id="tab-' . $tabCounter++ . '" class="rs-admin-js-set-tab rs-admin-js-set-active rs-admin-set-tab rs-admin-set-active"><ul><li>')->label($this->_language->get('name'), ['for' => 'name'])->text(['autofocus' => 'autofocus', 'id' => 'name', 'name' => 'name', 'required' => 'required', 'value' => $module->name])->append('</li><li>')->label($this->_language->get('description'), ['for' => 'description'])->textarea(['class' => 'rs-admin-js-auto-resize rs-admin-field-textarea rs-admin-field-small', 'id' => 'description', 'name' => 'description', 'rows' => 1, 'value' => $module->description])->append('</li></ul></fieldset>');
/* second tab */
if ($docsDirectoryArray) {
/* process directory */
foreach ($docsDirectoryArray as $value) {
$formElement->append('<fieldset id="tab-' . $tabCounter++ . '" class="rs-admin-js-set-tab rs-admin-set-tab">')->append(Template\Tag::partial('modules/' . $module->alias . '/docs/' . $value))->append('</fieldset>');
}
}
/* last tab */
$formElement->append('<fieldset id="tab-' . $tabCounter++ . '" class="rs-admin-js-set-tab rs-admin-set-tab"><ul><li>')->label($this->_language->get('status'), ['for' => 'status'])->select(Helper\Option::getToggleArray(), ['id' => 'status', 'name' => 'status', 'value' => intval($module->status)])->append('</li>');
if ($this->_registry->get('groupsEdit')) {
$formElement->append('<li>')->label($this->_language->get('access'), ['for' => 'access'])->select(Helper\Option::getAccessArray('groups'), ['id' => 'access', 'name' => 'access[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getAccessArray('groups')), 'value' => $module->access])->append('</li>');
}
$formElement->append('</ul></fieldset></div>')->token()->cancel();
if ($this->_registry->get('modulesUninstall')) {
$formElement->uninstall();
}
if ($this->_registry->get('modulesEdit')) {
$formElement->save();
}
/* collect output */
$output .= $titleElement . $formElement;
$output .= Hook::trigger('adminModuleFormEnd');
return $output;
}
示例6: render
/**
* render
*
* @since 2.5.0
*
* @return string
*/
public static function render()
{
/* query categories */
$categories = Db::forTablePrefix('categories')->where('status', 1)->whereNull('access')->orderByAsc('rank')->findMany();
/* query articles */
$articles = Db::forTablePrefix('articles')->where('status', 1)->whereNull('access')->orderByAsc('rank')->findMany();
/* write xml */
return self::_writeXML($categories, $articles);
}
示例7: render
/**
* render
*
* @since 2.2.0
*
* @return string
*/
public static function render()
{
$output = null;
$outputItem = null;
/* html elements */
$titleElement = new Html\Element();
$titleElement->init('h3', array('class' => self::$_config['className']['title']));
$linkElement = new Html\Element();
$linkElement->init('a');
$listElement = new Html\Element();
$listElement->init('ul', array('class' => self::$_config['className']['list']));
/* fetch articles */
$articles = Db::forTablePrefix('articles')->where('status', 1)->whereIn('language', array(Registry::get('language'), ''))->orderByDesc('category')->findArray();
/* process articles */
if (!$articles) {
$error = Language::get('article_no') . Language::get('point');
} else {
$accessValidator = new Validator\Access();
$accessDeny = 0;
$lastCategory = 0;
foreach ($articles as $value) {
if ($accessValidator->validate($value['access'], Registry::get('myGroups')) === Validator\ValidatorInterface::PASSED) {
$currentCategory = $value['category'];
/* collect output */
if ($lastCategory != $currentCategory) {
if ($lastCategory > 0) {
$output .= $listElement->html($outputItem);
$outputItem = null;
}
$output .= $titleElement->text($currentCategory < 1 ? Language::get('uncategorized') : Db::forTablePrefix('categories')->whereIdIs($currentCategory)->findOne()->title);
}
/* collect item output */
$outputItem .= '<li>';
$outputItem .= $linkElement->attr(array('href' => $value['category'] < 1 ? $value['alias'] : build_route('articles', $value['id']), 'title' => $value['description'] ? $value['description'] : $value['title']))->text($value['title']);
$outputItem .= '</li>';
/* collect list output */
if (end($articles) === $value) {
$output .= $listElement->html($outputItem);
$outputItem = null;
}
$lastCategory = $currentCategory;
} else {
$accessDeny++;
}
}
/* handle access */
if (count($articles) === $accessDeny) {
$error = Language::get('access_no') . Language::get('point');
}
}
/* handle error */
if ($error) {
$output = $listElement->html('<li>' . $error . '</li>');
}
return $output;
}
示例8: render
/**
* render the view
*
* @since 3.0.0
*
* @param integer $userId identifier of the user
*
* @return string
*/
public function render($userId = null)
{
$output = Hook::trigger('adminUserFormStart');
$user = Db::forTablePrefix('users')->whereIdIs($userId)->findOne();
/* html elements */
$titleElement = new Html\Element();
$titleElement->init('h2', ['class' => 'rs-admin-title-content']);
$titleElement->text($user->name ? $user->name : $this->_language->get('user_new'));
$linkElement = new Html\Element();
$linkElement->init('a');
$itemElement = new Html\Element();
$itemElement->init('li');
$listElement = new Html\Element();
$listElement->init('ul', ['class' => 'rs-admin-js-list-tab rs-admin-list-tab']);
$formElement = new AdminForm($this->_registry, $this->_language);
$formElement->init(['form' => ['action' => $this->_registry->get('parameterRoute') . ($user->id ? 'admin/process/users/' . $user->id : 'admin/process/users'), 'class' => 'rs-admin-js-tab rs-admin-js-validate-form rs-admin-component-tab rs-admin-form-default rs-admin-fn-clearfix'], 'link' => ['cancel' => ['href' => $this->_registry->get('usersEdit') && $this->_registry->get('usersDelete') ? $this->_registry->get('parameterRoute') . 'admin/view/users' : $this->_registry->get('parameterRoute') . 'admin'], 'delete' => ['href' => $user->id ? $this->_registry->get('parameterRoute') . 'admin/delete/users/' . $user->id . '/' . $this->_registry->get('token') : null]]]);
/* collect item output */
$tabRoute = $this->_registry->get('parameterRoute') . $this->_registry->get('fullRoute');
$outputItem = $itemElement->copy()->addClass('rs-admin-js-item-active rs-admin-item-active')->html($linkElement->copy()->attr('href', $tabRoute . '#tab-1')->text($this->_language->get('user')));
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-2')->text($this->_language->get('general')));
if (!$user->id || $user->id > 1) {
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-3')->text($this->_language->get('customize')));
}
$listElement->append($outputItem);
/* create the form */
$formElement->append($listElement)->append('<div class="rs-admin-js-box-tab rs-admin-box-tab">')->append('<fieldset id="tab-1" class="rs-admin-js-set-tab rs-admin-js-set-active rs-admin-set-tab rs-admin-set-active"><ul><li>')->label($this->_language->get('name'), ['for' => 'name'])->text(['autofocus' => 'autofocus', 'id' => 'name', 'name' => 'name', 'required' => 'required', 'value' => $user->name])->append('</li>');
if (!$user->id) {
$formElement->append('<li>')->label($this->_language->get('user'), ['for' => 'user'])->text(['id' => 'user', 'name' => 'user', 'pattern' => '[a-zA-Z0-9]{1,30}', 'required' => 'required', 'value' => $user->user])->append('</li>');
}
$formElement->append('<li>')->label($this->_language->get('password'), ['for' => 'password'])->password(['id' => 'password', 'pattern' => '[a-zA-Z0-9]{1,30}', 'name' => 'password'])->append('</li><li>')->label($this->_language->get('password_confirm'), ['for' => 'password_confirm'])->password(['id' => 'password_confirm', 'pattern' => '[a-zA-Z0-9]{1,30}', 'name' => 'password_confirm'])->append('</li><li>')->label($this->_language->get('email'), ['for' => 'email'])->email(['id' => 'email', 'name' => 'email', 'required' => 'required', 'value' => $user->email])->append('</li><li>')->label($this->_language->get('description'), ['for' => 'description'])->textarea(['class' => 'rs-admin-js-auto-resize rs-admin-field-textarea rs-admin-field-small', 'id' => 'description', 'name' => 'description', 'rows' => 1, 'value' => $user->description])->append('</li></ul></fieldset>')->append('<fieldset id="tab-2" class="rs-admin-js-set-tab rs-admin-set-tab"><ul><li>')->label($this->_language->get('language'), ['for' => 'language'])->select(Helper\Option::getLanguageArray(), ['id' => 'language', 'name' => 'language', 'value' => $user->language])->append('</li></ul></fieldset>');
/* last tab */
if (!$user->id || $user->id > 1) {
$formElement->append('<fieldset id="tab-3" class="rs-admin-js-set-tab rs-admin-set-tab"><ul><li>')->label($this->_language->get('status'), ['for' => 'status'])->select(Helper\Option::getToggleArray(), ['id' => 'status', 'name' => 'status', 'value' => $user->id ? intval($user->status) : 1])->append('</li>');
if ($this->_registry->get('groupsEdit')) {
$formElement->append('<li>')->label($this->_language->get('groups'), ['for' => 'groups'])->select(Helper\Option::getAccessArray('groups'), ['id' => 'groups', 'name' => 'groups[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getAccessArray('groups')), 'value' => $user->groups])->append('</li>');
}
$formElement->append('</ul></fieldset>');
}
$formElement->append('</div>')->token()->cancel();
if ($user->id) {
if (($this->_registry->get('usersDelete') || $this->_registry->get('myId') === $user->id) && $user->id > 1) {
$formElement->delete();
}
if ($this->_registry->get('usersEdit') || $this->_registry->get('myId') === $user->id) {
$formElement->save();
}
} else {
if ($this->_registry->get('usersNew')) {
$formElement->create();
}
}
/* collect output */
$output .= $titleElement . $formElement;
$output .= Hook::trigger('adminUserFormEnd');
return $output;
}
示例9: _autorun
/**
* automate run
*
* @since 2.1.0
*/
protected function _autorun()
{
$dbStatus = $this->_registry->get('dbStatus');
$lastTable = $this->_registry->get('lastTable');
$lastId = $this->_registry->get('lastId');
$fileInstall = $this->_registry->get('file') === 'install.php';
$partial = $fileInstall ? 'install.phtml' : 'index.phtml';
/* detect template */
$this->_detect(['query' => $this->_request->getQuery('t'), 'session' => $this->_request->getSession('template'), 'contents' => $lastTable ? Db::forTablePrefix($lastTable)->where('id', $lastId)->findOne()->template : null, 'settings' => $dbStatus === 2 ? Db::getSetting('template') : null, 'install' => $fileInstall ? 'install' : null, 'fallback' => 'default'], 'template', 'templates/' . $this->_filePlaceholder . '/' . $partial);
}
示例10: testUninstall
/**
* testUninstall
*
* @since 2.2.0
*/
public function testUninstall()
{
/* setup */
$module = new Module();
$module->init(array('alias' => 'Test'));
$module->uninstall();
/* actual */
$actual = Db::forTablePrefix('modules')->where('alias', 'Test')->findOne();
/* compare */
$this->assertFalse(is_object($actual));
}
示例11: _module
/**
* uninstall the module
*
* @since 3.0.0
*
* @param array $optionArray
*
* @return boolean
*/
protected function _module($optionArray = [])
{
$alias = $this->prompt('alias', $optionArray);
$moduleClass = 'Redaxscript\\Modules\\' . $alias . '\\' . $alias;
if (class_exists($moduleClass)) {
$module = new $moduleClass();
$module->uninstall();
return !Db::forTablePrefix('modules')->where('alias', $alias)->count();
}
return false;
}
示例12: render
/**
* render
*
* @since 2.2.0
*
* @return string
*/
public static function render()
{
$output = '';
$outputItem = '';
/* html elements */
$titleElement = new Element('h3', array('class' => self::$_config['className']['title']));
$linkElement = new Element('a');
$listElement = new Element('ul', array('class' => self::$_config['className']['list']));
/* fetch articles */
$articles = Db::forTablePrefix('articles')->selectExpr('*, YEAR(date) as year, MONTH(date) as month')->where('status', 1)->whereIn('language', array(Registry::get('language'), ''))->orderByDesc('date')->findArray();
/* process articles */
if (empty($articles)) {
$error = Language::get('article_no') . Language::get('point');
} else {
$accessValidator = new Validator\Access();
$accessDeny = 0;
$lastDate = 0;
foreach ($articles as $value) {
if ($accessValidator->validate($value['access'], Registry::get('myGroups')) === Validator\ValidatorInterface::PASSED) {
$currentDate = $value['month'] + $value['year'];
/* collect output */
if ($lastDate != $currentDate) {
if ($lastDate > 0) {
$output .= $listElement->html($outputItem);
$outputItem = '';
}
$output .= $titleElement->text(Language::get($value['month'] - 1, '_month') . ' ' . $value['year']);
}
/* collect item output */
$outputItem .= '<li>';
$outputItem .= $linkElement->attr(array('href' => $value['category'] < 1 ? $value['alias'] : build_route('articles', $value['id']), 'title' => $value['description'] ? $value['description'] : $value['title']))->text($value['title']);
$outputItem .= '</li>';
/* collect list output */
if (end($articles) === $value) {
$output .= $listElement->html($outputItem);
$outputItem = '';
}
$lastDate = $currentDate;
} else {
$accessDeny++;
}
}
/* handle access */
if (count($articles) === $accessDeny) {
$error = Language::get('access_no') . Language::get('point');
}
}
/* handle error */
if ($error) {
$output = $listElement->html('<li>' . $error . '</li>');
}
return $output;
}
示例13: testUninstall
/**
* testUninstall
*
* @since 2.6.0
*/
public function testUninstall()
{
/* setup */
$module = new Module();
$module->init(array('alias' => 'TestDummy'));
$module->uninstall();
/* actual */
$actualModules = Db::forTablePrefix('modules')->findMany()->count();
$actualTables = Db::countTablePrefix();
/* compare */
$this->assertEquals(1, $actualModules);
$this->assertEquals(8, $actualTables);
}
示例14: render
/**
* render
*
* @since 2.2.0
*
* @return string
*/
public static function render()
{
$output = null;
/* html elements */
$titleElement = new Html\Element();
$titleElement->init('h3', ['class' => self::$_configArray['className']['title']]);
$linkElement = new Html\Element();
$linkElement->init('a');
$listElement = new Html\Element();
$listElement->init('ul', ['class' => self::$_configArray['className']['list']]);
/* query articles */
$articles = Db::forTablePrefix('articles')->where('status', 1)->whereLanguageIs(Registry::get('language'))->orderByDesc('date')->findMany();
/* process articles */
if (!$articles) {
$error = Language::get('article_no') . Language::get('point');
} else {
$accessValidator = new Validator\Access();
$accessDeny = 0;
$lastDate = 0;
foreach ($articles as $value) {
if ($accessValidator->validate($value->access, Registry::get('myGroups')) === Validator\ValidatorInterface::PASSED) {
$month = date('n', strtotime($value->date));
$year = date('Y', strtotime($value->date));
$currentDate = $month + $year;
/* collect output */
if ($lastDate != $currentDate) {
$output .= $titleElement->text(Language::get($month - 1, '_month') . ' ' . $year);
}
$lastDate = $currentDate;
/* collect item output */
$outputItem = '<li>';
$outputItem .= $linkElement->attr(['href' => Registry::get('parameterRoute') . build_route('articles', $value->id), 'title' => $value->description ? $value->description : $value->title])->text($value->title);
$outputItem .= '</li>';
/* collect list output */
$output .= $listElement->html($outputItem);
} else {
$accessDeny++;
}
}
/* handle access */
if (count($articles) === $accessDeny) {
$error = Language::get('access_no') . Language::get('point');
}
}
/* handle error */
if ($error) {
$output = $listElement->html('<li>' . $error . '</li>');
}
return $output;
}
示例15: render
/**
* render the view
*
* @since 3.0.0
*
* @param integer $groupId identifier of the group
*
* @return string
*/
public function render($groupId = null)
{
$output = Hook::trigger('adminGroupFormStart');
$group = Db::forTablePrefix('groups')->whereIdIs($groupId)->findOne();
/* html elements */
$titleElement = new Html\Element();
$titleElement->init('h2', ['class' => 'rs-admin-title-content']);
$titleElement->text($group->name ? $group->name : $this->_language->get('group_new'));
$linkElement = new Html\Element();
$linkElement->init('a');
$itemElement = new Html\Element();
$itemElement->init('li');
$listElement = new Html\Element();
$listElement->init('ul', ['class' => 'rs-admin-js-list-tab rs-admin-list-tab']);
$formElement = new AdminForm($this->_registry, $this->_language);
$formElement->init(['form' => ['action' => $this->_registry->get('parameterRoute') . ($group->id ? 'admin/process/groups/' . $group->id : 'admin/process/groups'), 'class' => 'rs-admin-js-tab rs-admin-js-validate-form rs-admin-component-tab rs-admin-form-default rs-admin-fn-clearfix'], 'link' => ['cancel' => ['href' => $this->_registry->get('groupsEdit') && $this->_registry->get('groupsDelete') ? $this->_registry->get('parameterRoute') . 'admin/view/groups' : $this->_registry->get('parameterRoute') . 'admin'], 'delete' => ['href' => $group->id ? $this->_registry->get('parameterRoute') . 'admin/delete/groups/' . $group->id . '/' . $this->_registry->get('token') : null]]]);
/* collect item output */
$tabRoute = $this->_registry->get('parameterRoute') . $this->_registry->get('fullRoute');
$outputItem = $itemElement->copy()->addClass('rs-admin-js-item-active rs-admin-item-active')->html($linkElement->copy()->attr('href', $tabRoute . '#tab-1')->text($this->_language->get('group')));
if (!$group->id || $group->id > 1) {
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-2')->text($this->_language->get('access')));
$outputItem .= $itemElement->copy()->html($linkElement->copy()->attr('href', $tabRoute . '#tab-3')->text($this->_language->get('customize')));
}
$listElement->append($outputItem);
/* create the form */
$formElement->append($listElement)->append('<div class="rs-admin-js-box-tab rs-admin-box-tab rs-admin-box-tab">')->append('<fieldset id="tab-1" class="rs-admin-js-set-tab rs-admin-js-set-active rs-admin-set-tab rs-admin-set-active"><ul><li>')->label($this->_language->get('name'), ['for' => 'name'])->text(['autofocus' => 'autofocus', 'id' => 'name', 'name' => 'name', 'required' => 'required', 'value' => $group->name])->append('</li><li>')->label($this->_language->get('user'), ['for' => 'user'])->text(['id' => 'alias', 'name' => 'alias', 'pattern' => '[a-zA-Z0-9-]+', 'required' => 'required', 'value' => $group->alias])->append('</li><li>')->label($this->_language->get('description'), ['for' => 'description'])->textarea(['class' => 'rs-admin-js-auto-resize rs-admin-field-textarea rs-admin-field-small', 'id' => 'description', 'name' => 'description', 'rows' => 1, 'value' => $group->description])->append('</li></ul></fieldset>');
/* second tab */
if (!$group->id || $group->id > 1) {
$formElement->append('<fieldset id="tab-2" class="rs-admin-js-set-tab rs-admin-set-tab"><ul><li>')->label($this->_language->get('categories'), ['for' => 'categories'])->select(Helper\Option::getPermissionArray(), ['id' => 'categories', 'name' => 'categories[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->categories])->append('</li><li>')->label($this->_language->get('articles'), ['for' => 'articles'])->select(Helper\Option::getPermissionArray(), ['id' => 'articles', 'name' => 'articles[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->articles])->append('</li><li>')->label($this->_language->get('extras'), ['for' => 'extras'])->select(Helper\Option::getPermissionArray(), ['id' => 'extras', 'name' => 'extras[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->extras])->append('</li><li>')->label($this->_language->get('comments'), ['for' => 'comments'])->select(Helper\Option::getPermissionArray(), ['id' => 'comments', 'name' => 'comments[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->comments])->append('</li><li>')->label($this->_language->get('groups'), ['for' => 'groups'])->select(Helper\Option::getPermissionArray(), ['id' => 'groups', 'name' => 'groups[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->groups])->append('</li><li>')->label($this->_language->get('users'), ['for' => 'users'])->select(Helper\Option::getPermissionArray(), ['id' => 'users', 'name' => 'users[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray()), 'value' => $group->users])->append('</li><li>')->label($this->_language->get('modules'), ['for' => 'modules'])->select(Helper\Option::getPermissionArray('modules'), ['id' => 'modules', 'name' => 'modules[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray('modules')), 'value' => $group->modules])->append('</li><li>')->label($this->_language->get('settings'), ['for' => 'settings'])->select(Helper\Option::getPermissionArray('settings'), ['id' => 'settings', 'name' => 'settings[]', 'multiple' => 'multiple', 'size' => count(Helper\Option::getPermissionArray('settings')), 'value' => intval($group->settings)])->append('</li></ul></fieldset>')->append('<fieldset id="tab-3" class="rs-admin-js-set-tab rs-admin-set-tab"><ul><li>')->label($this->_language->get('filter'), ['for' => 'filter'])->select(Helper\Option::getToggleArray(), ['id' => 'filter', 'name' => 'filter', 'value' => $group->id ? $group->filter : 1])->append('</li><li>')->label($this->_language->get('status'), ['for' => 'status'])->select(Helper\Option::getToggleArray(), ['id' => 'status', 'name' => 'status', 'value' => $group->id ? intval($group->status) : 1])->append('</li></ul></fieldset>');
}
$formElement->append('</div>')->token()->cancel();
if ($group->id) {
if ($this->_registry->get('groupsDelete') && $group->id > 1) {
$formElement->delete();
}
if ($this->_registry->get('groupsEdit')) {
$formElement->save();
}
} else {
if ($this->_registry->get('groupsNew')) {
$formElement->create();
}
}
/* collect output */
$output .= $titleElement . $formElement;
$output .= Hook::trigger('adminGroupFormEnd');
return $output;
}