private function formTag(Slay_Song $song) { $data = array(); $user = GWF_Session::getUser(); $votes = Slay_TagVote::getVotes($song, $user); $html = '<div class="tinytagger">'; foreach (Slay_Tag::getTagNames() as $tag) { $checked = in_array($tag, $votes, true) ? ' checked="checked"' : ''; // $data["tag_$tag"] = array(GWF_Form::CHECKBOX, $checked, $this->module->lang('tag', array($tag, $song->getVotePercent($tag)))); $perc = $song->getVotePercent($tag); $key = $perc > 0 ? 'tag' : 'tag2'; $text = $this->module->lang($key, array($tag, $song->getVotePercent($tag))); $html .= sprintf('<input type="checkbox" name="tag_%s"%s /><span>%s</span>', $tag, $checked, $text); } $html .= '</div>' . PHP_EOL; $data['html'] = array(GWF_Form::HTML, $html); $data['doit'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_tag')); return new GWF_Form($this, $data); }