/** * Get tempcode for adding/editing form. * * @param SHORT_TEXT The name of the multi moderation * @param LONG_TEXT The text to place as a post in the topic when the multi moderation is performed * @param ?AUTO_LINK Move the topic to this forum (NULL: don't move) * @param ?BINARY What to change the pin state to (NULL: don't change) * @param ?BINARY What to change the open state to (NULL: don't change) * @param ?BINARY What to change the sink state to (NULL: don't change) * @param SHORT_TEXT The forum multicode identifying where the multimoderation is applicable * @param SHORT_TEXT The title suffix * @return tempcode The input fields */ function get_form_fields($name = '', $post_text = '', $move_to = NULL, $pin_state = NULL, $open_state = NULL, $sink_state = NULL, $forum_multi_code = '*', $title_suffix = '') { require_code('ocf_forums2'); $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME'), 'name', $name, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('_POST'), do_lang_tempcode('DESCRIPTION_MULTI_MODERATION_POST'), 'post_text', $post_text, false)); $fields->attach(form_input_tree_list(do_lang_tempcode('DESTINATION'), do_lang_tempcode('DESCRIPTION_DESTINATION_FORUM'), 'move_to', NULL, 'choose_forum', array(), false, is_null($move_to) ? NULL : strval($move_to))); $pin_state_list = new ocp_tempcode(); $pin_state_list->attach(form_input_radio_entry('pin_state', '-1', is_null($pin_state), do_lang_tempcode('NA_EM'))); $pin_state_list->attach(form_input_radio_entry('pin_state', '0', $pin_state === 0, do_lang_tempcode('UNPIN_TOPIC'))); $pin_state_list->attach(form_input_radio_entry('pin_state', '1', $pin_state === 1, do_lang_tempcode('PIN_TOPIC'))); $fields->attach(form_input_radio(do_lang_tempcode('PIN_STATE'), do_lang_tempcode('DESCRIPTION_PIN_STATE'), 'pin_state', $pin_state_list)); $open_state_list = new ocp_tempcode(); $open_state_list->attach(form_input_radio_entry('open_state', '-1', is_null($open_state), do_lang_tempcode('NA_EM'))); $open_state_list->attach(form_input_radio_entry('open_state', '0', $open_state === 0, do_lang_tempcode('CLOSE_TOPIC'))); $open_state_list->attach(form_input_radio_entry('open_state', '1', $open_state === 1, do_lang_tempcode('OPEN_TOPIC'))); $fields->attach(form_input_radio(do_lang_tempcode('OPEN_STATE'), do_lang_tempcode('DESCRIPTION_OPEN_STATE'), 'open_state', $open_state_list)); $sink_state_list = new ocp_tempcode(); $sink_state_list->attach(form_input_radio_entry('sink_state', '-1', is_null($sink_state), do_lang_tempcode('NA_EM'))); $sink_state_list->attach(form_input_radio_entry('sink_state', '0', $sink_state === 0, do_lang_tempcode('SINK_TOPIC'))); $sink_state_list->attach(form_input_radio_entry('sink_state', '1', $sink_state === 1, do_lang_tempcode('UNSINK_TOPIC'))); $fields->attach(form_input_radio(do_lang_tempcode('SINK_STATE'), do_lang_tempcode('DESCRIPTION_SINK_STATE'), 'sink_state', $sink_state_list)); $fields->attach(ocf_get_forum_multi_code_field($forum_multi_code)); $fields->attach(form_input_line(do_lang_tempcode('TITLE_SUFFIX'), do_lang_tempcode('DESCRIPTION_TITLE_SUFFIX'), 'title_suffix', $title_suffix, false)); return $fields; }
/** * Get tempcode for a post template adding/editing form. * * @param SHORT_TEXT The title (name) of the post template * @param LONG_TEXT The actual post template text * @param SHORT_TEXT Multi-code identifying forums it is applicable to * @param BINARY Whether to use as the default post for applicable forums * @return tempcode The input fields */ function get_form_fields($title = '', $text = '', $forum_multi_code = '', $use_default_forums = 0) { $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('_POST'), do_lang_tempcode('DESCRIPTION_POST_TEMPLATE_X'), 'text', $text, true)); $fields->attach(ocf_get_forum_multi_code_field($forum_multi_code)); $fields->attach(form_input_tick(do_lang_tempcode('DEFAULT'), do_lang_tempcode('USE_AS_DEFAULT_ON_APPLICABLE_FORUMS'), 'use_default_forums', $use_default_forums == 1)); return $fields; }