Your IP : 216.73.216.240


Current Path : /home/juvelize/www/administrator/components/com_zhgooglemap/models/
Upload File :
Current File : /home/juvelize/www/administrator/components/com_zhgooglemap/models/mapinfobubble.php

<?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');

/**
 * ZhGoogleInfoBubble Model
 */
class ZhGoogleMapModelMapInfoBubble extends JModelAdmin
{
    var $mapapikey;


    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 = 'MapInfoBubble', $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.mapinfobubble', 'mapinfobubble', 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/mapinfobubble.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.mapinfobubble.data', array());
        if (empty($data)) 
        {
            $data = $this->getItem();
        }
        return $data;
    }


    public function getAPIKey() 
    {
        // Get global params
        $params = JComponentHelper::getParams( 'com_zhgooglemap' );

        return $mapapikey = $params->get( 'map_map_key', '' );
    }

    
    
    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;        
    }
    

}