aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/sidebar/TemplateWidget.php
blob: c937c3b69de99b0b521f1aea2f0da6a176430c3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
 * This widget type consists of a template and associated variables and will
 * render the template content as the widget content.
 *
 * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
 * @license GPL2 or any later version
 * @since   Stud.IP 4.0
 */
class TemplateWidget extends SidebarWidget
{
    protected $forced_rendering = true;

    /**
     * Constructor of the widget.
     *
     * @param String         $title     Title of the widget
     * @param Flexi_Template $template  Template for the widget
     * @param array          $variables Associated variables for the template
     */
    public function __construct($title, Flexi_Template $template, array $variables = [])
    {
        parent::__construct();

        $this->title    = $title;
        $this->template = $template;
        $this->template->set_attributes($variables);
    }
}