@@ -11,27 +11,27 @@ public function init()
1111 protected function _redirectAfterDelete ($ record )
1212 {
1313 $ this ->_helper ->redirector ('user ' );
14- }
15-
14+ }
15+
1616 public function editAction ()
1717 {
1818 $ this ->view ->addHelperPath (USER_PROFILES_DIR . '/helpers ' , 'UserProfiles_View_Helper_ ' );
1919 $ allTypes = $ this ->_helper ->db ->getTable ('UserProfilesType ' )->findAll ();
2020 $ typeId = $ this ->getParam ('type ' );
21-
21+
2222 //if no typeId
2323 if (!$ typeId ) {
2424 $ typeId = $ allTypes ['0 ' ]->id ;
2525 }
2626 $ profileType = $ this ->_helper ->db ->getTable ('UserProfilesType ' )->find ($ typeId );
27-
27+
2828 $ userId = $ this ->_getParam ('id ' );
2929 if ($ userId ) {
3030 $ user = $ this ->_helper ->db ->getTable ('User ' )->find ($ userId );
3131 } else {
3232 $ user = current_user ();
33- $ userId = $ user ->id ;
34- }
33+ $ userId = $ user ->id ;
34+ }
3535 $ this ->view ->user = $ user ;
3636 $ userProfile = $ this ->_helper ->db ->getTable ()->findByUserIdAndTypeId ($ userId , $ typeId );
3737 if (!$ userProfile ) {
@@ -40,7 +40,7 @@ public function editAction()
4040 $ userProfile ->type_id = $ typeId ;
4141 $ userProfile ->setRelationData (array ('subject_id ' =>$ userId ));
4242 }
43-
43+
4444 if (!is_allowed ($ userProfile , 'edit ' )) {
4545 throw new Omeka_Controller_Exception_403 ;
4646 }
@@ -52,7 +52,6 @@ public function editAction()
5252 } else {
5353 $ this ->_helper ->flashMessenger ($ userProfile ->getErrors ());
5454 }
55-
5655 }
5756 $ this ->view ->userprofilesprofile = $ userProfile ;
5857 $ this ->view ->userprofilestype = $ profileType ;
@@ -63,9 +62,9 @@ public function userAction()
6362 {
6463 $ allTypes = $ this ->_helper ->db ->getTable ('UserProfilesType ' )->findAll ();
6564 $ userId = $ this ->_getParam ('id ' );
66-
65+
6766 $ typeId = $ this ->getParam ('type ' );
68-
67+
6968 //if no typeId, as happens on the public side, give the first profile typeId
7069 if (!$ typeId ) {
7170 $ typeId = $ allTypes ['0 ' ]->id ;
@@ -84,26 +83,24 @@ public function userAction()
8483 $ this ->view ->userprofilestype = $ profileType ;
8584 $ this ->view ->profile_types = apply_filters ('user_profiles_type ' , $ allTypes );
8685 }
87-
86+
8887 public function elementFormAction ()
8988 {
9089 $ elementId = (int )$ _POST ['element_id ' ];
9190 $ recordType = $ _POST ['record_type ' ];
9291 $ recordId = (int )$ _POST ['record_id ' ];
93-
92+
9493 // Re-index the element form posts so that they are displayed in the correct order
9594 // when one is removed.
9695 if (isset ($ _POST ['Elements ' ])) {
9796 $ _POST ['Elements ' ][$ elementId ] = array_merge ($ _POST ['Elements ' ][$ elementId ]);
9897 }
9998 $ element = $ this ->_helper ->db ->getTable ('Element ' )->find ($ elementId );
10099 $ record = $ this ->_helper ->db ->getTable ($ recordType )->find ($ recordId );
101-
100+
102101 if (!$ record ) {
103102 $ record = new $ recordType ;
104103 }
105-
106104 $ this ->view ->assign (compact ('element ' , 'record ' ));
107- }
108-
105+ }
109106}
0 commit comments