/** * Show the add/edit group form * * @access private * @param string 'add' or 'edit' * @return void [Outputs to screen] */ private function _groupForm($type = 'edit') { //----------------------------------------- // Grab group data and start us off //----------------------------------------- if ($type == 'edit') { if ($this->request['id'] == "") { $this->registry->output->showError($this->lang->words['g_whichgroup'], 11210); } $group = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']))); $group = IPSLib::unpackGroup($group); //----------------------------------------- // Check restrictions. //----------------------------------------- if ($group['g_access_cp']) { $this->registry->getClass('class_permissions')->checkPermissionAutoMsg('groups_edit_admin'); } } else { $group = array(); if ($this->request['id']) { $group = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'groups', 'where' => "g_id=" . intval($this->request['id']))); $group = IPSLib::unpackGroup($group); } $group['g_title'] = 'New Group'; } //----------------------------------------- // Grab permission masks //----------------------------------------- $perm_masks = array(); $this->DB->build(array('select' => '*', 'from' => 'forum_perms')); $this->DB->execute(); while ($r = $this->DB->fetch()) { $perm_masks[] = array($r['perm_id'], $r['perm_name']); } //----------------------------------------- // Ok? Load interface and child classes //----------------------------------------- $blocks = array('tabs' => array(), 'area' => array()); IPSLib::loadInterface('admin/group_form.php'); $tabsUsed = 2; foreach (ipsRegistry::$applications as $app_dir => $app_data) { if (!IPSLib::appIsInstalled($app_dir)) { continue; } if (file_exists(IPSLib::getAppDir($app_dir) . '/extensions/admin/group_form.php')) { require_once IPSLib::getAppDir($app_dir) . '/extensions/admin/group_form.php'; $_class = 'admin_group_form__' . $app_dir; if (class_exists($_class)) { $_object = new $_class($this->registry); $data = $_object->getDisplayContent($group, $tabsUsed); $blocks['area'][$app_dir] = $data['content']; $blocks['tabs'][$app_dir] = $data['tabs']; $tabsUsed = $data['tabsUsed'] ? $tabsUsed + $data['tabsUsed'] : $tabsUsed + 1; } } } //----------------------------------------- // And output to form //----------------------------------------- $this->registry->output->html .= $this->html->groupsForm($type, $group, $perm_masks, $blocks); }