Exemplo n.º 1
0
 /**
  * Copy an entry and all associated data
  *
  * @return	void
  */
 public function copyTask()
 {
     // Incoming
     $id = Request::getVar('id', array());
     // Get the single ID we're working with
     if (is_array($id)) {
         $id = !empty($id) ? $id[0] : 0;
     }
     if (!$id) {
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&unit=' . Request::getInt('unit', 0), false), Lang::txt('COM_COURSES_ERROR_NO_ID'), 'error');
         return;
     }
     $assetgroup = new \Components\Courses\Models\Assetgroup($id);
     if (!$assetgroup->copy()) {
         // Redirect back to the courses page
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&unit=' . $assetgroup->get('unit_id'), false), Lang::txt('COM_COURSES_ERROR_COPY_FAILED') . ': ' . $assetgroup->getError(), 'error');
         return;
     }
     // Redirect back to the courses page
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&unit=' . $assetgroup->get('unit_id'), false), Lang::txt('COM_COURSES_ITEM_COPIED'));
 }