| Current Path : /home/bonneesp/www/administrator/components/com_contactmap/tables/ |
| Current File : /home/bonneesp/www/administrator/components/com_contactmap/tables/marqueur.php |
<?php
/*
* ContactMap Component Google Map for Joomla! 3.x
* Version J3.0
* Creation date: Août 2014
* Author: Fabrice4821 - www.gmapfp.org
* Author email: webmaster@gmapfp.org
* License GNU/GPL
*/
defined('_JEXEC') or die;
class ContactMapTableMarqueur extends JTable
{
public function __construct(&$_db)
{
parent::__construct('#__contactmap_marqueurs', 'id', $_db);
}
public function publish($pks = null, $state = 1, $userId = 0)
{
$k = $this->_tbl_key;
// Sanitize input.
JArrayHelper::toInteger($pks);
$userId = (int) $userId;
$state = (int) $state;
// If there are no primary keys set check to see if the instance key is set.
if (empty($pks))
{
if ($this->$k)
{
$pks = array($this->$k);
}
// Nothing to set publishing state on, return false.
else
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
return false;
}
}
// Build the WHERE clause for the primary keys.
$where = $k . '=' . implode(' OR ' . $k . '=', $pks);
// Update the publishing state for rows with the given primary keys.
$this->_db->setQuery(
'UPDATE ' . $this->_db->quoteName($this->_tbl) .
' SET ' . $this->_db->quoteName('published') . ' = ' . (int) $state .
' WHERE (' . $where . ')' .
$checkin
);
try
{
$this->_db->execute();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->$k, $pks))
{
$this->state = $state;
}
$this->setError('');
return true;
}
}