Author: david
Date: 2008-09-30 11:32:12 -0700 (Tue, 30 Sep 2008)
New Revision: 1411

Modified:
   trunk/apps/qubit/modules/actor/actions/updateAction.class.php
Log:
Fix indenting. Add docblock header.

Modified: trunk/apps/qubit/modules/actor/actions/updateAction.class.php
===================================================================
--- trunk/apps/qubit/modules/actor/actions/updateAction.class.php       
2008-09-30 18:29:38 UTC (rev 1410)
+++ trunk/apps/qubit/modules/actor/actions/updateAction.class.php       
2008-09-30 18:32:12 UTC (rev 1411)
@@ -19,218 +19,228 @@
  * Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+/**
+ * Controller for updating an Actor.
+ * 
+ * @package    qubit
+ * @subpackage actor
+ * @version    svn: $Id$
+ * @author     Peter Van Garderen <[EMAIL PROTECTED]>
+ * @author     Jack Bates <[EMAIL PROTECTED]>
+ * @author     David Juhasz <[EMAIL PROTECTED]>
+ */
 class ActorUpdateAction extends sfAction
 {
   public function execute($request)
   {
-  if (!$this->getRequestParameter('id', 0))
+    if (!$this->getRequestParameter('id', 0))
     {
-    $actor = new QubitActor;
+      $actor = new QubitActor;
 
-    //set the user navigation context to 'add'
-    $this->getUser()->setAttribute('nav_context_module', 'add');
+      //set the user navigation context to 'add'
+      $this->getUser()->setAttribute('nav_context_module', 'add');
     }
-   else
+    else
     {
-    $actor = QubitActor::getById($this->getRequestParameter('id'));
-    $this->forward404Unless($actor);
+      $actor = QubitActor::getById($this->getRequestParameter('id'));
+      $this->forward404Unless($actor);
     }
 
     $actor->setId($this->getRequestParameter('id'));
 
     if ($this->getRequestParameter('dateId'))
-      {
+    {
       $date = QubitEvent::getById($this->getRequestParameter('dateId'));
-      }
+    }
     else
-      {
+    {
       $date = new QubitEvent;
-      }
+    }
 
     //save fields by template
     switch ($this->getRequestParameter('template'))
-        {
-        case 'anotherTemplate' :
-          //save stuff
-          break;
+    {
+      case 'anotherTemplate' :
+        //save stuff
+        break;
         //default template is 'ISAAR'
-        case 'isaar' :
-        default :
-          $this->updateActorAttributes($actor);
-          $this->updateOtherNames($actor);
-          $this->updateTermOneToManyRelations($actor);
-          $this->updateProperties($actor);
-//          $this->updateObjectTermRelations($actor);
-          $this->updateDates($actor, $date);
-          $this->updateActorNotes($actor);
-          //$this->updateInformationObjectRelations($actor);
-          //$this->updateRecursiveRelations($actor);
-          //$this->updateContactInformation($actor);
+      case 'isaar' :
+      default :
+        $this->updateActorAttributes($actor);
+        $this->updateOtherNames($actor);
+        $this->updateTermOneToManyRelations($actor);
+        $this->updateProperties($actor);
+        //          $this->updateObjectTermRelations($actor);
+        $this->updateDates($actor, $date);
+        $this->updateActorNotes($actor);
+        //$this->updateInformationObjectRelations($actor);
+        //$this->updateRecursiveRelations($actor);
+        //$this->updateContactInformation($actor);
 
-          break;
-        }
+        break;
+    }
 
-  //set redirect if actor edit was called from another module
+    //set redirect if actor edit was called from another module
     if ($this->getRequestParameter('repositoryReroute'))
-      {
+    {
       return 
$this->redirect('repository/edit?id='.$this->getRequestParameter('repositoryReroute'));
-      }
+    }
 
     if ($this->getRequestParameter('informationObjectReroute'))
-      {
+    {
       return 
$this->redirect('informationobject/edit?id='.$this->getRequestParameter('informationObjectReroute'));
-      }
+    }
 
     //set view template
     switch ($this->getRequestParameter('template'))
-      {
+    {
       case 'anotherTemplate' :
         return 
$this->redirect('actor/edit?id='.$actor->getId().'&template=editAnotherTemplate');
-      //default template is ISAAR)
+        //default template is ISAAR)
       case 'isaar' :
         return 
$this->redirect('actor/edit?id='.$actor->getId().'&template=isaar');
       default :
         return $this->redirect('actor/edit?id='.$actor->getId());
-      }
+    }
   } //close execute()
 
   public function updateActorAttributes($actor)
   {
-  
$actor->setAuthorizedFormOfName($this->getRequestParameter('authorized_form_of_name'));
-  
$actor->setCorporateBodyIdentifiers($this->getRequestParameter('corporate_body_identifiers'));
-  $actor->setHistory($this->getRequestParameter('history'));
-  $actor->setPlaces($this->getRequestParameter('places'));
-  $actor->setLegalStatus($this->getRequestParameter('legal_status'));
-  $actor->setFunctions($this->getRequestParameter('functions'));
-  $actor->setMandates($this->getRequestParameter('mandates'));
-  
$actor->setInternalStructures($this->getRequestParameter('internal_structures'));
-  $actor->setGeneralContext($this->getRequestParameter('general_context'));
-  
$actor->setDescriptionIdentifier($this->getRequestParameter('description_identifier'));
-  
$actor->setInstitutionResponsibleIdentifier($this->getRequestParameter('institution_responsible_identifier'));
-  $actor->setRules($this->getRequestParameter('rules'));
-  $actor->setSources($this->getRequestParameter('sources'));
-  $actor->setRevisionHistory($this->getRequestParameter('revision_history'));
+    
$actor->setAuthorizedFormOfName($this->getRequestParameter('authorized_form_of_name'));
+    
$actor->setCorporateBodyIdentifiers($this->getRequestParameter('corporate_body_identifiers'));
+    $actor->setHistory($this->getRequestParameter('history'));
+    $actor->setPlaces($this->getRequestParameter('places'));
+    $actor->setLegalStatus($this->getRequestParameter('legal_status'));
+    $actor->setFunctions($this->getRequestParameter('functions'));
+    $actor->setMandates($this->getRequestParameter('mandates'));
+    
$actor->setInternalStructures($this->getRequestParameter('internal_structures'));
+    $actor->setGeneralContext($this->getRequestParameter('general_context'));
+    
$actor->setDescriptionIdentifier($this->getRequestParameter('description_identifier'));
+    
$actor->setInstitutionResponsibleIdentifier($this->getRequestParameter('institution_responsible_identifier'));
+    $actor->setRules($this->getRequestParameter('rules'));
+    $actor->setSources($this->getRequestParameter('sources'));
+    $actor->setRevisionHistory($this->getRequestParameter('revision_history'));
 
-  $actor->save();
+    $actor->save();
   }
 
   public function updateOtherNames($actor)
+  {
+    if ($this->getRequestParameter('name'))
     {
-    if ($this->getRequestParameter('name'))
-      {
       $actor->setOtherNames($this->getRequestParameter('name'), 
$this->getRequestParameter('type_id'), $this->getRequestParameter('note'));
-      }
     }
+  }
 
   public function updateActorNotes($actor)
+  {
+    if ($this->getRequestParameter('content'))
     {
-    if ($this->getRequestParameter('content'))
-      {
       $actor->setActorNote($this->getUser()->getAttribute('user_id'), 
$this->getRequestParameter('content'), 
$this->getRequestParameter('note_type_id'));
-      }
     }
+  }
 
   public function updateTermOneToManyRelations($actor)
+  {
+    if ($this->getRequestParameter('entity_type_id'))
     {
-    if ($this->getRequestParameter('entity_type_id'))
-      {
       $actor->setEntityTypeId($this->getRequestParameter('entity_type_id'));
-      }
+    }
     else
-      {
+    {
       $actor->setEntityTypeId(null);
-      }
+    }
 
     if ($this->getRequestParameter('description_status_id'))
-      {
+    {
       
$actor->setDescriptionStatusId($this->getRequestParameter('description_status_id'));
-      }
-      else
-      {
+    }
+    else
+    {
       $actor->setDescriptionStatusId(null);
-      }
+    }
 
     if ($this->getRequestParameter('description_detail_id'))
-      {
+    {
       
$actor->setDescriptionDetailId($this->getRequestParameter('description_detail_id'));
-      }
+    }
     else
-      {
+    {
       $actor->setDescriptionDetailId(null);
-      }
+    }
 
     $actor->save();
-    }
+  }
 
   public function updateProperties($actor)
