示例#1
0
 /**
  * Gets a rendered HTML form
  */
 public function get_form(ezcWorkflowExecution $execution)
 {
     $list_of_variables = $execution->getVariables();
     if (array_key_exists('review_form', $list_of_variables)) {
         $db_form = new midgardmvc_ui_forms_form($list_of_variables['review_form']);
         $form = midgardmvc_ui_forms_generator::get_by_form($db_form, false);
         $form->set_readonly(false);
         if ($this->request->isset_data_item('redirect_link')) {
             $redirect_link = $this->request->get_data_item('redirect_link');
         } else {
             if (array_key_exists('HTTP_REFERER', $_SERVER)) {
                 $redirect_link = $_SERVER['HTTP_REFERER'];
             } else {
                 $redirect_link = '';
             }
         }
         $form->set_cancel(null, $this->mvc->i18n->get('cancel', 'midgardmvc_helper_forms'), $redirect_link);
         // add a hidden input with the recirect link
         // where we go upon successful submit
         $field = $form->add_field('redirect_link', 'text');
         $field->set_value($redirect_link);
         $widget = $field->set_widget('hidden');
         // add a hidden input with the execution guid
         $field = $form->add_field('execution', 'text');
         $field->set_value($execution->guid);
         $widget = $field->set_widget('hidden');
         return array('db_form' => $db_form, 'form' => $form);
     }
     return null;
 }