/** * Returns the ordering value to place a new item last in its group * * @access public * @param string query WHERE clause for selecting MAX(ordering). */ function getNextOrder($where = '') { if (!in_array('ordering', array_keys($this->getProperties()))) { $this->setError(get_class($this) . ' does not support ordering'); return false; } $query = 'SELECT MAX(ordering)' . ' FROM ' . $this->_tbl . ($where ? ' WHERE ' . $where : ''); $this->_db->setQuery($query); $maxord = $this->_db->loadResult(); if ($this->_db->getErrorNum()) { $this->setError($this->_db->getErrorMsg()); return false; } return $maxord + 1; }