Friday, March 27, 2015

Dynamic Web Application - Part 3

The last post of Dynamic Web Application will show the implementation of the ORB within the index page. There are two things to take into account : Actions and Forms
The actions will do the CRUD operations based on your Request via the Criteria knowing that they have been setup with your displayers.


 switch ($action) {  
  case "delete" :  
   if($security->isAdmin())  
    $message = $helper->doDelete($security);   
   $sql_row = $helper->redirectTo($helper->getWebhome());  
   break;  
  case "update" :        
   $message = $helper->doUpdate($security);  
   $sql_row = $helper->getPageFromId();  
   break;  
  case "insert" :  
   $message = $helper->doInsert($security);  
   $sql_row = $helper->redirectTo($_REQUEST['bin_document_name']);        
   break;  
  case "redirect" :  
   $sql_row = $helper->redirectTo($_REQUEST['redirect']);  
   break;  
  default :  
   $sql_row = $helper->getPageFromRequest();        
 }  
 if ($action != "edit")     
    $action = "view";  

meanwhile your displayers can switch in various mode


 switch ($action) {  
   case "edit" :  
    echo $fields['content']->displayEdit ($table, $sql_row, $inline_model_class,"bin");  
    echo "\n  <div class=\"comment\">\n" . $fields['content']->getWikiHelp() . "  </div>\n";  
    break;  
   default :  
    echo $fields['content']->displayView ($table, $sql_row, $inline_model_class,"bin");  

No comments:

Post a Comment