Your IP : 216.73.216.240
<?php
/*------------------------------------------------------------------------
# com_zhgooglemap - Zh GoogleMap
# ------------------------------------------------------------------------
# author: Dmitry Zhuk
# copyright: Copyright (C) 2011 zhuk.cc. All Rights Reserved.
# license: http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
# website: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/**
* ZhGoogleMarkerContent Model
*/
class ZhGoogleMapModelMapMarkerContent extends JModelAdmin
{
var $categoryList;
var $categoryListType;
/**
* Returns a reference to the 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 = 'MapMarkerContent', $prefix = 'ZhGoogleMapTable', $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.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_zhgooglemap.mapmarkercontent', 'mapmarkercontent', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string Script files
*/
public function getScript()
{
return 'administrator/components/com_zhgooglemap/models/forms/mapmarkercontent.js';
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_zhgooglemap.edit.mapmarkercontent.data', array());
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
public function getCategoryList()
{
// Get global params
$params = JComponentHelper::getParams( 'com_zhgooglemap' );
$cat_list_type = $params->get( 'category_list_type', '' );
if ($cat_list_type == "")
{
$cat_list_type = 0;
}
else
{
$cat_list_type = (int)$cat_list_type;
}
if ($cat_list_type == 1)
{
if (!isset($this->categoryList))
{
$this->_db->setQuery($this->_db->getQuery(true)
->select('h.title as text, h.id as value')
->from('#__categories as h')
->where('h.extension = \'com_zhgooglemap\' AND h.published IN (0,1)')
->order('h.title'));
$this->categoryList = $this->_db->loadObjectList();
// Custom Fields
//if (!$this->categoryList = $this->_db->loadObjectList())
//{
// $this->setError($this->_db->getError());
//}
}
}
return $this->categoryList;
}
public function getCategoryListType()
{
// Get global params
$params = JComponentHelper::getParams( 'com_zhgooglemap' );
$cat_list_type = $params->get( 'category_list_type', '' );
if ($cat_list_type == "")
{
$categoryListType = 0;
}
else
{
$categoryListType = (int)$cat_list_type;
}
return $categoryListType;
}
}