User Tools

Site Tools


tech2018:s4:edit_account_controller

Edit_account_data FORM CONTROLLER

/applications/controllers/actions/Account_change.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Account_change extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('account_changes');
	}
	
	
	/**
	 * Index Page for this controller.
	 */
	public function index()
	{
		
		//POST VALUES
		if($this->input->post()){
			$post_data = $this->input->post();
			$save_state = $this->account_changes->update_accounts($post_data['account_id']);			
		}
		
		//based on save do var update
		if($save_state){
			if($this->input->post('status') == 'DONE') $data['RESULT'] = 'OK';
			$data['STATUS'] = $this->input->post('status');
			$this->core_actions->update_var('ACTIVITY',$this->input->post('activity'),'ACTIVITY',$this->input->post('activity'),$data,NULL);
		}
		
		//handle errors according to business logic
		$result = true;
		$message = '';
		
		$return = array(
				'result' => $save_state,
				'error' => $message
		);
		
		$this->output->set_content_type('application/json')->set_output(json_encode($return));
		
	}
	
}	

Back to: dev forms/develop custom forms

tech2018/s4/edit_account_controller.txt · Last modified: 2018/06/07 11:08 by Gianluca Pelliccioli