| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/bordeaux/administrator/components/com_djmediatools/models/ |
Upload File : |
<?php
/**
* @version $Id$
* @package DJ-MediaTools
* @copyright Copyright (C) 2017 DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
* @developer Szymon Woronowski - szymon.woronowski@design-joomla.eu
*
* DJ-MediaTools 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.
*
* DJ-MediaTools 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 DJ-MediaTools. If not, see <http://www.gnu.org/licenses/>.
*
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.modeladmin');
class DJMediatoolsModelItem extends JModelAdmin
{
public function getTable($type = 'Items', $prefix = 'DJMediatoolsTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
public function getForm($data = array(), $loadData = true)
{
jimport('joomla.form.form');
//JForm::addFieldPath('JPATH_ADMINISTRATOR/components/com_djcatalog2/models/fields');
// Get the form.
$form = $this->loadForm('com_djmediatools.item', 'item', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
/* not implemented yet
// Modify the form based on access controls.
if (!$this->canEditState((object) $data)) {
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
// The controller has already verified this is a record you can edit.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}*/
return $form;
}
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_djmediatools.edit.item.data', array());
if (empty($data)) {
$data = $this->getItem();
// Prime some default values.
if ($this->getState('item.id') == 0) {
$app = JFactory::getApplication();
$data->set('catid', JFactory::getApplication()->input->getInt('catid', $app->getUserState('com_djmediatools.items.filter.category')));
}
}
if(isset($data->params['link_type']) && strstr($data->params['link_type'], ';') !== false) {
$tmp = explode(';',$data->params['link_type']);
$data->params['link_type'] = $tmp[0];
}
return $data;
}
protected function prepareTable($table)
{
jimport('joomla.filter.output');
$date = JFactory::getDate();
$user = JFactory::getUser();
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
$table->alias = JFilterOutput::stringURLSafe($table->alias);
if (empty($table->alias)) {
$table->alias = JFilterOutput::stringURLSafe($table->title);
}
// Set the publish date to now
if($table->published == 1 && intval($table->publish_up) == 0) {
$table->publish_up = $date->toSql();
}
if(empty($table->publish_down)) {
$table->publish_down = JFactory::getDbo()->getNullDate();
}
/*
if (empty($table->id)) {
// Set ordering to the last item if not set
if (empty($table->ordering)) {
$table->ordering = 0;
$db = JFactory::getDbo();
$query = 'SELECT MAX(ordering) FROM #__djmt_items';
if($table->catid) $query.= ' WHERE catid='. (int) $table->catid;
$db->setQuery($query);
$max = $db->loadResult();
$table->ordering = $max+1;
}
}*/
}
protected function getReorderConditions($table)
{
$condition = array();
$condition[] = 'catid = '.(int) $table->catid;
return $condition;
}
}