本文整理汇总了PHP中iaCore::getConfigGroupsTable方法的典型用法代码示例。如果您正苦于以下问题:PHP iaCore::getConfigGroupsTable方法的具体用法?PHP iaCore::getConfigGroupsTable怎么用?PHP iaCore::getConfigGroupsTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaCore
的用法示例。
在下文中一共展示了iaCore::getConfigGroupsTable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _indexPage
protected function _indexPage(&$iaView)
{
if (!empty($_GET['group'])) {
$this->_type = 'group';
$this->_typeId = (int) $_GET['group'];
iaBreadcrumb::preEnd(iaLanguage::get('usergroups'), IA_ADMIN_URL . 'usergroups/');
} elseif (!empty($_GET['user'])) {
$this->_type = 'user';
$this->_typeId = (int) $_GET['user'];
iaBreadcrumb::preEnd(iaLanguage::get('members'), IA_ADMIN_URL . 'members/');
}
$groupName = isset($this->_iaCore->requestPath[0]) ? $this->_iaCore->requestPath[0] : 'general';
$groupData = $this->_iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $groupName), iaCore::getConfigGroupsTable());
if (empty($groupData)) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$this->_setGroup($iaView, $groupData);
if (isset($_POST['save'])) {
$this->_save($iaView);
}
$iaView->assign('custom', (bool) $this->_type);
$iaView->assign('group', $groupData);
$iaView->assign('params', $this->_getParams($groupName));
$iaView->assign('tooltips', iaLanguage::getTooltips());
}
示例2: getAdminMenu
public function getAdminMenu()
{
$iaDb =& $this->iaCore->iaDb;
$result = array();
$menuGroups = array();
$extras = $this->iaCore->get('extras');
$stmt = "`extras` IN ('', '" . implode("','", $extras) . "')";
$rows = $iaDb->all(array('id', 'name', 'title'), $stmt . ' ORDER BY `order`', null, null, 'admin_pages_groups');
foreach ($rows as $row) {
$menuGroups[$row['id']] = array_merge($row, array('items' => array()));
}
$this->iaCore->factory('item');
$sql = 'SELECT g.`name` `config`, e.`type`, ' . 'p.`id`, p.`group`, p.`name`, p.`parent`, p.`title`, p.`attr`, p.`alias`, p.`extras` ' . 'FROM `:prefix:table_admin_pages` p ' . 'LEFT JOIN `:prefix:table_config_groups` g ON ' . "(p.`extras` IN (':extras') AND p.`extras` = g.`extras`) " . 'LEFT JOIN `:prefix:table_extras` e ON ' . "(p.`extras` = e.`name`) " . 'WHERE p.`group` IN (:groups) ' . "AND FIND_IN_SET('menu', p.`menus`) " . "AND p.`status` = ':status' " . "AND p.`extras` IN ('',':extras') " . 'ORDER BY p.`order`';
$sql = iaDb::printf($sql, array('prefix' => $iaDb->prefix, 'table_admin_pages' => 'admin_pages', 'table_config_groups' => iaCore::getConfigGroupsTable(), 'table_extras' => iaItem::getExtrasTable(), 'groups' => implode(',', array_keys($menuGroups)), 'status' => iaCore::STATUS_ACTIVE, 'extras' => implode("','", $extras)));
$rows = $iaDb->getAll($sql);
foreach ($rows as $row) {
$menuGroups[$row['group']]['items'][] = $row;
}
$iaAcl = $this->iaCore->factory('acl');
// config groups to be included as menu items
$rows = $iaDb->all(array('name', 'title', 'extras'), "`name` != 'email_templates' AND " . $stmt . ' ORDER BY `order`', null, null, iaCore::getConfigGroupsTable());
$configGroups = array();
$templateName = $this->iaCore->get('tmpl');
foreach ($rows as $row) {
switch (true) {
case $templateName == $row['extras']:
$configGroups['template'] = $row['name'];
break;
case $row['extras']:
$row['config'] = $row['name'];
$configGroups['plugins'][$row['extras']] = $row;
break;
default:
$row['url'] = 'configuration' . IA_URL_DELIMITER . $row['name'] . IA_URL_DELIMITER;
$row['name'] = 'configuration_' . $row['name'];
$configGroups['common'][] = $row;
}
}
//
foreach ($menuGroups as $group) {
if (!$group['items']) {
continue;
}
$separatorsCount = 0;
$menuEntry = $group;
$menuEntry['items'] = array();
if (1 == $group['id']) {
$menuEntry['items'] = $configGroups['common'];
}
foreach ($group['items'] as $item) {
if ($iaAcl->checkAccess(iaAcl::OBJECT_ADMIN_PAGE . iaAcl::SEPARATOR . iaCore::ACTION_READ, $item['name'])) {
$title = iaLanguage::get($item['title'], $item['title']);
$data = array('name' => $item['name'], 'parent' => isset($item['parent']) ? $item['parent'] : null, 'title' => $title);
if ($item['alias']) {
$data['url'] = IA_ADMIN_URL . $item['alias'];
}
if (isset($item['attr']) && $item['attr']) {
$data['attr'] = $item['attr'];
}
if ($item['type'] != iaItem::TYPE_PACKAGE && isset($item['config']) && $item['config']) {
$data['config'] = $item['config'];
}
if ('templates' == $item['name'] && isset($configGroups['template'])) {
$data['config'] = $configGroups['template'];
}
if (isset($configGroups['plugins'][$item['extras']])) {
unset($configGroups['plugins'][$item['extras']]);
}
$menuEntry['items'][] = $data;
if (empty($item['name'])) {
$separatorsCount++;
}
}
}
// delete separators if no elements allowed
if ($separatorsCount == count($menuEntry['items'])) {
unset($menuEntry['items']);
}
if (isset($menuEntry['items'][0]['name']) && $menuEntry['items'][0]['name']) {
$menuHeading = array('name' => null, 'title' => iaLanguage::get('global'));
if (iaItem::TYPE_PACKAGE == $item['type']) {
$menuHeading['config'] = $item['extras'];
}
array_unshift($menuEntry['items'], $menuHeading);
}
$result[$group['name']] = $menuEntry;
}
if (!empty($configGroups['plugins'])) {
$result['extensions']['items'] = array_merge($result['extensions']['items'], array_values($configGroups['plugins']));
}
return $result;
}
示例3: install
public function install()
{
$iaDb =& $this->iaDb;
$this->iaCore->startHook('phpExtrasInstallBefore', array('extra' => $this->itemData['name']));
$extrasList = array();
$array = $iaDb->all(array('id', 'name', 'version'), "`status` = 'active'", null, null, self::getTable());
foreach ($array as $item) {
$extrasList[$item['name']] = $item;
}
// TODO: check for relations and deactivate all needed extras
if ($this->itemData['requirements']) {
$messages = array();
foreach ($this->itemData['requirements'] as $requirement) {
if ($requirement['min'] || $requirement['max']) {
$min = $max = false;
if (isset($extrasList[$requirement['name']])) {
$info = $extrasList[$requirement['name']];
$min = $requirement['min'] ? version_compare($requirement['min'], $info['version'], '<=') : true;
$max = $requirement['max'] ? version_compare($requirement['max'], $info['version'], '>=') : true;
}
if (!$max || !$min) {
$ver = '';
if ($requirement['min']) {
$ver .= $requirement['min'];
}
if ($requirement['max']) {
if ($requirement['min']) {
$ver .= '-';
}
$ver .= $requirement['max'];
}
$values = array(':extra' => $requirement['type'], ':name' => $requirement['name'], ':version' => $ver);
$messages[] = iaLanguage::getf('required_extras_error', $values);
$this->error = true;
} else {
// TODO: add relations in database to deactivate when parent is uninstalled
}
}
}
if ($this->error) {
$this->setMessage(implode('<br />', $messages));
return false;
}
}
$this->uninstall($this->itemData['name']);
if (false !== stristr('update', $this->itemData['name'])) {
$this->isUpdate = true;
}
if ($this->itemData['groups']) {
$iaDb->setTable('admin_pages_groups');
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['groups'] as $block) {
$iaDb->insert($block, array('order' => ++$maxOrder));
}
$iaDb->resetTable();
}
if ($this->itemData['pages']['admin']) {
$iaDb->setTable('admin_pages');
$order = (int) $iaDb->one('MAX(`order`)', "`menus` IN ('menu')");
$order = max($order, 1);
foreach ($this->itemData['pages']['admin'] as $page) {
if (is_null($page['order'])) {
$order += 5;
$page['order'] = $order;
}
if ($page['group']) {
$this->_menuGroups[] = $page['group'];
}
$page['group'] = $this->_lookupGroupId($page['group']);
$iaDb->insert($page);
}
$iaDb->resetTable();
}
if ($this->itemData['actions']) {
$iaDb->setTable('admin_actions');
foreach ($this->itemData['actions'] as $action) {
$action['name'] = strtolower(str_replace(' ', '_', $action['name']));
if ($action['name'] && !$iaDb->exists('`name` = :name', array('name' => $action['name']))) {
$action['order'] = empty($action['order']) || !is_numeric($action['order']) ? $iaDb->getMaxOrder() + 1 : $action['order'];
$iaDb->insert($action);
}
}
$iaDb->resetTable();
}
if ($this->itemData['phrases']) {
$this->_processPhrases($this->itemData['phrases']);
}
if ($this->itemData['config_groups']) {
$iaDb->setTable(iaCore::getConfigGroupsTable());
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['config_groups'] as $config) {
$iaDb->insert($config, array('order' => ++$maxOrder));
}
$iaDb->resetTable();
}
if ($this->itemData['objects']) {
$iaDb->setTable('acl_objects');
foreach ($this->itemData['objects'] as $obj) {
if ($obj['title']) {
$key = ($obj['object'] == $obj['pre_object'] ? '' : $obj['pre_object'] . '-') . $obj['object'] . '--' . $obj['action'];
//.........这里部分代码省略.........
示例4: install
public function install($type = self::SETUP_REPLACE)
{
$iaDb =& $this->iaDb;
// TODO: check for relations and deactivate all needed extras
if ($this->_requires) {
$messages = array();
foreach ($this->_requires as $require) {
if ($require['min'] || $require['max']) {
$min = $max = false;
if (isset($extrasList[$require['name']])) {
$info = $extrasList[$require['name']];
$min = $require['min'] ? version_compare($require['min'], $info['version'], '<=') : true;
$max = $require['max'] ? version_compare($require['max'], $info['version'], '>=') : true;
}
if (!$max || !$min) {
$ver = '';
if ($require['min']) {
$ver .= $require['min'];
}
if ($require['max']) {
if ($require['min']) {
$ver .= '-';
}
$ver .= $require['max'];
}
$replace = array(':extra' => $require['type'], ':name' => $require['name'], ':version' => $ver);
$messages[] = iaLanguage::getf('required_template_error', $replace);
$this->error = true;
} else {
// TODO: add relations in database to deactivate when parent is uninstalled
}
}
}
if ($this->error) {
$this->_message = implode('<br>', $messages);
return false;
}
}
if (self::SETUP_REPLACE == $type) {
$template = $iaDb->one('value', "`name` = 'tmpl'", iaCore::getConfigTable());
$tablesList = array('hooks', 'blocks', iaLanguage::getTable(), 'pages', iaCore::getConfigTable(), iaCore::getConfigGroupsTable(), iaCore::getCustomConfigTable());
$iaDb->cascadeDelete($tablesList, "`extras` = '{$template}'");
$iaDb->cascadeDelete($tablesList, "`extras` = '{$this->name}'");
}
$iaDb->update(array('value' => $this->name), "`name` = 'tmpl'", null, iaCore::getConfigTable());
if ($this->_phrases) {
$this->_processPhrases();
}
if ($this->_config) {
$iaDb->setTable(iaCore::getConfigTable());
$maxOrder = $iaDb->one_bind('MAX(`order`) + 1', '`extras` = :extras', array('extras' => $this->name));
$maxOrder = $maxOrder ? (int) $maxOrder : 1;
foreach ($this->_config as $entry) {
$id = $this->iaDb->one(iaDb::ID_COLUMN_SELECTION, iaDb::convertIds($entry['name'], 'name'));
$entry['order'] = isset($entry['order']) ? $entry['order'] : ++$maxOrder;
if (!$id || empty($entry['name'])) {
$this->iaDb->insert($entry);
} elseif ($id) {
if (isset($entry['value'])) {
unset($entry['value']);
}
$this->iaDb->update($entry, iaDb::convertIds($id));
}
}
$iaDb->resetTable();
}
if ($this->_configGroups) {
$iaDb->setTable(iaCore::getConfigGroupsTable());
$maxOrder = $iaDb->getMaxOrder() + 1;
foreach ($this->_configGroups as $title => $entry) {
$iaDb->insert($entry, array('order' => $maxOrder));
$this->_addPhrase('config_group_' . $entry['name'], $title, iaLanguage::CATEGORY_ADMIN);
$maxOrder++;
}
$iaDb->resetTable();
}
if ($this->_hooks) {
$iaDb->setTable('hooks');
$maxOrder = $iaDb->one('MAX(`order`) + 1');
$maxOrder = $maxOrder ? $maxOrder : 1;
foreach ($this->_hooks as $hook) {
$array = explode(',', $hook['name']);
foreach ($array as $hookName) {
if (trim($hookName)) {
$hook['name'] = $hookName;
if (isset($hook['code']) && $hook['code']) {
$hook['code'] = str_replace('{extras}', $this->name, $hook['code']);
}
$iaDb->insert($hook, array('order' => $maxOrder));
$maxOrder++;
}
}
}
$iaDb->resetTable();
}
$positionsList = array();
if ($this->_positions) {
$positionPages = array();
$iaDb->setTable('positions');
$iaDb->truncate();
//.........这里部分代码省略.........
示例5: install
public function install()
{
$iaDb =& $this->iaDb;
$this->iaCore->startHook('phpExtrasInstallBefore', array('extra' => $this->itemData['name']));
$extrasList = array();
$array = $iaDb->all(array('id', 'name', 'version'), "`status` = 'active'", null, null, self::getTable());
foreach ($array as $item) {
$extrasList[$item['name']] = $item;
}
// TODO: check for relations and deactivate all needed extras
if ($this->itemData['requirements']) {
$messages = array();
foreach ($this->itemData['requirements'] as $requirement) {
if ($requirement['min'] || $requirement['max']) {
$min = $max = false;
if (isset($extrasList[$requirement['name']])) {
$info = $extrasList[$requirement['name']];
$min = $requirement['min'] ? version_compare($requirement['min'], $info['version'], '<=') : true;
$max = $requirement['max'] ? version_compare($requirement['max'], $info['version'], '>=') : true;
}
if (!$max || !$min) {
$ver = '';
if ($requirement['min']) {
$ver .= $requirement['min'];
}
if ($requirement['max']) {
if ($requirement['min']) {
$ver .= '-';
}
$ver .= $requirement['max'];
}
$values = array(':extra' => $requirement['type'], ':name' => $requirement['name'], ':version' => $ver);
$messages[] = iaLanguage::getf('required_extras_error', $values);
$this->error = true;
} else {
// TODO: add relations in database to deactivate when parent is uninstalled
}
}
}
if ($this->error) {
$this->setMessage(implode('<br />', $messages));
return false;
}
}
$this->uninstall($this->itemData['name']);
if (false !== stristr('update', $this->itemData['name'])) {
$this->isUpdate = true;
}
$this->_processQueries('install', self::SQL_STAGE_START);
if ($this->itemData['groups']) {
$iaDb->setTable('admin_pages_groups');
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['groups'] as $title => $entry) {
$iaDb->insert($entry, array('order' => ++$maxOrder));
$this->_addPhrase('pages_group_' . $entry['name'], $title, iaLanguage::CATEGORY_ADMIN);
}
$iaDb->resetTable();
}
if ($this->itemData['pages']['admin']) {
$this->_processAdminPages($this->itemData['pages']['admin']);
}
if ($this->itemData['actions']) {
$iaDb->setTable('admin_actions');
foreach ($this->itemData['actions'] as $action) {
$action['name'] = strtolower(str_replace(' ', '_', $action['name']));
if ($action['name'] && !$iaDb->exists('`name` = :name', array('name' => $action['name']))) {
$action['order'] = empty($action['order']) || !is_numeric($action['order']) ? $iaDb->getMaxOrder() + 1 : $action['order'];
$iaDb->insert($action);
}
}
$iaDb->resetTable();
}
if ($this->itemData['phrases']) {
$this->_processPhrases($this->itemData['phrases']);
}
if ($this->itemData['config_groups']) {
$iaDb->setTable(iaCore::getConfigGroupsTable());
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['config_groups'] as $title => $entry) {
$iaDb->insert($entry, array('order' => ++$maxOrder));
$this->_addPhrase('config_group_' . $entry['name'], $title, iaLanguage::CATEGORY_ADMIN);
}
$iaDb->resetTable();
}
if ($this->itemData['objects']) {
$iaDb->setTable('acl_objects');
foreach ($this->itemData['objects'] as $obj) {
if ($obj['title']) {
$key = ($obj['object'] == $obj['pre_object'] ? '' : $obj['pre_object'] . '-') . $obj['object'] . '--' . $obj['action'];
iaLanguage::addPhrase($key, $obj['title'], null, $this->itemData['name'], iaLanguage::CATEGORY_COMMON, false);
unset($obj['title']);
}
$iaDb->insert($obj);
}
$iaDb->resetTable();
}
if ($this->itemData['permissions']) {
$iaDb->setTable('acl_privileges');
foreach ($this->itemData['permissions'] as $permission) {
$iaDb->insert($permission);
//.........这里部分代码省略.........
示例6: _indexPage
protected function _indexPage(&$iaView)
{
$type = null;
$customEntryId = false;
if (isset($_GET['group'])) {
$type = 'group';
$customEntryId = (int) $_GET['group'];
iaBreadcrumb::preEnd(iaLanguage::get('usergroups'), IA_ADMIN_URL . 'usergroups/');
} elseif (isset($_GET['user'])) {
$type = 'user';
$customEntryId = (int) $_GET['user'];
iaBreadcrumb::preEnd(iaLanguage::get('members'), IA_ADMIN_URL . 'members/');
}
if (isset($_POST['save'])) {
$this->_save($iaView, $type, $customEntryId);
}
$iaItem = $this->_iaCore->factory('item');
$groupName = isset($this->_iaCore->requestPath[0]) ? $this->_iaCore->requestPath[0] : 'general';
$groupData = $this->_iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $groupName), iaCore::getConfigGroupsTable());
if (empty($groupData)) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$this->_setGroup($iaView, $iaItem, $groupData);
$where = "`config_group` = '{$groupName}' AND `type` != 'hidden' " . ($type ? 'AND `custom` = 1' : '') . ' ORDER BY `order`';
$params = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, $where, null, null, iaCore::getConfigTable());
if ($type) {
$custom = 'user' == $type ? $this->_iaCore->getCustomConfig($customEntryId) : $this->_iaCore->getCustomConfig(false, $customEntryId);
$custom2 = array();
if ('user' == $type) {
$custom2 = $this->_iaDb->getKeyValue('SELECT d.`name`, d.`value` ' . "FROM `{$this->_iaCore->iaDb->prefix}config_custom` d, `{$this->_iaCore->iaDb->prefix}members` a " . "WHERE d.`type` = 'group' AND d.`type_id` = a.`usergroup_id` AND a.`id` = '{$customEntryId}'");
}
}
$itemsList = $iaItem->getItems();
foreach ($params as $index => $item) {
$className = 'default';
if ($type) {
$className = 'custom';
if (self::TYPE_DIVIDER != $item['type']) {
if (isset($custom2[$item['name']])) {
$params[$index]['dtype'] = 'usergroup';
$params[$index]['default'] = $custom2[$item['name']];
$params[$index]['value'] = $custom2[$item['name']];
} else {
$params[$index]['dtype'] = 'core';
$params[$index]['default'] = $this->_iaCore->get($item['name']);
}
if (isset($custom[$item['name']])) {
$className = 'common';
$params[$index]['value'] = $custom[$item['name']];
}
}
}
if ('itemscheckbox' == $item['type']) {
$array = $this->_iaCore->get($item['extras'] . '_items_implemented');
$array = $array ? explode(',', $array) : array();
$array = array_values(array_intersect($array, $itemsList));
if ($array) {
$enabledItems = $iaItem->getEnabledItemsForPlugin($item['extras']);
for ($i = 0; $i < count($array); $i++) {
$array[$i] = trim($array[$i]);
$params[$index]['items'][] = array('name' => $array[$i], 'title' => iaLanguage::get($array[$i]), 'checked' => (int) in_array($array[$i], $enabledItems));
}
}
}
if ('select' == $item['type']) {
switch ($item['name']) {
case 'timezone':
$params[$index]['values'] = iaUtil::getFormattedTimezones();
break;
case 'lang':
$params[$index]['values'] = $this->_iaCore->languages;
break;
default:
$params[$index]['values'] = explode(',', $item['multiple_values']);
}
}
$params[$index]['classname'] = $className;
}
$customUrl = '';
if ($type) {
$customUrl = isset($_GET['user']) ? '?user=' . $_GET['user'] : '?group=' . $_GET['group'];
$customUrl = iaSanitize::html($customUrl);
}
$iaView->assign('group', $groupData);
$iaView->assign('params', $params);
$iaView->assign('tooltips', iaLanguage::getTooltips());
$iaView->assign('url_custom', $customUrl);
}
示例7: _getGroupByName
protected function _getGroupByName($groupName)
{
$result = $this->_iaDb->row_bind(iaDb::ALL_COLUMNS_SELECTION, '`name` = :name', array('name' => $groupName), iaCore::getConfigGroupsTable());
empty($result) || ($result['title'] = iaLanguage::get('config_group_' . $result['name']));
return $result;
}