| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.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 : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/new-saint-martin/administrator/components/com_mobilemenuck/models/ |
Upload File : |
<?php
/**
* @name Mobile Menu CK
* @copyright Copyright (C) 2017. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr
*/
// No direct access.
defined('_JEXEC') or die;
use Mobilemenuck\CKModel;
use Mobilemenuck\CKFof;
use Joomla\Registry\Registry;
class MobilemenuckModelMenu extends CKModel {
protected $table = '#__mobilemenuck_menus';
var $_item = null;
/*protected function populateState() {
$app = \Joomla\CMS\Factory::getApplication('com_mobilemenuck');
// Load state from the request userState on edit or from the passed variable on default
if ($app->input->get('layout', '', 'cmd') == 'edit') {
$id = \Joomla\CMS\Factory::getApplication()->getUserState('com_mobilemenuck.edit.menu.id');
} else {
$id = $app->input->get('id', 0 , 'int');
\Joomla\CMS\Factory::getApplication()->setUserState('com_mobilemenuck.edit.menu.id', $id);
}
$this->setState('menu.id', $id);
// Load the parameters.
// $params = $app->getParams();
// $this->setState('params', $params);
}*/
public function &getData($id = null) {
$input = new \Joomla\CMS\Input\Input();
$id = $input->get('id', $id, 'int');
$db = \Joomla\CMS\Factory::getDbo();
if ($this->_item === null) {
if ($id) {
$this->_item = new stdClass();
$db->setQuery('SELECT * FROM #__mobilemenuck_menus WHERE id=' . (int) $id);
$this->_item = $db->loadObject();
$this->_item->params = new CKParams(unserialize($this->_item->params));
} else {
$this->_item = new stdClass();
$this->_item->id = 0;
$this->_item->name = '';
$this->_item->state = '1';
$this->_item->params = new CKParams();
$this->_item->type = '';
$this->_item->style = '';
}
}
return $this->_item;
}
public function &getItem($id = null) {
$app = \Joomla\CMS\Factory::getApplication();
if ($this->_item === null) {
$this->_item = false;
if (empty($id)) {
$id = $app->input->get('id', 0, 'int');
}
// \Joomla\CMS\Table\Table::addIncludePath(MOBILEMENUCK_ADMIN_PATH . '/tables');
// $row = \Joomla\CMS\Table\Table::getInstance('Styles', 'MobilemenuckTable');
$table = $this->getTable();
// Attempt to load the row.
if ($table->load((int)$id)) {
// Check published state.
if ($published = $this->getState('filter.published')) {
if ($table->state != $published) {
return $this->_item;
}
}
// Convert the \Joomla\CMS\Table\Table to a clean \Joomla\CMS\Object\CMSObject.
$properties = $table->getProperties(1);
$this->_item = \Joomla\Utilities\ArrayHelper::toObject($properties, '\Joomla\CMS\Object\CMSObject');
$this->_item->params = new CKParams(unserialize($this->_item->params));
} elseif ($error = $table->getError()) {
$this->setError($error);
}
}
return $this->_item;
}
// public function getTable($type = 'Menus', $prefix = 'MobilemenuckTable', $config = array()) {
// $this->addTablePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
// return \Joomla\CMS\Table\Table::getInstance($type, $prefix, $config);
// }
/*public function getForm($data = array(), $loadData = true) {
// Get the form.
$form = $this->loadForm('com_mobilemenuck.menu', 'menu', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
return $form;
}*/
/*protected function loadFormData() {
$data = $this->getData();
return $data;
}*/
public function save($data) {
$input = \Joomla\CMS\Factory::getApplication()->input;
$id = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('menu.id');
$user = \Joomla\CMS\Factory::getUser();
// if (isset($data['options']) && is_array($data['options']))
// {
// $registry = new Registry;
// $registry->loadArray($data['options']);
// $data['params'] = (string) $registry;
// }
if ($id) {
//Check the user can edit this item
$authorised = $user->authorise('core.edit', 'menu.' . $id);
} else {
//Check the user can create new items in this section
$authorised = $user->authorise('core.create', 'com_mobilemenuck');
}
if ($authorised !== true) {
throw new Exception(\Joomla\CMS\Language\Text::_('JERROR_ALERTNOAUTHOR'), 403);
return false;
}
// $table = $this->getTable();
// $table->load($data['id']);
$data['params'] = serialize($data['params']);
$result = CKFof::dbStore('#__mobilemenuck_menus', $data);
return $result;
// if ($table->save($data) === true) {
// return $table->id;
// } else {
// return false;
// }
}
function copy($id = null) {
$row = $this->getTable();
$cid = \Joomla\CMS\Factory::getApplication()->input->get('id', '', 'array');
$pk = isset($cid[0]) ? (int) $cid[0] : $id;
$table = $this->getTable();
// Attempt to load the row.
$table->load((int)$id);
$table->id = 0;
// give the new name
$table->name .= '-copy';
$data->state = 0;
// Bind the form fields to the table
if (!$row->bind($table)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the table to the database
if (!$row->store()) {
$this->setError($row->getErrorMsg());
return false;
}
// $this->setId($row->id);
return true;
}
}