public function actionSync($guid = null, $useQueue = true) {
		if (empty($guid) || $useQueue) {
			$modelQueuedTask = ClassRegistry::init('Queue.QueuedTask');
			$data = null;
			if (!empty($guid)) {
				$data = compact('guid');
			}
			if ((bool)$modelQueuedTask->createJob('SyncEmployee', $data, null, 'sync')) {
				$this->_controller->Flash->success(__d('cake_ldap', 'Synchronization information of employees put in queue...'));
				$this->_controller->ViewExtension->setProgressSseTask('SyncEmployee');
			} else {
				$this->_controller->Flash->error(__d('cake_ldap', 'Synchronization information of employees put in queue unsuccessfully'));
			}
		} else {
			$modelSync = ClassRegistry::init('CakeLdap.Sync');
			if ($modelSync->syncInformation($guid)) {
				$this->_controller->Flash->success(__d('cake_ldap', 'Synchronization information of employees has been finished successfully'));
			} else {
				$this->_controller->Flash->error(__d('cake_ldap', 'Synchronization information of employees has been finished unsuccessfully'));
			}
		}
		$this->_controller->ViewExtension->setRedirectUrl(null, 'employee');

		return $this->_controller->ViewExtension->redirectByUrl(null, 'employee');
	}
public function actionSync($guid = null, $useQueue = true) {
		if (empty($guid) || $useQueue) {
			$modelQueuedTask = ClassRegistry::init('Queue.QueuedTask');
			$data = null;
			if (!empty($guid)) {
				$data = compact('guid');
			}
			if ((bool)$modelQueuedTask->createJob('SyncEmployee', $data, null, 'sync')) {
				$this->_controller->Flash->success(__d('cake_ldap', 'Synchronization information of employees put in queue...'));
				$this->_controller->ViewExtension->setProgressSseTask('SyncEmployee');
			} else {
				$this->_controller->Flash->error(__d('cake_ldap', 'Synchronization information of employees put in queue unsuccessfully'));
			}
		} else {
			$modelSync = ClassRegistry::init('CakeLdap.Sync');
			if ($modelSync->syncInformation($guid)) {
				$this->_controller->Flash->success(__d('cake_ldap', 'Synchronization information of employees has been finished successfully'));
			} else {
				$this->_controller->Flash->error(__d('cake_ldap', 'Synchronization information of employees has been finished unsuccessfully'));
			}
		}
		$this->_controller->ViewExtension->setRedirectUrl(null, 'employee');

		return $this->_controller->ViewExtension->redirectByUrl(null, 'employee');
	}
public function actionSync ( $ guid = null , $ useQueue = true ) { if ( empty ( $ guid ) || $ useQueue ) { $ modelQueuedTask = ClassRegistry :: init ( 'Queue.QueuedTask' ) ; $ data = null ; if ( ! empty ( $ guid ) ) { $ data = compact ( 'guid' ) ; } if ( ( bool ) $ modelQueuedTask -> createJob ( 'SyncEmployee' , $ data , null , 'sync' ) ) { $ this -> _controller -> Flash -> success ( __d ( 'cake_ldap' , 'Synchronization information of employees put in queue...' ) ) ; $ this -> _controller -> ViewExtension -> setProgressSseTask ( 'SyncEmployee' ) ; } else { $ this -> _controller -> Flash -> error ( __d ( 'cake_ldap' , 'Synchronization information of employees put in queue unsuccessfully' ) ) ; } } else { $ modelSync = ClassRegistry :: init ( 'CakeLdap.Sync' ) ; if ( $ modelSync -> syncInformation ( $ guid ) ) { $ this -> _controller -> Flash -> success ( __d ( 'cake_ldap' , 'Synchronization information of employees has been finished successfully' ) ) ; } else { $ this -> _controller -> Flash -> error ( __d ( 'cake_ldap' , 'Synchronization information of employees has been finished unsuccessfully' ) ) ; } } $ this -> _controller -> ViewExtension -> setRedirectUrl ( null , 'employee' ) ; return $ this -> _controller -> ViewExtension -> redirectByUrl ( null , 'employee' ) ; }
Action `sync`. Used to synchronization information of employee
with Active Directory.

@param string|null $guid GUID of employee for synchronization
@param bool $useQueue If True, use queue of task for synchronization.
Otherwise, synchronization is started now.
@return void
Action sync . Used to synchronization information of employee with Active Directory .