Skip to content

Commit

Permalink
update frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
diddipoeler committed Apr 22, 2014
1 parent de438c1 commit dc9ede3
Show file tree
Hide file tree
Showing 19 changed files with 1,692 additions and 134 deletions.
49 changes: 49 additions & 0 deletions site/controllers/editperson.php
@@ -0,0 +1,49 @@
<?php

// No direct access.
defined('_JEXEC') or die;

// Include dependancy of the main controllerform class
jimport('joomla.application.component.controllerform');

class sportsmanagementControllereditperson extends JControllerForm
{

public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, array('ignore_request' => false));
}

public function submit()
{
// // Check for request forgeries.
// JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
//
// // Initialise variables.
// $app = JFactory::getApplication();
// $model = $this->getModel('updhelloworld');
//
// // Get the data from the form POST
// $data = JRequest::getVar('jform', array(), 'post', 'array');
//
// // Now update the loaded data to the database via a function in the model
// $upditem = $model->updItem($data);
//
// // check if ok and display appropriate message. This can also have a redirect if desired.
// if ($upditem) {
// echo "<h2>Updated Greeting has been saved</h2>";
// } else {
// echo "<h2>Updated Greeting failed to be saved</h2>";
// }

return true;
}

public function save()
{


return true;
}

}
72 changes: 69 additions & 3 deletions site/helpers/imageselect.php
@@ -1,22 +1,82 @@
<?php
/** SportsManagement ein Programm zur Verwaltung f?r alle Sportarten
* @version 1.0.05
* @file agegroup.php
* @author diddipoeler, stony, svdoldie und donclumsy (diddipoeler@arcor.de)
* @copyright Copyright: ? 2013 Fussball in Europa http://fussballineuropa.de/ All rights reserved.
* @license This file is part of SportsManagement.
*
* SportsManagement is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* SportsManagement is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SportsManagement. If not, see <http://www.gnu.org/licenses/>.
*
* Diese Datei ist Teil von SportsManagement.
*
* SportsManagement ist Freie Software: Sie k?nnen es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder sp?teren
* ver?ffentlichten Version, weiterverbreiten und/oder modifizieren.
*
* SportsManagement wird in der Hoffnung, dass es n?tzlich sein wird, aber
* OHNE JEDE GEW?HELEISTUNG, bereitgestellt; sogar ohne die implizite
* Gew?hrleistung der MARKTF?HIGKEIT oder EIGNUNG F?R EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License f?r weitere Details.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*
* Note : All ini files need to be saved as UTF-8 without BOM
*/

// no direct access

/* inspired from eventlist */

defined( '_JEXEC' ) or die( 'Restricted access' );

/**
* ImageSelectSM
*
* @package
* @author
* @copyright diddi
* @version 2014
* @access public
*/
abstract class ImageSelectSM
{

var $_foldertype = '';

/**
* ImageSelectSM::__construct()
*
* @return void
*/
function __construct()
{
$type = JRequest::getVar( 'type' );
$this->_foldertype = $type;
}

/**
* ImageSelectSM::getSelector()
*
* @param mixed $fieldname
* @param mixed $fieldpreview_name
* @param mixed $type
* @param mixed $value
* @param string $default
* @param string $control_name
* @param mixed $fieldid
* @return
*/
function getSelector( $fieldname, $fieldpreview_name, $type, $value, $default = '', $control_name='', $fieldid)
{
$document = JFactory::getDocument();
Expand Down Expand Up @@ -98,6 +158,12 @@ function clear_" . $funcname . "()
}


/**
* ImageSelectSM::check()
*
* @param mixed $file
* @return
*/
function check( $file )
{
jimport( 'joomla.filesystem.file' );
Expand Down
135 changes: 135 additions & 0 deletions site/models/editperson.php
@@ -0,0 +1,135 @@
<?php


// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

//jimport('joomla.application.component.model');
//jimport('joomla.application.component.modelitem');
//jimport('joomla.application.component.modelform');

jimport('joomla.application.component.modeladmin');

require_once(JPATH_ROOT.DS.'components'.DS.'com_sportsmanagement'.DS. 'helpers' . DS . 'imageselect.php');


/**
* sportsmanagementModelEditPerson
*
* @package
* @author
* @copyright diddi
* @version 2014
* @access public
*/
class sportsmanagementModelEditPerson extends JModelAdmin
{

/* interfaces */
var $latitude = null;
var $longitude = null;

/**
* Method to load content person data
*
* @access private
* @return boolean True on success
* @since 0.1
*/
function getData()
{
$this->_id = JRequest::getInt('id',0);
// // Lets load the content if it doesn't already exist
// if (empty($this->_data))
// {
$query='SELECT * FROM #__sportsmanagement_person WHERE id='.(int) $this->_id;
$this->_db->setQuery($query);
$this->_data = $this->_db->loadObject();
return $this->_data;
// }
// return true;
}



/**
* Method to return a joomla users array (id,name)
*
* @access public
* @return array
*
function getJLUsers()
{
$query="SELECT id AS value,name AS text FROM #__users ";
$this->_db->setQuery($query);
if (!$result=$this->_db->loadObjectList())
{
$this->setError($this->_db->getErrorMsg());
return false;
}
return $result;
}
*/




/**
* Returns a Table object, always creating it
*
* @param type The table type to instantiate
* @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional.
* @return JTable A database object
* @since 1.6
*/
public function getTable($type = 'person', $prefix = 'sportsmanagementTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}

/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return mixed A JForm object on success, false on failure
* @since 1.7
*/
public function getForm($data = array(), $loadData = true)
{
$cfg_which_media_tool = JComponentHelper::getParams(JRequest::getCmd('option'))->get('cfg_which_media_tool',0);
$app = JFactory::getApplication('site');
// Get the form.
$form = $this->loadForm('com_sportsmanagement.'.$this->name, $this->name,array('load_data' => $loadData) );
if (empty($form))
{
return false;
}

$form->setFieldAttribute('picture', 'default', JComponentHelper::getParams(JRequest::getCmd('option'))->get('ph_player',''));
$form->setFieldAttribute('picture', 'directory', 'com_sportsmanagement/database/persons');
$form->setFieldAttribute('picture', 'type', $cfg_which_media_tool);

return $form;
}

/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.7
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_sportsmanagement.edit.'.$this->name.'.data', array());
if (empty($data))
{
$data = $this->getData();
}
return $data;
}

}

0 comments on commit dc9ede3

Please sign in to comment.