public function wallpost_form(BlockInstance $instance, $replyto = '', $replyuser = '') { if ($replyuser) { $walltoreplyto = self::get_wall_id_for_user($replyuser); } else { $walltoreplyto = $instance->get('id'); } require_once 'pieforms/pieform.php'; return pieform(array('name' => 'wallpost_' . $instance->get('id'), 'renderer' => 'maharatable', 'autofocus' => false, 'jsform' => true, 'template' => 'wallpost.php', 'templatedir' => pieform_template_dir('wallpost.php', 'blocktype/wall'), 'successcallback' => array('PluginBlocktypeWall', 'wallpost_submit'), 'jssuccesscallback' => 'wallpost_success', 'elements' => array('text' => array('type' => 'textarea', 'description' => bbcode_format_post_message(), 'rows' => 3, 'cols' => 50, 'defaultvalue' => '', 'width' => '100%', 'rules' => array('required' => true, 'maxlength' => get_config_plugin('blocktype', 'wall', 'defaultpostsizelimit'))), 'postsizelimit' => array('type' => 'html', 'value' => get_string('maxcharacters', 'blocktype.wall', get_config_plugin('blocktype', 'wall', 'defaultpostsizelimit'))), 'private' => array('type' => 'checkbox', 'title' => get_string('makeyourpostprivate', 'blocktype.wall')), 'instance' => array('type' => 'hidden', 'value' => $walltoreplyto), 'replyto' => array('type' => 'hidden', 'value' => $replyto), 'submit' => array('type' => 'submit', 'value' => get_string('Post', 'blocktype.wall'))))); // TODO if replying here, add select element for replyto other wall or own wall // depending on if the user we're replying to has a wall }
function add_feedback_form($attachments = false) { global $USER; $form = array('name' => 'add_feedback_form', 'method' => 'post', 'plugintype' => 'core', 'pluginname' => 'view', 'jsform' => true, 'autofocus' => false, 'elements' => array(), 'jssuccesscallback' => 'addFeedbackSuccess'); if (!$USER->is_logged_in()) { $form['elements']['authorname'] = array('type' => 'text', 'title' => get_string('name'), 'rules' => array('required' => true)); } $form['elements']['message'] = array('type' => 'textarea', 'title' => get_string('message'), 'rows' => 5, 'cols' => 80, 'description' => bbcode_format_post_message()); $form['elements']['ispublic'] = array('type' => 'checkbox', 'title' => get_string('makepublic', 'view')); if ($attachments) { $form['elements']['attachment'] = array('type' => 'file', 'title' => get_string('attachfile', 'view')); } $form['elements']['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('placefeedback', 'view'), get_string('cancel'))); return $form; }