Your IP : 216.73.216.240


Current Path : /home/juvelize/martine/modules/mod_simple_unite_gallery/elements/
Upload File :
Current File : /home/juvelize/martine/modules/mod_simple_unite_gallery/elements/ckslidesmanager.php

<?php
/**
* Simple Unit Gallery - Joomla Module 
* Version			: 1.2.5 
* Package			: Joomla 3.6.x
* copyright 		: Copyright (C) 2016 ConseilGouz. All rights reserved.
* license    		: http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* From              : Unit Gallery, https://github.com/vvvmax/unitegallery
* The class JFormFieldCkslidesmanager is adapted from carouselCK by Cedric KEIFLIN alias ced1870
* Updated on        : November, 2016
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
JText::script('SAG_ADDSLIDE');
JText::script('SAG_SELECTIMAGE');
JText::script('SAG_CAPTION');
JText::script('SAG_ADDSLIDE');
JText::script('SAG_IMAGE_REMOVE2');
JText::script('SAG_IMAGE_TITLE');
JText::script('SAG_CLEAR_IMAGE');
JText::script('SAG_REMOVE');
JText::script('SAG_IMAGE_ARTICLE_ID');
JText::script('SAG_IMAGE_TITLE');

class JFormFieldCkslidesmanager extends JFormField {

    protected $type = 'ckslidesmanager';

    protected function getInput() {

        $document = JFactory::getDocument();
        $document->addScriptDeclaration("JURI='" . JURI::root() . "';");
        $path = 'modules/mod_simple_unite_gallery/elements/ckslidesmanager/';
		JHtml::_('jquery.framework');
		JHtml::_('jquery.ui', array('core', 'sortable'));
        JHTML::_('behavior.modal');
        JHTML::_('script', $path.'ckslidesmanager.js');
        JHTML::_('stylesheet', $path.'ckslidesmanager.css');

        $html = '<input name="' . $this->name . '" id="ckslides" type="hidden" position="absolute" margin-left="30px" value="' . $this->value . '" />'
                . '<input name="ckaddslide" id="ckaddslide" type="button" value="' . JText::_('SAG_ADDSLIDE') . '" onclick="javascript:addslideck();"/>'
                . '<ul id="ckslideslist" style="clear:both;"></ul>'
                . '<input name="ckaddslide" id="ckaddslide" type="button" value="' . JText::_('SAG_ADDSLIDE') . '" onclick="javascript:addslideck();"/>';

        return $html;
    }

    protected function getPathToImages() {
        $localpath = dirname(__FILE__);
        $rootpath = JPATH_ROOT;
        $httppath = trim(JURI::root(), "/");
        $pathtoimages = str_replace("\\", "/", str_replace($rootpath, $httppath, $localpath));
        return $pathtoimages;
    }

    protected function getLabel() {

        return '';
    }

    protected function getArticlesList() {
        $db = & JFactory::getDBO();

        $query = "SELECT id, title FROM #__content WHERE state = 1 LIMIT 2;";
        $db->setQuery($query);
        $row = $db->loadObjectList('id');
        return json_encode($row);
    }

}