示例#1
0
  *  Are there any form validation errors?
  */
 if (strlen($error_message)) {
     /*
      * Tell the form submitter input to send to the browser
      * an order to display validation error feedback message.
      */
     $title = "Validation error";
     $output = HtmlSpecialChars($error_message);
     $active = 0;
     $icon = '';
     ob_start();
     require 'templates/message.html.php';
     $content = ob_get_contents();
     ob_end_clean();
     $form->SetInputProperty("sender", "Feedback", $content);
 } else {
     /*
      *  The form was processed without errors.
      *  Lets execute the form processing actions
      *  and show some progress feedback.
      */
     $active = 1;
     $title = "Status";
     $output = '<center>Operation in progress: ' . '<tt><span id="progress">0</span>%</tt></center>';
     $icon = '&nbsp;';
     ob_start();
     require 'templates/message.html.php';
     $content = ob_get_contents();
     ob_end_clean();
     /*
示例#2
0
 switch ($message["Event"]) {
     case "listing":
         /*
          *  When the listing event is sent, applications should
          *  retrieve the data of entries to display and set a few
          *  properties to tell the scaffolding plug-in how to render
          *  the entries.
          */
         $page = $message['Page'];
         if (!$model->GetEntries($page, $posts, $total_posts)) {
             die('Error: ' . $model->error);
         }
         if (!$view->GetPostListingFormat($columns, $id_column, $page_entries)) {
             die('Error: ' . $view->error);
         }
         $form->SetInputProperty('posts', 'IDColumn', $id_column);
         $form->SetInputProperty('posts', 'Columns', $columns);
         $form->SetInputProperty('posts', 'TotalEntries', $total_posts);
         $form->SetInputProperty('posts', 'PageEntries', $page_entries);
         $form->SetInputProperty('posts', 'Page', $page);
         $form->SetInputProperty('posts', 'Rows', $posts);
         break;
     case "created":
         /*
          *  When the created event is sent, applications should
          *  validate the form and create a new entry if it is all
          *  OK.
          */
         if (strlen($error_message = $form->Validate($verify, 'posts-submit')) == 0) {
             $form->LoadInputValues(1);
             $entry = array('title' => $form->GetInputValue('title'), 'body' => $form->GetInputValue('body'));