mosDBTable( '#__polls', 'id', $db ); } // overloaded check function function check() { // check for valid name if (trim( $this->title ) == '') { $this->_error = 'Your Poll must contain a title.'; return false; } // check for valid lag $this->lag = intval( $this->lag ); if ($this->lag == 0) { $this->_error = 'Your Poll must have a non-zero lag time.'; return false; } // check for existing title $query = "SELECT id" . "\n FROM #__polls" . "\n WHERE title = '$this->title'" ; $this->_db->setQuery( $query ); $xid = intval( $this->_db->loadResult() ); if ( $xid && $xid != intval( $this->id ) ) { $this->_error = 'There is a module already with that name, please try again.'; return false; } return true; } // overloaded delete function function delete( $oid=null ) { $k = $this->_tbl_key; if ( $oid ) { $this->$k = intval( $oid ); } if (mosDBTable::delete( $oid )) { $query = "DELETE FROM #__poll_data" . "\n WHERE pollid = ". $this->$k ; $this->_db->setQuery( $query ); if ( !$this->_db->query() ) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } $query = "DELETE FROM #__poll_date" . "\n WHERE pollid = ". $this->$k ; $this->_db->setQuery( $query ); if ( !$this->_db->query() ) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } $query = "DELETE from #__poll_menu" . "\n WHERE pollid = ". $this->$k ; $this->_db->setQuery( $query ); if ( !$this->_db->query() ) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } return true; } else { return false; } } } ?>