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()); }
public final function process() { $iaView =& $this->_iaCore->iaView; $this->_iaDb->setTable($this->getTable()); if (iaView::REQUEST_JSON == $iaView->getRequestType()) { switch ($iaView->get('action')) { case iaCore::ACTION_READ: $output = $this->_gridRead($_GET); break; case iaCore::ACTION_EDIT: $output = $this->_gridUpdate($_POST); break; case iaCore::ACTION_DELETE: $output = $this->_gridDelete($_POST); break; default: $output = $this->_jsonAction($iaView); } $iaView->assign($output); } if (iaView::REQUEST_HTML == $iaView->getRequestType()) { switch ($iaView->get('action')) { case iaCore::ACTION_READ: $this->_indexPage($iaView); break; case iaCore::ACTION_ADD: if (!$this->_processAdd) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $entry = array(); $this->_setDefaultValues($entry); // intentionally missing BREAK stmt // intentionally missing BREAK stmt case iaCore::ACTION_EDIT: if (iaCore::ACTION_EDIT == $iaView->get('action')) { if (!$this->_processEdit) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $this->_entryId = isset($this->_iaCore->requestPath[0]) ? $this->_iaCore->requestPath[0] : null; if (!$this->getEntryId()) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } $entry = $this->getById($this->_entryId); if (empty($entry)) { return iaView::errorPage(iaView::ERROR_NOT_FOUND); } unset($entry['id']); } $data = $_POST; // own variable copy if (isset($data['save'])) { $reopenOption = empty($data['goto']) ? null : $data['goto']; unset($data['save'], $data['goto'], $data['v']); $result = $this->_saveEntry($iaView, $entry, $data); $iaView->setMessages($this->getMessages(), $result ? iaView::SUCCESS : iaView::ERROR); empty($result) || $this->_reopen($reopenOption, $iaView->get('action')); } $this->_assignValues($iaView, $entry); $this->_assignGoto($iaView); empty($this->_permissionsEdit) || $this->_assignPermissionsValues($iaView, $entry); $this->_defaultAssigns($iaView, $entry); if ($this->_tooltipsEnabled) { $iaView->assign('tooltips', iaLanguage::getTooltips()); } if (!$this->_systemFieldsEnabled) { $iaView->assign('noSystemFields', true); } $this->_setPageTitle($iaView, $entry, $iaView->get('action')); $iaView->display($this->_template); break; default: $this->_htmlAction($iaView); } } $this->_iaDb->resetTable(); }
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); }