本文整理汇总了PHP中iaUsers::getUsergroupsTable方法的典型用法代码示例。如果您正苦于以下问题:PHP iaUsers::getUsergroupsTable方法的具体用法?PHP iaUsers::getUsergroupsTable怎么用?PHP iaUsers::getUsergroupsTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaUsers
的用法示例。
在下文中一共展示了iaUsers::getUsergroupsTable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setGroup
private function _setGroup(&$iaView, array $groupData)
{
$iaItem = $this->_iaCore->factory('item');
if ($this->_type) {
$entity = 'user' == $this->_type ? $this->_iaCore->factory('users')->getInfo($this->_typeId) : $this->_iaDb->row(array('name'), iaDb::convertIds($this->_typeId), iaUsers::getUsergroupsTable());
if (!$entity) {
return iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
$title = 'user' == $this->_type ? $entity['fullname'] : iaLanguage::get('usergroup_' . $entity['name']);
$title = iaLanguage::getf('custom_configuration_title', array('settings' => $groupData['title'], 'title' => $title, 'type' => strtolower(iaLanguage::get('user' == $this->_type ? 'member' : 'usergroup'))));
} else {
$title = $groupData['title'];
}
$iaView->title($title);
if ($groupData['extras']) {
$iaPage = $this->_iaCore->factory('page', iaCore::ADMIN);
$activeMenu = $groupData['name'];
if ($groupData['extras'] == $this->_iaCore->get('tmpl')) {
// template configuration options
$page = $iaPage->getByName('templates');
$iaView->set('group', $page['group']);
$iaView->set('active_config', $groupData['name']);
iaBreadcrumb::add($page['title'], IA_ADMIN_URL . $page['alias']);
} elseif ($pluginPage = $this->_iaDb->row(array('alias', 'group'), iaDb::printf("`name` = ':name' OR `name` = ':name_stats'", array('name' => $groupData['extras'])), iaPage::getAdminTable())) {
// it is a package
$iaView->set('group', $pluginPage['group']);
$iaView->set('active_config', $groupData['name']);
$activeMenu = null;
iaBreadcrumb::insert($groupData['title'], IA_ADMIN_URL . $pluginPage['alias'], iaBreadcrumb::POSITION_FIRST);
} elseif ($iaItem->isExtrasExist($groupData['extras'], iaItem::TYPE_PLUGIN)) {
// plugin with no admin pages
$iaView->set('group', 5);
$iaView->set('active_config', $groupData['extras']);
}
} else {
$activeMenu = 'configuration_' . $groupData['name'];
iaBreadcrumb::toEnd($groupData['title'], IA_SELF);
}
$iaView->set('active_menu', $activeMenu);
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->setTable(iaUsers::getUsergroupsTable());
$this->_iaUsers = $this->_iaCore->factory('users');
}
示例3: install
//.........这里部分代码省略.........
}
}
$iaDb->resetTable();
}
if ($this->itemData['blocks']) {
$iaBlock = $this->iaCore->factory('block', iaCore::ADMIN);
foreach ($this->itemData['blocks'] as $block) {
$iaBlock->insert($block);
}
}
if ($this->itemData['hooks']) {
$iaDb->setTable('hooks');
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['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->itemData['name'], $hook['code']);
}
$rawValues = array();
if (!isset($hook['order'])) {
$rawValues['order'] = ++$maxOrder;
}
$iaDb->insert($hook, $rawValues);
}
}
}
$iaDb->resetTable();
}
if ($this->itemData['usergroups']) {
$this->iaCore->factory('acl');
$iaDb->setTable(iaUsers::getUsergroupsTable());
foreach ($this->itemData['usergroups'] as $item) {
if (!$iaDb->exists('`name` = :name', array('name' => $item['name']))) {
$configs = $item['configs'];
$permissions = $item['permissions'];
$groupId = $iaDb->insert(array('extras' => $item['extras'], 'name' => $item['name'], 'system' => true, 'assignable' => $item['assignable'], 'visible' => $item['visible']));
// update language records
$this->_addPhrase('usergroup_' . $item['name'], $item['title']);
$iaDb->setTable(iaCore::getCustomConfigTable());
$iaDb->delete('`type` = :type AND `type_id` = :id', null, array('type' => iaAcl::GROUP, 'id' => $groupId));
foreach ($configs as $config) {
$data = array('name' => $config['name'], 'value' => $config['value'], 'type' => iaAcl::GROUP, 'type_id' => $groupId, 'extras' => $this->itemData['name']);
$iaDb->insert($data);
}
$iaDb->resetTable();
$iaDb->setTable('acl_privileges');
$iaDb->delete('`type` = :type AND `type_id` = :id', null, array('type' => iaAcl::GROUP, 'id' => $groupId));
foreach ($permissions as $permission) {
$data = array('object' => $permission['object'], 'object_id' => $permission['object_id'], 'action' => $permission['action'], 'access' => $permission['access'], 'type' => iaAcl::GROUP, 'type_id' => $groupId, 'extras' => $permission['extras']);
$iaDb->insert($data);
}
$iaDb->resetTable();
}
}
$iaDb->resetTable();
}
$extraEntry = array_merge($this->itemData['info'], array('name' => $this->itemData['name'], 'type' => $this->itemData['type']));
unset($extraEntry['date']);
if ($this->itemData['sql']['uninstall']) {
$extraEntry['uninstall_sql'] = serialize($this->itemData['sql']['uninstall']);
}
if ($this->itemData['code']['uninstall']) {
$extraEntry['uninstall_code'] = $this->itemData['code']['uninstall'];
示例4: _assignPermissionsValues
protected function _assignPermissionsValues(&$iaView, $entryData)
{
$iaAcl = $this->_iaCore->factory('acl');
$iaUsers = $this->_iaCore->factory('users');
$objectId = empty($entryData['name']) ? '' : $entryData['name'];
$objectName = substr($this->getName(), 0, -1);
$actionCode = $iaAcl->encodeAction($objectName, iaCore::ACTION_READ, $objectId);
$data = array();
$modified = false;
$usergroups = $this->_iaDb->all(array('id', 'name', 'system'), null, null, null, iaUsers::getUsergroupsTable());
foreach ($usergroups as $entry) {
if (iaUsers::MEMBERSHIP_ADMINISTRATOR == $entry['id']) {
continue;
}
$custom = array('group' => $entry['id'], 'perms' => $iaAcl->getPermissions(0, $entry['id']));
$data[] = array('id' => $entry['id'], 'title' => iaLanguage::get('usergroup_' . $entry['name']), 'default' => $iaAcl->checkAccess($objectName, $objectId, 0, 0, true), 'access' => (int) $iaAcl->checkAccess($objectName, $objectId, 0, 0, $custom), 'system' => $entry['system']);
if (isset($custom['perms'][$actionCode]) && !$modified) {
$modified = true;
}
}
$iaView->assign('ugp_modified', $modified);
$iaView->assign('ugp', $data);
}
示例5: array
<?php
//##copyright##
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
if (!iaUsers::hasIdentity()) {
return iaView::errorPage(iaView::ERROR_UNAUTHORIZED);
}
$iaField = $iaCore->factory('field');
$iaUsers = $iaCore->factory('users');
$itemName = $tableName = iaUsers::getTable();
$messages = array();
$assignableGroups = $iaDb->keyvalue(array('id', 'name'), '`assignable` = 1', iaUsers::getUsergroupsTable());
$iaPlan = $iaCore->factory('plan');
$plans = $iaPlan->getPlans($iaUsers->getItemName());
$iaDb->setTable($tableName);
if (isset($_POST['change_pass'])) {
$error = false;
$newPassword = empty($_POST['new']) ? false : $_POST['new'];
// checks for current password
if (iaUsers::getIdentity()->password != $iaUsers->encodePassword($_POST['current'])) {
$error = true;
$messages[] = iaLanguage::get('password_incorrect');
}
if (!$newPassword) {
$error = true;
$messages[] = iaLanguage::get('password_empty');
}
if ($newPassword != $_POST['confirm']) {
$error = true;
$messages[] = iaLanguage::get('error_password_match');
}
示例6: deleteUsergroup
public function deleteUsergroup($entryId)
{
$this->iaDb->setTable(iaUsers::getUsergroupsTable());
$usergroup = $this->iaDb->row(iaDb::ALL_COLUMNS_SELECTION, iaDb::convertIds($entryId));
$result = $this->iaDb->delete(iaDb::convertIds($entryId));
if ($result) {
// delete language records
iaLanguage::delete('usergroup_' . $usergroup['name']);
$this->iaDb->delete('`type` = :type AND `type_id` = :id', 'acl_privileges', array('type' => 'group', 'id' => $entryId));
// TODO: use the class method for this
$this->iaDb->update(array('usergroup_id' => iaUsers::MEMBERSHIP_REGULAR), iaDb::convertIds((int) $entryId, 'usergroup_id'), null, iaUsers::getTable());
}
$this->iaDb->resetTable();
return $result;
}
示例7: install
//.........这里部分代码省略.........
}
}
$iaDb->resetTable();
}
$iaBlock = $this->iaCore->factory('block', iaCore::ADMIN);
if ($this->itemData['blocks']) {
foreach ($this->itemData['blocks'] as $block) {
$iaBlock->insert($block);
}
}
if ($this->itemData['hooks']) {
$iaDb->setTable('hooks');
$maxOrder = $iaDb->getMaxOrder();
foreach ($this->itemData['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->itemData['name'], $hook['code']);
}
$rawValues = array();
if (!isset($hook['order'])) {
$rawValues['order'] = ++$maxOrder;
}
$iaDb->insert($hook, $rawValues);
}
}
}
$iaDb->resetTable();
}
if ($this->itemData['usergroups']) {
$this->iaCore->factory('acl');
$iaDb->setTable(iaUsers::getUsergroupsTable());
foreach ($this->itemData['usergroups'] as $item) {
if (!$iaDb->exists('`name` = :name', array('name' => $item['name']))) {
$configs = $item['configs'];
$permissions = $item['permissions'];
$groupId = $iaDb->insert(array('extras' => $item['extras'], 'name' => $item['name'], 'system' => true, 'assignable' => $item['assignable'], 'visible' => $item['visible']));
// update language records
$this->_addPhrase('usergroup_' . $item['name'], $item['title']);
$iaDb->setTable(iaCore::getCustomConfigTable());
$iaDb->delete('`type` = :type AND `type_id` = :id', null, array('type' => iaAcl::GROUP, 'id' => $groupId));
foreach ($configs as $config) {
$data = array('name' => $config['name'], 'value' => $config['value'], 'type' => iaAcl::GROUP, 'type_id' => $groupId, 'extras' => $this->itemData['name']);
$iaDb->insert($data);
}
$iaDb->resetTable();
$iaDb->setTable('acl_privileges');
$iaDb->delete('`type` = :type AND `type_id` = :id', null, array('type' => iaAcl::GROUP, 'id' => $groupId));
foreach ($permissions as $permission) {
$data = array('object' => $permission['object'], 'object_id' => $permission['object_id'], 'action' => $permission['action'], 'access' => $permission['access'], 'type' => iaAcl::GROUP, 'type_id' => $groupId, 'extras' => $permission['extras']);
$iaDb->insert($data);
}
$iaDb->resetTable();
}
}
$iaDb->resetTable();
}
$extraEntry = array_merge($this->itemData['info'], array('name' => $this->itemData['name'], 'type' => $this->itemData['type']));
unset($extraEntry['date']);
if ($this->itemData['sql']['uninstall']) {
$extraEntry['uninstall_sql'] = serialize($this->itemData['sql']['uninstall']);
}
if ($this->itemData['code']['uninstall']) {
$extraEntry['uninstall_code'] = $this->itemData['code']['uninstall'];
示例8: _listMembers
private function _listMembers()
{
$sql = 'SELECT m.`id`, m.`fullname`, g.`name` `usergroup`, IF(m.`usergroup_id` = 1, 1, p.`access`) `admin_access` ' . 'FROM `:prefix:table_members` m ' . 'LEFT JOIN `:prefix:table_groups` g ON (m.`usergroup_id` = g.`id`) ' . "LEFT JOIN `:prefix:table_privileges` p ON (p.`type_id` = m.`id` AND p.`type` = 'user' AND p.`object` = 'admin_access')" . 'WHERE m.`id` IN (' . "SELECT DISTINCT `type_id` FROM `:prefix:table_privileges` WHERE `type` = 'user'" . ')';
$sql = iaDb::printf($sql, array('prefix' => $this->_iaDb->prefix, 'table_members' => iaUsers::getTable(), 'table_groups' => iaUsers::getUsergroupsTable(), 'table_privileges' => 'acl_privileges'));
return $this->_iaDb->getAll($sql);
}