private function _getParams($groupName) { $where = "`config_group` = '{$groupName}' AND `type` != 'hidden' " . ($this->_type ? 'AND `custom` = 1' : '') . ' ORDER BY `order`'; $params = $this->_iaDb->all(iaDb::ALL_COLUMNS_SELECTION, $where, null, null, iaCore::getConfigTable()); if ($this->_type) { $custom = 'user' == $this->_type ? $this->_iaCore->getCustomConfig($this->_typeId) : $this->_iaCore->getCustomConfig(null, $this->_typeId); $custom2 = 'user' == $this->_type ? $this->_getUsersSpecificConfig() : array(); } $iaItem = $this->_iaCore->factory('item'); $itemsList = $iaItem->getItems(); foreach ($params as &$entry) { $className = 'default'; if ($this->_type) { $className = 'custom'; if (self::TYPE_DIVIDER != $entry['type']) { if (isset($custom2[$entry['name']])) { $entry['default'] = $custom2[$entry['name']]; $entry['value'] = $custom2[$entry['name']]; } else { $entry['default'] = $this->_iaCore->get($entry['name']); } if (isset($custom[$entry['name']])) { $className = 'common'; $entry['value'] = $custom[$entry['name']]; } } } if ('itemscheckbox' == $entry['type']) { $array = $this->_iaCore->get($entry['extras'] . '_items_implemented'); $array = $array ? explode(',', $array) : array(); $array = array_values(array_intersect($array, $itemsList)); if ($array) { $enabledItems = $iaItem->getEnabledItemsForPlugin($entry['extras']); for ($i = 0; $i < count($array); $i++) { $array[$i] = trim($array[$i]); $entry['items'][] = array('name' => $array[$i], 'title' => iaLanguage::get($array[$i]), 'checked' => (int) in_array($array[$i], $enabledItems)); } } } if (self::TYPE_SELECT == $entry['type']) { switch ($entry['name']) { case 'timezone': $entry['values'] = iaUtil::getFormattedTimezones(); break; case 'lang': $entry['values'] = $this->_iaCore->languages; break; default: $entry['values'] = explode(',', $entry['multiple_values']); } } $entry['class'] = $className; } return $params; }
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='******'user'] : '******' . $_GET['group']; $customUrl = iaSanitize::html($customUrl); } $iaView->assign('group', $groupData); $iaView->assign('params', $params); $iaView->assign('tooltips', iaLanguage::getTooltips()); $iaView->assign('url_custom', $customUrl); }