Exemple #1
0
    /**
     * Display the view
     */
    function display()
    {
        $task = BabioonRequest::getVar('task', 'system');
        $conf = BabioonConfig::getInstance($task);
        $params = $conf->getParamsObj();
        $document =& BabioonFactory::getDocument();
        $document->setTitle(BabioonText::_('Edit Preferences'));
        BabioonHTML::_('behavior.tooltip');
        ?>
	<form action="index.php" method="post" name="adminForm" autocomplete="off">
		<fieldset>
			<div style="float: right">
				<button type="button" onclick="submitbutton('save');window.top.setTimeout('window.parent.document.getElementById(\'sbox-window\').close()', 700);">
					<?php 
        echo BabioonText::_('Save');
        ?>
</button>
				<button type="button" onclick="window.parent.document.getElementById('sbox-window').close();">
					<?php 
        echo BabioonText::_('Cancel');
        ?>
</button>
			</div>
			<div class="configuration" >
				<?php 
        $task = BabioonRequest::getVar('task', '');
        echo BabioonText::_('Config' . $task);
        ?>
			</div>
		</fieldset>

		<fieldset>
			<legend>
				<?php 
        echo BabioonText::_('Configuration');
        ?>
			</legend>
			<?php 
        echo $params->render();
        ?>
		</fieldset>

		<input type="hidden" name="id" value="<?php 
        echo $params->get('id', 0);
        ?>
" />
		<input type="hidden" name="control" value="<?php 
        echo $task;
        ?>
" />

		<input type="hidden" name="section" value="config" />
		<input type="hidden" name="option" value="<?php 
        echo $conf->getComponent();
        ?>
" />
		<input type="hidden" name="task" value="" />
	</form>
<?php 
    }
Exemple #2
0
 function save()
 {
     $post = BabioonRequest::get('post');
     $params = $post['params'];
     $control = 'Config' . ucfirst($this->type);
     if (is_array($params)) {
         $txt = array();
         foreach ($params as $k => $v) {
             $txt[] = "{$k}={$v}";
         }
         $paramsdata = implode("\n", $txt);
     }
     $query = "UPDATE {$this->table} set params='{$paramsdata}' WHERE control = '{$control}';";
     $this->db->setQuery($query);
     if (!$this->db->query()) {
         BabioonError::raiseWarning(500, $this->db->getError());
     }
 }
 function save()
 {
     $control = BabioonRequest::getVar('control');
     $conf = BabioonConfig::getInstance($control);
     $conf->save();
 }