Пример #1
0
def timeslots_pdf_output(timeslots, workshop, request):
    """
    write the pdf output of an attendance sheet to the current request response

        timeslots

            The timeslots to render in the attendance sheet (one timeslot = one
            column)

        workshop

            The workshop object

        request

            The current request object
    """
    if not hasattr(timeslots, '__iter__'):
        timeslots = [timeslots]

    date = workshop.datetime.strftime("%e_%m_%Y")
    filename = u"atelier_{0}_{1}.pdf".format(date, workshop.id)

    template = u"autonomie:templates/accompagnement/workshop_pdf.mako"
    rendering_datas = dict(
        timeslots=timeslots,
        workshop=workshop,
        config=request.config,
        participants=workshop.sorted_participants,
    )
    html_str = render_html(request, template, rendering_datas)

    write_pdf(request, filename, html_str)

    return request.response
Пример #2
0
def timeslots_pdf_output(timeslots, workshop, request):
    """
    write the pdf output of an attendance sheet to the current request response

        timeslots

            The timeslots to render in the attendance sheet (one timeslot = one
            column)

        workshop

            The workshop object

        request

            The current request object
    """
    if not hasattr(timeslots, '__iter__'):
        timeslots = [timeslots]

    date = workshop.datetime.strftime("%e_%m_%Y")
    filename = u"atelier_{0}_{1}.pdf".format(date, workshop.id)

    template = u"autonomie:templates/accompagnement/workshop_pdf.mako"
    rendering_datas = dict(
        timeslots=timeslots,
        workshop=workshop,
        config=request.config,
        participants=workshop.sorted_participants,
        )
    html_str = render_html(request, template, rendering_datas)

    write_pdf(request, filename, html_str)

    return request.response
Пример #3
0
def activity_pdf_view(context, request):
    """
    Return a pdf output of the current activity
    """
    date = context.datetime.strftime("%e_%m_%Y")
    filename = u"rdv_{0}_{1}.pdf".format(date, context.id)

    template = u"autonomie:templates/activity_pdf.mako"
    datas = dict(activity=context)
    html_str = render_html(request, template, datas)

    write_pdf(request, filename, html_str)

    return request.response
Пример #4
0
def activity_pdf_view(context, request):
    """
    Return a pdf output of the current activity
    """
    date = context.datetime.strftime("%e_%m_%Y")
    filename = u"rdv_{0}_{1}.pdf".format(date, context.id)

    template = u"autonomie:templates/accompagnement/activity_pdf.mako"
    datas = dict(activity=context)
    html_str = render_html(request, template, datas)

    write_pdf(request, filename, html_str)

    return request.response
Пример #5
0
def html(request, tasks=None, bulk=False):
    """
        return the html output of a given task
    """
    template = "autonomie:templates/tasks/task.mako"

    if tasks is None:
        tasks = [request.context]

    datas = dict(
        tasks=tasks,
        config=request.config,
        bulk=bulk,
    )

    return render_html(request, template, datas)
Пример #6
0
def html(request, tasks=None, bulk=False):
    """
        return the html output of a given task
    """
    template = "autonomie:templates/tasks/task.mako"

    if tasks == None:
        tasks = [ request.context ]

    datas = dict(
                 tasks=tasks,
                 config=request.config,
                 bulk=bulk,
                 )

    return render_html(request, template, datas)
Пример #7
0
def html(request, template):
    """
        return the html output of a given task
    """
    task = request.context
    tvas = task.get_tvas()
    if len([value for value in tvas.keys() if value >=0]) > 1:
        multiple_tvas = True
    else:
        multiple_tvas = False
    datas = dict(company=task.project.company,
                 project=task.project,
                 task=task,
                 config=request.config,
                 multiple_tvas=multiple_tvas,
                 tvas=tvas)
    return render_html(request, template, datas)
Пример #8
0
 def render(self, request):
     """
         return an html output of the widget
     """
     request = self.request or request
     return render_html(request, self.template, {'elem': self})
Пример #9
0
 def render(self, request, item):
     return render_html(request, self.template, {'elem': self,
                                                 'item': item})
Пример #10
0
 def render(self, request):
     """
         return an html output of the widget
     """
     request = self.request or request
     return render_html(request, self.template, {'elem': self})
Пример #11
0
 def render(self, request, item):
     return render_html(request, self.template, {
         'elem': self,
         'item': item
     })