public function transferAction() { // No service ID? if (null === ($service_id = $this->_getParam('service_id'))) { return $this->_helper->redirector->gotoRoute(array('action' => 'index')); } // Make form $this->view->form = $form = new Core_Form_Confirm(array('title' => 'Transfer Files?', 'description' => 'This will begin transferring stored files from other ' . 'services to this storage service.', 'submitLabel' => 'Transfer', 'cancelHref' => $this->view->url(array('action' => 'index', 'service_id' => null)))); $jobsTable = Engine_Api::_()->getDbtable('jobs', 'core'); // Check for existing active job? $activeJobs = $jobsTable->getActiveJobs(array('jobtype' => 'storage_transfer')); if ($activeJobs->count() > 0) { return $form->addError('There is already a pending job to transfer files.'); } // Check if (!$this->getRequest()->isPost()) { return; } if (!$form->isValid($this->getRequest()->getPost())) { return; } // Process $jobsTable->addJob('storage_transfer', array('service_id' => $service_id)); $form->addNotice('A job has been created to transfer the files.'); }