another update

This commit is contained in:
JT Smith 2005-12-07 03:22:51 +00:00
parent 6bda7a623d
commit 9e17031f84
2 changed files with 39 additions and 4 deletions

View file

@ -16,6 +16,7 @@ package WebGUI::ProfileCategory;
=cut =cut
use strict; use strict;
use WebGUI::Id;
use WebGUI::Session; use WebGUI::Session;
@ -50,7 +51,14 @@ A hash reference containing the properties of this field. See the set() method f
=cut =cut
sub create { sub create {
my $class = shift;
my $properties = shift;
my $id = WebGUI::Id::generate();
my ($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory");
WebGUI::SQL->write("insert into userProfileCategory (profileCategoryId,sequenceNumber) values (".quote($id).", ".($sequenceNumber+1).")");
my $self = $class->new($id);
$self->update($properties);
return $self;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -62,7 +70,11 @@ Deletes this category and all fields attached to it.
=cut =cut
sub delete { sub delete {
my $self = shift;
foreach my $field (@{$self->getFields}) {
$field->delete;
}
WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=".quote($self->getId));
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -78,7 +90,12 @@ If specified, the value of an individual property is returned.
=cut =cut
sub get { sub get {
my $self = shift;
my $propertyName = shift;
if (defined $propertyName) {
return $self->{_properties}{$propertyName};
}
return $self->{_properties};
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -108,6 +125,19 @@ sub getFields {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 getId ()
Returns the unique ID for this category.
=cut
sub getId {
my $self = shift;
return $self->{_id};
}
#-------------------------------------------------------------------
=head2 moveDown () =head2 moveDown ()
Moves this category down one position. Moves this category down one position.

View file

@ -107,7 +107,12 @@ If specified, the value of an individual property is returned.
=cut =cut
sub get { sub get {
my $self = shift;
my $propertyName = shift;
if (defined $propertyName) {
return $self->{_properties}{$propertyName};
}
return $self->{_properties};
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------