diff --git a/UniversityPrograms/UniversityPrograms.xcodeproj/project.pbxproj b/UniversityPrograms/UniversityPrograms.xcodeproj/project.pbxproj index 0c49ef1..aba5937 100644 --- a/UniversityPrograms/UniversityPrograms.xcodeproj/project.pbxproj +++ b/UniversityPrograms/UniversityPrograms.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 1B0A691C1938D58C005C821D /* AboutUPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B0A691A1938D58C005C821D /* AboutUPViewController.m */; }; 1B0A69211938DA8B005C821D /* UpcomingEventsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B0A691F1938DA8B005C821D /* UpcomingEventsTableViewCell.m */; }; 1B0A69221938DA8B005C821D /* UpcomingEventsTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1B0A69201938DA8B005C821D /* UpcomingEventsTableViewCell.xib */; }; + 1B48B56819421640008F5186 /* DirectoryTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B48B56619421640008F5186 /* DirectoryTableViewCell.m */; }; + 1B48B56919421640008F5186 /* DirectoryTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1B48B56719421640008F5186 /* DirectoryTableViewCell.xib */; }; 1B7880DA1940EBED00333ED5 /* MyUPInitTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B7880D81940EBED00333ED5 /* MyUPInitTableViewCell.m */; }; 1B7880DB1940EBED00333ED5 /* MyUPInitTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1B7880D91940EBED00333ED5 /* MyUPInitTableViewCell.xib */; }; 1B7880E01940EC8B00333ED5 /* ContactUPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B7880DE1940EC8B00333ED5 /* ContactUPViewController.m */; }; @@ -95,6 +97,9 @@ 1B0A691F1938DA8B005C821D /* UpcomingEventsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UpcomingEventsTableViewCell.m; sourceTree = ""; }; 1B0A69201938DA8B005C821D /* UpcomingEventsTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UpcomingEventsTableViewCell.xib; sourceTree = ""; }; 1B38F299193F6FD2005158D1 /* UPWebserviceConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UPWebserviceConstants.h; sourceTree = ""; }; + 1B48B56519421640008F5186 /* DirectoryTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryTableViewCell.h; sourceTree = ""; }; + 1B48B56619421640008F5186 /* DirectoryTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DirectoryTableViewCell.m; sourceTree = ""; }; + 1B48B56719421640008F5186 /* DirectoryTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DirectoryTableViewCell.xib; sourceTree = ""; }; 1B7880D71940EBED00333ED5 /* MyUPInitTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyUPInitTableViewCell.h; sourceTree = ""; }; 1B7880D81940EBED00333ED5 /* MyUPInitTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyUPInitTableViewCell.m; sourceTree = ""; }; 1B7880D91940EBED00333ED5 /* MyUPInitTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MyUPInitTableViewCell.xib; sourceTree = ""; }; @@ -201,11 +206,11 @@ 1B0A69031938D434005C821D /* Controllers */ = { isa = PBXGroup; children = ( - 1B7880DC1940EC5E00333ED5 /* Contact UP */, 1BB198C4193F9AB60017A1D6 /* UPNavigationViewController.h */, 1BB198C5193F9AB60017A1D6 /* UPNavigationViewController.m */, 1BB198CA193FA54A0017A1D6 /* UPViewController.h */, 1BB198CB193FA54A0017A1D6 /* UPViewController.m */, + 1B7880DC1940EC5E00333ED5 /* Contact UP */, 1B0A690B1938D4A5005C821D /* upcoming events */, 1B0A69181938D575005C821D /* about */, 1BAD1A3C193CCB9E006D24AD /* MyUP */, @@ -251,6 +256,9 @@ 1B7880D71940EBED00333ED5 /* MyUPInitTableViewCell.h */, 1B7880D81940EBED00333ED5 /* MyUPInitTableViewCell.m */, 1B7880D91940EBED00333ED5 /* MyUPInitTableViewCell.xib */, + 1B48B56519421640008F5186 /* DirectoryTableViewCell.h */, + 1B48B56619421640008F5186 /* DirectoryTableViewCell.m */, + 1B48B56719421640008F5186 /* DirectoryTableViewCell.xib */, ); name = "Table Cells"; sourceTree = ""; @@ -258,10 +266,10 @@ 1B0A690B1938D4A5005C821D /* upcoming events */ = { isa = PBXGroup; children = ( - 1BAD1A4B193CD2AA006D24AD /* event */, 1B0A690E1938D520005C821D /* UpcomingEventViewController.h */, 1B0A690F1938D520005C821D /* UpcomingEventViewController.m */, 1B0A69101938D520005C821D /* UpcomingEventViewController.xib */, + 1BAD1A4B193CD2AA006D24AD /* event */, ); name = "upcoming events"; sourceTree = ""; @@ -582,6 +590,7 @@ 1BB198C0193F99F70017A1D6 /* Cog_filled.png in Resources */, 1B7880E91940EE9000333ED5 /* Contact@2x.png in Resources */, 1BAD1A50193CD385006D24AD /* SpecificEventViewController.xib in Resources */, + 1B48B56919421640008F5186 /* DirectoryTableViewCell.xib in Resources */, 1B7880E11940EC8B00333ED5 /* ContactUPViewController.xib in Resources */, 1BB198DB193FAA580017A1D6 /* Info.png in Resources */, 1B7880F1194105CE00333ED5 /* Pencil_filled.png in Resources */, @@ -640,6 +649,7 @@ 1BAD1A4F193CD385006D24AD /* SpecificEventViewController.m in Sources */, 1BB198C9193FA4530017A1D6 /* UIColor+UPColors.m in Sources */, 1B7880E01940EC8B00333ED5 /* ContactUPViewController.m in Sources */, + 1B48B56819421640008F5186 /* DirectoryTableViewCell.m in Sources */, 1B0A691C1938D58C005C821D /* AboutUPViewController.m in Sources */, 1BA9FE68193E244B008F8981 /* PriorFeedbackTableViewCell.m in Sources */, 1BB198E3193FC4900017A1D6 /* LocationDTO.m in Sources */, diff --git a/UniversityPrograms/UniversityPrograms/CommentViewController.m b/UniversityPrograms/UniversityPrograms/CommentViewController.m index 5b5d8db..b3d0f54 100644 --- a/UniversityPrograms/UniversityPrograms/CommentViewController.m +++ b/UniversityPrograms/UniversityPrograms/CommentViewController.m @@ -54,6 +54,7 @@ - (void)viewDidLoad self.firstNameBox.text = [[NSUserDefaults standardUserDefaults] valueForKey:@"userFirstName"]; self.lastNameBox.text = [[NSUserDefaults standardUserDefaults] valueForKey:@"userLastName"]; + // Do any additional setup after loading the view from its nib. } - (IBAction)didTapSubmit:(id)sender { diff --git a/UniversityPrograms/UniversityPrograms/ContactUPViewController.h b/UniversityPrograms/UniversityPrograms/ContactUPViewController.h index 31d5914..2e737a3 100644 --- a/UniversityPrograms/UniversityPrograms/ContactUPViewController.h +++ b/UniversityPrograms/UniversityPrograms/ContactUPViewController.h @@ -8,6 +8,6 @@ #import #import "UPViewController.h" -@interface ContactUPViewController : UPViewController +@interface ContactUPViewController : UPViewController @end diff --git a/UniversityPrograms/UniversityPrograms/ContactUPViewController.m b/UniversityPrograms/UniversityPrograms/ContactUPViewController.m index bb42551..3b2db02 100644 --- a/UniversityPrograms/UniversityPrograms/ContactUPViewController.m +++ b/UniversityPrograms/UniversityPrograms/ContactUPViewController.m @@ -7,9 +7,19 @@ // #import "ContactUPViewController.h" +#import "DirectoryTableViewCell.h" +#import "CommentViewController.h" @interface ContactUPViewController () +@property NSArray *directoryArray; +@property (weak, nonatomic) IBOutlet UITableView *contactUPTableView; + +@property (strong, nonatomic) IBOutlet UITableViewCell *addressCell; +@property (strong, nonatomic) IBOutlet UITableViewCell *directoryHeaderCell; +@property (strong, nonatomic) IBOutlet UITableViewCell *sendFeedbackCell; + + @end @implementation ContactUPViewController @@ -21,6 +31,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil self.title=@"Contact UP"; self.tabBarItem.image=[UIImage imageNamed:@"Contact.png"]; self.tabBarItem.selectedImage=[UIImage imageNamed:@"Contact_filled.png"]; + self.directoryArray = [[NSArray alloc] init]; // Custom initialization } return self; @@ -37,5 +48,80 @@ - (void)didReceiveMemoryWarning [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + + // Return the number of sections. + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + + // Return the number of rows in the section. + return self.directoryArray.count+3; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + + if(indexPath.row==0){ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"sendFeedbackCell"]; + + if(!cell){ + cell = self.sendFeedbackCell; + } + cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator; + return cell; + + + } + else if(indexPath.row==1){ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"addressCell"]; + + if(!cell){ + cell = self.addressCell; + } + return cell; + + } + else if(indexPath.row==2){ + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"directoryHeaderCell"]; + + if(!cell){ + cell = self.directoryHeaderCell; + } + return cell; + } + else{ + DirectoryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"directoryCell"]; + + if(!cell){ + cell = [[DirectoryTableViewCell alloc] init]; + } + return cell; + } + +} +- (CGFloat)tableView:(UITableView *)tableview heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + CGFloat retVal =0.0f; + if(indexPath.row==1){ + retVal=120.0f; + + } + else{ + retVal=44.0f; + + } + + return retVal; + +} +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + CommentViewController *tappedEvent = [[CommentViewController alloc] init]; + [self.navigationController pushViewController:tappedEvent animated:YES]; + [self.contactUPTableView reloadData]; +} @end diff --git a/UniversityPrograms/UniversityPrograms/ContactUPViewController.xib b/UniversityPrograms/UniversityPrograms/ContactUPViewController.xib index b9314a1..5fdc5be 100644 --- a/UniversityPrograms/UniversityPrograms/ContactUPViewController.xib +++ b/UniversityPrograms/UniversityPrograms/ContactUPViewController.xib @@ -1,28 +1,113 @@ - + - + + + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.h b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.h new file mode 100644 index 0000000..eaee6bf --- /dev/null +++ b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.h @@ -0,0 +1,19 @@ +// +// DirectoryTableViewCell.h +// UniversityPrograms +// +// Created by Miles Crabbe on 6/6/14. +// Copyright (c) 2014 CAPS. All rights reserved. +// + +#import + +@interface DirectoryTableViewCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UIImageView *employeeImage; +@property (weak, nonatomic) IBOutlet UILabel *employeeName; +@property (weak, nonatomic) IBOutlet UILabel *employeeTitle; +@property (weak, nonatomic) IBOutlet UILabel *employeePhone; +@property (weak, nonatomic) IBOutlet UILabel *employeeEmail; + + +@end diff --git a/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.m b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.m new file mode 100644 index 0000000..246ff48 --- /dev/null +++ b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.m @@ -0,0 +1,30 @@ +// +// DirectoryTableViewCell.m +// UniversityPrograms +// +// Created by Miles Crabbe on 6/6/14. +// Copyright (c) 2014 CAPS. All rights reserved. +// + +#import "DirectoryTableViewCell.h" + +@implementation DirectoryTableViewCell +-(instancetype)init{ + //init is such a way that the xib file actually works + self=[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([DirectoryTableViewCell class]) owner:nil options:nil][0]; + + return self; +} +- (void)awakeFromNib +{ + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated +{ + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.xib b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.xib new file mode 100644 index 0000000..eb77802 --- /dev/null +++ b/UniversityPrograms/UniversityPrograms/DirectoryTableViewCell.xib @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UniversityPrograms/UniversityPrograms/MyUPViewController.m b/UniversityPrograms/UniversityPrograms/MyUPViewController.m index c0b7d77..41a9a6b 100644 --- a/UniversityPrograms/UniversityPrograms/MyUPViewController.m +++ b/UniversityPrograms/UniversityPrograms/MyUPViewController.m @@ -71,9 +71,9 @@ -(void)viewDidAppear:(BOOL)animated{ [self loadData]; } -(void)loadData{ - [self loadFeedback]; - [self loadEvents]; + [self loadEvents]; + [self loadFeedback]; [self.refreshControl endRefreshing]; } -(void)loadEvents{ diff --git a/UniversityPrograms/UniversityPrograms/MyUPViewController.xib b/UniversityPrograms/UniversityPrograms/MyUPViewController.xib index b9aef94..1a9fd73 100644 --- a/UniversityPrograms/UniversityPrograms/MyUPViewController.xib +++ b/UniversityPrograms/UniversityPrograms/MyUPViewController.xib @@ -43,14 +43,14 @@ - + @@ -62,13 +62,14 @@ + diff --git a/UniversityPrograms/UniversityPrograms/SpecificEventViewController.m b/UniversityPrograms/UniversityPrograms/SpecificEventViewController.m index 64ad310..bb749f8 100644 --- a/UniversityPrograms/UniversityPrograms/SpecificEventViewController.m +++ b/UniversityPrograms/UniversityPrograms/SpecificEventViewController.m @@ -100,24 +100,6 @@ - (void)alertView:(UIAlertView *)alertView } -- (void)didTapRSVP { - - if([[NSUserDefaults standardUserDefaults]stringForKey:@"cwid"]==nil||[[[NSUserDefaults standardUserDefaults]stringForKey:@"cwid"]isEqualToString:@""]){ - [self addAlertView]; - } - else{ - [UPDataRetrieval rsvpEvent:[[NSUserDefaults standardUserDefaults] stringForKey:@"cwid"] event:self.specifiedEvent completetionHandler:^(NSURLResponse *response, NSData *data, NSError *e) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self confirmAlertView]; - [self.loadingIndicator startAnimating]; - [self getEvent:self.specifiedEvent]; - self.navigationItem.rightBarButtonItem=nil; - }); - - }]; - } - -} -(void)confirmAlertView{ UIAlertView *confirmAlert = [[UIAlertView alloc]initWithTitle:@"You have RSVPed" message:@"Your RSVP for this event has been recorded. Thank you." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [confirmAlert setTag:2]; @@ -128,9 +110,13 @@ -(void)confirmAlertView{ #pragma mark - UI -(void)setUI{ + //set bar button type if(!self.specifiedEvent.isRegistered){ self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"RSVP" style:UIBarButtonItemStyleDone target:self action:@selector(didTapRSVP)]; } + else{ + self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"un-RSVP" style:UIBarButtonItemStyleDone target:self action:@selector(didTapUnRSVP)]; + } //Set image url [_eventImageView setImageWithURL:[NSURL URLWithString:_specifiedEvent.imageUrl]]; self.eventTitleLabel.text = _specifiedEvent.eventName; @@ -140,12 +126,13 @@ -(void)setUI{ } else{ - NSNumber *sponseredByTheNumberOne = [[NSNumber alloc] initWithInt:1]; - NSNumber *sponseredByTheNumberZero = [[NSNumber alloc] initWithInt:0]; - if(self.specifiedEvent.numberAttending==sponseredByTheNumberOne){ + + + + if(self.specifiedEvent.numberAttending==[NSNumber numberWithInt:1]){ self.attendingLabel.text=[NSString stringWithFormat:@"%@ person is attending", [self.specifiedEvent.numberAttending stringValue]]; } - else if(self.specifiedEvent.numberAttending==sponseredByTheNumberZero){ + else if(self.specifiedEvent.numberAttending==[NSNumber numberWithInt:0]){ self.attendingLabel.text=@""; } @@ -216,6 +203,27 @@ -(void)getEvent:(Event *)event{ }]; } +- (void)didTapRSVP { + + if([[NSUserDefaults standardUserDefaults]stringForKey:@"cwid"]==nil||[[[NSUserDefaults standardUserDefaults]stringForKey:@"cwid"]isEqualToString:@""]){ + [self addAlertView]; + } + else{ + [UPDataRetrieval rsvpEvent:[[NSUserDefaults standardUserDefaults] stringForKey:@"cwid"] event:self.specifiedEvent completetionHandler:^(NSURLResponse *response, NSData *data, NSError *e) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self confirmAlertView]; + [self.loadingIndicator startAnimating]; + [self getEvent:self.specifiedEvent]; + self.navigationItem.rightBarButtonItem=nil; + }); + + }]; + } + +} +-(void)didTapUnRSVP{ + +} #pragma mark - ScrollView Delegate