Subversion Repositories php_users

Rev

Rev 18 | Rev 20 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 19
Line 85... Line 85...
85
      }
85
      }
86
      return implode( "\n", $return );
86
      return implode( "\n", $return );
87
   }
87
   }
88
   
88
   
89
   protected function addEdit( $connection ) {
89
   protected function addEdit( $connection ) {
90
      //print "<pre>addEdit\n" . print_r( $this->workingOn, true) . '</pre>';
90
      print "<pre>addEdit\n" . print_r( $this->workingOn, true) . '</pre>';
91
      $return = parent::addEdit( $connection );
91
      $return = parent::addEdit( $connection );
92
      $data = array();
92
      $data = array();
93
      // now we process all of the permissions
93
      // now we process all of the permissions
94
      if ( $return != 'Error' ) {
94
      if ( $return != 'Error' ) {
95
         foreach ( $this->workingOn['permissions'] as $name => $value ) {
95
         foreach ( $this->workingOn['permissions'] as $name => $value ) {
96
            $htmlFieldName = $this->configuration['input prefix'] . $name;
96
            $htmlFieldName = $this->configuration['input prefix'] . $name;
-
 
97
            // if a new user, the permission is whatever is in the form
-
 
98
            if ( $this->workingOn['id'] == -1 && isset( $_REQUEST[$htmlFieldName] ) ) {
-
 
99
               $data[$name] = 1;
-
 
100
            // otherwise, if it is not a new user, only do an update if it has changed
97
            if ( $this->workingOn['id'] == -1 || ( isset( $_REQUEST[$htmlFieldName] ) != $this->workingOn['permissions'][$name] ) ) {
101
            } elseif ( $this->workingOn['id'] > 0 && isset( $_REQUEST[$htmlFieldName] ) != $this->workingOn['permissions'][$name] ) {
98
               $data[$name] = isset( $_REQUEST[$htmlFieldName] ) ? 1 : 0;
102
               $data[$name] = isset( $_REQUEST[$htmlFieldName] ) ? 1 : 0;
99
            }
103
            }
100
         } // foreach
104
         } // foreach
101
         $connection->updatePermissions( $this->workingOn['id'],$data );
105
         $connection->updatePermissions( $this->workingOn['id'],$data );
102
      } // if not an error
106
      } // if not an error
103
      return $return;
107
      return $return;
104
   } // addEdit
108
   } // addEdit
105
   
109
   
-
 
110
   protected function initWorkingOn( $connection, $id ) {
-
 
111
      parent::initWorkingOn( $connection, $id );
-
 
112
      if ( ! isset( $this->workingOn['permissions'] ) ) {
-
 
113
         $this->workingOn['permissions'] = $connection->getPermissions( $id );
-
 
114
      }
-
 
115
   }
-
 
116
 
106
 
117
 
107
}
118
}
108
 
119
 
109
?>
120
?>