Exemplo n.º 1
0
  def trophy_case_values(self, user_ref, acc_ref, height, width):
    badges = badges_dao.get_user_badges(user_ref)
    tcase_ref = None
    if not acc_ref:
      tcase_ref = TrophyCase()
    else:
      try:
        tcase_ref = acc_ref.trophyWidget
      except:
        tcase_ref = widgets_dao.add_trophy_case(acc_ref)

    awarded_badges= []
    for b in badges:
      if b.awarded == "yes":
        awarded_badges.append(b)
    # here we get the custom trophy case settings
    # Grab all the badge urls
    ret = {"status":"success"}
     
    for ii in tcase_ref.properties():
      ret[ii] = getattr(tcase_ref, ii)
    ret["badges"] = awarded_badges

    # Internal div's need to be slighy smaller than the iframe
    if width and height:
      try:
        width = int(width)
        height = int(height)
        # How did I get this equation? Trial and error.
        height = height - 2 *int(ret['borderThickness']) - 8
        width = width - 2 *int(ret['borderThickness']) - 8
        ret['height'] = height
        ret['width'] = width
      except:
        pass
    return ret 
Exemplo n.º 2
0
def get_trophy_case_properties_to_render(email):
  return get_values("TrophyCase", email, TrophyCase.properties())
Exemplo n.º 3
0
def get_trophy_case_properties_to_render(email):
  return get_values("TrophyCase", email, TrophyCase.properties())