<?php
/**
* Joomla! 1.5 component injooosm
*
* @version $Id: view.html.php 2009-11-22 14:03:00$
* @author Christian Knorr
* @package injooosm
* @subpackage backend
* @license GNU/GPL
* @filesource
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Import Joomla! libraries
jimport( 'joomla.application.component.view');
/**
*
*/
class injooosmViewConfig extends JView {
/**
*
* @param object $tpl
*/
function display($tpl = null) {
jimport('joomla.filesystem.file');
$config =& injooosmHelper::getConfig();
$captcha = checkCaptcha();
$cactiv = ($captcha > 0) ? '<font color="green">'.JText::_("OSM_INSTALLED").'</font>' : '<font color="red">'.JText::_("OSM_NOT_INSTALLED").'</font>';
$model = $this->getModel();
$row = $model->getContent();
// var_dump($row);
$tmpl = $model->getTemplates();
// unit array for lists
$unit = array();
array_push($unit, array("unit" => "Kilometer"));
array_push($unit, array("unit" => "Miles"));
// users array for lists
$users = array(
array('id' => 0, 'text' => JText::_('OSM_PUPLIC')),
array('id' => 1, 'text' => JText::_('OSM_REGISTERED'))
);
// yes/no array for lists
$inform = array(
array('id' => 1, 'text' => JText::_('yes')),
array('id' => 0, 'text' => JText::_('no'))
);
// comments order aray for lists
$order =array(
array('order' => 'DESC', 'text' => JText::_('OSM_NEWEST')),
array('order' => 'ASC', 'text' => JText::_('OSM_OLDEST'))
);
$comments = array(
array('id' => 0, 'text' => JText::_('OSM_NO_COMMENTS')),
array('id' => 1, 'text' => JText::_('OSM_INTERN_COMMENTS')),
array('id' => 2, 'text' => JText::_('OSM_JOMCOMMENTS'))
);
// OSM-Karten Verfügbarkeit prüfen BEGIN
$osm_available_maps = $config->osm_allow_map;
$osm_allow_map = array();
$osm_allow_map_size = 0;
$osm_default_map = -1;
for ($i=0;$i<9;$i++) {
if ($osm_available_maps[$i] == true) {
if ($osm_default_map == -1)
$osm_default_map = $i; // Default-Map auf erste Möglichkeit setzen falls Falscheingabe
$osm_allow_map[] = array('id' => $i, 'text' => JText::_('OSM_OSM_MAP_'.$i));
$osm_allow_map_size++;
}
}
if ( ($osm_available_maps[($osm_available_maps[9]-1)]) == 1 ) // Ist Default-Map vorhanden?
$osm_default_map = ($osm_available_maps[9]-1); // dann Default-Map auf diesen Wert setzen
// OSM-Karten Verfügbarkeit prüfen END
// build the html select list
$acl =& JFactory::getACL();
$gtree = $acl->get_group_children_tree( null, 'USERS', false );
$lists['gid'] = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', $config->gid );
$lists['content'] = JHTML::_('select.genericlist', $row, 'terms_id', 'size="5"', 'id', 'title', $config->terms_id );
$lists['unit'] = JHTML::_('select.genericlist', $unit, 'unit', 'size="1"', 'unit', 'unit', $config->unit );
$lists['tmpl'] = JHTML::_('select.genericlist', $tmpl, 'template', 'size="1"', 'name', 'name', $config->template );
$lists['who'] = JHTML::_('select.genericlist', $users, 'comment_who', 'size="2"', 'id', 'text', $config->comment_who );
$lists['inform'] = JHTML::_('select.genericlist', $inform, 'inform_autor', 'size="2"', 'id', 'text', $config->inform_autor );
$lists['captcha'] = JHTML::_('select.genericlist', $inform, 'captcha', 'size="2"', 'id', 'text', $config->captcha );
$lists['order'] = JHTML::_('select.genericlist', $order, 'ordering', 'size="2"', 'order', 'text', $config->ordering );
$lists['comments'] = JHTML::_('select.genericlist', $comments, 'comments', 'size="3"', 'id', 'text', $config->comments );
$lists['access'] = JHTML::_('select.genericlist', $inform, 'access', 'size="2"', 'id', 'text', $config->access );
$lists['osm_default_map'] = JHTML::_('select.genericlist', $osm_allow_map, 'osm_default_map', 'size="'.($osm_allow_map_size+1).'"', 'id', 'text', $osm_default_map );
$this->assignRef('config', $config);
$this->assignRef('lists', $lists);
$this->assignRef('captcha', $cactiv);
parent::display($tpl);
}
}