/**
  * Show the form to edit permissions
  *
  * @access	public
  * @return	void		Outputs to screen
  **/
 public function permEditForm()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['f'] = intval($this->request['f']);
     //-----------------------------------------
     // check..
     //-----------------------------------------
     if (!$this->request['f']) {
         $this->registry->output->showError($this->lang->words['for_noid'], 11316);
     }
     //-----------------------------------------
     // Get this forum details
     //-----------------------------------------
     $forum = $this->forum_functions->forum_by_id[$this->request['f']];
     //-----------------------------------------
     // Next id...
     //-----------------------------------------
     $relative = $this->getNextId($this->request['f']);
     //-----------------------------------------
     // check...
     //-----------------------------------------
     if (!$forum['id']) {
         $this->registry->output->showError($this->lang->words['for_noid'], 11317);
     }
     //-----------------------------------------
     // HTML
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php';
     $permissions = new classPublicPermissions(ipsRegistry::instance());
     if ($forum['parent_id'] != 'root') {
         $perm_matrix = $permissions->adminPermMatrix('forum', $forum);
     } else {
         $perm_matrix = $permissions->adminPermMatrix('forum', $forum, 'forums', 'view');
     }
     $this->registry->output->html .= $this->html->forumPermissionForm($forum, $relative, $perm_matrix, $forum);
 }
 /**
  * Add/Edit Calendar Form
  *
  * @access	public
  * @param	string	$type	Either new or edit
  * @return	void
  */
 public function calendarForm($type = 'new')
 {
     //-----------------------------------------
     // Init Vars
     //-----------------------------------------
     $cal_id = $this->request['cal_id'] ? intval($this->request['cal_id']) : 0;
     $form = array();
     $form['perm_read'] = "";
     $form['perm_post'] = "";
     $form['perm_nomod'] = "";
     $form['perm_read_all'] = "";
     $form['perm_post_all'] = "";
     $form['perm_nomod_all'] = "";
     /* New Calendar */
     if ($type == 'new') {
         /* Form Bits */
         $formcode = 'calendar_add_do';
         $title = $this->lang->words['c_addcal'];
         $button = $this->lang->words['c_addcal'];
         /* Data */
         $calendar = array('perm_read' => '', 'perm_post' => '', 'perm_nomod' => '', 'cal_title' => '', 'cal_moderate' => '', 'cal_event_limit' => '', 'cal_bday_limit' => '', 'cal_rss_export' => '', 'cal_rss_update' => '', 'cal_rss_export_days' => '', 'cal_rss_export_max' => '', 'cal_id' => 0);
     } else {
         /* Data */
         $calendar = $this->DB->buildAndFetch(array('select' => 'c.*', 'from' => array('cal_calendars' => 'c'), 'where' => 'c.cal_id=' . $cal_id, 'add_join' => array(array('select' => 'p.*', 'from' => array('permission_index' => 'p'), 'where' => "p.perm_type='calendar' AND perm_type_id=c.cal_id", 'type' => 'left'))));
         if (!$calendar['cal_id']) {
             $this->registry->output->global_message = $this->lang->words['c_noid'];
             $this->calendarsList();
             return;
         }
         /* Form Bits */
         $formcode = 'calendar_edit_do';
         $title = $this->lang->words['c_editbutton'] . $calendar['cal_title'];
         $button = $this->lang->words['c_savebutton'];
     }
     /* Permissions */
     require_once IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php';
     $permissions = new classPublicPermissions(ipsRegistry::instance());
     $form['perm_matrix'] = $permissions->adminPermMatrix('calendar', $calendar);
     /* Form Elements */
     $form['cal_title'] = $this->registry->output->formInput('cal_title', IPSText::htmlspecialchars((isset($_POST['cal_title']) and $_POST['cal_title']) ? $_POST['cal_title'] : $calendar['cal_title']));
     $form['cal_moderate'] = $this->registry->output->formYesNo('cal_moderate', (isset($this->request['cal_moderate']) and $this->request['cal_moderate']) ? $this->request['cal_moderate'] : $calendar['cal_moderate']);
     $form['cal_event_limit'] = $this->registry->output->formSimpleInput('cal_event_limit', (isset($this->request['cal_event_limit']) and $this->request['cal_event_limit']) ? $this->request['cal_event_limit'] : $calendar['cal_event_limit'], 5);
     $form['cal_bday_limit'] = $this->registry->output->formSimpleInput('cal_bday_limit', (isset($this->request['cal_bday_limit']) and $this->request['cal_bday_limit']) ? $this->request['cal_bday_limit'] : $calendar['cal_bday_limit'], 5);
     $form['cal_rss_export'] = $this->registry->output->formYesNo('cal_rss_export', (isset($this->request['cal_rss_export']) and $this->request['cal_rss_export']) ? $this->request['cal_rss_export'] : $calendar['cal_rss_export']);
     $form['cal_rss_update'] = $this->registry->output->formSimpleInput('cal_rss_update', (isset($this->request['cal_rss_update']) and $this->request['cal_rss_update']) ? $this->request['cal_rss_update'] : $calendar['cal_rss_update'], 5);
     $form['cal_rss_export_days'] = $this->registry->output->formSimpleInput('cal_rss_export_days', (isset($this->request['cal_rss_export_days']) and $this->request['cal_rss_export_days']) ? $this->request['cal_rss_export_days'] : $calendar['cal_rss_export_days'], 5);
     $form['cal_rss_export_max'] = $this->registry->output->formSimpleInput('cal_rss_export_max', (isset($this->request['cal_rss_export_max']) and $this->request['cal_rss_export_max']) ? $this->request['cal_rss_export_max'] : $calendar['cal_rss_export_max'], 5);
     /* Output */
     $this->registry->output->html .= $this->html->calendarForm($form, $title, $formcode, $button, $calendar);
 }