/**
  * @param $id
  * @return \Illuminate\View\View
  */
 function index($id)
 {
     $activityData = $this->activityManager->getActivityData($id);
     if (Gate::denies('ownership', $activityData)) {
         return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
     }
     $iatiIdentifier = $this->iatiIdentifierManager->getIatiIdentifierData($id);
     $organization = $this->organizationManager->getOrganization($this->organization_id);
     $reportingOrganization = $organization->reporting_org;
     $form = $this->identifier->editForm($iatiIdentifier, $id);
     return view('Activity.iatiIdentifier.iatiIdentifier', compact('form', 'reportingOrganization', 'id'));
 }
 /**
  * @param bool $duplicate
  * @param int  $activityId
  * @return \Illuminate\View\View
  */
 public function create($duplicate = false, $activityId = 0)
 {
     $organization = $this->organizationManager->getOrganization($this->organization_id);
     if (Gate::denies('create', $organization)) {
         return redirect()->route('activity.index')->withResponse($this->getNoPrivilegesMessage());
     }
     $this->authorize('add_activity', $organization);
     $form = $duplicate ? $this->identifierForm->duplicate($activityId) : $this->identifierForm->create();
     $settings = $this->settingsManager->getSettings($this->organization_id);
     if ($organization->reporting_org == null || $organization->reporting_org[0]['reporting_organization_identifier'] == "" || $organization->reporting_org[0]['reporting_organization_type'] == "") {
         $response = ['type' => 'warning', 'code' => ['settings', ['name' => 'activity']]];
         return redirect('/settings')->withResponse($response);
     }
     $defaultFieldValues = $settings->default_field_values;
     $reportingOrganization = $organization->reporting_org;
     return view('Activity.create', compact('form', 'organization', 'reportingOrganization', 'defaultFieldValues', 'duplicate'));
 }