+  {
+    if ($this->getRequestParameter('language_code'))
     {
-      if ($this->getRequestParameter('language_code'))
-        {
-          $actor->setProperty($this->getRequestParameter('language_code'), 
$name = 'language_of_actor_description', $scope = 'languages');
-        }
-
-      if ($this->getRequestParameter('script_code'))
-        {
-           $actor->setProperty($this->getRequestParameter('script_code'), 
$name = 'script_of_actor_description', $scope = 'scripts');
-        }
+      $actor->setProperty($this->getRequestParameter('language_code'), $name = 
'language_of_actor_description', $scope = 'languages');
     }
 
-  public function updateObjectTermRelations($actor)
+    if ($this->getRequestParameter('script_code'))
     {
+      $actor->setProperty($this->getRequestParameter('script_code'), $name = 
'script_of_actor_description', $scope = 'scripts');
     }
+  }
 
+  public function updateObjectTermRelations($actor)
+  {
+  }
+
   public function updateEventRelations($actor)
-    {
+  {
     //used to be updateInformationObjectRelations - TO DO: update to handle 
relations via Event object
 
     if ($this->getRequestParameter('informationObjectId'))
+    {
+      if ($this->getRequestParameter('actor_role_id'))
       {
-      if ($this->getRequestParameter('actor_role_id'))
-        {
         $actorRoleId = $this->getRequestParameter('actor_role_id');
-        }
+      }
       else
-        {
+      {
         //default role is Creator
         $actorRoleId = QubitTerm::EXISTENCE_ID;
-        }
+      }
 
       
$actor->addInformationObjectRelation($this->getRequestParameter('informationObjectId'),
 $actorRoleId,$this->getRequestParameter('relation_dates'));
 
       
SearchIndex::updateIndexDocument($this->getRequestParameter('informationObjectId'));
-      }
     }
+  }
 
   public function updateDates($actor, $date)
