english/administrator/components/com_templates/tables/style.php
/**
	 * Overloaded store method to unsure existence of a default style for a template.
	 *
	 * @param	mixed	An optional primary key value to delete.  If not set the
	 *					instance property value is used.
	 * @return	boolean	True on success.
	 * @since	1.0
	 * @link	http://docs.joomla.org/JTable/delete
	 */
Overloaded store method to unsure existence of a default style for a template.
@param       mixed   An optional primary key value to delete.  If not set the
instance property value is used.
@return      boolean True on success.
Overloaded store method to unsure existence of a default style for a template . @param mixed An optional primary key value to delete . If not set the instance property value is used . @return boolean True on success .
public function delete($pk = null)
	{
		$k = $this->_tbl_key;
		$pk = (is_null($pk)) ? $this->$k : $pk;
		if (!is_null($pk)) {
			$query = $this->_db->getQuery(true);
			$query->from('#__template_styles');
			$query->select('id');
			$query->where('client_id='.(int)$this->client_id);
			$query->where('template='.$this->_db->quote($this->template));
			$this->_db->setQuery($query);
			$results = $this->_db->loadResultArray();
			if (count($results)==1 && $results[0]==$pk) {
				$this->setError(JText::_('COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE'));
				return false;
			}
		}
		return parent::delete($pk);
	}
public function delete ( $ pk = null ) { $ k = $ this -> _tbl_key ; $ pk = ( is_null ( $ pk ) ) ? $ this -> $ k : $ pk ; if ( ! is_null ( $ pk ) ) { $ query = $ this -> _db -> getQuery ( true ) ; $ query -> from ( '#__template_styles' ) ; $ query -> select ( 'id' ) ; $ query -> where ( 'client_id=' . ( int ) $ this -> client_id ) ; $ query -> where ( 'template=' . $ this -> _db -> quote ( $ this -> template ) ) ; $ this -> _db -> setQuery ( $ query ) ; $ results = $ this -> _db -> loadResultArray ( ) ; if ( count ( $ results ) == 1 && $ results [ 0 ] == $ pk ) { $ this -> setError ( JText :: _ ( 'COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE' ) ) ; return false ; } } return parent :: delete ( $ pk ) ; }
Overloaded store method to unsure existence of a default style for a template.
Overloaded store method to unsure existence of a default style for a template .