public function view($form_key = null)
 {
     //If dropdown filter was chosen from dashboard,
     // redirect back to ourselves with the form_key in the url...
     if (!empty($_GET['form_key'])) {
         $this->redirect('/dashboard/reports/custom_contact_form', $_GET['form_key']);
     }
     $forms = CustomContactForm::getFormKeysAndTitles();
     $this->set('forms', $forms);
     if (empty($forms)) {
         $this->set('error_no_forms', true);
         return;
     }
     $form_key = empty($form_key) ? key($forms) : $form_key;
     //use first form's key if none provided
     $this->set('form_key', $form_key);
     if (!array_key_exists($form_key, $forms)) {
         $this->set('error_invalid_form_key', true);
         return;
     }
     $this->set('fields', CustomContactForm::getFieldNamesAndLabelsForDashboardReport($form_key));
     $this->set('submissions', CustomContactForm::getSubmissionsForDashboardView($form_key));
     $this->addHeaderItem(Loader::helper('html')->css('dashboard.css', 'custom_contact_form'));
 }
 private function setAvailableForms()
 {
     $this->set('available_forms', CustomContactForm::getFormKeysAndTitles());
 }