english/administrator/components/com_aicontactsafe/models/default.php
// function used to save the new order of records
function used to save the new order of records
function used to save the new order of records
function saveorder() {
		JRequest::checkToken() or jexit( 'Invalid Token' );
		$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
		JArrayHelper::toInteger($cid);
		$order = JRequest::getVar( 'order', array(), 'post', 'array' );
		JArrayHelper::toInteger($order);
		$n = count($cid);
		$this->_app->_session->set( 'isOK:' . $this->_sTask, true );
		for ($i = 0; $i<$n; $i++) {
			$row = &$this->getRowData($cid[$i]);
			$row->ordering = $order[$i];
			if (!$row->store()) {
				$this->_app->_session->set( 'isOK:' . $this->_sTask, false );
				$this->_app->_session->set( 'errorMsg:' . $this->_sTask, $dataRow->getError() );
				break;
			}
		}
		$isOK = $this->_app->_session->get( 'isOK:' . $this->_sTask );
		return $isOK;
	}
function saveorder ( ) { JRequest :: checkToken ( ) or jexit ( 'Invalid Token' ) ; $ cid = JRequest :: getVar ( 'cid' , array ( ) , 'post' , 'array' ) ; JArrayHelper :: toInteger ( $ cid ) ; $ order = JRequest :: getVar ( 'order' , array ( ) , 'post' , 'array' ) ; JArrayHelper :: toInteger ( $ order ) ; $ n = count ( $ cid ) ; $ this -> _app -> _session -> set ( 'isOK:' . $ this -> _sTask , true ) ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) { $ row = & $ this -> getRowData ( $ cid [ $ i ] ) ; $ row -> ordering = $ order [ $ i ] ; if ( ! $ row -> store ( ) ) { $ this -> _app -> _session -> set ( 'isOK:' . $ this -> _sTask , false ) ; $ this -> _app -> _session -> set ( 'errorMsg:' . $ this -> _sTask , $ dataRow -> getError ( ) ) ; break ; } } $ isOK = $ this -> _app -> _session -> get ( 'isOK:' . $ this -> _sTask ) ; return $ isOK ; }
function used to save the new order of records
function used to save the new order of records
// Check for request forgeries // read the id of the record seleted for move // for each record in the database read the fields, modify the 'ordering' field and save it // get an object with the values of the fields of the selected record