public function tasks() {
		$this->response->disableCache();
		Configure::write('debug', 0);
		if (!$this->request->is('ajax') || !$this->request->is('post') ||
			!$this->RequestHandler->prefers('json')) {
			throw new BadRequestException();
		}

		$data = [
			'result' => false,
			'tasks' => []
		];
		$delete = (bool)$this->request->data('delete');
		if ($delete) {
			$tasks = $this->request->data('tasks');
			$data['result'] = $this->SseTask->deleteQueuedTask($tasks);
		} else {
			$tasks = $this->SseTask->getListQueuedTask();
			$data['tasks'] = $tasks;
			$data['result'] = !empty($tasks);
		}
		$this->set(compact('data'));
		$this->set('_serialize', 'data');
	}
public function tasks() {
		$this->response->disableCache();
		Configure::write('debug', 0);
		if (!$this->request->is('ajax') || !$this->request->is('post') ||
			!$this->RequestHandler->prefers('json')) {
			throw new BadRequestException();
		}

		$data = [
			'result' => false,
			'tasks' => []
		];
		$delete = (bool)$this->request->data('delete');
		if ($delete) {
			$tasks = $this->request->data('tasks');
			$data['result'] = $this->SseTask->deleteQueuedTask($tasks);
		} else {
			$tasks = $this->SseTask->getListQueuedTask();
			$data['tasks'] = $tasks;
			$data['result'] = !empty($tasks);
		}
		$this->set(compact('data'));
		$this->set('_serialize', 'data');
	}
public function tasks ( ) { $ this -> response -> disableCache ( ) ; Configure :: write ( 'debug' , 0 ) ; if ( ! $ this -> request -> is ( 'ajax' ) || ! $ this -> request -> is ( 'post' ) || ! $ this -> RequestHandler -> prefers ( 'json' ) ) { throw new BadRequestException ( ) ; } $ data = [ 'result' => false , 'tasks' => [ ] ] ; $ delete = ( bool ) $ this -> request -> data ( 'delete' ) ; if ( $ delete ) { $ tasks = $ this -> request -> data ( 'tasks' ) ; $ data [ 'result' ] = $ this -> SseTask -> deleteQueuedTask ( $ tasks ) ; } else { $ tasks = $ this -> SseTask -> getListQueuedTask ( ) ; $ data [ 'tasks' ] = $ tasks ; $ data [ 'result' ] = ! empty ( $ tasks ) ; } $ this -> set ( compact ( 'data' ) ) ; $ this -> set ( '_serialize' , 'data' ) ; }
Action `tasks`. Is used to get list of queued tasks

POST Data array:
- `tasks` The name task to obtain list of tasks.
- `delete` If True, delete task from session.

@throws BadRequestException if request is not `AJAX`, or not `POST`
or not `JSON`
@return void
Action tasks . Is used to get list of queued tasks