english/administrator/components/com_aicontactsafe/models/default.php
// function to write data to database
function to write data to database
function to write data to database
function writeData() {
		$ctablename = $this->getTableName($this->_sTask, 'writeData');
		$postData = $this->readPostDataFromSession();
		$dataRow =& JTable::getInstance($ctablename, 'Table');
		if ($dataRow->bind($postData)) {
			if (!$dataRow->store()) {
				$this->_app->_session->set( 'isOK:' . $this->_sTask, false );
				$this->_app->_session->set( 'errorMsg:' . $this->_sTask, $dataRow->getError() );
			} else {
				$this->writeOtherTables($postData, $dataRow->id);
			}
		} else {
			$this->_app->_session->set( 'isOK:' . $this->_sTask, false );
			$this->_app->_session->set( 'errorMsg:' . $this->_sTask, $dataRow->getError() );
		}
		$isOK = $this->_app->_session->get( 'isOK:' . $this->_sTask );
		if ($isOK) {
			$this->_app->_session->set( 'idSaved:' . $this->_sTask, $dataRow->id );
		}
		return $isOK;
	}
function writeData ( ) { $ ctablename = $ this -> getTableName ( $ this -> _sTask , 'writeData' ) ; $ postData = $ this -> readPostDataFromSession ( ) ; $ dataRow = & JTable :: getInstance ( $ ctablename , 'Table' ) ; if ( $ dataRow -> bind ( $ postData ) ) { if ( ! $ dataRow -> store ( ) ) { $ this -> _app -> _session -> set ( 'isOK:' . $ this -> _sTask , false ) ; $ this -> _app -> _session -> set ( 'errorMsg:' . $ this -> _sTask , $ dataRow -> getError ( ) ) ; } else { $ this -> writeOtherTables ( $ postData , $ dataRow -> id ) ; } } else { $ this -> _app -> _session -> set ( 'isOK:' . $ this -> _sTask , false ) ; $ this -> _app -> _session -> set ( 'errorMsg:' . $ this -> _sTask , $ dataRow -> getError ( ) ) ; } $ isOK = $ this -> _app -> _session -> get ( 'isOK:' . $ this -> _sTask ) ; if ( $ isOK ) { $ this -> _app -> _session -> set ( 'idSaved:' . $ this -> _sTask , $ dataRow -> id ) ; } return $ isOK ; }
function to write data to database
function to write data to database
// get the table name // bind the data sent from the form to the table fields