+  {
+    if (($this->getRequestParameter('start_date')) or 
($this->getRequestParameter('description')))
     {
-     if (($this->getRequestParameter('start_date')) or 
($this->getRequestParameter('description')))
-      {
       $date->setTypeId(QubitTerm::EXISTENCE_ID);
       $date->setActorId($actor->getId());
       $date->setStartDate($this->getRequestParameter('start_date').'-01-01');
       if ($this->getRequestParameter('end_date') == '')
-        {
-          $date->setEndDate(null);
-        }
+      {
+        $date->setEndDate(null);
+      }
       else
-        {
-          $date->setEndDate($this->getRequestParameter('end_date').'-01-01');
-        }
+      {
+        $date->setEndDate($this->getRequestParameter('end_date').'-01-01');
+      }
       if ($this->getRequestParameter('description'))
-        {
+      {
         $date->setDescription($this->getRequestParameter('description'));
-        }
+      }
       else
-        {
+      {
         $dateString = $this->getRequestParameter('start_date');
         if ($this->getRequestParameter('end_date'))
-          {
-            $dateString .= ' - '.$this->getRequestParameter('end_date');
-          }
+        {
+          $dateString .= ' - '.$this->getRequestParameter('end_date');
+        }
         $date->setDescription($dateString);
-        }
+      }
 
       $date->save();
-      }
     }
+  }
 }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to