Package com.liferay.portlet.polls.model

Examples of com.liferay.portlet.polls.model.PollsChoice


      List choices = pollsAPI.getChoices(questionId);
      Iterator itr = choices.iterator();
 
      htmlResult.append("<table class='poll-answer-table' id='answer" + questionId + "'>");
      while (itr.hasNext()) {
        PollsChoice choice = (PollsChoice) itr.next();
       
        htmlResult.append("<tr><td class='poll-radio'>");
        htmlResult
            .append("<input type='radio' name='question" + questionId + "' id='choice-" + choice.getChoiceId() + "'  value='"
            + choice.getChoiceId() + "'/>");
        htmlResult.append("</td><td class='poll-label'>");
        htmlResult.append("<label for='choice-"+ choice.getChoiceId() +"'>" + choice.getDescription() + "</label>");
        htmlResult.append("</td></tr>");
      }
     
     
View Full Code Here


    htmlResult.append("<div id='result" + questionId + "'>");
    //htmlResult.append("<h2>" + question.getDescription() + "</h2>");
    htmlResult.append("<table class='poll-result-table'>");

    for (int i = 0; i < choices.size(); i++) {
      PollsChoice choice = (PollsChoice) choices.get(i);

      int choiceVotes = pollsAPI.getChoiceVotes(questionId, choice
          .getChoiceId());

      double votesPercent = 0.0;
      if (totalVotes > 0) {
        votesPercent = (double) choiceVotes / totalVotes;
      }
     
      htmlResult.append("<tr>");
        htmlResult.append("<td  colspan=4 class='poll-question'>");
          htmlResult.append(choice.getDescription());
        htmlResult.append("</td>");
      htmlResult.append("</tr>");
      htmlResult.append("<tr>");
        htmlResult.append("<td class='poll-percents'>");
          htmlResult.append(percentFormat.format(votesPercent));
View Full Code Here

    }
    else if (pollsChoicePK == null) {
      return null;
    }
    else {
      PollsChoice obj = null;
      String key = pollsChoicePK.toString();

      if (Validator.isNull(key)) {
        return null;
      }
View Full Code Here

    }
    else if (pollsChoicePK == null) {
      return null;
    }
    else {
      PollsChoice obj = null;
      String key = pollsChoicePK.toString();

      if (Validator.isNull(key)) {
        return null;
      }
View Full Code Here

    // Add choices

    Iterator itr = choices.iterator();

    while (itr.hasNext()) {
      PollsChoice choice = (PollsChoice)itr.next();

      choice.setQuestionId(questionId);

      PollsChoiceUtil.update(choice);
    }

    return question;
View Full Code Here

    // Add choices

    Iterator itr = choices.iterator();

    while (itr.hasNext()) {
      PollsChoice choice = (PollsChoice)itr.next();

      choice.setQuestionId(questionId);

      PollsChoiceUtil.update(choice);
    }

    return question;
View Full Code Here

      vote = PollsVoteUtil.create(votePK);

      PollsChoicePK choicePK =
        new PollsChoicePK(questionId, choiceId);

      PollsChoice choice = PollsChoiceUtil.findByPrimaryKey(choicePK);

      vote.setChoiceId(choice.getChoiceId());
      vote.setVoteDate(now);

      PollsVoteUtil.update(vote);
    }
  }
View Full Code Here

    if (choices.size() < 2) {
      throw new QuestionChoiceException();
    }

    for (int i = 0; i < choices.size(); i++) {
      PollsChoice choice = (PollsChoice)choices.get(i);

      if (Validator.isNull(choice.getChoiceId()) ||
        Validator.isNull(choice.getDescription())) {

        throw new QuestionChoiceException();
      }
    }
  }
View Full Code Here

          String choiceId = req.getParameter("choice_id_" + id);

          String choiceDesc = req.getParameter(param);

          PollsChoice choice =
            new PollsChoice(null, choiceId, choiceDesc);

          choices.add(choice);
        }
        catch (Exception exc) {
        }
View Full Code Here

TOP

Related Classes of com.liferay.portlet.polls.model.PollsChoice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.