示例#1
0
    public function compile()
    {
        \System::loadLanguageFile('tl_iso_gallery');
        $strBuffer = '
<table style="width:100%">
<thead>
    <tr>
        <th>' . $GLOBALS['TL_LANG']['tl_iso_gallery']['name'][0] . '</th>
        <th>' . $GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_template'][0] . '<span class="mandatory">*</span></th>
    </tr>
</thead>
<tbody>';
        foreach ($this->objGaleries as $objGallery) {
            $objSelect = new \SelectMenu(\Widget::getAttributesFromDca(array('options' => array_merge(\Controller::getTemplateGroup('moo_'), \Controller::getTemplateGroup('j_')), 'eval' => array('includeBlankOption' => true, 'mandatory' => true)), 'gallery[' . $objGallery->id . ']'));
            if (\Input::post('FORM_SUBMIT') == 'tl_iso_upgrade_20010000') {
                $objSelect->validate();
                if (!$objSelect->hasErrors()) {
                    $objGallery->lightbox_template = serialize(array($objSelect->value));
                    $objGallery->save();
                }
            }
            $strBuffer .= '
    <tr>
        <td>' . $objGallery->name . '</td>
        <td>' . $objSelect->generateWithError() . '</td>
    </tr>';
        }
        $strBuffer .= '
</tbody>
</table>';
        $this->Template->formSubmit = 'tl_iso_upgrade_20010000';
        $this->Template->fields = $strBuffer;
        $this->Template->matter = $GLOBALS['TL_LANG']['UPG']['20010000'];
        if (\Input::post('FORM_SUBMIT') == 'tl_iso_upgrade_20010000') {
            \Controller::reload();
        }
    }