Ejemplo n.º 1
0
 public function executeUpdateLists(sfWebRequest $request)
 {
     //Check that the HTTP method is 'POST':
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     //Get the POST parameters:
     $entries_to_remove = $request->getParameter('remove', array());
     $entries_to_disable = $request->getParameter('disable', array());
     $table = $request->getParameter('table');
     $entries_to_add_designation = $request->getParameter('add_designation', array());
     $entries_to_add_short_designation = $request->getParameter('add_short_designation', array());
     $entries_to_add_order = $request->getParameter('add_order', array());
     $entries_to_add_family_id = $request->getParameter('add_family_id', array());
     //Remove the entries passed in the 'remove' parameter:
     PredefinedLists::removeFrom($entries_to_remove, $table);
     //Add the entries passed in the 'add' parameter:
     PredefinedLists::addInto($entries_to_add_designation, $entries_to_add_order, $entries_to_add_short_designation, $entries_to_add_family_id, $table);
     //Disable the entries passed in the 'disable' parameter:
     PredefinedLists::disable($entries_to_disable, $table);
     //Re-get the table that have been updated:
     $data = PredefinedLists::getData(array($table => null));
     $this->updated_table = $data[$table];
     //Set the correct template to display:
     if ($table == PredefinedLists::UNITY) {
         $this->setTemplate('updateUnities', 'configuration');
     } else {
         if ($table == PredefinedLists::COMPUTER_OS) {
             $this->setTemplate('updateOs', 'configuration');
         } else {
             $this->table_name = $table;
         }
     }
 }