source: temp/test-xoops.ec-cube.net/html/modules/tinyd0/admin/blockform.php @ 405

Revision 405, 5.6 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: blockform.php,v 1.8 2003/03/10 13:32:05 okazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
29$form = new XoopsThemeForm($block['form_title'], 'blockform', 'admin.php');
30if (isset($block['name'])) {
31    $form->addElement(new XoopsFormLabel(_AM_NAME, $block['name']));
32}
33$side_select = new XoopsFormSelect(_AM_BLKTYPE, "bside", $block['side']);
34$side_select->addOptionArray(array(0 => _AM_SBLEFT, 1 => _AM_SBRIGHT, 3 => _AM_CBLEFT, 4 => _AM_CBRIGHT, 5 => _AM_CBCENTER, ));
35$form->addElement($side_select);
36$form->addElement(new XoopsFormText(_AM_WEIGHT, "bweight", 2, 5, $block['weight']));
37$form->addElement(new XoopsFormRadioYN(_AM_VISIBLE, 'bvisible', $block['visible']));
38$mod_select = new XoopsFormSelect(_AM_VISIBLEIN, "bmodule", $block['modules'], 5, true);
39$module_handler =& xoops_gethandler('module');
40$criteria = new CriteriaCompo(new Criteria('hasmain', 1));
41$criteria->add(new Criteria('isactive', 1));
42$module_list =& $module_handler->getList($criteria);
43$module_list[-1] = _AM_TOPPAGE;
44$module_list[0] = _AM_ALLPAGES;
45ksort($module_list);
46$mod_select->addOptionArray($module_list);
47$form->addElement($mod_select);
48$form->addElement(new XoopsFormText(_AM_TITLE, 'btitle', 50, 255, $block['title']), false);
49if ( $block['is_custom'] ) {
50    $textarea = new XoopsFormDhtmlTextArea(_AM_CONTENT, 'bcontent', $block['content'], 15, 70);
51    $textarea->setDescription('<span style="font-size:x-small;font-weight:bold;">'._AM_USEFULTAGS.'</span><br /><span style="font-size:x-small;font-weight:normal;">'.sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL.'/').'</span>');
52    $form->addElement($textarea, true);
53    $ctype_select = new XoopsFormSelect(_AM_CTYPE, 'bctype', $block['ctype']);
54    $ctype_select->addOptionArray(array('H' => _AM_HTML, 'P' => _AM_PHP, 'S' => _AM_AFWSMILE, 'T' => _AM_AFNOSMILE));
55    $form->addElement($ctype_select);
56} else {
57    if ($block['template'] != '') {
58        $tplfile_handler =& xoops_gethandler('tplfile');
59        $btemplate =& $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $block['bid']);
60        if (count($btemplate) > 0) {
61            $form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate[0]->getVar('tpl_id').'">'._AM_EDITTPL.'</a>'));
62        } else {
63            $btemplate2 =& $tplfile_handler->find('default', 'block', $block['bid']);
64            if (count($btemplate2) > 0) {
65                $form->addElement(new XoopsFormLabel(_AM_CONTENT, '<a href="'.XOOPS_URL.'/modules/system/admin.php?fct=tplsets&op=edittpl&id='.$btemplate2[0]->getVar('tpl_id').'" target="_blank">'._AM_EDITTPL.'</a>'));
66            }
67        }
68    }
69    if ($block['edit_form'] != false) {
70        $form->addElement(new XoopsFormLabel(_AM_OPTIONS, $block['edit_form']));
71    }
72}
73$cache_select = new XoopsFormSelect(_AM_BCACHETIME, 'bcachetime', $block['cachetime']);
74$cache_select->addOptionArray(array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK, '2592000' => _MONTH));
75$form->addElement($cache_select);
76if (isset($block['bid'])) {
77    $form->addElement(new XoopsFormHidden('bid', $block['bid']));
78}
79// $form->addElement(new XoopsFormHidden('options', $block['options']));
80$form->addElement(new XoopsFormHidden('op', $block['op']));
81$form->addElement(new XoopsFormHidden('fct', 'blocksadmin'));
82$button_tray = new XoopsFormElementTray('', '&nbsp;');
83/* if ($block['is_custom']) {
84    $button_tray->addElement(new XoopsFormButton('', 'previewblock', _PREVIEW, "submit"));
85} */
86$button_tray->addElement(new XoopsFormButton('', 'submitblock', $block['submit_button'], "submit"));
87$form->addElement($button_tray);
88?>
Note: See TracBrowser for help on using the repository browser.